From 33a0ebfc5c9b18850d4d09900fe9dea8abfd1fd2 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 4 Mar 2009 16:35:08 +0100 Subject: Fixes: Initial work on an API to allow a custom/indexing on the QGraphicsScene --- src/gui/graphicsview/graphicsview.pri | 2 + src/gui/graphicsview/qgraphicsscene.cpp | 51 +++++++++++++++-- src/gui/graphicsview/qgraphicsscene.h | 4 ++ src/gui/graphicsview/qgraphicsscene_p.h | 3 + src/gui/graphicsview/qgraphicssceneindex.cpp | 61 ++++++++++++++++++++ src/gui/graphicsview/qgraphicssceneindex.h | 83 ++++++++++++++++++++++++++++ 6 files changed, 198 insertions(+), 6 deletions(-) create mode 100644 src/gui/graphicsview/qgraphicssceneindex.cpp create mode 100644 src/gui/graphicsview/qgraphicssceneindex.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index 02d9bb1..f0bdddc 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -7,6 +7,7 @@ HEADERS += \ graphicsview/qgraphicsscene.h \ graphicsview/qgraphicsscene_p.h \ graphicsview/qgraphicsscene_bsp_p.h \ + graphicsview/qgraphicssceneindex.h \ graphicsview/qgraphicssceneevent.h \ graphicsview/qgraphicsview_p.h \ graphicsview/qgraphicsview.h @@ -16,6 +17,7 @@ SOURCES += \ graphicsview/qgraphicsitemanimation.cpp \ graphicsview/qgraphicsscene.cpp \ graphicsview/qgraphicsscene_bsp.cpp \ + graphicsview/qgraphicssceneindex.cpp \ graphicsview/qgraphicssceneevent.cpp \ graphicsview/qgraphicsview.cpp diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index e885238..e74ae3a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -219,6 +219,7 @@ static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; #include "qgraphicsview_p.h" #include "qgraphicswidget.h" #include "qgraphicswidget_p.h" +#include "qgraphicssceneindex.h" #include #include @@ -330,6 +331,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() indexMethod(QGraphicsScene::BspTreeIndex), bspTreeDepth(0), lastItemCount(0), + customIndex(0), hasSceneRect(false), updateAll(false), calledEmitUpdated(false), @@ -381,12 +383,18 @@ QList QGraphicsScenePrivate::estimateItemsInRect(const QRectF & const_cast(this)->purgeRemovedItems(); const_cast(this)->_q_updateSortCache(); - if (indexMethod == QGraphicsScene::BspTreeIndex) { + if (indexMethod != QGraphicsScene::NoIndex) { // ### Only do this once in a while. QGraphicsScenePrivate *that = const_cast(this); - // Get items from BSP tree - QList items = that->bspTree.items(rect); + QList items; + if (indexMethod == QGraphicsScene::BspTreeIndex) { + // Get items from BSP tree + items = that->bspTree.items(rect); + } else { + //ask to the custom indexing + items = that->customIndex->items(rect); + } // Fill in with any unindexed items for (int i = 0; i < unindexedItems.size(); ++i) { @@ -444,6 +452,12 @@ void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item) // size. startIndexTimer(); } + } else if (indexMethod == QGraphicsScene::CustomIndex) { + if (item->d_func()->index != -1) { + customIndex->insertItem(item, item->sceneBoundingRect()); + foreach (QGraphicsItem *child, item->children()) + child->addToIndex(); + } } } @@ -452,10 +466,13 @@ void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item) */ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) { - if (indexMethod == QGraphicsScene::BspTreeIndex) { + if (indexMethod != QGraphicsScene::NoIndex) { int index = item->d_func()->index; if (index != -1) { - bspTree.removeItem(item, item->sceneBoundingRect()); + if (indexMethod == QGraphicsScene::CustomIndex) + customIndex->removeItem(item, item->sceneBoundingRect()); + else + bspTree.removeItem(item, item->sceneBoundingRect()); freeItemIndexes << index; indexedItems[index] = 0; item->d_func()->index = -1; @@ -464,7 +481,6 @@ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) foreach (QGraphicsItem *child, item->children()) child->removeFromIndex(); } - startIndexTimer(); } } @@ -564,6 +580,8 @@ void QGraphicsScenePrivate::_q_updateIndex() continue; if (indexMethod == QGraphicsScene::BspTreeIndex) bspTree.insertItem(item, rect); + if (indexMethod == QGraphicsScene::CustomIndex) + customIndex->insertItem(item,rect); // If the item ignores view transformations, update our // largest-item-counter to ensure that the view can accurately @@ -2359,10 +2377,31 @@ QGraphicsScene::ItemIndexMethod QGraphicsScene::itemIndexMethod() const void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) { Q_D(QGraphicsScene); + if (method == CustomIndex) { + qWarning("QGraphicsScene: Invalid index type %d", CustomIndex); + return; + } d->resetIndex(); d->indexMethod = method; } +void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) +{ + Q_D(QGraphicsScene); + if (!index) { + qWarning("QGraphicsScene::setSceneIndex: Attempt to insert a null indexer"); + } else { + d->indexMethod = CustomIndex; + d->customIndex = index; + } +} + +QGraphicsSceneIndex* QGraphicsScene::sceneIndex() +{ + Q_D(QGraphicsScene); + return d->customIndex; +} + /*! \property QGraphicsScene::bspTreeDepth \brief the depth of QGraphicsScene's BSP index tree diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 9802f87..7e1e040 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -83,6 +83,7 @@ class QGraphicsSimpleTextItem; class QGraphicsTextItem; class QGraphicsView; class QGraphicsWidget; +class QGraphicsSceneIndex; class QHelpEvent; class QInputMethodEvent; class QKeyEvent; @@ -113,6 +114,7 @@ class Q_GUI_EXPORT QGraphicsScene : public QObject public: enum ItemIndexMethod { BspTreeIndex, + CustomIndex, NoIndex = -1 }; @@ -142,6 +144,8 @@ public: ItemIndexMethod itemIndexMethod() const; void setItemIndexMethod(ItemIndexMethod method); + void setSceneIndex(QGraphicsSceneIndex *index); + QGraphicsSceneIndex* sceneIndex(); bool isSortCacheEnabled() const; void setSortCacheEnabled(bool enabled); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 9ace725..fe36fbd 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -58,6 +58,7 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW #include "qgraphicsscene_bsp_p.h" +#include "qgraphicssceneindex.h" #include "qgraphicsitem_p.h" #include @@ -95,6 +96,8 @@ public: void _q_updateIndex(); int lastItemCount; + QGraphicsSceneIndex *customIndex; + QRectF sceneRect; bool hasSceneRect; QRectF growingItemsBoundingRect; diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp new file mode 100644 index 0000000..00c63a3 --- /dev/null +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssceneindex.h" + +#ifndef QT_NO_GRAPHICSVIEW + +QT_BEGIN_NAMESPACE + +QGraphicsSceneIndex::QGraphicsSceneIndex() +{ +} + +QGraphicsSceneIndex::~QGraphicsSceneIndex() +{ + +} + +QT_END_NAMESPACE + +//#include "moc_qgraphicssceneindex.cpp" + +#endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h new file mode 100644 index 0000000..2b1cc6e --- /dev/null +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENEINDEX_H +#define QGRAPHICSSCENEINDEX_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +class QGraphicsItem; +class QRectF; +class QPointF; +template class QList; +template class QSet; + +class Q_GUI_EXPORT QGraphicsSceneIndex +{ +public: + QGraphicsSceneIndex(); + virtual ~QGraphicsSceneIndex(); + + virtual void clear() = 0; + + virtual void insertItem(QGraphicsItem *item, const QRectF &rect) = 0; + virtual void removeItem(QGraphicsItem *item, const QRectF &rect) = 0; + virtual void removeItems(const QSet &items) = 0; + + virtual QList items(const QRectF &rect) = 0; + virtual QList items(const QPointF &pos) = 0; +}; + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRAPHICSSCENEINDEX_H -- cgit v0.12 From 030554d7527663bd389b681f2e2c7e8262517013 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 5 Mar 2009 12:22:42 +0100 Subject: Fixes: Adapt a bit the public API --- src/gui/graphicsview/qgraphicssceneindex.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index 2b1cc6e..8e8c3ea 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -64,14 +64,13 @@ public: QGraphicsSceneIndex(); virtual ~QGraphicsSceneIndex(); + virtual void initialize(const QRectF &rect) = 0; virtual void clear() = 0; virtual void insertItem(QGraphicsItem *item, const QRectF &rect) = 0; virtual void removeItem(QGraphicsItem *item, const QRectF &rect) = 0; - virtual void removeItems(const QSet &items) = 0; virtual QList items(const QRectF &rect) = 0; - virtual QList items(const QPointF &pos) = 0; }; #endif // QT_NO_GRAPHICSVIEW -- cgit v0.12 From a7f4886b896751ed52db474514a2c4244ed6fc14 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 7 Apr 2009 20:02:09 +0200 Subject: Fixes: Some modifications after a talk with Ariya --- src/gui/graphicsview/qgraphicsscene.cpp | 7 ++++--- src/gui/graphicsview/qgraphicsscene.h | 2 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 6 ++++++ src/gui/graphicsview/qgraphicssceneindex.h | 11 +++++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index e74ae3a..fc9590f 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -491,7 +491,7 @@ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) void QGraphicsScenePrivate::resetIndex() { purgeRemovedItems(); - if (indexMethod == QGraphicsScene::BspTreeIndex) { + if (indexMethod != QGraphicsScene::NoIndex) { for (int i = 0; i < indexedItems.size(); ++i) { if (QGraphicsItem *item = indexedItems.at(i)) { item->d_ptr->index = -1; @@ -2393,12 +2393,13 @@ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) } else { d->indexMethod = CustomIndex; d->customIndex = index; + index->mscene = this; } } -QGraphicsSceneIndex* QGraphicsScene::sceneIndex() +QGraphicsSceneIndex* QGraphicsScene::sceneIndex() const { - Q_D(QGraphicsScene); + Q_D(const QGraphicsScene); return d->customIndex; } diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 7e1e040..bb3cea7 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -145,7 +145,7 @@ public: ItemIndexMethod itemIndexMethod() const; void setItemIndexMethod(ItemIndexMethod method); void setSceneIndex(QGraphicsSceneIndex *index); - QGraphicsSceneIndex* sceneIndex(); + QGraphicsSceneIndex* sceneIndex() const; bool isSortCacheEnabled() const; void setSortCacheEnabled(bool enabled); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 00c63a3..7868388 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qgraphicssceneindex.h" +#include "qgraphicsscene.h" #ifndef QT_NO_GRAPHICSVIEW @@ -54,6 +55,11 @@ QGraphicsSceneIndex::~QGraphicsSceneIndex() } +QGraphicsScene* QGraphicsSceneIndex::scene() +{ + return mscene; +} + QT_END_NAMESPACE //#include "moc_qgraphicssceneindex.cpp" diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index 8e8c3ea..a56634d 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -53,10 +53,10 @@ QT_MODULE(Gui) #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW class QGraphicsItem; +class QGraphicsScene; class QRectF; class QPointF; template class QList; -template class QSet; class Q_GUI_EXPORT QGraphicsSceneIndex { @@ -64,13 +64,20 @@ public: QGraphicsSceneIndex(); virtual ~QGraphicsSceneIndex(); - virtual void initialize(const QRectF &rect) = 0; + virtual void setRect(const QRectF &rect) = 0; + virtual QRectF rect() const = 0; virtual void clear() = 0; virtual void insertItem(QGraphicsItem *item, const QRectF &rect) = 0; + virtual void insertItems(QList items, const QRectF &rect) = 0; virtual void removeItem(QGraphicsItem *item, const QRectF &rect) = 0; + virtual void removeItems(QList items, const QRectF &rect) = 0; virtual QList items(const QRectF &rect) = 0; + + QGraphicsScene* scene(); + + QGraphicsScene* mscene; }; #endif // QT_NO_GRAPHICSVIEW -- cgit v0.12 From 9e5293822b849ed37742054cf1f4c0bb1b1e7156 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 7 Apr 2009 20:05:20 +0200 Subject: Fixes: Some API adjusments --- src/gui/graphicsview/qgraphicsscene.cpp | 6 +++--- src/gui/graphicsview/qgraphicssceneindex.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index fc9590f..a41f931 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -454,7 +454,7 @@ void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item) } } else if (indexMethod == QGraphicsScene::CustomIndex) { if (item->d_func()->index != -1) { - customIndex->insertItem(item, item->sceneBoundingRect()); + customIndex->insertItem(item); foreach (QGraphicsItem *child, item->children()) child->addToIndex(); } @@ -470,7 +470,7 @@ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) int index = item->d_func()->index; if (index != -1) { if (indexMethod == QGraphicsScene::CustomIndex) - customIndex->removeItem(item, item->sceneBoundingRect()); + customIndex->removeItem(item); else bspTree.removeItem(item, item->sceneBoundingRect()); freeItemIndexes << index; @@ -581,7 +581,7 @@ void QGraphicsScenePrivate::_q_updateIndex() if (indexMethod == QGraphicsScene::BspTreeIndex) bspTree.insertItem(item, rect); if (indexMethod == QGraphicsScene::CustomIndex) - customIndex->insertItem(item,rect); + customIndex->insertItem(item); // If the item ignores view transformations, update our // largest-item-counter to ensure that the view can accurately diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index a56634d..5e825ba 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -68,10 +68,10 @@ public: virtual QRectF rect() const = 0; virtual void clear() = 0; - virtual void insertItem(QGraphicsItem *item, const QRectF &rect) = 0; - virtual void insertItems(QList items, const QRectF &rect) = 0; - virtual void removeItem(QGraphicsItem *item, const QRectF &rect) = 0; - virtual void removeItems(QList items, const QRectF &rect) = 0; + virtual void insertItem(QGraphicsItem *item) = 0; + virtual void insertItems(QList items) = 0; + virtual void removeItem(QGraphicsItem *item) = 0; + virtual void removeItems(QList items) = 0; virtual QList items(const QRectF &rect) = 0; -- cgit v0.12 From e2e30d5c0ca99a47cc142465436d5e0a3f616b82 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 7 Apr 2009 20:06:38 +0200 Subject: Fixes: Make the bsp tree inherits from the new API --- src/gui/graphicsview/qgraphicsscene.cpp | 6 +++--- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 31 ++++++++++++++++++++++------- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 16 ++++++++++----- src/gui/graphicsview/qgraphicsscene_p.h | 2 +- src/gui/graphicsview/qgraphicssceneindex.h | 4 ++-- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a41f931..8660853 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -443,7 +443,7 @@ void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item) { if (indexMethod == QGraphicsScene::BspTreeIndex) { if (item->d_func()->index != -1) { - bspTree.insertItem(item, item->sceneBoundingRect()); + bspTree.insertItem(item); foreach (QGraphicsItem *child, item->children()) child->addToIndex(); } else { @@ -472,7 +472,7 @@ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) if (indexMethod == QGraphicsScene::CustomIndex) customIndex->removeItem(item); else - bspTree.removeItem(item, item->sceneBoundingRect()); + bspTree.removeItem(item); freeItemIndexes << index; indexedItems[index] = 0; item->d_func()->index = -1; @@ -579,7 +579,7 @@ void QGraphicsScenePrivate::_q_updateIndex() if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) continue; if (indexMethod == QGraphicsScene::BspTreeIndex) - bspTree.insertItem(item, rect); + bspTree.insertItem(item); if (indexMethod == QGraphicsScene::CustomIndex) customIndex->insertItem(item); diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index f8fa450..c295cb3 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -100,7 +100,7 @@ QGraphicsSceneBspTree::~QGraphicsSceneBspTree() void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth) { - this->rect = rect; + sceneRect = rect; leafCnt = 0; nodes.resize((1 << (depth + 1)) - 1); nodes.fill(Node()); @@ -117,19 +117,36 @@ void QGraphicsSceneBspTree::clear() leaves.clear(); } -void QGraphicsSceneBspTree::insertItem(QGraphicsItem *item, const QRectF &rect) +QRectF QGraphicsSceneBspTree::rect() const +{ + return sceneRect; +} + +void QGraphicsSceneBspTree::setRect(const QRectF &rect) +{ + sceneRect = rect; +} + +void QGraphicsSceneBspTree::insertItem(QGraphicsItem *item) { insertVisitor->item = item; - climbTree(insertVisitor, rect); + climbTree(insertVisitor, item->sceneBoundingRect()); +} + +void QGraphicsSceneBspTree::insertItems(const QList &items) +{ + foreach(QGraphicsItem *item, items) { + insertItem(item); + } } -void QGraphicsSceneBspTree::removeItem(QGraphicsItem *item, const QRectF &rect) +void QGraphicsSceneBspTree::removeItem(QGraphicsItem *item) { removeVisitor->item = item; - climbTree(removeVisitor, rect); + climbTree(removeVisitor, item->sceneBoundingRect()); } -void QGraphicsSceneBspTree::removeItems(const QSet &items) +void QGraphicsSceneBspTree::removeItems(const QList &items) { for (int i = 0; i < leaves.size(); ++i) { QList newItemList; @@ -302,7 +319,7 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con QRectF QGraphicsSceneBspTree::rectForIndex(int index) const { if (index <= 0) - return rect; + return sceneRect; int parentIdx = parentIndex(index); QRectF rect = rectForIndex(parentIdx); diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index e6ceb78..4114b3b 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -60,6 +60,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -69,7 +70,7 @@ class QGraphicsSceneInsertItemBspTreeVisitor; class QGraphicsSceneRemoveItemBspTreeVisitor; class QGraphicsSceneFindItemBspTreeVisitor; -class QGraphicsSceneBspTree +class QGraphicsSceneBspTree : public QGraphicsSceneIndex { public: struct Node @@ -87,10 +88,13 @@ public: void initialize(const QRectF &rect, int depth); void clear(); + QRectF rect() const; + void setRect(const QRectF &rect); - void insertItem(QGraphicsItem *item, const QRectF &rect); - void removeItem(QGraphicsItem *item, const QRectF &rect); - void removeItems(const QSet &items); + void insertItem(QGraphicsItem *item); + void insertItems(const QList &items); + void removeItem(QGraphicsItem *item); + void removeItems(const QList &items); QList items(const QRectF &rect); QList items(const QPointF &pos); @@ -116,7 +120,7 @@ private: QVector nodes; QVector > leaves; int leafCnt; - QRectF rect; + QRectF sceneRect; QGraphicsSceneInsertItemBspTreeVisitor *insertVisitor; QGraphicsSceneRemoveItemBspTreeVisitor *removeVisitor; @@ -130,6 +134,8 @@ public: virtual void visit(QList *items) = 0; }; +Q_DECLARE_TYPEINFO(QGraphicsSceneBspTree::Node, Q_PRIMITIVE_TYPE); + QT_END_NAMESPACE #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index fe36fbd..aacbc40 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -132,7 +132,7 @@ public: bool purgePending; void _q_removeItemLater(QGraphicsItem *item); - QSet removedItems; + QList removedItems; void purgeRemovedItems(); QBrush backgroundBrush; diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index 5e825ba..bda6f5e 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -69,9 +69,9 @@ public: virtual void clear() = 0; virtual void insertItem(QGraphicsItem *item) = 0; - virtual void insertItems(QList items) = 0; + virtual void insertItems(const QList &items) = 0; virtual void removeItem(QGraphicsItem *item) = 0; - virtual void removeItems(QList items) = 0; + virtual void removeItems(const QList &items) = 0; virtual QList items(const QRectF &rect) = 0; -- cgit v0.12 From 45c70c9834316f39a939b87450099560fd286a6e Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 7 Apr 2009 20:11:32 +0200 Subject: Fixes: Default implementation for QGraphicsSceneIndex::removeItems and QGraphicsSceneIndex::insertItems --- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 7 ------- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 1 - src/gui/graphicsview/qgraphicssceneindex.cpp | 13 +++++++++++++ src/gui/graphicsview/qgraphicssceneindex.h | 5 +++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index c295cb3..bf95893 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -133,13 +133,6 @@ void QGraphicsSceneBspTree::insertItem(QGraphicsItem *item) climbTree(insertVisitor, item->sceneBoundingRect()); } -void QGraphicsSceneBspTree::insertItems(const QList &items) -{ - foreach(QGraphicsItem *item, items) { - insertItem(item); - } -} - void QGraphicsSceneBspTree::removeItem(QGraphicsItem *item) { removeVisitor->item = item; diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index 4114b3b..a35148c 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -92,7 +92,6 @@ public: void setRect(const QRectF &rect); void insertItem(QGraphicsItem *item); - void insertItems(const QList &items); void removeItem(QGraphicsItem *item); void removeItems(const QList &items); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 7868388..d8c28ed 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -60,6 +60,19 @@ QGraphicsScene* QGraphicsSceneIndex::scene() return mscene; } +void QGraphicsSceneIndex::insertItems(const QList &items) +{ + foreach (QGraphicsItem *item, items) + insertItem(item); +} + +void QGraphicsSceneIndex::removeItems(const QList &items) +{ + foreach (QGraphicsItem *item, items) + removeItem(item); +} + + QT_END_NAMESPACE //#include "moc_qgraphicssceneindex.cpp" diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index bda6f5e..df398ae 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -69,9 +69,10 @@ public: virtual void clear() = 0; virtual void insertItem(QGraphicsItem *item) = 0; - virtual void insertItems(const QList &items) = 0; virtual void removeItem(QGraphicsItem *item) = 0; - virtual void removeItems(const QList &items) = 0; + + virtual void insertItems(const QList &items); + virtual void removeItems(const QList &items); virtual QList items(const QRectF &rect) = 0; -- cgit v0.12 From 600beb2a2ed1c3df581230c526f1e64b78112477 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Thu, 12 Mar 2009 16:08:24 +0100 Subject: Fixes: Mark the BSP tree class so we can autotest it. --- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index a35148c..ebcb402 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -70,7 +70,7 @@ class QGraphicsSceneInsertItemBspTreeVisitor; class QGraphicsSceneRemoveItemBspTreeVisitor; class QGraphicsSceneFindItemBspTreeVisitor; -class QGraphicsSceneBspTree : public QGraphicsSceneIndex +class Q_AUTOTEST_EXPORT QGraphicsSceneBspTree : public QGraphicsSceneIndex { public: struct Node -- cgit v0.12 From d5ab1562ea7b8ce8e94e8db9ea2a7fcab17f657f Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Thu, 12 Mar 2009 15:51:19 +0100 Subject: Fixes: Add a simple test for the scene index. Details: This is just the beginning. More complex tests follow. --- tests/auto/auto.pro | 1 + .../qgraphicssceneindex/qgraphicssceneindex.pro | 3 + .../tst_qgraphicssceneindex.cpp | 74 ++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro create mode 100644 tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 443ee7e..9bde383 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -140,6 +140,7 @@ SUBDIRS += bic \ qgraphicsitem \ qgraphicsitemanimation \ qgraphicsscene \ + qgraphicssceneindex \ qgraphicsview \ qgridlayout \ qgroupbox \ diff --git a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro new file mode 100644 index 0000000..740a23e --- /dev/null +++ b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro @@ -0,0 +1,3 @@ +load(qttest_p4) +SOURCES += tst_qgraphicssceneindex.cpp + diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp new file mode 100644 index 0000000..209e4be --- /dev/null +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include + +#include + +//TESTED_CLASS= +//TESTED_FILES= + +class tst_QGraphicsSceneIndex : public QObject +{ + Q_OBJECT +public slots: + void initTestCase(); + +private slots: + void sceneRect(); +}; + +void tst_QGraphicsSceneIndex::initTestCase() +{ +} + +void tst_QGraphicsSceneIndex::sceneRect() +{ + QGraphicsSceneIndex *index = new QGraphicsSceneBspTree; + index->setRect(QRectF(0, 0, 2000, 2000)); + QCOMPARE(index->rect(), QRectF(0, 0, 2000, 2000)); +} + +QTEST_MAIN(tst_QGraphicsSceneIndex) +#include "tst_qgraphicssceneindex.moc" -- cgit v0.12 From 14785a965fc475d220ca8592c6ee4a44a0be25f6 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 16 Mar 2009 13:54:20 +0100 Subject: Fixes: Parametrize the test with potentially different indexing method. --- .../tst_qgraphicssceneindex.cpp | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 209e4be..f2a2bf1 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -44,7 +44,6 @@ #include #include -#include //TESTED_CLASS= //TESTED_FILES= @@ -56,13 +55,40 @@ public slots: void initTestCase(); private slots: + void sceneRect_data(); void sceneRect(); + +private: + void common_data(); + QGraphicsSceneIndex *createIndex(const QString &name); }; void tst_QGraphicsSceneIndex::initTestCase() { } +void tst_QGraphicsSceneIndex::common_data() +{ + QTest::addColumn("indexMethod"); + + QTest::newRow("BSP") << QString("bsp"); +} + +QGraphicsSceneIndex *tst_QGraphicsSceneIndex::createIndex(const QString &indexMethod) +{ + QGraphicsSceneIndex *index = 0; + + if (indexMethod == "bsp") + index = new QGraphicsSceneBspTree; + + return index; +} + +void tst_QGraphicsSceneIndex::sceneRect_data() +{ + common_data(); +} + void tst_QGraphicsSceneIndex::sceneRect() { QGraphicsSceneIndex *index = new QGraphicsSceneBspTree; -- cgit v0.12 From 7b21055e3966ed8620586decaca4c30f9bf0823a Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 16 Mar 2009 13:57:05 +0100 Subject: Fixes: Autotest for changing the index method of a scene. --- .../qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index f2a2bf1..9372823 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -41,6 +41,7 @@ #include +#include #include #include @@ -57,6 +58,8 @@ public slots: private slots: void sceneRect_data(); void sceneRect(); + void customIndex_data(); + void customIndex(); private: void common_data(); @@ -96,5 +99,23 @@ void tst_QGraphicsSceneIndex::sceneRect() QCOMPARE(index->rect(), QRectF(0, 0, 2000, 2000)); } +void tst_QGraphicsSceneIndex::customIndex_data() +{ + common_data(); +} + +void tst_QGraphicsSceneIndex::customIndex() +{ + QFETCH(QString, indexMethod); + QGraphicsSceneIndex *index = createIndex(indexMethod); + + QGraphicsScene scene; + scene.setSceneIndex(index); + + scene.addRect(0, 0, 30, 40); + QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1); +} + + QTEST_MAIN(tst_QGraphicsSceneIndex) #include "tst_qgraphicssceneindex.moc" -- cgit v0.12 From 7185361703e2837e4258b18350da791c84f7ef62 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 16 Mar 2009 13:58:02 +0100 Subject: Fixes: Autotest for inserting non-overlapped items in the scene index. --- .../tst_qgraphicssceneindex.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 9372823..cfe3ef0 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -60,6 +60,8 @@ private slots: void sceneRect(); void customIndex_data(); void customIndex(); + void scatteredItems_data(); + void scatteredItems(); private: void common_data(); @@ -116,6 +118,26 @@ void tst_QGraphicsSceneIndex::customIndex() QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1); } +void tst_QGraphicsSceneIndex::scatteredItems_data() +{ + common_data(); +} + +void tst_QGraphicsSceneIndex::scatteredItems() +{ + QFETCH(QString, indexMethod); + QGraphicsSceneIndex *index = createIndex(indexMethod); + + QGraphicsScene scene; + scene.setSceneIndex(index); + + for (int i = 0; i < 10; ++i) + scene.addRect(i*50, i*50, 40, 35); + + QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1); + QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 10); + QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0); +} QTEST_MAIN(tst_QGraphicsSceneIndex) #include "tst_qgraphicssceneindex.moc" -- cgit v0.12 From 2a1ced292424501d3bf453f337f8ce9c8c17bda9 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 16 Mar 2009 15:07:06 +0100 Subject: Fixes: Initialize the BSP tree if it has not been initialized before. Details: The BSP tree internal to QGraphicsScene does need this as the scene does call initialize() at proper time. This fix is needed only for using the BSP tree as custom indexing and/or for autotest. --- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index bf95893..b73cba2 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -247,8 +247,10 @@ void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth, int index) void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index) { - if (nodes.isEmpty()) - return; + if (nodes.isEmpty()) { + // should never happen for bsp tree internal to QGraphicsScene + initialize(sceneRect, 0); + } const Node &node = nodes.at(index); int childIndex = firstChildIndex(index); @@ -277,8 +279,10 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index) { - if (nodes.isEmpty()) - return; + if (nodes.isEmpty()) { + // should never happen for bsp tree internal to QGraphicsScene + initialize(sceneRect, 0); + } const Node &node = nodes.at(index); int childIndex = firstChildIndex(index); -- cgit v0.12 From e30e12306c9cc834eada3ce07b32761748fa423a Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 16 Mar 2009 15:34:07 +0100 Subject: Fixes: Make some BSP tree functions as 'private'. --- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index ebcb402..a8c54f0 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -96,9 +96,13 @@ public: void removeItems(const QList &items); QList items(const QRectF &rect); - QList items(const QPointF &pos); + int leafCount() const; +private: + + QList items(const QPointF &pos); + inline int firstChildIndex(int index) const { return index * 2 + 1; } @@ -107,7 +111,6 @@ public: QString debug(int index) const; -private: void initialize(const QRectF &rect, int depth, int index); void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index = 0); void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0); -- cgit v0.12 From 79257690c8fe8802e75a642138a2b466a0f54e65 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Thu, 12 Mar 2009 15:43:19 +0100 Subject: Fixes: Added linear scene index class. Not used yet. --- src/gui/graphicsview/graphicsview.pri | 1 + src/gui/graphicsview/qgraphicsscene_linear_p.h | 110 +++++++++++++++++++++ .../tst_qgraphicssceneindex.cpp | 5 + 3 files changed, 116 insertions(+) create mode 100644 src/gui/graphicsview/qgraphicsscene_linear_p.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index f0bdddc..bc4d9dd 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -7,6 +7,7 @@ HEADERS += \ graphicsview/qgraphicsscene.h \ graphicsview/qgraphicsscene_p.h \ graphicsview/qgraphicsscene_bsp_p.h \ + graphicsview/qgraphicsscene_linear_p.h \ graphicsview/qgraphicssceneindex.h \ graphicsview/qgraphicssceneevent.h \ graphicsview/qgraphicsview_p.h \ diff --git a/src/gui/graphicsview/qgraphicsscene_linear_p.h b/src/gui/graphicsview/qgraphicsscene_linear_p.h new file mode 100644 index 0000000..1ef1902 --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscene_linear_p.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENELINEARINDEX_P_H +#define QGRAPHICSSCENELINEARINDEX_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex +{ +private: + QRectF m_sceneRect; + QList m_items; + +public: + QGraphicsSceneLinearIndex(): QGraphicsSceneIndex() { + } + + virtual void setRect(const QRectF &rect) { + m_sceneRect = rect; + } + + virtual QRectF rect() const { + return m_sceneRect; + } + + virtual void clear() { + m_items.clear(); + } + + virtual void insertItem(QGraphicsItem *item) { + m_items << item; + } + + virtual void removeItem(QGraphicsItem *item) { + m_items.removeAll(item); + } + + virtual QList items(const QRectF &rect) { + QList result; + foreach (QGraphicsItem *item, m_items) + if (item->sceneBoundingRect().intersects(rect)) + result << item; + return result; + } +}; + +QT_END_NAMESPACE + +#endif // QT_NO_GRAPHICSVIEW + +#endif // QGRAPHICSSCENELINEARINDEX_P_H diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index cfe3ef0..d199351 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -44,6 +44,7 @@ #include #include #include +#include //TESTED_CLASS= @@ -77,6 +78,7 @@ void tst_QGraphicsSceneIndex::common_data() QTest::addColumn("indexMethod"); QTest::newRow("BSP") << QString("bsp"); + QTest::newRow("Linear") << QString("linear"); } QGraphicsSceneIndex *tst_QGraphicsSceneIndex::createIndex(const QString &indexMethod) @@ -86,6 +88,9 @@ QGraphicsSceneIndex *tst_QGraphicsSceneIndex::createIndex(const QString &indexMe if (indexMethod == "bsp") index = new QGraphicsSceneBspTree; + if (indexMethod == "linear") + index = new QGraphicsSceneLinearIndex; + return index; } -- cgit v0.12 From ff2f96de0c71f53cc71902e8119c84aed9967226 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 17 Mar 2009 12:06:44 +0100 Subject: Fixes: New updateItem(s) function with default implementation (of removing and inserting) --- src/gui/graphicsview/qgraphicssceneindex.cpp | 11 +++++++++++ src/gui/graphicsview/qgraphicssceneindex.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index d8c28ed..cb84f6b 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -60,6 +60,12 @@ QGraphicsScene* QGraphicsSceneIndex::scene() return mscene; } +void QGraphicsSceneIndex::updateItem(QGraphicsItem *item) +{ + removeItem(item); + insertItem(item); +} + void QGraphicsSceneIndex::insertItems(const QList &items) { foreach (QGraphicsItem *item, items) @@ -72,6 +78,11 @@ void QGraphicsSceneIndex::removeItems(const QList &items) removeItem(item); } +void QGraphicsSceneIndex::updateItems(const QList &items) +{ + foreach (QGraphicsItem *item, items) + updateItem(item); +} QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index df398ae..6246753 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -70,9 +70,11 @@ public: virtual void insertItem(QGraphicsItem *item) = 0; virtual void removeItem(QGraphicsItem *item) = 0; + virtual void updateItem(QGraphicsItem *item); virtual void insertItems(const QList &items); virtual void removeItems(const QList &items); + virtual void updateItems(const QList &items); virtual QList items(const QRectF &rect) = 0; -- cgit v0.12 From 6df288191c5b6de8c6d1f00fd931401dc9f0c342 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 17 Mar 2009 13:50:05 +0100 Subject: Fixes: Add API documentation for QGraphicsSceneIndex --- src/gui/graphicsview/qgraphicssceneindex.cpp | 80 ++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index cb84f6b..99d1b3b 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -46,38 +46,118 @@ QT_BEGIN_NAMESPACE +/*! + Constructs an abstract scene index. +*/ QGraphicsSceneIndex::QGraphicsSceneIndex() { } +/*! + Destroys the scene index. +*/ QGraphicsSceneIndex::~QGraphicsSceneIndex() { } +/*! + \fn virtual void setRect(const QRectF &rect) = 0 + + This pure virtual function is called when the scene changes its bounding + rectangle. + + \sa rect(), QGraphicsScene::setSceneRect +*/ + +/*! + \fn virtual QRectF rect() const = 0 + + This pure virtual function returns the bounding rectangle of this + scene index. It could be as large as or larger than the scene + bounding rectangle, depending on the implementation of the + scene index. + + \sa setRect(), QGraphicsScene::sceneRect +*/ + +/*! + \fn virtual void clear() = 0 + + This pure virtual function removes all items in the scene index. +*/ + +/*! + \fn virtual void insertItem(QGraphicsItem *item) = 0 + + This pure virtual function inserts an item to the scene index. + + \sa removeItem(), updateItem(), insertItems() +*/ + +/*! + \fn virtual void removeItem(QGraphicsItem *item) = 0 + + This pure virtual function removes an item to the scene index. + + \sa insertItem(), updateItem(), removeItems() +*/ + +/*! + Returns the scene of this scene index. +*/ QGraphicsScene* QGraphicsSceneIndex::scene() { return mscene; } +/*! + Updates an item when its geometry has changed. + + The default implemention will remove the item from the index + and then insert it again. + + \sa insertItem(), removeItem(), updateItems() +*/ void QGraphicsSceneIndex::updateItem(QGraphicsItem *item) { removeItem(item); insertItem(item); } +/*! + Inserts a list of items to the index. + + The default implemention will insert the items one by one. + + \sa insertItem(), removeItems(), updateItems() +*/ void QGraphicsSceneIndex::insertItems(const QList &items) { foreach (QGraphicsItem *item, items) insertItem(item); } +/*! + Removes a list of items from the index. + + The default implemention will remove the items one by one. + + \sa removeItem(), removeItems(), updateItems() +*/ void QGraphicsSceneIndex::removeItems(const QList &items) { foreach (QGraphicsItem *item, items) removeItem(item); } +/*! + Update a list of items which have changed the geometry. + + The default implemention will update the items one by one. + + \sa updateItem(), insertItems(), removeItems() +*/ void QGraphicsSceneIndex::updateItems(const QList &items) { foreach (QGraphicsItem *item, items) -- cgit v0.12 From 8e13ebc41ccbf4d1ec6ba552f8865007db5af875 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 17 Mar 2009 14:56:04 +0100 Subject: Fixes: Add autotest for overlapped rectangles --- .../tst_qgraphicssceneindex.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index d199351..f03404e 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -63,6 +63,8 @@ private slots: void customIndex(); void scatteredItems_data(); void scatteredItems(); + void overlappedItems_data(); + void overlappedItems(); private: void common_data(); @@ -144,5 +146,32 @@ void tst_QGraphicsSceneIndex::scatteredItems() QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0); } +void tst_QGraphicsSceneIndex::overlappedItems_data() +{ + common_data(); +} + +void tst_QGraphicsSceneIndex::overlappedItems() +{ + QFETCH(QString, indexMethod); + QGraphicsSceneIndex *index = createIndex(indexMethod); + + QGraphicsScene scene; + scene.setSceneIndex(index); + + for (int i = 0; i < 10; ++i) + for (int j = 0; j < 10; ++j) + scene.addRect(i*50, j*50, 200, 200); + + QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 100); + QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0); + QCOMPARE(scene.items(QRectF(0, 0, 200, 200)).count(), 16); + QCOMPARE(scene.items(QRectF(0, 0, 100, 100)).count(), 4); + QCOMPARE(scene.items(QRectF(0, 0, 1, 100)).count(), 2); + QCOMPARE(scene.items(QRectF(0, 0, 1, 1000)).count(), 10); +} + + + QTEST_MAIN(tst_QGraphicsSceneIndex) #include "tst_qgraphicssceneindex.moc" -- cgit v0.12 From 72f34ea254d2ad93e11f740bf2ed2523f1975ee9 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 17 Mar 2009 15:04:52 +0100 Subject: Fixes: Add autotest for moving rectangle between items. --- .../tst_qgraphicssceneindex.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index f03404e..9a01cb8 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -65,6 +65,8 @@ private slots: void scatteredItems(); void overlappedItems_data(); void overlappedItems(); + void movingItems_data(); + void movingItems(); private: void common_data(); @@ -171,6 +173,33 @@ void tst_QGraphicsSceneIndex::overlappedItems() QCOMPARE(scene.items(QRectF(0, 0, 1, 1000)).count(), 10); } +void tst_QGraphicsSceneIndex::movingItems_data() +{ + common_data(); +} + +void tst_QGraphicsSceneIndex::movingItems() +{ + QFETCH(QString, indexMethod); + QGraphicsSceneIndex *index = createIndex(indexMethod); + + QGraphicsScene scene; + scene.setSceneIndex(index); + + for (int i = 0; i < 10; ++i) + scene.addRect(i*50, i*50, 40, 35); + + QGraphicsRectItem *box = scene.addRect(0, 0, 10, 10); + QCOMPARE(scene.items(QRectF(0, 0, 5, 5)).count(), 2); + + box->setPos(10, 10); + QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 1); + + box->setPos(-5, -5); + QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 2); + + QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 11); +} QTEST_MAIN(tst_QGraphicsSceneIndex) -- cgit v0.12 From 22a3772006c34e51f446eb3ab1cfaf5e40cab583 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 17 Mar 2009 15:07:53 +0100 Subject: Fixes: Remove from the custom index too (this will change anyway) --- src/gui/graphicsview/qgraphicsscene.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 8660853..77711ad 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -822,8 +822,13 @@ void QGraphicsScenePrivate::purgeRemovedItems() return; // Remove stale items from the BSP tree. - if (indexMethod != QGraphicsScene::NoIndex) - bspTree.removeItems(removedItems); + if (indexMethod != QGraphicsScene::NoIndex) { + if (indexMethod == QGraphicsScene::BspTreeIndex) { + bspTree.removeItems(removedItems); + } else { + customIndex->removeItems(removedItems); + } + } // Purge this list. removedItems.clear(); -- cgit v0.12 From 133bded765f224bce31d8abff87cc74a63569715 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 17 Mar 2009 17:26:26 +0100 Subject: Fixes: The bsp and customs index share the same pointer --- src/gui/graphicsview/qgraphicsscene.cpp | 66 ++++++++++++++++++--------------- src/gui/graphicsview/qgraphicsscene_p.h | 6 ++- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 77711ad..4070f11 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -331,7 +331,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() indexMethod(QGraphicsScene::BspTreeIndex), bspTreeDepth(0), lastItemCount(0), - customIndex(0), + index(new QGraphicsSceneBspTree()), hasSceneRect(false), updateAll(false), calledEmitUpdated(false), @@ -361,7 +361,11 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() style(0) { } - +QGraphicsScenePrivate::~QGraphicsScenePrivate() +{ + if (index) + delete index; +} /*! \internal */ @@ -388,13 +392,8 @@ QList QGraphicsScenePrivate::estimateItemsInRect(const QRectF & QGraphicsScenePrivate *that = const_cast(this); QList items; - if (indexMethod == QGraphicsScene::BspTreeIndex) { - // Get items from BSP tree - items = that->bspTree.items(rect); - } else { - //ask to the custom indexing - items = that->customIndex->items(rect); - } + // Get items from index + items = that->index->items(rect); // Fill in with any unindexed items for (int i = 0; i < unindexedItems.size(); ++i) { @@ -443,7 +442,7 @@ void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item) { if (indexMethod == QGraphicsScene::BspTreeIndex) { if (item->d_func()->index != -1) { - bspTree.insertItem(item); + index->insertItem(item); foreach (QGraphicsItem *child, item->children()) child->addToIndex(); } else { @@ -454,7 +453,7 @@ void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item) } } else if (indexMethod == QGraphicsScene::CustomIndex) { if (item->d_func()->index != -1) { - customIndex->insertItem(item); + index->insertItem(item); foreach (QGraphicsItem *child, item->children()) child->addToIndex(); } @@ -469,10 +468,7 @@ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) if (indexMethod != QGraphicsScene::NoIndex) { int index = item->d_func()->index; if (index != -1) { - if (indexMethod == QGraphicsScene::CustomIndex) - customIndex->removeItem(item); - else - bspTree.removeItem(item); + this->index->removeItem(item); freeItemIndexes << index; indexedItems[index] = 0; item->d_func()->index = -1; @@ -551,7 +547,9 @@ void QGraphicsScenePrivate::_q_updateIndex() int oldDepth = intmaxlog(lastItemCount); depth = intmaxlog(indexedItems.size()); static const int slack = 100; - if (bspTree.leafCount() == 0 || (oldDepth != depth && qAbs(lastItemCount - indexedItems.size()) > slack)) { + //### do something better + QGraphicsSceneBspTree *bsp = static_cast(index); + if (bsp->leafCount() == 0 || (oldDepth != depth && qAbs(lastItemCount - indexedItems.size()) > slack)) { // ### Crude algorithm. regenerateIndex = true; } @@ -560,7 +558,9 @@ void QGraphicsScenePrivate::_q_updateIndex() // Regenerate the tree. if (regenerateIndex) { regenerateIndex = false; - bspTree.initialize(q->sceneRect(), depth); + //### do something better + QGraphicsSceneBspTree *bsp = static_cast(index); + bsp->initialize(q->sceneRect(), depth); unindexedItems = indexedItems; lastItemCount = indexedItems.size(); q->update(); @@ -578,10 +578,9 @@ void QGraphicsScenePrivate::_q_updateIndex() QRectF rect = item->sceneBoundingRect(); if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) continue; - if (indexMethod == QGraphicsScene::BspTreeIndex) - bspTree.insertItem(item); - if (indexMethod == QGraphicsScene::CustomIndex) - customIndex->insertItem(item); + + if (indexMethod != QGraphicsScene::NoIndex) + index->insertItem(item); // If the item ignores view transformations, update our // largest-item-counter to ensure that the view can accurately @@ -823,11 +822,7 @@ void QGraphicsScenePrivate::purgeRemovedItems() // Remove stale items from the BSP tree. if (indexMethod != QGraphicsScene::NoIndex) { - if (indexMethod == QGraphicsScene::BspTreeIndex) { - bspTree.removeItems(removedItems); - } else { - customIndex->removeItems(removedItems); - } + index->removeItems(removedItems); } // Purge this list. @@ -2386,8 +2381,18 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) qWarning("QGraphicsScene: Invalid index type %d", CustomIndex); return; } + if (d->indexMethod == method) { + return; + } d->resetIndex(); + if (d->indexMethod != NoIndex) { + delete d->index; + } d->indexMethod = method; + if (method == BspTreeIndex) { + d->index = new QGraphicsSceneBspTree(); + } + } void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) @@ -2396,8 +2401,11 @@ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) if (!index) { qWarning("QGraphicsScene::setSceneIndex: Attempt to insert a null indexer"); } else { + if (d->indexMethod == BspTreeIndex) { + delete d->index; + } d->indexMethod = CustomIndex; - d->customIndex = index; + d->index = index; index->mscene = this; } } @@ -2405,7 +2413,7 @@ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) QGraphicsSceneIndex* QGraphicsScene::sceneIndex() const { Q_D(const QGraphicsScene); - return d->customIndex; + return d->index; } /*! @@ -2814,7 +2822,7 @@ void QGraphicsScene::clear() d->indexedItems.clear(); d->freeItemIndexes.clear(); d->lastItemCount = 0; - d->bspTree.clear(); + d->index->clear(); d->largestUntransformableItem = QRectF(); d->allItemsIgnoreHoverEvents = true; d->allItemsUseDefaultCursor = true; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index aacbc40..b06db38 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -58,6 +58,7 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW #include "qgraphicsscene_bsp_p.h" +#include "qgraphicsscene_linear_p.h" #include "qgraphicssceneindex.h" #include "qgraphicsitem_p.h" @@ -80,6 +81,7 @@ class QGraphicsScenePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QGraphicsScene) public: QGraphicsScenePrivate(); + ~QGraphicsScenePrivate(); void init(); quint32 changedSignalMask; @@ -92,11 +94,11 @@ public: void removeFromIndex(QGraphicsItem *item); void resetIndex(); - QGraphicsSceneBspTree bspTree; void _q_updateIndex(); int lastItemCount; - QGraphicsSceneIndex *customIndex; + QGraphicsSceneIndex *index; + QGraphicsSceneLinearIndex *linearIndex; QRectF sceneRect; bool hasSceneRect; -- cgit v0.12 From 5cf43cf62221e3241e33ea25efc7014c07e4d7ad Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 7 Apr 2009 20:20:53 +0200 Subject: Fixes: Add new virtual QGraphicsSceneIndex::items(QPointF) --- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 3 +-- src/gui/graphicsview/qgraphicsscene_linear_p.h | 8 ++++++++ src/gui/graphicsview/qgraphicssceneindex.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index a8c54f0..ed207ea 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -95,14 +95,13 @@ public: void removeItem(QGraphicsItem *item); void removeItems(const QList &items); + QList items(const QPointF &point); QList items(const QRectF &rect); int leafCount() const; private: - QList items(const QPointF &pos); - inline int firstChildIndex(int index) const { return index * 2 + 1; } diff --git a/src/gui/graphicsview/qgraphicsscene_linear_p.h b/src/gui/graphicsview/qgraphicsscene_linear_p.h index 1ef1902..1981b17 100644 --- a/src/gui/graphicsview/qgraphicsscene_linear_p.h +++ b/src/gui/graphicsview/qgraphicsscene_linear_p.h @@ -94,6 +94,14 @@ public: m_items.removeAll(item); } + virtual QList items(const QPointF &point) { + QList result; + foreach (QGraphicsItem *item, m_items) + if (item->sceneBoundingRect().contains(point)) + result << item; + return result; + } + virtual QList items(const QRectF &rect) { QList result; foreach (QGraphicsItem *item, m_items) diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index 6246753..f78672f 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -76,6 +76,7 @@ public: virtual void removeItems(const QList &items); virtual void updateItems(const QList &items); + virtual QList items(const QPointF &point) = 0; virtual QList items(const QRectF &rect) = 0; QGraphicsScene* scene(); -- cgit v0.12 From 875d5f41b1a796d91a4a8edac6c23a7965395470 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 18 Mar 2009 15:36:41 +0100 Subject: Fixes: Autotest the scene index using the new items(QPointF) function. --- tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 9a01cb8..955f2d3 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -143,6 +143,10 @@ void tst_QGraphicsSceneIndex::scatteredItems() for (int i = 0; i < 10; ++i) scene.addRect(i*50, i*50, 40, 35); + QCOMPARE(scene.items(QPointF(5, 5)).count(), 1); + QCOMPARE(scene.items(QPointF(55, 55)).count(), 1); + QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0); + QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1); QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 10); QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0); @@ -165,6 +169,11 @@ void tst_QGraphicsSceneIndex::overlappedItems() for (int j = 0; j < 10; ++j) scene.addRect(i*50, j*50, 200, 200); + QCOMPARE(scene.items(QPointF(5, 5)).count(), 1); + QCOMPARE(scene.items(QPointF(55, 55)).count(), 4); + QCOMPARE(scene.items(QPointF(105, 105)).count(), 9); + QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0); + QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 100); QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0); QCOMPARE(scene.items(QRectF(0, 0, 200, 200)).count(), 16); @@ -190,12 +199,17 @@ void tst_QGraphicsSceneIndex::movingItems() scene.addRect(i*50, i*50, 40, 35); QGraphicsRectItem *box = scene.addRect(0, 0, 10, 10); + QCOMPARE(scene.items(QPointF(5, 5)).count(), 2); + QCOMPARE(scene.items(QPointF(-1, -1)).count(), 0); QCOMPARE(scene.items(QRectF(0, 0, 5, 5)).count(), 2); box->setPos(10, 10); + QCOMPARE(scene.items(QPointF(9, 9)).count(), 1); + QCOMPARE(scene.items(QPointF(15, 15)).count(), 2); QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 1); box->setPos(-5, -5); + QCOMPARE(scene.items(QPointF(-1, -1)).count(), 1); QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 2); QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 11); -- cgit v0.12 From 76b8d22cee1d0a12de30f2c9d49ead5625b5122f Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 18 Mar 2009 16:33:03 +0100 Subject: Fixes: QGraphicsSceneIndex now inherits from QObject --- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 4 ++-- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 4 +++- src/gui/graphicsview/qgraphicsscene_linear_p.h | 4 +++- src/gui/graphicsview/qgraphicssceneindex.cpp | 4 ++-- src/gui/graphicsview/qgraphicssceneindex.h | 7 +++++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index b73cba2..29c54bb 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -83,8 +83,8 @@ public: } }; -QGraphicsSceneBspTree::QGraphicsSceneBspTree() - : leafCnt(0) +QGraphicsSceneBspTree::QGraphicsSceneBspTree(QObject *parent) + : QGraphicsSceneIndex(parent), leafCnt(0) { insertVisitor = new QGraphicsSceneInsertItemBspTreeVisitor; removeVisitor = new QGraphicsSceneRemoveItemBspTreeVisitor; diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index ed207ea..8b7d753 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -72,6 +72,8 @@ class QGraphicsSceneFindItemBspTreeVisitor; class Q_AUTOTEST_EXPORT QGraphicsSceneBspTree : public QGraphicsSceneIndex { + Q_OBJECT + public: struct Node { @@ -83,7 +85,7 @@ public: Type type; }; - QGraphicsSceneBspTree(); + QGraphicsSceneBspTree(QObject *parent = 0); ~QGraphicsSceneBspTree(); void initialize(const QRectF &rect, int depth); diff --git a/src/gui/graphicsview/qgraphicsscene_linear_p.h b/src/gui/graphicsview/qgraphicsscene_linear_p.h index 1981b17..4871b2c 100644 --- a/src/gui/graphicsview/qgraphicsscene_linear_p.h +++ b/src/gui/graphicsview/qgraphicsscene_linear_p.h @@ -66,12 +66,14 @@ QT_BEGIN_NAMESPACE class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex { + Q_OBJECT + private: QRectF m_sceneRect; QList m_items; public: - QGraphicsSceneLinearIndex(): QGraphicsSceneIndex() { + QGraphicsSceneLinearIndex(QObject *parent = 0): QGraphicsSceneIndex(parent) { } virtual void setRect(const QRectF &rect) { diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 99d1b3b..904e0af 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE /*! Constructs an abstract scene index. */ -QGraphicsSceneIndex::QGraphicsSceneIndex() +QGraphicsSceneIndex::QGraphicsSceneIndex(QObject *parent): QObject(parent) { } @@ -166,6 +166,6 @@ void QGraphicsSceneIndex::updateItems(const QList &items) QT_END_NAMESPACE -//#include "moc_qgraphicssceneindex.cpp" +#include "moc_qgraphicssceneindex.cpp" #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index f78672f..d3b6c9f 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -43,6 +43,7 @@ #define QGRAPHICSSCENEINDEX_H #include +#include QT_BEGIN_HEADER @@ -58,10 +59,12 @@ class QRectF; class QPointF; template class QList; -class Q_GUI_EXPORT QGraphicsSceneIndex +class Q_GUI_EXPORT QGraphicsSceneIndex: public QObject { + Q_OBJECT + public: - QGraphicsSceneIndex(); + QGraphicsSceneIndex(QObject *parent = 0); virtual ~QGraphicsSceneIndex(); virtual void setRect(const QRectF &rect) = 0; -- cgit v0.12 From dfd72ab3c8e519f2c08b9a85e1309f8e06a5dd45 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 18 Mar 2009 19:49:55 +0100 Subject: Fixes: 'delete' always works even with null pointer. --- src/gui/graphicsview/qgraphicsscene.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 4070f11..dd67067 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -363,8 +363,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() } QGraphicsScenePrivate::~QGraphicsScenePrivate() { - if (index) - delete index; + delete index; } /*! \internal -- cgit v0.12 From 31bba59443638a2f97f330a9b64ded261b060701 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 18 Mar 2009 20:16:55 +0100 Subject: Fixes: Own our internal scene index so we do not need to explicitly delete it. --- src/gui/graphicsview/qgraphicsscene.cpp | 7 +++---- src/gui/graphicsview/qgraphicsscene_p.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index dd67067..d4fcbd0 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -361,10 +361,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() style(0) { } -QGraphicsScenePrivate::~QGraphicsScenePrivate() -{ - delete index; -} + /*! \internal */ @@ -372,6 +369,8 @@ void QGraphicsScenePrivate::init() { Q_Q(QGraphicsScene); + index->setParent(q); + // Keep this index so we can check for connected slots later on. changedSignalMask = (1 << q->metaObject()->indexOfSignal("changed(QList)")); qApp->d_func()->scene_list.append(q); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index b06db38..7e311ee 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -81,7 +81,6 @@ class QGraphicsScenePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QGraphicsScene) public: QGraphicsScenePrivate(); - ~QGraphicsScenePrivate(); void init(); quint32 changedSignalMask; -- cgit v0.12 From 980e01d69a29e2710a954e2bcd47d78039c76dbd Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 18 Mar 2009 20:21:36 +0100 Subject: Fixes: Recreate the BSP tree properly. --- src/gui/graphicsview/qgraphicsscene.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index d4fcbd0..4b40d3b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2383,14 +2383,12 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) return; } d->resetIndex(); - if (d->indexMethod != NoIndex) { + if (method == BspTreeIndex) { delete d->index; + d->index = new QGraphicsSceneBspTree(this); + // ### FIXME: transfer the items } d->indexMethod = method; - if (method == BspTreeIndex) { - d->index = new QGraphicsSceneBspTree(); - } - } void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) -- cgit v0.12 From f4c03e0eec3b39145471f25d0a1cdcdba604790c Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 18 Mar 2009 20:41:27 +0100 Subject: Fixes: Recreate the index properly when switching the index method. --- src/gui/graphicsview/qgraphicsscene.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 4b40d3b..f8f8e98 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2372,6 +2372,17 @@ QGraphicsScene::ItemIndexMethod QGraphicsScene::itemIndexMethod() const Q_D(const QGraphicsScene); return d->indexMethod; } + +// Possibilities +// NoIndex -> CustomIndex : warning +// BspTreeIndex -> CustomIndex : warning +// CustomIndex -> CustomIndex : warning +// NoIndex -> BspTreeIndex : create an empty BSP if necessary +// BspTreeIndex -> BspTreeIndex : nothing +// CustomIndex -> BspTreeIndex : create BSP and transfer items +// NoIndex -> NoIndex : nothing +// BspTreeIndex -> NoIndex : nothing +// CustomIndex -> NoIndex : create BSP tree but do not populate void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) { Q_D(QGraphicsScene); @@ -2383,11 +2394,25 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) return; } d->resetIndex(); - if (method == BspTreeIndex) { - delete d->index; + + if (d->indexMethod == NoIndex && method == BspTreeIndex) { + QGraphicsSceneBspTree *tree = qobject_cast(d->index); + if (!tree) { + delete d->index; + d->index = new QGraphicsSceneBspTree(this); + } + } + + if (d->indexMethod == CustomIndex && method == BspTreeIndex) { + QGraphicsSceneIndex *oldIndex = d->index; d->index = new QGraphicsSceneBspTree(this); - // ### FIXME: transfer the items + d->index->insertItems(oldIndex->items(oldIndex->rect())); } + + if (d->indexMethod == CustomIndex && method == NoIndex) { + d->index = new QGraphicsSceneBspTree(this); + } + d->indexMethod = method; } -- cgit v0.12 From ce77e1d327653c2c0724d6d4a45564c25d98eda8 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Thu, 19 Mar 2009 11:26:24 +0100 Subject: Fixes: Move the bsp depth variable to the BSP tree class. --- src/gui/graphicsview/qgraphicsscene.cpp | 16 ++++++++++++---- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 2 +- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index f8f8e98..6aab9df 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -329,7 +329,6 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph QGraphicsScenePrivate::QGraphicsScenePrivate() : changedSignalMask(0), indexMethod(QGraphicsScene::BspTreeIndex), - bspTreeDepth(0), lastItemCount(0), index(new QGraphicsSceneBspTree()), hasSceneRect(false), @@ -540,7 +539,9 @@ void QGraphicsScenePrivate::_q_updateIndex() // Determine whether we should regenerate the BSP tree. if (indexMethod == QGraphicsScene::BspTreeIndex) { - int depth = bspTreeDepth; + QGraphicsSceneBspTree *bspTree = qobject_cast(index); + Q_ASSERT(bspTree); + int depth = bspTree->depth; if (depth == 0) { int oldDepth = intmaxlog(lastItemCount); depth = intmaxlog(indexedItems.size()); @@ -2472,7 +2473,8 @@ QGraphicsSceneIndex* QGraphicsScene::sceneIndex() const int QGraphicsScene::bspTreeDepth() const { Q_D(const QGraphicsScene); - return d->bspTreeDepth; + QGraphicsSceneBspTree *bspTree = qobject_cast(d->index); + return bspTree ? bspTree->depth : 0; } void QGraphicsScene::setBspTreeDepth(int depth) { @@ -2485,7 +2487,13 @@ void QGraphicsScene::setBspTreeDepth(int depth) return; } - d->bspTreeDepth = depth; + QGraphicsSceneBspTree *bspTree = qobject_cast(d->index); + if (!bspTree) { + qWarning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); + return; + } + + bspTree->depth = depth; d->resetIndex(); } diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index 29c54bb..a81b14d 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -84,7 +84,7 @@ public: }; QGraphicsSceneBspTree::QGraphicsSceneBspTree(QObject *parent) - : QGraphicsSceneIndex(parent), leafCnt(0) + : QGraphicsSceneIndex(parent), depth(0), leafCnt(0) { insertVisitor = new QGraphicsSceneInsertItemBspTreeVisitor; removeVisitor = new QGraphicsSceneRemoveItemBspTreeVisitor; diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index 8b7d753..69d9eee 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -102,6 +102,8 @@ public: int leafCount() const; + int depth; + private: inline int firstChildIndex(int index) const -- cgit v0.12 From a779817905ae66de9333fbe3896b0ff1c3990581 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 19 Mar 2009 14:23:41 +0100 Subject: Fixes: First step to remove the indexing logic inside the scene. This commit basically remove the list of unindexingItems and use the linear index instead. Details: We now must be able to get rid of the timer which is the BSP role. --- src/gui/graphicsview/qgraphicsscene.cpp | 117 ++++++++++++------------- src/gui/graphicsview/qgraphicsscene_linear_p.h | 4 + src/gui/graphicsview/qgraphicsscene_p.h | 1 - 3 files changed, 60 insertions(+), 62 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 6aab9df..b559835 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -331,6 +331,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() indexMethod(QGraphicsScene::BspTreeIndex), lastItemCount(0), index(new QGraphicsSceneBspTree()), + linearIndex(new QGraphicsSceneLinearIndex()), hasSceneRect(false), updateAll(false), calledEmitUpdated(false), @@ -369,6 +370,7 @@ void QGraphicsScenePrivate::init() Q_Q(QGraphicsScene); index->setParent(q); + linearIndex->setParent(q); // Keep this index so we can check for connected slots later on. changedSignalMask = (1 << q->metaObject()->indexOfSignal("changed(QList)")); @@ -392,16 +394,13 @@ QList QGraphicsScenePrivate::estimateItemsInRect(const QRectF & // Get items from index items = that->index->items(rect); + //### Why there are items indexed and not at some point? + // Fill in with any unindexed items - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { - QRectF boundingRect = item->sceneBoundingRect(); - if (QRectF_intersects(boundingRect, rect)) { - item->d_ptr->itemDiscovered = 1; - items << item; - } - } + foreach (QGraphicsItem *item, linearIndex->items(rect)) { + if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { + item->d_ptr->itemDiscovered = 1; + items << item; } } @@ -412,14 +411,15 @@ QList QGraphicsScenePrivate::estimateItemsInRect(const QRectF & } QList itemsInRect; - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - continue; - if (item->d_ptr->visible && item->effectiveOpacity() > qreal(0.0)) - itemsInRect << item; - } + foreach (QGraphicsItem *item, linearIndex->items(rect)) { + if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) + continue; + if (item->d_ptr->visible && item->effectiveOpacity() > qreal(0.0)) + itemsInRect << item; } + + //### Why there are items indexed and not at some point? + for (int i = 0; i < indexedItems.size(); ++i) { if (QGraphicsItem *item = indexedItems.at(i)) { if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) @@ -469,7 +469,7 @@ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) freeItemIndexes << index; indexedItems[index] = 0; item->d_func()->index = -1; - unindexedItems << item; + linearIndex->insertItem(item); foreach (QGraphicsItem *child, item->children()) child->removeFromIndex(); @@ -488,7 +488,7 @@ void QGraphicsScenePrivate::resetIndex() for (int i = 0; i < indexedItems.size(); ++i) { if (QGraphicsItem *item = indexedItems.at(i)) { item->d_ptr->index = -1; - unindexedItems << item; + linearIndex->insertItem(item); } } indexedItems.clear(); @@ -519,17 +519,15 @@ void QGraphicsScenePrivate::_q_updateIndex() // Add unindexedItems to indexedItems QRectF unindexedItemsBoundingRect; - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - unindexedItemsBoundingRect |= item->sceneBoundingRect(); - if (!freeItemIndexes.isEmpty()) { - int freeIndex = freeItemIndexes.takeFirst(); - item->d_func()->index = freeIndex; - indexedItems[freeIndex] = item; - } else { - item->d_func()->index = indexedItems.size(); - indexedItems << item; - } + foreach (QGraphicsItem *item, linearIndex->indexedItems()) { + unindexedItemsBoundingRect |= item->sceneBoundingRect(); + if (!freeItemIndexes.isEmpty()) { + int freeIndex = freeItemIndexes.takeFirst(); + item->d_func()->index = freeIndex; + indexedItems[freeIndex] = item; + } else { + item->d_func()->index = indexedItems.size(); + indexedItems << item; } } @@ -560,7 +558,8 @@ void QGraphicsScenePrivate::_q_updateIndex() //### do something better QGraphicsSceneBspTree *bsp = static_cast(index); bsp->initialize(q->sceneRect(), depth); - unindexedItems = indexedItems; + foreach (QGraphicsItem *item, indexedItems) + linearIndex->insertItem(item); lastItemCount = indexedItems.size(); q->update(); @@ -572,30 +571,28 @@ void QGraphicsScenePrivate::_q_updateIndex() } // Insert all unindexed items into the tree. - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - QRectF rect = item->sceneBoundingRect(); - if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - continue; + foreach (QGraphicsItem *item, linearIndex->indexedItems()) { + QRectF rect = item->sceneBoundingRect(); + if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) + continue; - if (indexMethod != QGraphicsScene::NoIndex) - index->insertItem(item); - - // If the item ignores view transformations, update our - // largest-item-counter to ensure that the view can accurately - // discover untransformable items when drawing. - if (item->d_ptr->itemIsUntransformable()) { - QGraphicsItem *topmostUntransformable = item; - while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags - & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { - topmostUntransformable = topmostUntransformable->parentItem(); - } - // ### Verify that this is the correct largest untransformable rectangle. - largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); + if (indexMethod != QGraphicsScene::NoIndex) + index->insertItem(item); + + // If the item ignores view transformations, update our + // largest-item-counter to ensure that the view can accurately + // discover untransformable items when drawing. + if (item->d_ptr->itemIsUntransformable()) { + QGraphicsItem *topmostUntransformable = item; + while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags + & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { + topmostUntransformable = topmostUntransformable->parentItem(); } + // ### Verify that this is the correct largest untransformable rectangle. + largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); } } - unindexedItems.clear(); + linearIndex->clear(); // Notify scene rect changes. if (!hasSceneRect && growingItemsBoundingRect != oldGrowingItemsBoundingRect) @@ -756,7 +753,7 @@ void QGraphicsScenePrivate::_q_removeItemLater(QGraphicsItem *item) } else { // Recently added items are purged immediately. unindexedItems() never // contains stale items. - unindexedItems.removeAll(item); + linearIndex->removeItem(item); q->update(); } @@ -1982,8 +1979,7 @@ void QGraphicsScenePrivate::_q_updateSortCache() if (item && item->parentItem() == 0) topLevels << item; } - for (int i = 0; i < unindexedItems.size(); ++i) { - QGraphicsItem *item = unindexedItems.at(i); + foreach (QGraphicsItem *item, linearIndex->indexedItems()) { if (item->parentItem() == 0) topLevels << item; } @@ -2552,15 +2548,15 @@ QList QGraphicsScene::items() const // If freeItemIndexes is empty, we know there are no holes in indexedItems and // unindexedItems. if (d->freeItemIndexes.isEmpty()) { - if (d->unindexedItems.isEmpty()) + if (d->linearIndex->indexedItems().isEmpty()) return d->indexedItems; - return d->indexedItems + d->unindexedItems; + return d->indexedItems + d->linearIndex->indexedItems(); } // Rebuild the list of items to avoid holes. ### We could also just // compress the item lists at this point. QList itemList; - foreach (QGraphicsItem *item, d->indexedItems + d->unindexedItems) { + foreach (QGraphicsItem *item, d->indexedItems + d->linearIndex->indexedItems()) { if (item) itemList << item; } @@ -2841,12 +2837,11 @@ void QGraphicsScene::clear() } } QList unindexedParents; - for (int i = 0; i < d->unindexedItems.size(); ++i) { - QGraphicsItem *item = d->unindexedItems.at(i); + foreach (QGraphicsItem *item, d->linearIndex->indexedItems()) { if (!item->parentItem()) unindexedParents << item; } - d->unindexedItems.clear(); + d->linearIndex->clear(); qDeleteAll(unindexedParents); d->indexedItems.clear(); d->freeItemIndexes.clear(); @@ -2994,7 +2989,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Indexing requires sceneBoundingRect(), but because \a item might // not be completely constructed at this point, we need to store it in // a temporary list and schedule an indexing for later. - d->unindexedItems << item; + d->linearIndex->insertItem(item); item->d_func()->index = -1; d->startIndexTimer(); @@ -3382,7 +3377,7 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) d->freeItemIndexes << index; d->indexedItems[index] = 0; } else { - d->unindexedItems.removeAll(item); + d->linearIndex->removeItem(item); } // Remove from scene transform cache diff --git a/src/gui/graphicsview/qgraphicsscene_linear_p.h b/src/gui/graphicsview/qgraphicsscene_linear_p.h index 4871b2c..41e03e4 100644 --- a/src/gui/graphicsview/qgraphicsscene_linear_p.h +++ b/src/gui/graphicsview/qgraphicsscene_linear_p.h @@ -111,6 +111,10 @@ public: result << item; return result; } + + QList indexedItems() { + return m_items; + } }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 7e311ee..65c1a69 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -112,7 +112,6 @@ public: QPainterPath selectionArea; int selectionChanging; QSet selectedItems; - QList unindexedItems; QList indexedItems; QList dirtyItems; QList pendingUpdateItems; -- cgit v0.12 From 226baa99f53eeeff2489148c9187c19f5bc86f0e Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 7 Apr 2009 20:42:53 +0200 Subject: Remove the indexing (BSP) logic from the scene We basically add a new index that implement the old BSP logic but in a separate class instead of living into the QGraphicsScene. It will be much more easier to add a new index method or for people to use their own Conflicts: src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicssceneindex.h --- src/gui/graphicsview/graphicsview.pri | 4 +- src/gui/graphicsview/qgraphicsitem.cpp | 10 +- src/gui/graphicsview/qgraphicsitem.h | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 390 ++---------------- src/gui/graphicsview/qgraphicsscene.h | 2 +- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 40 +- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 27 +- src/gui/graphicsview/qgraphicsscene_linear_p.h | 124 ------ src/gui/graphicsview/qgraphicsscene_p.h | 20 +- .../graphicsview/qgraphicsscenebsptreeindex_p.cpp | 437 +++++++++++++++++++++ .../graphicsview/qgraphicsscenebsptreeindex_p.h | 118 ++++++ src/gui/graphicsview/qgraphicssceneindex.cpp | 14 +- src/gui/graphicsview/qgraphicssceneindex.h | 15 +- src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 126 ++++++ .../tst_qgraphicssceneindex.cpp | 15 +- 15 files changed, 769 insertions(+), 574 deletions(-) delete mode 100644 src/gui/graphicsview/qgraphicsscene_linear_p.h create mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp create mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h create mode 100644 src/gui/graphicsview/qgraphicsscenelinearindex_p.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index bc4d9dd..9097497 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -6,8 +6,9 @@ HEADERS += \ graphicsview/qgraphicsitemanimation.h \ graphicsview/qgraphicsscene.h \ graphicsview/qgraphicsscene_p.h \ + graphicsview/qgraphicsscenebsptreeindex_p.h \ graphicsview/qgraphicsscene_bsp_p.h \ - graphicsview/qgraphicsscene_linear_p.h \ + graphicsview/qgraphicsscenelinearindex_p.h \ graphicsview/qgraphicssceneindex.h \ graphicsview/qgraphicssceneevent.h \ graphicsview/qgraphicsview_p.h \ @@ -18,6 +19,7 @@ SOURCES += \ graphicsview/qgraphicsitemanimation.cpp \ graphicsview/qgraphicsscene.cpp \ graphicsview/qgraphicsscene_bsp.cpp \ + graphicsview/qgraphicsscenebsptreeindex_p.cpp \ graphicsview/qgraphicssceneindex.cpp \ graphicsview/qgraphicssceneevent.cpp \ graphicsview/qgraphicsview.cpp diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b8ff5b4..4574334 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5789,7 +5789,7 @@ void QGraphicsItem::addToIndex() return; } if (d_ptr->scene) - d_ptr->scene->d_func()->addToIndex(this); + d_ptr->scene->d_func()->index->insertItem(this); d_ptr->updateHelper(); } @@ -5802,13 +5802,9 @@ void QGraphicsItem::addToIndex() */ void QGraphicsItem::removeFromIndex() { - if (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { - // ### remove from child index only if applicable - return; - } d_ptr->updateHelper(); if (d_ptr->scene) - d_ptr->scene->d_func()->removeFromIndex(this); + d_ptr->scene->d_func()->index->removeItem(this,false); } /*! @@ -5831,7 +5827,7 @@ void QGraphicsItem::prepareGeometryChange() d_ptr->updateHelper(QRectF(), false, /*maybeDirtyClipPath=*/!d_ptr->inSetPosHelper); QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func(); - scenePrivate->removeFromIndex(this); + scenePrivate->index->updateItem(this); if (d_ptr->inSetPosHelper) return; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index b98882d..1b41232 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -398,6 +398,7 @@ private: friend class QGraphicsWidget; friend class QGraphicsWidgetPrivate; friend class QGraphicsProxyWidgetPrivate; + friend class QGraphicsSceneBspTreeIndex; friend class ::tst_QGraphicsItem; friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *); friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index b559835..8140f79 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -39,8 +39,6 @@ ** ****************************************************************************/ -static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; - /*! \class QGraphicsScene \brief The QGraphicsScene class provides a surface for managing a large @@ -329,18 +327,14 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph QGraphicsScenePrivate::QGraphicsScenePrivate() : changedSignalMask(0), indexMethod(QGraphicsScene::BspTreeIndex), + bspTreeDepth(0), lastItemCount(0), - index(new QGraphicsSceneBspTree()), - linearIndex(new QGraphicsSceneLinearIndex()), + index(0), hasSceneRect(false), updateAll(false), calledEmitUpdated(false), selectionChanging(0), dirtyItemResetPending(false), - regenerateIndex(true), - purgePending(false), - indexTimerId(0), - restartIndexTimer(false), stickyFocus(false), hasFocus(false), focusItem(0), @@ -369,8 +363,7 @@ void QGraphicsScenePrivate::init() { Q_Q(QGraphicsScene); - index->setParent(q); - linearIndex->setParent(q); + index = new QGraphicsSceneBspTreeIndex(q); // Keep this index so we can check for connected slots later on. changedSignalMask = (1 << q->metaObject()->indexOfSignal("changed(QList)")); @@ -383,220 +376,14 @@ void QGraphicsScenePrivate::init() */ QList QGraphicsScenePrivate::estimateItemsInRect(const QRectF &rect) const { - const_cast(this)->purgeRemovedItems(); const_cast(this)->_q_updateSortCache(); - if (indexMethod != QGraphicsScene::NoIndex) { - // ### Only do this once in a while. - QGraphicsScenePrivate *that = const_cast(this); - - QList items; - // Get items from index - items = that->index->items(rect); - - //### Why there are items indexed and not at some point? - - // Fill in with any unindexed items - foreach (QGraphicsItem *item, linearIndex->items(rect)) { - if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { - item->d_ptr->itemDiscovered = 1; - items << item; - } - } - - // Reset the discovered state of all discovered items - for (int i = 0; i < items.size(); ++i) - items.at(i)->d_func()->itemDiscovered = 0; - return items; - } - - QList itemsInRect; - foreach (QGraphicsItem *item, linearIndex->items(rect)) { - if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - continue; - if (item->d_ptr->visible && item->effectiveOpacity() > qreal(0.0)) - itemsInRect << item; - } + // ### Only do this once in a while. + QGraphicsScenePrivate *that = const_cast(this); - //### Why there are items indexed and not at some point? - - for (int i = 0; i < indexedItems.size(); ++i) { - if (QGraphicsItem *item = indexedItems.at(i)) { - if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - continue; - if (item->d_ptr->visible && item->effectiveOpacity() > qreal(0.0)) - itemsInRect << item; - } - } + // Get items from index + return that->index->items(rect); - return itemsInRect; -} - -/*! - \internal -*/ -void QGraphicsScenePrivate::addToIndex(QGraphicsItem *item) -{ - if (indexMethod == QGraphicsScene::BspTreeIndex) { - if (item->d_func()->index != -1) { - index->insertItem(item); - foreach (QGraphicsItem *child, item->children()) - child->addToIndex(); - } else { - // The BSP tree is regenerated if the number of items grows to a - // certain threshold, or if the bounding rect of the graph doubles in - // size. - startIndexTimer(); - } - } else if (indexMethod == QGraphicsScene::CustomIndex) { - if (item->d_func()->index != -1) { - index->insertItem(item); - foreach (QGraphicsItem *child, item->children()) - child->addToIndex(); - } - } -} - -/*! - \internal -*/ -void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item) -{ - if (indexMethod != QGraphicsScene::NoIndex) { - int index = item->d_func()->index; - if (index != -1) { - this->index->removeItem(item); - freeItemIndexes << index; - indexedItems[index] = 0; - item->d_func()->index = -1; - linearIndex->insertItem(item); - - foreach (QGraphicsItem *child, item->children()) - child->removeFromIndex(); - } - startIndexTimer(); - } -} - -/*! - \internal -*/ -void QGraphicsScenePrivate::resetIndex() -{ - purgeRemovedItems(); - if (indexMethod != QGraphicsScene::NoIndex) { - for (int i = 0; i < indexedItems.size(); ++i) { - if (QGraphicsItem *item = indexedItems.at(i)) { - item->d_ptr->index = -1; - linearIndex->insertItem(item); - } - } - indexedItems.clear(); - freeItemIndexes.clear(); - regenerateIndex = true; - startIndexTimer(); - } -} - -static inline int intmaxlog(int n) -{ - return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0); -} - -/*! - \internal -*/ -void QGraphicsScenePrivate::_q_updateIndex() -{ - if (!indexTimerId) - return; - - Q_Q(QGraphicsScene); - q->killTimer(indexTimerId); - indexTimerId = 0; - - purgeRemovedItems(); - - // Add unindexedItems to indexedItems - QRectF unindexedItemsBoundingRect; - foreach (QGraphicsItem *item, linearIndex->indexedItems()) { - unindexedItemsBoundingRect |= item->sceneBoundingRect(); - if (!freeItemIndexes.isEmpty()) { - int freeIndex = freeItemIndexes.takeFirst(); - item->d_func()->index = freeIndex; - indexedItems[freeIndex] = item; - } else { - item->d_func()->index = indexedItems.size(); - indexedItems << item; - } - } - - // Update growing scene rect. - QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; - growingItemsBoundingRect |= unindexedItemsBoundingRect; - - // Determine whether we should regenerate the BSP tree. - if (indexMethod == QGraphicsScene::BspTreeIndex) { - QGraphicsSceneBspTree *bspTree = qobject_cast(index); - Q_ASSERT(bspTree); - int depth = bspTree->depth; - if (depth == 0) { - int oldDepth = intmaxlog(lastItemCount); - depth = intmaxlog(indexedItems.size()); - static const int slack = 100; - //### do something better - QGraphicsSceneBspTree *bsp = static_cast(index); - if (bsp->leafCount() == 0 || (oldDepth != depth && qAbs(lastItemCount - indexedItems.size()) > slack)) { - // ### Crude algorithm. - regenerateIndex = true; - } - } - - // Regenerate the tree. - if (regenerateIndex) { - regenerateIndex = false; - //### do something better - QGraphicsSceneBspTree *bsp = static_cast(index); - bsp->initialize(q->sceneRect(), depth); - foreach (QGraphicsItem *item, indexedItems) - linearIndex->insertItem(item); - lastItemCount = indexedItems.size(); - q->update(); - - // Take this opportunity to reset our largest-item counter for - // untransformable items. When the items are inserted into the BSP - // tree, we'll get an accurate calculation. - largestUntransformableItem = QRectF(); - } - } - - // Insert all unindexed items into the tree. - foreach (QGraphicsItem *item, linearIndex->indexedItems()) { - QRectF rect = item->sceneBoundingRect(); - if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - continue; - - if (indexMethod != QGraphicsScene::NoIndex) - index->insertItem(item); - - // If the item ignores view transformations, update our - // largest-item-counter to ensure that the view can accurately - // discover untransformable items when drawing. - if (item->d_ptr->itemIsUntransformable()) { - QGraphicsItem *topmostUntransformable = item; - while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags - & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { - topmostUntransformable = topmostUntransformable->parentItem(); - } - // ### Verify that this is the correct largest untransformable rectangle. - largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); - } - } - linearIndex->clear(); - - // Notify scene rect changes. - if (!hasSceneRect && growingItemsBoundingRect != oldGrowingItemsBoundingRect) - emit q->sceneRectChanged(growingItemsBoundingRect); } /*! @@ -740,22 +527,8 @@ void QGraphicsScenePrivate::_q_removeItemLater(QGraphicsItem *item) // chain. item->clearFocus(); - int index = item->d_func()->index; - if (index != -1) { - // Important: The index is useless until purgeRemovedItems() is - // called. - indexedItems[index] = (QGraphicsItem *)0; - if (!purgePending) { - purgePending = true; - q->update(); - } - removedItems << item; - } else { - // Recently added items are purged immediately. unindexedItems() never - // contains stale items. - linearIndex->removeItem(item); - q->update(); - } + //We ask for a removing in the index + this->index->removeItem(item, true); // Reset the mouse grabber and focus item data. if (item == focusItem) @@ -806,51 +579,6 @@ void QGraphicsScenePrivate::_q_removeItemLater(QGraphicsItem *item) /*! \internal - - Removes stale pointers from all data structures. -*/ -void QGraphicsScenePrivate::purgeRemovedItems() -{ - Q_Q(QGraphicsScene); - - if (!purgePending && removedItems.isEmpty()) - return; - - // Remove stale items from the BSP tree. - if (indexMethod != QGraphicsScene::NoIndex) { - index->removeItems(removedItems); - } - - // Purge this list. - removedItems.clear(); - freeItemIndexes.clear(); - for (int i = 0; i < indexedItems.size(); ++i) { - if (!indexedItems.at(i)) - freeItemIndexes << i; - } - purgePending = false; - - // No locality info for the items; update the whole scene. - q->update(); -} - -/*! - \internal - - Starts or restarts the timer used for reindexing unindexed items. -*/ -void QGraphicsScenePrivate::startIndexTimer() -{ - Q_Q(QGraphicsScene); - if (indexTimerId) { - restartIndexTimer = true; - } else { - indexTimerId = q->startTimer(QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); - } -} - -/*! - \internal */ void QGraphicsScenePrivate::addPopup(QGraphicsWidget *widget) { @@ -1964,7 +1692,7 @@ void QGraphicsScenePrivate::climbTree(QGraphicsItem *item, int *stackingOrder) void QGraphicsScenePrivate::_q_updateSortCache() { - _q_updateIndex(); + index->updateIndex(); if (!sortCacheEnabled || !updatingSortCache) return; @@ -1974,15 +1702,11 @@ void QGraphicsScenePrivate::_q_updateSortCache() QList topLevels; - for (int i = 0; i < indexedItems.size(); ++i) { - QGraphicsItem *item = indexedItems.at(i); + for (int i = 0; i < index->indexedItems().count(); ++i) { + QGraphicsItem *item = index->indexedItems().at(i); if (item && item->parentItem() == 0) topLevels << item; } - foreach (QGraphicsItem *item, linearIndex->indexedItems()) { - if (item->parentItem() == 0) - topLevels << item; - } qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); for (int i = 0; i < topLevels.size(); ++i) @@ -2139,8 +1863,8 @@ QGraphicsScene::QGraphicsScene(QObject *parent) QGraphicsScene::QGraphicsScene(const QRectF &sceneRect, QObject *parent) : QObject(*new QGraphicsScenePrivate, parent) { - setSceneRect(sceneRect); d_func()->init(); + setSceneRect(sceneRect); } /*! @@ -2154,8 +1878,8 @@ QGraphicsScene::QGraphicsScene(const QRectF &sceneRect, QObject *parent) QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent) : QObject(*new QGraphicsScenePrivate, parent) { - setSceneRect(x, y, width, height); d_func()->init(); + setSceneRect(x, y, width, height); } /*! @@ -2192,8 +1916,8 @@ QGraphicsScene::~QGraphicsScene() QRectF QGraphicsScene::sceneRect() const { Q_D(const QGraphicsScene); - const_cast(d)->_q_updateIndex(); - return d->hasSceneRect ? d->sceneRect : d->growingItemsBoundingRect; + d->index->updateIndex(); + return d->hasSceneRect ? d->index->rect() : d->growingItemsBoundingRect; } void QGraphicsScene::setSceneRect(const QRectF &rect) { @@ -2201,7 +1925,7 @@ void QGraphicsScene::setSceneRect(const QRectF &rect) if (rect != d->sceneRect) { d->hasSceneRect = !rect.isNull(); d->sceneRect = rect; - d->resetIndex(); + d->index->setRect(rect); emit sceneRectChanged(rect); } } @@ -2390,24 +2114,23 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) if (d->indexMethod == method) { return; } - d->resetIndex(); if (d->indexMethod == NoIndex && method == BspTreeIndex) { - QGraphicsSceneBspTree *tree = qobject_cast(d->index); + QGraphicsSceneBspTreeIndex *tree = qobject_cast(d->index); if (!tree) { delete d->index; - d->index = new QGraphicsSceneBspTree(this); + d->index = new QGraphicsSceneBspTreeIndex(this); } } if (d->indexMethod == CustomIndex && method == BspTreeIndex) { QGraphicsSceneIndex *oldIndex = d->index; - d->index = new QGraphicsSceneBspTree(this); + d->index = new QGraphicsSceneBspTreeIndex(this); d->index->insertItems(oldIndex->items(oldIndex->rect())); } if (d->indexMethod == CustomIndex && method == NoIndex) { - d->index = new QGraphicsSceneBspTree(this); + d->index = new QGraphicsSceneLinearIndex(this); } d->indexMethod = method; @@ -2424,7 +2147,6 @@ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) } d->indexMethod = CustomIndex; d->index = index; - index->mscene = this; } } @@ -2469,8 +2191,8 @@ QGraphicsSceneIndex* QGraphicsScene::sceneIndex() const int QGraphicsScene::bspTreeDepth() const { Q_D(const QGraphicsScene); - QGraphicsSceneBspTree *bspTree = qobject_cast(d->index); - return bspTree ? bspTree->depth : 0; + QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); + return bspTree ? bspTree->bspDepth() : 0; } void QGraphicsScene::setBspTreeDepth(int depth) { @@ -2483,14 +2205,13 @@ void QGraphicsScene::setBspTreeDepth(int depth) return; } - QGraphicsSceneBspTree *bspTree = qobject_cast(d->index); + QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); if (!bspTree) { qWarning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); return; } - bspTree->depth = depth; - d->resetIndex(); + bspTree->setBspDepth(depth); } /*! @@ -2543,24 +2264,7 @@ QRectF QGraphicsScene::itemsBoundingRect() const QList QGraphicsScene::items() const { Q_D(const QGraphicsScene); - const_cast(d)->purgeRemovedItems(); - - // If freeItemIndexes is empty, we know there are no holes in indexedItems and - // unindexedItems. - if (d->freeItemIndexes.isEmpty()) { - if (d->linearIndex->indexedItems().isEmpty()) - return d->indexedItems; - return d->indexedItems + d->linearIndex->indexedItems(); - } - - // Rebuild the list of items to avoid holes. ### We could also just - // compress the item lists at this point. - QList itemList; - foreach (QGraphicsItem *item, d->indexedItems + d->linearIndex->indexedItems()) { - if (item) - itemList << item; - } - return itemList; + return d->index->indexedItems(); } /*! @@ -2830,21 +2534,12 @@ void QGraphicsScene::clear() { Q_D(QGraphicsScene); // Recursive descent delete - for (int i = 0; i < d->indexedItems.size(); ++i) { - if (QGraphicsItem *item = d->indexedItems.at(i)) { + for (int i = 0; i < d->index->indexedItems().size(); ++i) { + if (QGraphicsItem *item = d->index->indexedItems().at(i)) { if (!item->parentItem()) delete item; } } - QList unindexedParents; - foreach (QGraphicsItem *item, d->linearIndex->indexedItems()) { - if (!item->parentItem()) - unindexedParents << item; - } - d->linearIndex->clear(); - qDeleteAll(unindexedParents); - d->indexedItems.clear(); - d->freeItemIndexes.clear(); d->lastItemCount = 0; d->index->clear(); d->largestUntransformableItem = QRectF(); @@ -2968,10 +2663,6 @@ void QGraphicsScene::addItem(QGraphicsItem *item) return; } - // Prevent reusing a recently deleted pointer: purge all removed items - // from our lists. - d->purgeRemovedItems(); - // Invalidate any sort caching; arrival of a new item means we need to // resort. d->invalidateSortCache(); @@ -2989,9 +2680,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Indexing requires sceneBoundingRect(), but because \a item might // not be completely constructed at this point, we need to store it in // a temporary list and schedule an indexing for later. - d->linearIndex->insertItem(item); - item->d_func()->index = -1; - d->startIndexTimer(); + d->index->insertItem(item); // Add to list of toplevels if this item is a toplevel. if (!item->d_ptr->parent) @@ -3351,7 +3040,7 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) // Note: This will access item's sceneBoundingRect(), which (as this is // C++) is why we cannot call removeItem() from QGraphicsItem's // destructor. - d->removeFromIndex(item); + d->index->removeItem(item, false); if (item == d->tabFocusFirst) { QGraphicsWidget *widget = static_cast(item); @@ -3371,15 +3060,6 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) d->unregisterTopLevelItem(item); } - // Remove from our item lists. - int index = item->d_func()->index; - if (index != -1) { - d->freeItemIndexes << index; - d->indexedItems[index] = 0; - } else { - d->linearIndex->removeItem(item); - } - // Remove from scene transform cache int transformIndex = item->d_func()->sceneTransformIndex; if (transformIndex != -1) { @@ -3998,16 +3678,6 @@ bool QGraphicsScene::event(QEvent *event) // geometries that do not have an explicit style set. update(); break; - case QEvent::Timer: - if (d->indexTimerId && static_cast(event)->timerId() == d->indexTimerId) { - if (d->restartIndexTimer) { - d->restartIndexTimer = false; - } else { - // this call will kill the timer - d->_q_updateIndex(); - } - } - // Fallthrough intended - support timers in subclasses. default: return QObject::event(event); } diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index bb3cea7..6476b8c 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -279,7 +279,6 @@ private: Q_DECLARE_PRIVATE(QGraphicsScene) Q_DISABLE_COPY(QGraphicsScene) - Q_PRIVATE_SLOT(d_func(), void _q_updateIndex()) Q_PRIVATE_SLOT(d_func(), void _q_emitUpdated()) Q_PRIVATE_SLOT(d_func(), void _q_removeItemLater(QGraphicsItem *item)) Q_PRIVATE_SLOT(d_func(), void _q_updateLater()) @@ -292,6 +291,7 @@ private: friend class QGraphicsViewPrivate; friend class QGraphicsWidget; friend class QGraphicsWidgetPrivate; + friend class QGraphicsSceneBspTreeIndex; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index a81b14d..f8fa450 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -83,8 +83,8 @@ public: } }; -QGraphicsSceneBspTree::QGraphicsSceneBspTree(QObject *parent) - : QGraphicsSceneIndex(parent), depth(0), leafCnt(0) +QGraphicsSceneBspTree::QGraphicsSceneBspTree() + : leafCnt(0) { insertVisitor = new QGraphicsSceneInsertItemBspTreeVisitor; removeVisitor = new QGraphicsSceneRemoveItemBspTreeVisitor; @@ -100,7 +100,7 @@ QGraphicsSceneBspTree::~QGraphicsSceneBspTree() void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth) { - sceneRect = rect; + this->rect = rect; leafCnt = 0; nodes.resize((1 << (depth + 1)) - 1); nodes.fill(Node()); @@ -117,29 +117,19 @@ void QGraphicsSceneBspTree::clear() leaves.clear(); } -QRectF QGraphicsSceneBspTree::rect() const -{ - return sceneRect; -} - -void QGraphicsSceneBspTree::setRect(const QRectF &rect) -{ - sceneRect = rect; -} - -void QGraphicsSceneBspTree::insertItem(QGraphicsItem *item) +void QGraphicsSceneBspTree::insertItem(QGraphicsItem *item, const QRectF &rect) { insertVisitor->item = item; - climbTree(insertVisitor, item->sceneBoundingRect()); + climbTree(insertVisitor, rect); } -void QGraphicsSceneBspTree::removeItem(QGraphicsItem *item) +void QGraphicsSceneBspTree::removeItem(QGraphicsItem *item, const QRectF &rect) { removeVisitor->item = item; - climbTree(removeVisitor, item->sceneBoundingRect()); + climbTree(removeVisitor, rect); } -void QGraphicsSceneBspTree::removeItems(const QList &items) +void QGraphicsSceneBspTree::removeItems(const QSet &items) { for (int i = 0; i < leaves.size(); ++i) { QList newItemList; @@ -247,10 +237,8 @@ void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth, int index) void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index) { - if (nodes.isEmpty()) { - // should never happen for bsp tree internal to QGraphicsScene - initialize(sceneRect, 0); - } + if (nodes.isEmpty()) + return; const Node &node = nodes.at(index); int childIndex = firstChildIndex(index); @@ -279,10 +267,8 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index) { - if (nodes.isEmpty()) { - // should never happen for bsp tree internal to QGraphicsScene - initialize(sceneRect, 0); - } + if (nodes.isEmpty()) + return; const Node &node = nodes.at(index); int childIndex = firstChildIndex(index); @@ -316,7 +302,7 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con QRectF QGraphicsSceneBspTree::rectForIndex(int index) const { if (index <= 0) - return sceneRect; + return rect; int parentIdx = parentIndex(index); QRectF rect = rectForIndex(parentIdx); diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index 69d9eee..e6ceb78 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -60,7 +60,6 @@ #include #include #include -#include QT_BEGIN_NAMESPACE @@ -70,10 +69,8 @@ class QGraphicsSceneInsertItemBspTreeVisitor; class QGraphicsSceneRemoveItemBspTreeVisitor; class QGraphicsSceneFindItemBspTreeVisitor; -class Q_AUTOTEST_EXPORT QGraphicsSceneBspTree : public QGraphicsSceneIndex +class QGraphicsSceneBspTree { - Q_OBJECT - public: struct Node { @@ -85,27 +82,20 @@ public: Type type; }; - QGraphicsSceneBspTree(QObject *parent = 0); + QGraphicsSceneBspTree(); ~QGraphicsSceneBspTree(); void initialize(const QRectF &rect, int depth); void clear(); - QRectF rect() const; - void setRect(const QRectF &rect); - void insertItem(QGraphicsItem *item); - void removeItem(QGraphicsItem *item); - void removeItems(const QList &items); + void insertItem(QGraphicsItem *item, const QRectF &rect); + void removeItem(QGraphicsItem *item, const QRectF &rect); + void removeItems(const QSet &items); - QList items(const QPointF &point); QList items(const QRectF &rect); - + QList items(const QPointF &pos); int leafCount() const; - int depth; - -private: - inline int firstChildIndex(int index) const { return index * 2 + 1; } @@ -114,6 +104,7 @@ private: QString debug(int index) const; +private: void initialize(const QRectF &rect, int depth, int index); void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index = 0); void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0); @@ -125,7 +116,7 @@ private: QVector nodes; QVector > leaves; int leafCnt; - QRectF sceneRect; + QRectF rect; QGraphicsSceneInsertItemBspTreeVisitor *insertVisitor; QGraphicsSceneRemoveItemBspTreeVisitor *removeVisitor; @@ -139,8 +130,6 @@ public: virtual void visit(QList *items) = 0; }; -Q_DECLARE_TYPEINFO(QGraphicsSceneBspTree::Node, Q_PRIMITIVE_TYPE); - QT_END_NAMESPACE #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsscene_linear_p.h b/src/gui/graphicsview/qgraphicsscene_linear_p.h deleted file mode 100644 index 41e03e4..0000000 --- a/src/gui/graphicsview/qgraphicsscene_linear_p.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSCENELINEARINDEX_P_H -#define QGRAPHICSSCENELINEARINDEX_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex -{ - Q_OBJECT - -private: - QRectF m_sceneRect; - QList m_items; - -public: - QGraphicsSceneLinearIndex(QObject *parent = 0): QGraphicsSceneIndex(parent) { - } - - virtual void setRect(const QRectF &rect) { - m_sceneRect = rect; - } - - virtual QRectF rect() const { - return m_sceneRect; - } - - virtual void clear() { - m_items.clear(); - } - - virtual void insertItem(QGraphicsItem *item) { - m_items << item; - } - - virtual void removeItem(QGraphicsItem *item) { - m_items.removeAll(item); - } - - virtual QList items(const QPointF &point) { - QList result; - foreach (QGraphicsItem *item, m_items) - if (item->sceneBoundingRect().contains(point)) - result << item; - return result; - } - - virtual QList items(const QRectF &rect) { - QList result; - foreach (QGraphicsItem *item, m_items) - if (item->sceneBoundingRect().intersects(rect)) - result << item; - return result; - } - - QList indexedItems() { - return m_items; - } -}; - -QT_END_NAMESPACE - -#endif // QT_NO_GRAPHICSVIEW - -#endif // QGRAPHICSSCENELINEARINDEX_P_H diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 65c1a69..2c0d464 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -57,8 +57,8 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW -#include "qgraphicsscene_bsp_p.h" -#include "qgraphicsscene_linear_p.h" +#include "qgraphicsscenebsptreeindex_p.h" +#include "qgraphicsscenelinearindex_p.h" #include "qgraphicssceneindex.h" #include "qgraphicsitem_p.h" @@ -89,15 +89,10 @@ public: int bspTreeDepth; QList estimateItemsInRect(const QRectF &rect) const; - void addToIndex(QGraphicsItem *item); - void removeFromIndex(QGraphicsItem *item); - void resetIndex(); - void _q_updateIndex(); int lastItemCount; QGraphicsSceneIndex *index; - QGraphicsSceneLinearIndex *linearIndex; QRectF sceneRect; bool hasSceneRect; @@ -112,7 +107,6 @@ public: QPainterPath selectionArea; int selectionChanging; QSet selectedItems; - QList indexedItems; QList dirtyItems; QList pendingUpdateItems; QList unpolishedItems; @@ -127,21 +121,11 @@ public: void resetDirtyItemsLater(); bool dirtyItemResetPending; - QList freeItemIndexes; - bool regenerateIndex; - - bool purgePending; void _q_removeItemLater(QGraphicsItem *item); - QList removedItems; - void purgeRemovedItems(); QBrush backgroundBrush; QBrush foregroundBrush; - int indexTimerId; - bool restartIndexTimer; - void startIndexTimer(); - bool stickyFocus; bool hasFocus; QGraphicsItem *focusItem; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp new file mode 100644 index 0000000..ebc167a --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp @@ -0,0 +1,437 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; + +#include "qgraphicsscenebsptreeindex_p.h" +#include "qgraphicsitem_p.h" +#include "qgraphicsscene_p.h" + +#include + +#include + +QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) + : QGraphicsSceneIndex(scene), + bspTreeDepth(0), + indexTimerId(0), + restartIndexTimer(false), + regenerateIndex(true), + lastItemCount(0), + purgePending(false) +{ + +} + +void QGraphicsSceneBspTreeIndex::setRect(const QRectF &rect) +{ + m_sceneRect = rect; + resetIndex(); +} + +QRectF QGraphicsSceneBspTreeIndex::rect() const +{ + const_cast(this)->updateIndex(); + return m_sceneRect; +} + +void QGraphicsSceneBspTreeIndex::clear() +{ + bsp.clear(); + lastItemCount = 0; + freeItemIndexes.clear(); + m_indexedItems.clear(); + unindexedItems.clear(); +} + +void QGraphicsSceneBspTreeIndex::insertItem(QGraphicsItem *item) +{ + // Prevent reusing a recently deleted pointer: purge all removed items + // from our lists. + purgeRemovedItems(); + + // Indexing requires sceneBoundingRect(), but because \a item might + // not be completely constructed at this point, we need to store it in + // a temporary list and schedule an indexing for later. + unindexedItems << item; + item->d_func()->index = -1; + startIndexTimer(); +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndex::addToIndex(QGraphicsItem *item) +{ + if (item->d_func()->index != -1) { + bsp.insertItem(item, item->sceneBoundingRect()); + foreach (QGraphicsItem *child, item->children()) + child->addToIndex(); + } else { + // The BSP tree is regenerated if the number of items grows to a + // certain threshold, or if the bounding rect of the graph doubles in + // size. + startIndexTimer(); + } +} + +void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item, bool itemIsAboutToDie) +{ + if (!itemIsAboutToDie) { + // Note: This will access item's sceneBoundingRect(), which (as this is + // C++) is why we cannot call removeItem() from QGraphicsItem's + // destructor. + removeFromIndex(item); + + // Remove from our item lists. + int index = item->d_func()->index; + if (index != -1) { + freeItemIndexes << index; + m_indexedItems[index] = 0; + } else { + unindexedItems.removeAll(item); + } + + } else { + int index = item->d_func()->index; + if (index != -1) { + // Important: The index is useless until purgeRemovedItems() is + // called. + m_indexedItems[index] = (QGraphicsItem *)0; + if (!purgePending) { + purgePending = true; + scene()->update(); + } + removedItems << item; + } else { + // Recently added items are purged immediately. unindexedItems() never + // contains stale items. + unindexedItems.removeAll(item); + scene()->update(); + } + } +} +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndex::removeFromIndex(QGraphicsItem *item) +{ + if (item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { + // ### remove from child index only if applicable + return; + } + int index = item->d_func()->index; + if (index != -1) { + bsp.removeItem(item, item->sceneBoundingRect()); + freeItemIndexes << index; + m_indexedItems[index] = 0; + item->d_func()->index = -1; + unindexedItems << item; + + //prepareGeometryChange will call updateItem + foreach (QGraphicsItem *child, item->children()) + child->prepareGeometryChange(); + } + startIndexTimer(); +} + +void QGraphicsSceneBspTreeIndex::updateItem(QGraphicsItem *item) +{ + // Note: This will access item's sceneBoundingRect(), which (as this is + // C++) is why we cannot call removeItem() from QGraphicsItem's + // destructor. + removeFromIndex(item); +} + +QList QGraphicsSceneBspTreeIndex::items(const QPointF &point) +{ + purgeRemovedItems(); + QList rectItems = bsp.items(QRectF(point, QSizeF(1, 1))); + // Fill in with any unindexed items + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { + QRectF boundingRect = item->sceneBoundingRect(); + if (boundingRect.intersects(QRectF(point, QSizeF(1, 1)))) { + item->d_ptr->itemDiscovered = 1; + rectItems << item; + } + } + } + } + + // Reset the discovered state of all discovered items + for (int i = 0; i < rectItems.size(); ++i) + rectItems.at(i)->d_func()->itemDiscovered = 0; + + return rectItems; +} + +QList QGraphicsSceneBspTreeIndex::items(const QRectF &rect) +{ + purgeRemovedItems(); + QList rectItems = bsp.items(rect); + // Fill in with any unindexed items + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { + QRectF boundingRect = item->sceneBoundingRect(); + if (boundingRect.intersects(rect)) { + item->d_ptr->itemDiscovered = 1; + rectItems << item; + } + } + } + } + + // Reset the discovered state of all discovered items + for (int i = 0; i < rectItems.size(); ++i) + rectItems.at(i)->d_func()->itemDiscovered = 0; + + return rectItems; +} + +QList QGraphicsSceneBspTreeIndex::indexedItems() +{ + purgeRemovedItems(); + // If freeItemIndexes is empty, we know there are no holes in indexedItems and + // unindexedItems. + if (freeItemIndexes.isEmpty()) { + if (unindexedItems.isEmpty()) + return m_indexedItems; + return m_indexedItems + unindexedItems; + } + + // Rebuild the list of items to avoid holes. ### We could also just + // compress the item lists at this point. + QList itemList; + foreach (QGraphicsItem *item, m_indexedItems + unindexedItems) { + if (item) + itemList << item; + } + return itemList; +} + +void QGraphicsSceneBspTreeIndex::updateIndex() +{ + _q_updateIndex(); +} + +int QGraphicsSceneBspTreeIndex::bspDepth() +{ + return bspTreeDepth; +} + +void QGraphicsSceneBspTreeIndex::setBspDepth(int depth) +{ + bspTreeDepth = depth; + resetIndex(); +} + +bool QGraphicsSceneBspTreeIndex::event(QEvent *event) +{ + switch (event->type()) { + case QEvent::Timer: + if (indexTimerId && static_cast(event)->timerId() == indexTimerId) { + if (restartIndexTimer) { + restartIndexTimer = false; + } else { + // this call will kill the timer + _q_updateIndex(); + } + } + // Fallthrough intended - support timers in subclasses. + default: + return QObject::event(event); + } + return true; +} + +static inline int intmaxlog(int n) +{ + return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0); +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndex::_q_updateIndex() +{ + if (!indexTimerId) + return; + + killTimer(indexTimerId); + indexTimerId = 0; + + purgeRemovedItems(); + + // Add unindexedItems to indexedItems + QRectF unindexedItemsBoundingRect; + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + unindexedItemsBoundingRect |= item->sceneBoundingRect(); + if (!freeItemIndexes.isEmpty()) { + int freeIndex = freeItemIndexes.takeFirst(); + item->d_func()->index = freeIndex; + m_indexedItems[freeIndex] = item; + } else { + item->d_func()->index = m_indexedItems.size(); + m_indexedItems << item; + } + } + } + + // Update growing scene rect. + QRectF oldGrowingItemsBoundingRect = scene()->d_func()->growingItemsBoundingRect; + scene()->d_func()->growingItemsBoundingRect |= unindexedItemsBoundingRect; + + // Determine whether we should regenerate the BSP tree. + if (bspTreeDepth == 0) { + int oldDepth = intmaxlog(lastItemCount); + bspTreeDepth = intmaxlog(m_indexedItems.size()); + static const int slack = 100; + if (bsp.leafCount() == 0 || (oldDepth != bspTreeDepth && qAbs(lastItemCount - m_indexedItems.size()) > slack)) { + // ### Crude algorithm. + regenerateIndex = true; + } + } + + // Regenerate the tree. + if (regenerateIndex) { + regenerateIndex = false; + bsp.initialize(scene()->sceneRect(), bspTreeDepth); + unindexedItems = m_indexedItems; + lastItemCount = m_indexedItems.size(); + scene()->update(); + + // Take this opportunity to reset our largest-item counter for + // untransformable items. When the items are inserted into the BSP + // tree, we'll get an accurate calculation. + scene()->d_func()->largestUntransformableItem = QRectF(); + } + + // Insert all unindexed items into the tree. + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + QRectF rect = item->sceneBoundingRect(); + if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) + continue; + + bsp.insertItem(item,rect); + + // If the item ignores view transformations, update our + // largest-item-counter to ensure that the view can accurately + // discover untransformable items when drawing. + if (item->d_ptr->itemIsUntransformable()) { + QGraphicsItem *topmostUntransformable = item; + while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags + & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { + topmostUntransformable = topmostUntransformable->parentItem(); + } + // ### Verify that this is the correct largest untransformable rectangle. + scene()->d_func()->largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); + } + } + } + unindexedItems.clear(); + + // Notify scene rect changes. + if (!scene()->d_func()->hasSceneRect && scene()->d_func()->growingItemsBoundingRect != oldGrowingItemsBoundingRect) + emit scene()->sceneRectChanged(scene()->d_func()->growingItemsBoundingRect); +} + + +/*! + \internal + + Removes stale pointers from all data structures. +*/ +void QGraphicsSceneBspTreeIndex::purgeRemovedItems() +{ + if (!purgePending && removedItems.isEmpty()) + return; + + // Remove stale items from the BSP tree. + bsp.removeItems(removedItems.toSet()); + // Purge this list. + removedItems.clear(); + freeItemIndexes.clear(); + for (int i = 0; i < m_indexedItems.size(); ++i) { + if (!m_indexedItems.at(i)) + freeItemIndexes << i; + } + purgePending = false; + + // No locality info for the items; update the whole scene. + scene()->update(); +} + +/*! + \internal + + Starts or restarts the timer used for reindexing unindexed items. +*/ +void QGraphicsSceneBspTreeIndex::startIndexTimer() +{ + if (indexTimerId) { + restartIndexTimer = true; + } else { + indexTimerId = startTimer(QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); + } +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndex::resetIndex() +{ + purgeRemovedItems(); + for (int i = 0; i < m_indexedItems.size(); ++i) { + if (QGraphicsItem *item = m_indexedItems.at(i)) { + item->d_ptr->index = -1; + unindexedItems << item; + } + } + m_indexedItems.clear(); + freeItemIndexes.clear(); + regenerateIndex = true; + startIndexTimer(); +} diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h new file mode 100644 index 0000000..74af910 --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef QGRAPHICSBSPTREEINDEX_H +#define QGRAPHICSBSPTREEINDEX_H + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +QT_BEGIN_NAMESPACE + +#include +#include +#include +#include +#include + +#include "qgraphicsscene_bsp_p.h" + +class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex +{ + Q_OBJECT +public: + QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); + + void setRect(const QRectF &rect); + virtual QRectF rect() const; + + void clear(); + + void insertItem(QGraphicsItem *item); + void removeItem(QGraphicsItem *item, bool itemIsAboutToDie); + void updateItem(QGraphicsItem *item); + + QList items(const QPointF &point); + QList items(const QRectF &rect); + + QList indexedItems(); + + void updateIndex(); + + int bspDepth(); + void setBspDepth(int depth); + +protected: + bool event(QEvent *event); + +public slots : + void _q_updateIndex(); + +private : + QGraphicsSceneBspTree bsp; + QRectF m_sceneRect; + int bspTreeDepth; + int indexTimerId; + bool restartIndexTimer; + bool regenerateIndex; + int lastItemCount; + + QList m_indexedItems; + QList unindexedItems; + QList freeItemIndexes; + + bool purgePending; + QList removedItems; + void purgeRemovedItems(); + + void startIndexTimer(); + void resetIndex(); + + void addToIndex(QGraphicsItem *item); + void removeFromIndex(QGraphicsItem *item); +}; + +QT_END_NAMESPACE + +#endif // QT_NO_GRAPHICSVIEW + +#endif // QGRAPHICSBSPTREEINDEX_H diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 904e0af..7360bed 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE /*! Constructs an abstract scene index. */ -QGraphicsSceneIndex::QGraphicsSceneIndex(QObject *parent): QObject(parent) +QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene): QObject(scene), m_scene(scene) { } @@ -108,7 +108,7 @@ QGraphicsSceneIndex::~QGraphicsSceneIndex() */ QGraphicsScene* QGraphicsSceneIndex::scene() { - return mscene; + return m_scene; } /*! @@ -121,7 +121,7 @@ QGraphicsScene* QGraphicsSceneIndex::scene() */ void QGraphicsSceneIndex::updateItem(QGraphicsItem *item) { - removeItem(item); + removeItem(item,false); insertItem(item); } @@ -145,10 +145,10 @@ void QGraphicsSceneIndex::insertItems(const QList &items) \sa removeItem(), removeItems(), updateItems() */ -void QGraphicsSceneIndex::removeItems(const QList &items) +void QGraphicsSceneIndex::removeItems(const QList &items, bool itemsAreAboutToDie) { foreach (QGraphicsItem *item, items) - removeItem(item); + removeItem(item,itemsAreAboutToDie); } /*! @@ -164,6 +164,10 @@ void QGraphicsSceneIndex::updateItems(const QList &items) updateItem(item); } +void QGraphicsSceneIndex::updateIndex() +{ +} + QT_END_NAMESPACE #include "moc_qgraphicssceneindex.cpp" diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index d3b6c9f..3b034d4 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -64,27 +64,32 @@ class Q_GUI_EXPORT QGraphicsSceneIndex: public QObject Q_OBJECT public: - QGraphicsSceneIndex(QObject *parent = 0); + QGraphicsSceneIndex(QGraphicsScene *scene = 0); virtual ~QGraphicsSceneIndex(); + QGraphicsScene* scene(); + virtual void setRect(const QRectF &rect) = 0; virtual QRectF rect() const = 0; virtual void clear() = 0; virtual void insertItem(QGraphicsItem *item) = 0; - virtual void removeItem(QGraphicsItem *item) = 0; + virtual void removeItem(QGraphicsItem *items, bool itemIsAboutToDie) = 0; virtual void updateItem(QGraphicsItem *item); virtual void insertItems(const QList &items); - virtual void removeItems(const QList &items); + virtual void removeItems(const QList &items, bool itemsAreAboutToDie); virtual void updateItems(const QList &items); virtual QList items(const QPointF &point) = 0; virtual QList items(const QRectF &rect) = 0; - QGraphicsScene* scene(); + virtual QList indexedItems() = 0; + + virtual void updateIndex(); - QGraphicsScene* mscene; +private: + QGraphicsScene *m_scene; }; #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h new file mode 100644 index 0000000..30948d9 --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENELINEARINDEX_P_H +#define QGRAPHICSSCENELINEARINDEX_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex +{ + Q_OBJECT + +private: + QRectF m_sceneRect; + QList m_items; + +public: + QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): QGraphicsSceneIndex(scene) + { + } + + virtual void setRect(const QRectF &rect) { + m_sceneRect = rect; + } + + virtual QRectF rect() const { + return m_sceneRect; + } + + virtual void clear() { + m_items.clear(); + } + + virtual void insertItem(QGraphicsItem *item) { + m_items << item; + } + + virtual void removeItem(QGraphicsItem *item, bool itemIsAboutToDie) { + Q_UNUSED(itemIsAboutToDie); + m_items.removeAll(item); + } + + virtual QList items(const QPointF &point) { + QList result; + foreach (QGraphicsItem *item, m_items) + if (item->sceneBoundingRect().contains(point)) + result << item; + return result; + } + + virtual QList items(const QRectF &rect) { + QList result; + foreach (QGraphicsItem *item, m_items) + if (item->sceneBoundingRect().intersects(rect)) + result << item; + return result; + } + + QList indexedItems() { + return m_items; + } +}; + +QT_END_NAMESPACE + +#endif // QT_NO_GRAPHICSVIEW + +#endif // QGRAPHICSSCENELINEARINDEX_P_H diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 955f2d3..3dca152 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -43,8 +43,8 @@ #include #include #include -#include -#include +#include +#include //TESTED_CLASS= @@ -88,12 +88,12 @@ void tst_QGraphicsSceneIndex::common_data() QGraphicsSceneIndex *tst_QGraphicsSceneIndex::createIndex(const QString &indexMethod) { QGraphicsSceneIndex *index = 0; - + QGraphicsScene *scene = new QGraphicsScene(); if (indexMethod == "bsp") - index = new QGraphicsSceneBspTree; + index = new QGraphicsSceneBspTreeIndex(scene); if (indexMethod == "linear") - index = new QGraphicsSceneLinearIndex; + index = new QGraphicsSceneLinearIndex(scene); return index; } @@ -104,8 +104,9 @@ void tst_QGraphicsSceneIndex::sceneRect_data() } void tst_QGraphicsSceneIndex::sceneRect() -{ - QGraphicsSceneIndex *index = new QGraphicsSceneBspTree; +{ + QGraphicsScene *scene = new QGraphicsScene(); + QGraphicsSceneIndex *index = new QGraphicsSceneBspTreeIndex(scene); index->setRect(QRectF(0, 0, 2000, 2000)); QCOMPARE(index->rect(), QRectF(0, 0, 2000, 2000)); } -- cgit v0.12 From 7d39e871e679be8afc10c7109a5cc396ead886f7 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 5 May 2009 17:56:43 +0200 Subject: Fix deletion of indexed items, and fix comments. It was not a good idea to delete all items in the middle of the loop when clearing the scene since we change the content of indexedItems by deleting one of them. We need to store first all top level items in a temporary list and then delete them in one shot (that will delete their children as well). --- src/gui/graphicsview/qgraphicsscene.cpp | 9 +++++---- tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index e9fad68..f2e5f57 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2549,13 +2549,16 @@ void QGraphicsScene::clearSelection() void QGraphicsScene::clear() { Q_D(QGraphicsScene); + QList items; // Recursive descent delete for (int i = 0; i < d->index->indexedItems().size(); ++i) { if (QGraphicsItem *item = d->index->indexedItems().at(i)) { if (!item->parentItem()) - delete item; + items << item; } } + //We delete all top level items + qDeleteAll(items); d->lastItemCount = 0; d->index->clear(); d->largestUntransformableItem = QRectF(); @@ -2693,9 +2696,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Add the item to this scene item->d_func()->scene = targetScene; - // Indexing requires sceneBoundingRect(), but because \a item might - // not be completely constructed at this point, we need to store it in - // a temporary list and schedule an indexing for later. + // Add the item in the index d->index->insertItem(item); // Add to list of toplevels if this item is a toplevel. diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp index f2a6bfd..617790c 100644 --- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp @@ -687,7 +687,6 @@ void tst_QGraphicsLayout::ownership() delete top; //don't crash after that. } - } QTEST_MAIN(tst_QGraphicsLayout) -- cgit v0.12 From 560ca373e4879f335a0ceeb3f8a769cc0e4297fe Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 6 May 2009 10:16:51 +0200 Subject: Make const when it needs to be. --- src/gui/graphicsview/qgraphicssceneindex.cpp | 4 ++-- src/gui/graphicsview/qgraphicssceneindex.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 7360bed..86a2fbb 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -104,9 +104,9 @@ QGraphicsSceneIndex::~QGraphicsSceneIndex() */ /*! - Returns the scene of this scene index. + Returns the scene of this index. */ -QGraphicsScene* QGraphicsSceneIndex::scene() +QGraphicsScene* QGraphicsSceneIndex::scene() const { return m_scene; } diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index 3b034d4..a782323 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -67,7 +67,7 @@ public: QGraphicsSceneIndex(QGraphicsScene *scene = 0); virtual ~QGraphicsSceneIndex(); - QGraphicsScene* scene(); + QGraphicsScene* scene() const; virtual void setRect(const QRectF &rect) = 0; virtual QRectF rect() const = 0; -- cgit v0.12 From 210bd7b6033e41aad61fe131002dc5e496d7427a Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sat, 16 May 2009 12:15:40 +0200 Subject: Extended QRegExp by a W3C XML Schema mode --- src/corelib/tools/qregexp.cpp | 330 +++++++++++++++++++++++++++++++++++++++++- src/corelib/tools/qregexp.h | 2 +- 2 files changed, 329 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index e1c3921..f69a99f 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -70,6 +70,8 @@ int qFindString(const QChar *haystack, int haystackLen, int from, #define RXERR_LEFTDELIM QT_TRANSLATE_NOOP("QRegExp", "missing left delim") #define RXERR_END QT_TRANSLATE_NOOP("QRegExp", "unexpected end") #define RXERR_LIMIT QT_TRANSLATE_NOOP("QRegExp", "met internal limit") +#define RXERR_INTERVAL QT_TRANSLATE_NOOP("QRegExp", "invalid interval") +#define RXERR_CATEGORY QT_TRANSLATE_NOOP("QRegExp", "invalid category") /* WARNING! Be sure to read qregexp.tex before modifying this file. @@ -1116,6 +1118,7 @@ private: bool valid; // is the regular expression valid? Qt::CaseSensitivity cs; // case sensitive? bool greedyQuantifiers; // RegExp2? + bool xmlSchemaExtensions; #ifndef QT_NO_REGEXP_BACKREF int nbrefs; // number of back-references #endif @@ -1193,6 +1196,8 @@ private: friend class Box; + void setupCategoriesRangeMap(); + /* This is the lexical analyzer for regular expressions. */ @@ -1232,6 +1237,7 @@ private: int yyTok; // the last token read bool yyMayCapture; // set this to false to disable capturing + QHash > categoriesRangeMap; // fast lookup hash for xml schema extensions friend struct QRegExpMatchState; }; @@ -1253,7 +1259,8 @@ struct QRegExpLookahead #endif QRegExpEngine::QRegExpEngine(const QRegExpEngineKey &key) - : cs(key.cs), greedyQuantifiers(key.patternSyntax == QRegExp::RegExp2) + : cs(key.cs), greedyQuantifiers(key.patternSyntax == QRegExp::RegExp2), + xmlSchemaExtensions(false) { setup(); @@ -1268,6 +1275,8 @@ QRegExpEngine::QRegExpEngine(const QRegExpEngineKey &key) case QRegExp::FixedString: rx = QRegExp::escape(key.pattern); break; + case QRegExp::W3CXmlSchema11: + xmlSchemaExtensions = true; default: rx = key.pattern; } @@ -2621,6 +2630,152 @@ void QRegExpEngine::Box::addAnchorsToEngine(const Box &to) const } } +void QRegExpEngine::setupCategoriesRangeMap() +{ + categoriesRangeMap.insert("IsBasicLatin", qMakePair(0x0000, 0x007F)); + categoriesRangeMap.insert("IsLatin-1Supplement", qMakePair(0x0080, 0x00FF)); + categoriesRangeMap.insert("IsLatinExtended-A", qMakePair(0x0100, 0x017F)); + categoriesRangeMap.insert("IsLatinExtended-B", qMakePair(0x0180, 0x024F)); + categoriesRangeMap.insert("IsIPAExtensions", qMakePair(0x0250, 0x02AF)); + categoriesRangeMap.insert("IsSpacingModifierLetters", qMakePair(0x02B0, 0x02FF)); + categoriesRangeMap.insert("IsCombiningDiacriticalMarks", qMakePair(0x0300, 0x036F)); + categoriesRangeMap.insert("IsGreek", qMakePair(0x0370, 0x03FF)); + categoriesRangeMap.insert("IsCyrillic", qMakePair(0x0400, 0x04FF)); + categoriesRangeMap.insert("IsCyrillicSupplement", qMakePair(0x0500, 0x052F)); + categoriesRangeMap.insert("IsArmenian", qMakePair(0x0530, 0x058F)); + categoriesRangeMap.insert("IsHebrew", qMakePair(0x0590, 0x05FF)); + categoriesRangeMap.insert("IsArabic", qMakePair(0x0600, 0x06FF)); + categoriesRangeMap.insert("IsSyriac", qMakePair(0x0700, 0x074F)); + categoriesRangeMap.insert("IsArabicSupplement", qMakePair(0x0750, 0x077F)); + categoriesRangeMap.insert("IsThaana", qMakePair(0x0780, 0x07BF)); + categoriesRangeMap.insert("IsDevanagari", qMakePair(0x0900, 0x097F)); + categoriesRangeMap.insert("IsBengali", qMakePair(0x0980, 0x09FF)); + categoriesRangeMap.insert("IsGurmukhi", qMakePair(0x0A00, 0x0A7F)); + categoriesRangeMap.insert("IsGujarati", qMakePair(0x0A80, 0x0AFF)); + categoriesRangeMap.insert("IsOriya", qMakePair(0x0B00, 0x0B7F)); + categoriesRangeMap.insert("IsTamil", qMakePair(0x0B80, 0x0BFF)); + categoriesRangeMap.insert("IsTelugu", qMakePair(0x0C00, 0x0C7F)); + categoriesRangeMap.insert("IsKannada", qMakePair(0x0C80, 0x0CFF)); + categoriesRangeMap.insert("IsMalayalam", qMakePair(0x0D00, 0x0D7F)); + categoriesRangeMap.insert("IsSinhala", qMakePair(0x0D80, 0x0DFF)); + categoriesRangeMap.insert("IsThai", qMakePair(0x0E00, 0x0E7F)); + categoriesRangeMap.insert("IsLao", qMakePair(0x0E80, 0x0EFF)); + categoriesRangeMap.insert("IsTibetan", qMakePair(0x0F00, 0x0FFF)); + categoriesRangeMap.insert("IsMyanmar", qMakePair(0x1000, 0x109F)); + categoriesRangeMap.insert("IsGeorgian", qMakePair(0x10A0, 0x10FF)); + categoriesRangeMap.insert("IsHangulJamo", qMakePair(0x1100, 0x11FF)); + categoriesRangeMap.insert("IsEthiopic", qMakePair(0x1200, 0x137F)); + categoriesRangeMap.insert("IsEthiopicSupplement", qMakePair(0x1380, 0x139F)); + categoriesRangeMap.insert("IsCherokee", qMakePair(0x13A0, 0x13FF)); + categoriesRangeMap.insert("IsUnifiedCanadianAboriginalSyllabics", qMakePair(0x1400, 0x167F)); + categoriesRangeMap.insert("IsOgham", qMakePair(0x1680, 0x169F)); + categoriesRangeMap.insert("IsRunic", qMakePair(0x16A0, 0x16FF)); + categoriesRangeMap.insert("IsTagalog", qMakePair(0x1700, 0x171F)); + categoriesRangeMap.insert("IsHanunoo", qMakePair(0x1720, 0x173F)); + categoriesRangeMap.insert("IsBuhid", qMakePair(0x1740, 0x175F)); + categoriesRangeMap.insert("IsTagbanwa", qMakePair(0x1760, 0x177F)); + categoriesRangeMap.insert("IsKhmer", qMakePair(0x1780, 0x17FF)); + categoriesRangeMap.insert("IsMongolian", qMakePair(0x1800, 0x18AF)); + categoriesRangeMap.insert("IsLimbu", qMakePair(0x1900, 0x194F)); + categoriesRangeMap.insert("IsTaiLe", qMakePair(0x1950, 0x197F)); + categoriesRangeMap.insert("IsNewTaiLue", qMakePair(0x1980, 0x19DF)); + categoriesRangeMap.insert("IsKhmerSymbols", qMakePair(0x19E0, 0x19FF)); + categoriesRangeMap.insert("IsBuginese", qMakePair(0x1A00, 0x1A1F)); + categoriesRangeMap.insert("IsPhoneticExtensions", qMakePair(0x1D00, 0x1D7F)); + categoriesRangeMap.insert("IsPhoneticExtensionsSupplement", qMakePair(0x1D80, 0x1DBF)); + categoriesRangeMap.insert("IsCombiningDiacriticalMarksSupplement", qMakePair(0x1DC0, 0x1DFF)); + categoriesRangeMap.insert("IsLatinExtendedAdditional", qMakePair(0x1E00, 0x1EFF)); + categoriesRangeMap.insert("IsGreekExtended", qMakePair(0x1F00, 0x1FFF)); + categoriesRangeMap.insert("IsGeneralPunctuation", qMakePair(0x2000, 0x206F)); + categoriesRangeMap.insert("IsSuperscriptsandSubscripts", qMakePair(0x2070, 0x209F)); + categoriesRangeMap.insert("IsCurrencySymbols", qMakePair(0x20A0, 0x20CF)); + categoriesRangeMap.insert("IsCombiningMarksforSymbols", qMakePair(0x20D0, 0x20FF)); + categoriesRangeMap.insert("IsLetterlikeSymbols", qMakePair(0x2100, 0x214F)); + categoriesRangeMap.insert("IsNumberForms", qMakePair(0x2150, 0x218F)); + categoriesRangeMap.insert("IsArrows", qMakePair(0x2190, 0x21FF)); + categoriesRangeMap.insert("IsMathematicalOperators", qMakePair(0x2200, 0x22FF)); + categoriesRangeMap.insert("IsMiscellaneousTechnical", qMakePair(0x2300, 0x23FF)); + categoriesRangeMap.insert("IsControlPictures", qMakePair(0x2400, 0x243F)); + categoriesRangeMap.insert("IsOpticalCharacterRecognition", qMakePair(0x2440, 0x245F)); + categoriesRangeMap.insert("IsEnclosedAlphanumerics", qMakePair(0x2460, 0x24FF)); + categoriesRangeMap.insert("IsBoxDrawing", qMakePair(0x2500, 0x257F)); + categoriesRangeMap.insert("IsBlockElements", qMakePair(0x2580, 0x259F)); + categoriesRangeMap.insert("IsGeometricShapes", qMakePair(0x25A0, 0x25FF)); + categoriesRangeMap.insert("IsMiscellaneousSymbols", qMakePair(0x2600, 0x26FF)); + categoriesRangeMap.insert("IsDingbats", qMakePair(0x2700, 0x27BF)); + categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-A", qMakePair(0x27C0, 0x27EF)); + categoriesRangeMap.insert("IsSupplementalArrows-A", qMakePair(0x27F0, 0x27FF)); + categoriesRangeMap.insert("IsBraillePatterns", qMakePair(0x2800, 0x28FF)); + categoriesRangeMap.insert("IsSupplementalArrows-B", qMakePair(0x2900, 0x297F)); + categoriesRangeMap.insert("IsMiscellaneousMathematicalSymbols-B", qMakePair(0x2980, 0x29FF)); + categoriesRangeMap.insert("IsSupplementalMathematicalOperators", qMakePair(0x2A00, 0x2AFF)); + categoriesRangeMap.insert("IsMiscellaneousSymbolsandArrows", qMakePair(0x2B00, 0x2BFF)); + categoriesRangeMap.insert("IsGlagolitic", qMakePair(0x2C00, 0x2C5F)); + categoriesRangeMap.insert("IsCoptic", qMakePair(0x2C80, 0x2CFF)); + categoriesRangeMap.insert("IsGeorgianSupplement", qMakePair(0x2D00, 0x2D2F)); + categoriesRangeMap.insert("IsTifinagh", qMakePair(0x2D30, 0x2D7F)); + categoriesRangeMap.insert("IsEthiopicExtended", qMakePair(0x2D80, 0x2DDF)); + categoriesRangeMap.insert("IsSupplementalPunctuation", qMakePair(0x2E00, 0x2E7F)); + categoriesRangeMap.insert("IsCJKRadicalsSupplement", qMakePair(0x2E80, 0x2EFF)); + categoriesRangeMap.insert("IsKangxiRadicals", qMakePair(0x2F00, 0x2FDF)); + categoriesRangeMap.insert("IsIdeographicDescriptionCharacters", qMakePair(0x2FF0, 0x2FFF)); + categoriesRangeMap.insert("IsCJKSymbolsandPunctuation", qMakePair(0x3000, 0x303F)); + categoriesRangeMap.insert("IsHiragana", qMakePair(0x3040, 0x309F)); + categoriesRangeMap.insert("IsKatakana", qMakePair(0x30A0, 0x30FF)); + categoriesRangeMap.insert("IsBopomofo", qMakePair(0x3100, 0x312F)); + categoriesRangeMap.insert("IsHangulCompatibilityJamo", qMakePair(0x3130, 0x318F)); + categoriesRangeMap.insert("IsKanbun", qMakePair(0x3190, 0x319F)); + categoriesRangeMap.insert("IsBopomofoExtended", qMakePair(0x31A0, 0x31BF)); + categoriesRangeMap.insert("IsCJKStrokes", qMakePair(0x31C0, 0x31EF)); + categoriesRangeMap.insert("IsKatakanaPhoneticExtensions", qMakePair(0x31F0, 0x31FF)); + categoriesRangeMap.insert("IsEnclosedCJKLettersandMonths", qMakePair(0x3200, 0x32FF)); + categoriesRangeMap.insert("IsCJKCompatibility", qMakePair(0x3300, 0x33FF)); + categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionA", qMakePair(0x3400, 0x4DB5)); + categoriesRangeMap.insert("IsYijingHexagramSymbols", qMakePair(0x4DC0, 0x4DFF)); + categoriesRangeMap.insert("IsCJKUnifiedIdeographs", qMakePair(0x4E00, 0x9FFF)); + categoriesRangeMap.insert("IsYiSyllables", qMakePair(0xA000, 0xA48F)); + categoriesRangeMap.insert("IsYiRadicals", qMakePair(0xA490, 0xA4CF)); + categoriesRangeMap.insert("IsModifierToneLetters", qMakePair(0xA700, 0xA71F)); + categoriesRangeMap.insert("IsSylotiNagri", qMakePair(0xA800, 0xA82F)); + categoriesRangeMap.insert("IsHangulSyllables", qMakePair(0xAC00, 0xD7A3)); + categoriesRangeMap.insert("IsPrivateUse", qMakePair(0xE000, 0xF8FF)); + categoriesRangeMap.insert("IsCJKCompatibilityIdeographs", qMakePair(0xF900, 0xFAFF)); + categoriesRangeMap.insert("IsAlphabeticPresentationForms", qMakePair(0xFB00, 0xFB4F)); + categoriesRangeMap.insert("IsArabicPresentationForms-A", qMakePair(0xFB50, 0xFDFF)); + categoriesRangeMap.insert("IsVariationSelectors", qMakePair(0xFE00, 0xFE0F)); + categoriesRangeMap.insert("IsVerticalForms", qMakePair(0xFE10, 0xFE1F)); + categoriesRangeMap.insert("IsCombiningHalfMarks", qMakePair(0xFE20, 0xFE2F)); + categoriesRangeMap.insert("IsCJKCompatibilityForms", qMakePair(0xFE30, 0xFE4F)); + categoriesRangeMap.insert("IsSmallFormVariants", qMakePair(0xFE50, 0xFE6F)); + categoriesRangeMap.insert("IsArabicPresentationForms-B", qMakePair(0xFE70, 0xFEFF)); + categoriesRangeMap.insert("IsHalfwidthandFullwidthForms", qMakePair(0xFF00, 0xFFEF)); + categoriesRangeMap.insert("IsSpecials", qMakePair(0xFFF0, 0xFFFF)); + categoriesRangeMap.insert("IsLinearBSyllabary", qMakePair(0x10000, 0x1007F)); + categoriesRangeMap.insert("IsLinearBIdeograms", qMakePair(0x10080, 0x100FF)); + categoriesRangeMap.insert("IsAegeanNumbers", qMakePair(0x10100, 0x1013F)); + categoriesRangeMap.insert("IsAncientGreekNumbers", qMakePair(0x10140, 0x1018F)); + categoriesRangeMap.insert("IsOldItalic", qMakePair(0x10300, 0x1032F)); + categoriesRangeMap.insert("IsGothic", qMakePair(0x10330, 0x1034F)); + categoriesRangeMap.insert("IsUgaritic", qMakePair(0x10380, 0x1039F)); + categoriesRangeMap.insert("IsOldPersian", qMakePair(0x103A0, 0x103DF)); + categoriesRangeMap.insert("IsDeseret", qMakePair(0x10400, 0x1044F)); + categoriesRangeMap.insert("IsShavian", qMakePair(0x10450, 0x1047F)); + categoriesRangeMap.insert("IsOsmanya", qMakePair(0x10480, 0x104AF)); + categoriesRangeMap.insert("IsCypriotSyllabary", qMakePair(0x10800, 0x1083F)); + categoriesRangeMap.insert("IsKharoshthi", qMakePair(0x10A00, 0x10A5F)); + categoriesRangeMap.insert("IsByzantineMusicalSymbols", qMakePair(0x1D000, 0x1D0FF)); + categoriesRangeMap.insert("IsMusicalSymbols", qMakePair(0x1D100, 0x1D1FF)); + categoriesRangeMap.insert("IsAncientGreekMusicalNotation", qMakePair(0x1D200, 0x1D24F)); + categoriesRangeMap.insert("IsTaiXuanJingSymbols", qMakePair(0x1D300, 0x1D35F)); + categoriesRangeMap.insert("IsMathematicalAlphanumericSymbols", qMakePair(0x1D400, 0x1D7FF)); + categoriesRangeMap.insert("IsCJKUnifiedIdeographsExtensionB", qMakePair(0x20000, 0x2A6DF)); + categoriesRangeMap.insert("IsCJKCompatibilityIdeographsSupplement", qMakePair(0x2F800, 0x2FA1F)); + categoriesRangeMap.insert("IsTags", qMakePair(0xE0000, 0xE007F)); + categoriesRangeMap.insert("IsVariationSelectorsSupplement", qMakePair(0xE0100, 0xE01EF)); + categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-A", qMakePair(0xF0000, 0xFFFFF)); + categoriesRangeMap.insert("IsSupplementaryPrivateUseArea-B", qMakePair(0x100000, 0x10FFFF)); +} + int QRegExpEngine::getChar() { return (yyPos == yyLen) ? EOS : yyIn[yyPos++].unicode(); @@ -2713,6 +2868,177 @@ int QRegExpEngine::getEscape() yyCharClass->addCategories(0x000f807e); yyCharClass->addSingleton(0x005f); // '_' return Tok_CharClass; + case 'I': + if (xmlSchemaExtensions) { + yyCharClass->setNegative(!yyCharClass->negative()); + // fall through + } + case 'i': + if (xmlSchemaExtensions) { + yyCharClass->addCategories(0x000f807e); + yyCharClass->addSingleton(0x003a); // ':' + yyCharClass->addSingleton(0x005f); // '_' + yyCharClass->addRange(0x0041, 0x005a); // [A-Z] + yyCharClass->addRange(0x0061, 0x007a); // [a-z] + yyCharClass->addRange(0xc0, 0xd6); + yyCharClass->addRange(0xd8, 0xf6); + yyCharClass->addRange(0xf8, 0x2ff); + yyCharClass->addRange(0x370, 0x37d); + yyCharClass->addRange(0x37f, 0x1fff); + yyCharClass->addRange(0x200c, 0x200d); + yyCharClass->addRange(0x2070, 0x218f); + yyCharClass->addRange(0x2c00, 0x2fef); + yyCharClass->addRange(0x3001, 0xd7ff); + yyCharClass->addRange(0xf900, 0xfdcf); + yyCharClass->addRange(0xfdf0, 0xfffd); + yyCharClass->addRange((ushort)0x10000, (ushort)0xeffff); + } + return Tok_CharClass; + case 'C': + if (xmlSchemaExtensions) { + yyCharClass->setNegative(!yyCharClass->negative()); + // fall through + } + case 'c': + if (xmlSchemaExtensions) { + yyCharClass->addCategories(0x000f807e); + yyCharClass->addSingleton(0x002d); // '-' + yyCharClass->addSingleton(0x002e); // '.' + yyCharClass->addSingleton(0x003a); // ':' + yyCharClass->addSingleton(0x005f); // '_' + yyCharClass->addSingleton(0xb7); + yyCharClass->addRange(0x0030, 0x0039); // [0-9] + yyCharClass->addRange(0x0041, 0x005a); // [A-Z] + yyCharClass->addRange(0x0061, 0x007a); // [a-z] + yyCharClass->addRange(0xc0, 0xd6); + yyCharClass->addRange(0xd8, 0xf6); + yyCharClass->addRange(0xf8, 0x2ff); + yyCharClass->addRange(0x370, 0x37d); + yyCharClass->addRange(0x37f, 0x1fff); + yyCharClass->addRange(0x200c, 0x200d); + yyCharClass->addRange(0x2070, 0x218f); + yyCharClass->addRange(0x2c00, 0x2fef); + yyCharClass->addRange(0x3001, 0xd7ff); + yyCharClass->addRange(0xf900, 0xfdcf); + yyCharClass->addRange(0xfdf0, 0xfffd); + yyCharClass->addRange((ushort)0x10000, (ushort)0xeffff); + yyCharClass->addRange(0x0300, 0x036f); + yyCharClass->addRange(0x203f, 0x2040); + } + return Tok_CharClass; + case 'P': + if (xmlSchemaExtensions) { + yyCharClass->setNegative(!yyCharClass->negative()); + // fall through + } + case 'p': + if (xmlSchemaExtensions) { + if (yyCh != '{') { + error(RXERR_CHARCLASS); + return Tok_CharClass; + } + + QByteArray category; + yyCh = getChar(); + while (yyCh != '}') { + if (yyCh == EOS) { + error(RXERR_END); + return Tok_CharClass; + } + category.append(yyCh); + yyCh = getChar(); + } + yyCh = getChar(); // skip closing '}' + + if (category == "M") { + yyCharClass->addCategories(0x0000000e); + } else if (category == "Mn") { + yyCharClass->addCategories(0x00000002); + } else if (category == "Mc") { + yyCharClass->addCategories(0x00000004); + } else if (category == "Me") { + yyCharClass->addCategories(0x00000008); + } else if (category == "N") { + yyCharClass->addCategories(0x00000070); + } else if (category == "Nd") { + yyCharClass->addCategories(0x00000010); + } else if (category == "Nl") { + yyCharClass->addCategories(0x00000020); + } else if (category == "No") { + yyCharClass->addCategories(0x00000040); + } else if (category == "Z") { + yyCharClass->addCategories(0x00000380); + } else if (category == "Zs") { + yyCharClass->addCategories(0x00000080); + } else if (category == "Zl") { + yyCharClass->addCategories(0x00000100); + } else if (category == "Zp") { + yyCharClass->addCategories(0x00000200); + } else if (category == "C") { + yyCharClass->addCategories(0x00006c00); + } else if (category == "Cc") { + yyCharClass->addCategories(0x00000400); + } else if (category == "Cf") { + yyCharClass->addCategories(0x00000800); + } else if (category == "Cs") { + yyCharClass->addCategories(0x00001000); + } else if (category == "Co") { + yyCharClass->addCategories(0x00002000); + } else if (category == "Cn") { + yyCharClass->addCategories(0x00004000); + } else if (category == "L") { + yyCharClass->addCategories(0x000f8000); + } else if (category == "Lu") { + yyCharClass->addCategories(0x00008000); + } else if (category == "Ll") { + yyCharClass->addCategories(0x00010000); + } else if (category == "Lt") { + yyCharClass->addCategories(0x00020000); + } else if (category == "Lm") { + yyCharClass->addCategories(0x00040000); + } else if (category == "Lo") { + yyCharClass->addCategories(0x00080000); + } else if (category == "P") { + yyCharClass->addCategories(0x4f580780); + } else if (category == "Pc") { + yyCharClass->addCategories(0x00100000); + } else if (category == "Pd") { + yyCharClass->addCategories(0x00200000); + } else if (category == "Ps") { + yyCharClass->addCategories(0x00400000); + } else if (category == "Pe") { + yyCharClass->addCategories(0x00800000); + } else if (category == "Pi") { + yyCharClass->addCategories(0x01000000); + } else if (category == "Pf") { + yyCharClass->addCategories(0x02000000); + } else if (category == "Po") { + yyCharClass->addCategories(0x04000000); + } else if (category == "S") { + yyCharClass->addCategories(0x78000000); + } else if (category == "Sm") { + yyCharClass->addCategories(0x08000000); + } else if (category == "Sc") { + yyCharClass->addCategories(0x10000000); + } else if (category == "Sk") { + yyCharClass->addCategories(0x20000000); + } else if (category == "So") { + yyCharClass->addCategories(0x40000000); + } else if (category.startsWith("Is")) { + if (categoriesRangeMap.isEmpty()) + setupCategoriesRangeMap(); + + if (categoriesRangeMap.contains(category)) { + const QPair range = categoriesRangeMap.value(category); + yyCharClass->addRange(range.first, range.second); + } else { + error(RXERR_CATEGORY); + } + } else { + error(RXERR_CATEGORY); + } + } + return Tok_CharClass; #endif #ifndef QT_NO_REGEXP_ESCAPE case 'x': @@ -2934,7 +3260,7 @@ int QRegExpEngine::getToken() yyMaxRep = getRep(InftyRep); } if (yyMaxRep < yyMinRep) - qSwap(yyMinRep, yyMaxRep); + error(RXERR_INTERVAL); if (yyCh != '}') error(RXERR_REPETITION); yyCh = getChar(); diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h index b387e23..f2e3d3b 100644 --- a/src/corelib/tools/qregexp.h +++ b/src/corelib/tools/qregexp.h @@ -61,7 +61,7 @@ class QStringList; class Q_CORE_EXPORT QRegExp { public: - enum PatternSyntax { RegExp, Wildcard, FixedString, RegExp2 }; + enum PatternSyntax { RegExp, Wildcard, FixedString, RegExp2, W3CXmlSchema11 }; enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch }; QRegExp(); -- cgit v0.12 From 135a028d9dc9a28a0a072665a7dc43b7e9e187be Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sat, 16 May 2009 12:19:10 +0200 Subject: Add W3C XML Schema validation support This was done by Tobias Koenig, as part of an internship at Trolltech/Qt Software, started at Wed Oct 1 18:32:43 2008 +0200, and the last commit being part of this commit dating Tue Feb 24 11:03:36 2009 +0100. This is work consisting of about 650 commits squashed into one, where the first commit was 61b280386c1905a15690fdd917dcbc8eb09b6283, in the repository before Qt's history cut. --- examples/tools/regexp/regexpdialog.cpp | 1 + examples/xmlpatterns/schema/main.cpp | 24 + examples/xmlpatterns/schema/mainwindow.cpp | 175 + examples/xmlpatterns/schema/mainwindow.h | 38 + examples/xmlpatterns/schema/schema.pro | 11 + examples/xmlpatterns/schema/schema.qrc | 13 + examples/xmlpatterns/schema/schema.ui | 71 + examples/xmlpatterns/xmlpatterns.pro | 3 +- src/xmlpatterns/Doxyfile | 2 +- src/xmlpatterns/acceltree/qacceltree.cpp | 43 + src/xmlpatterns/acceltree/qacceltree_p.h | 17 +- src/xmlpatterns/acceltree/qacceltreebuilder.cpp | 31 +- src/xmlpatterns/acceltree/qacceltreebuilder_p.h | 19 +- .../acceltree/qacceltreeresourceloader.cpp | 60 +- .../acceltree/qacceltreeresourceloader_p.h | 27 +- src/xmlpatterns/api/api.pri | 11 + src/xmlpatterns/api/qabstractxmlnodemodel.cpp | 16 + src/xmlpatterns/api/qabstractxmlnodemodel.h | 5 + src/xmlpatterns/api/qabstractxmlnodemodel_p.h | 10 + src/xmlpatterns/api/qabstractxmlpullprovider.cpp | 147 + src/xmlpatterns/api/qabstractxmlpullprovider_p.h | 83 + src/xmlpatterns/api/qpullbridge.cpp | 202 + src/xmlpatterns/api/qpullbridge_p.h | 73 + src/xmlpatterns/api/qresourcedelegator.cpp | 8 - src/xmlpatterns/api/qxmlnamepool.cpp | 4 + src/xmlpatterns/api/qxmlnamepool.h | 7 + src/xmlpatterns/api/qxmlquery.cpp | 12 + src/xmlpatterns/api/qxmlquery.h | 11 +- src/xmlpatterns/api/qxmlquery_p.h | 24 +- src/xmlpatterns/api/qxmlschema.cpp | 229 + src/xmlpatterns/api/qxmlschema.h | 66 + src/xmlpatterns/api/qxmlschema_p.cpp | 169 + src/xmlpatterns/api/qxmlschema_p.h | 79 + src/xmlpatterns/api/qxmlschemavalidator.cpp | 264 + src/xmlpatterns/api/qxmlschemavalidator.h | 64 + src/xmlpatterns/api/qxmlschemavalidator_p.h | 98 + src/xmlpatterns/common.pri | 1 + src/xmlpatterns/data/data.pri | 20 +- src/xmlpatterns/data/qcomparisonfactory.cpp | 124 + src/xmlpatterns/data/qcomparisonfactory_p.h | 91 + src/xmlpatterns/data/qitem_p.h | 5 + src/xmlpatterns/data/qvaluefactory.cpp | 76 + src/xmlpatterns/data/qvaluefactory_p.h | 68 + .../environment/createReportContext.xsl | 5 + src/xmlpatterns/environment/qreportcontext.cpp | 1 + src/xmlpatterns/environment/qreportcontext_p.h | 4 + src/xmlpatterns/expr/qcastingplatform.cpp | 22 +- src/xmlpatterns/expr/qcastingplatform_p.h | 23 +- src/xmlpatterns/expr/qexpressionfactory.cpp | 27 +- src/xmlpatterns/functions/qpatternplatform.cpp | 21 +- src/xmlpatterns/functions/qpatternplatform_p.h | 18 +- src/xmlpatterns/parser/qquerytransformparser.cpp | 944 +-- src/xmlpatterns/parser/qquerytransformparser_p.h | 40 + src/xmlpatterns/parser/querytransformparser.ypp | 174 +- src/xmlpatterns/schema/.gitignore | 1 + src/xmlpatterns/schema/builtinschemas.qrc | 5 + src/xmlpatterns/schema/doc/All_diagram.dot | 13 + src/xmlpatterns/schema/doc/Alternative_diagram.dot | 11 + src/xmlpatterns/schema/doc/Annotation_diagram.dot | 9 + .../schema/doc/AnyAttribute_diagram.dot | 6 + src/xmlpatterns/schema/doc/Any_diagram.dot | 6 + src/xmlpatterns/schema/doc/Assert_diagram.dot | 6 + src/xmlpatterns/schema/doc/Choice_diagram.dot | 22 + .../schema/doc/ComplexContentExtension_diagram.dot | 47 + .../doc/ComplexContentRestriction_diagram.dot | 47 + .../schema/doc/ComplexContent_diagram.dot | 11 + .../schema/doc/DefaultOpenContent_diagram.dot | 9 + .../schema/doc/EnumerationFacet_diagram.dot | 6 + src/xmlpatterns/schema/doc/Field_diagram.dot | 6 + .../schema/doc/FractionDigitsFacet_diagram.dot | 6 + .../schema/doc/GlobalAttribute_diagram.dot | 9 + .../schema/doc/GlobalComplexType_diagram.dot | 52 + .../schema/doc/GlobalElement_diagram.dot | 32 + .../schema/doc/GlobalSimpleType_diagram.dot | 13 + src/xmlpatterns/schema/doc/Import_diagram.dot | 6 + src/xmlpatterns/schema/doc/Include_diagram.dot | 6 + src/xmlpatterns/schema/doc/KeyRef_diagram.dot | 12 + src/xmlpatterns/schema/doc/Key_diagram.dot | 12 + src/xmlpatterns/schema/doc/LengthFacet_diagram.dot | 6 + src/xmlpatterns/schema/doc/List_diagram.dot | 9 + src/xmlpatterns/schema/doc/LocalAll_diagram.dot | 13 + .../schema/doc/LocalAttribute_diagram.dot | 9 + src/xmlpatterns/schema/doc/LocalChoice_diagram.dot | 22 + .../schema/doc/LocalComplexType_diagram.dot | 52 + .../schema/doc/LocalElement_diagram.dot | 32 + .../schema/doc/LocalSequence_diagram.dot | 22 + .../schema/doc/LocalSimpleType_diagram.dot | 13 + .../schema/doc/MaxExclusiveFacet_diagram.dot | 6 + .../schema/doc/MaxInclusiveFacet_diagram.dot | 6 + .../schema/doc/MaxLengthFacet_diagram.dot | 6 + .../schema/doc/MinExclusiveFacet_diagram.dot | 6 + .../schema/doc/MinInclusiveFacet_diagram.dot | 6 + .../schema/doc/MinLengthFacet_diagram.dot | 6 + .../schema/doc/NamedAttributeGroup_diagram.dot | 17 + src/xmlpatterns/schema/doc/NamedGroup_diagram.dot | 13 + src/xmlpatterns/schema/doc/Notation_diagram.dot | 6 + src/xmlpatterns/schema/doc/Override_diagram.dot | 21 + .../schema/doc/PatternFacet_diagram.dot | 6 + src/xmlpatterns/schema/doc/Redefine_diagram.dot | 15 + .../schema/doc/ReferredAttributeGroup_diagram.dot | 6 + .../schema/doc/ReferredGroup_diagram.dot | 13 + src/xmlpatterns/schema/doc/Schema_diagram.dot | 66 + src/xmlpatterns/schema/doc/Selector_diagram.dot | 6 + src/xmlpatterns/schema/doc/Sequence_diagram.dot | 22 + .../schema/doc/SimpleContentExtension_diagram.dot | 23 + .../doc/SimpleContentRestriction_diagram.dot | 87 + .../schema/doc/SimpleContent_diagram.dot | 11 + .../schema/doc/SimpleRestriction_diagram.dot | 62 + .../schema/doc/TotalDigitsFacet_diagram.dot | 6 + src/xmlpatterns/schema/doc/Union_diagram.dot | 10 + src/xmlpatterns/schema/doc/Unique_diagram.dot | 12 + .../schema/doc/WhiteSpaceFacet_diagram.dot | 6 + src/xmlpatterns/schema/doc/legend.dot | 7 + src/xmlpatterns/schema/qnamespacesupport.cpp | 132 + src/xmlpatterns/schema/qnamespacesupport_p.h | 143 + src/xmlpatterns/schema/qxsdalternative.cpp | 38 + src/xmlpatterns/schema/qxsdalternative_p.h | 84 + src/xmlpatterns/schema/qxsdannotated.cpp | 33 + src/xmlpatterns/schema/qxsdannotated_p.h | 66 + src/xmlpatterns/schema/qxsdannotation.cpp | 48 + src/xmlpatterns/schema/qxsdannotation_p.h | 97 + .../schema/qxsdapplicationinformation.cpp | 38 + .../schema/qxsdapplicationinformation_p.h | 85 + src/xmlpatterns/schema/qxsdassertion.cpp | 28 + src/xmlpatterns/schema/qxsdassertion_p.h | 71 + src/xmlpatterns/schema/qxsdattribute.cpp | 100 + src/xmlpatterns/schema/qxsdattribute_p.h | 216 + src/xmlpatterns/schema/qxsdattributegroup.cpp | 43 + src/xmlpatterns/schema/qxsdattributegroup_p.h | 92 + src/xmlpatterns/schema/qxsdattributereference.cpp | 58 + src/xmlpatterns/schema/qxsdattributereference_p.h | 117 + src/xmlpatterns/schema/qxsdattributeterm.cpp | 28 + src/xmlpatterns/schema/qxsdattributeterm_p.h | 66 + src/xmlpatterns/schema/qxsdattributeuse.cpp | 106 + src/xmlpatterns/schema/qxsdattributeuse_p.h | 194 + src/xmlpatterns/schema/qxsdcomplextype.cpp | 201 + src/xmlpatterns/schema/qxsdcomplextype_p.h | 374 ++ src/xmlpatterns/schema/qxsddocumentation.cpp | 56 + src/xmlpatterns/schema/qxsddocumentation_p.h | 107 + src/xmlpatterns/schema/qxsdelement.cpp | 214 + src/xmlpatterns/schema/qxsdelement_p.h | 373 ++ src/xmlpatterns/schema/qxsdfacet.cpp | 94 + src/xmlpatterns/schema/qxsdfacet_p.h | 183 + src/xmlpatterns/schema/qxsdidcache.cpp | 36 + src/xmlpatterns/schema/qxsdidcache_p.h | 69 + src/xmlpatterns/schema/qxsdidchelper.cpp | 107 + src/xmlpatterns/schema/qxsdidchelper_p.h | 156 + src/xmlpatterns/schema/qxsdidentityconstraint.cpp | 63 + src/xmlpatterns/schema/qxsdidentityconstraint_p.h | 143 + src/xmlpatterns/schema/qxsdinstancereader.cpp | 166 + src/xmlpatterns/schema/qxsdinstancereader_p.h | 159 + src/xmlpatterns/schema/qxsdmodelgroup.cpp | 48 + src/xmlpatterns/schema/qxsdmodelgroup_p.h | 109 + src/xmlpatterns/schema/qxsdnotation.cpp | 38 + src/xmlpatterns/schema/qxsdnotation_p.h | 89 + src/xmlpatterns/schema/qxsdparticle.cpp | 65 + src/xmlpatterns/schema/qxsdparticle_p.h | 124 + src/xmlpatterns/schema/qxsdparticlechecker.cpp | 510 ++ src/xmlpatterns/schema/qxsdparticlechecker_p.h | 69 + src/xmlpatterns/schema/qxsdreference.cpp | 53 + src/xmlpatterns/schema/qxsdreference_p.h | 115 + src/xmlpatterns/schema/qxsdschema.cpp | 242 + src/xmlpatterns/schema/qxsdschema_p.h | 271 + src/xmlpatterns/schema/qxsdschemachecker.cpp | 2031 +++++++ .../schema/qxsdschemachecker_helper.cpp | 276 + src/xmlpatterns/schema/qxsdschemachecker_p.h | 254 + src/xmlpatterns/schema/qxsdschemachecker_setup.cpp | 287 + src/xmlpatterns/schema/qxsdschemacontext.cpp | 498 ++ src/xmlpatterns/schema/qxsdschemacontext_p.h | 157 + src/xmlpatterns/schema/qxsdschemadebugger.cpp | 196 + src/xmlpatterns/schema/qxsdschemadebugger_p.h | 97 + src/xmlpatterns/schema/qxsdschemahelper.cpp | 791 +++ src/xmlpatterns/schema/qxsdschemahelper_p.h | 156 + src/xmlpatterns/schema/qxsdschemamerger.cpp | 127 + src/xmlpatterns/schema/qxsdschemamerger_p.h | 69 + src/xmlpatterns/schema/qxsdschemaparser.cpp | 6012 ++++++++++++++++++++ src/xmlpatterns/schema/qxsdschemaparser_p.h | 691 +++ src/xmlpatterns/schema/qxsdschemaparser_setup.cpp | 1070 ++++ src/xmlpatterns/schema/qxsdschemaparsercontext.cpp | 573 ++ src/xmlpatterns/schema/qxsdschemaparsercontext_p.h | 201 + src/xmlpatterns/schema/qxsdschemaresolver.cpp | 1706 ++++++ src/xmlpatterns/schema/qxsdschemaresolver_p.h | 548 ++ src/xmlpatterns/schema/qxsdschematoken.cpp | 2951 ++++++++++ src/xmlpatterns/schema/qxsdschematoken_p.h | 168 + src/xmlpatterns/schema/qxsdschematypesfactory.cpp | 96 + src/xmlpatterns/schema/qxsdschematypesfactory_p.h | 79 + src/xmlpatterns/schema/qxsdsimpletype.cpp | 118 + src/xmlpatterns/schema/qxsdsimpletype_p.h | 189 + src/xmlpatterns/schema/qxsdstatemachine.cpp | 433 ++ src/xmlpatterns/schema/qxsdstatemachine_p.h | 209 + src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp | 230 + src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h | 111 + src/xmlpatterns/schema/qxsdterm.cpp | 38 + src/xmlpatterns/schema/qxsdterm_p.h | 84 + src/xmlpatterns/schema/qxsdtypechecker.cpp | 1308 +++++ src/xmlpatterns/schema/qxsdtypechecker_p.h | 159 + src/xmlpatterns/schema/qxsduserschematype.cpp | 45 + src/xmlpatterns/schema/qxsduserschematype_p.h | 94 + .../schema/qxsdvalidatedxmlnodemodel.cpp | 185 + .../schema/qxsdvalidatedxmlnodemodel_p.h | 149 + .../schema/qxsdvalidatinginstancereader.cpp | 1245 ++++ .../schema/qxsdvalidatinginstancereader_p.h | 266 + src/xmlpatterns/schema/qxsdwildcard.cpp | 85 + src/xmlpatterns/schema/qxsdwildcard_p.h | 169 + src/xmlpatterns/schema/qxsdxpathexpression.cpp | 58 + src/xmlpatterns/schema/qxsdxpathexpression_p.h | 113 + src/xmlpatterns/schema/schema.pri | 93 + src/xmlpatterns/schema/schemas/xml.xsd | 145 + src/xmlpatterns/schema/tokens.xml | 125 + src/xmlpatterns/type/qanysimpletype.cpp | 10 + src/xmlpatterns/type/qanysimpletype_p.h | 12 + src/xmlpatterns/type/qanytype.cpp | 12 +- src/xmlpatterns/type/qanytype_p.h | 10 + src/xmlpatterns/type/qnamedschemacomponent.cpp | 41 + src/xmlpatterns/type/qnamedschemacomponent_p.h | 97 + src/xmlpatterns/type/qprimitives_p.h | 13 + src/xmlpatterns/type/qschematype.cpp | 5 + src/xmlpatterns/type/qschematype_p.h | 30 +- src/xmlpatterns/type/type.pri | 2 + src/xmlpatterns/utils/qpatternistlocale_p.h | 10 + src/xmlpatterns/xmlpatterns.pro | 2 + tests/auto/auto.pro | 5 + .../tst_qabstractxmlnodemodel.cpp | 8 + tests/auto/qxmlquery/tst_qxmlquery.cpp | 158 + tests/auto/qxmlschema/.gitignore | 1 + tests/auto/qxmlschema/qxmlschema.pro | 4 + tests/auto/qxmlschema/tst_qxmlschema.cpp | 231 + tests/auto/qxmlschemavalidator/.gitignore | 1 + .../qxmlschemavalidator/qxmlschemavalidator.pro | 4 + .../tst_qxmlschemavalidator.cpp | 308 + tests/auto/runQtXmlPatternsTests.sh | 2 + tests/auto/xmlpatterns.pri | 14 + .../test/tst_xmlpatternsdiagnosticsts.cpp | 2 +- tests/auto/xmlpatternsschema/.gitignore | 1 + .../xmlpatternsschema/tst_xmlpatternsschema.cpp | 988 ++++ tests/auto/xmlpatternsschema/xmlpatternsschema.pro | 6 + tests/auto/xmlpatternsschemats/.gitignore | 4 + tests/auto/xmlpatternsschemats/Baseline.xml | 2 + .../auto/xmlpatternsschemats/TESTSUITE/.gitignore | 3 + .../xmlpatternsschemats/TESTSUITE/unifyCatalog.xsl | 21 + .../xmlpatternsschemats/TESTSUITE/updateSuite.sh | 20 + .../tst_xmlpatternsschemats.cpp | 44 + .../xmlpatternsschemats/xmlpatternsschemats.pro | 23 + tests/auto/xmlpatternsvalidator/files/instance.xml | 3 + .../xmlpatternsvalidator/files/invalid_schema.xsd | 12 + .../files/other_valid_schema.xsd | 12 + .../files/sa_invalid_instance.xml | 3 + .../files/sa_valid_instance.xml | 3 + .../xmlpatternsvalidator/files/valid_schema.xsd | 12 + .../tst_xmlpatternsvalidator.cpp | 174 + .../xmlpatternsvalidator/xmlpatternsvalidator.pro | 5 + tests/auto/xmlpatternsview/view/MainWindow.cpp | 32 +- tests/auto/xmlpatternsview/view/MainWindow.h | 6 +- tests/auto/xmlpatternsview/view/ui_MainWindow.ui | 9 + tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp | 7 + tests/auto/xmlpatternsxqts/lib/TestBaseLine.h | 9 +- tests/auto/xmlpatternsxqts/lib/TestGroup.cpp | 6 +- tests/auto/xmlpatternsxqts/lib/TestSuite.cpp | 26 +- tests/auto/xmlpatternsxqts/lib/TestSuite.h | 14 +- tests/auto/xmlpatternsxqts/lib/TreeModel.cpp | 9 +- tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp | 346 ++ tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h | 130 + .../xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp | 881 +++ .../auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h | 90 + tests/auto/xmlpatternsxqts/lib/lib.pro | 4 + tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp | 15 +- tests/auto/xmlpatternsxqts/test/tst_suitetest.h | 14 +- .../xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp | 2 +- .../auto/xmlpatternsxslts/tst_xmlpatternsxslts.cpp | 2 +- tools/tools.pro | 2 +- tools/xmlpatternsvalidator/main.cpp | 96 + tools/xmlpatternsvalidator/main.h | 46 + .../xmlpatternsvalidator/xmlpatternsvalidator.pro | 19 + 273 files changed, 39053 insertions(+), 595 deletions(-) create mode 100644 examples/xmlpatterns/schema/main.cpp create mode 100644 examples/xmlpatterns/schema/mainwindow.cpp create mode 100644 examples/xmlpatterns/schema/mainwindow.h create mode 100644 examples/xmlpatterns/schema/schema.pro create mode 100644 examples/xmlpatterns/schema/schema.qrc create mode 100644 examples/xmlpatterns/schema/schema.ui create mode 100644 src/xmlpatterns/api/qabstractxmlpullprovider.cpp create mode 100644 src/xmlpatterns/api/qabstractxmlpullprovider_p.h create mode 100644 src/xmlpatterns/api/qpullbridge.cpp create mode 100644 src/xmlpatterns/api/qpullbridge_p.h create mode 100644 src/xmlpatterns/api/qxmlschema.cpp create mode 100644 src/xmlpatterns/api/qxmlschema.h create mode 100644 src/xmlpatterns/api/qxmlschema_p.cpp create mode 100644 src/xmlpatterns/api/qxmlschema_p.h create mode 100644 src/xmlpatterns/api/qxmlschemavalidator.cpp create mode 100644 src/xmlpatterns/api/qxmlschemavalidator.h create mode 100644 src/xmlpatterns/api/qxmlschemavalidator_p.h create mode 100644 src/xmlpatterns/data/qcomparisonfactory.cpp create mode 100644 src/xmlpatterns/data/qcomparisonfactory_p.h create mode 100644 src/xmlpatterns/data/qvaluefactory.cpp create mode 100644 src/xmlpatterns/data/qvaluefactory_p.h create mode 100644 src/xmlpatterns/schema/.gitignore create mode 100644 src/xmlpatterns/schema/builtinschemas.qrc create mode 100644 src/xmlpatterns/schema/doc/All_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Alternative_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Annotation_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Any_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Assert_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Choice_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/ComplexContent_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Field_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/GlobalElement_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Import_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Include_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/KeyRef_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Key_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LengthFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/List_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LocalAll_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LocalChoice_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LocalElement_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LocalSequence_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/NamedGroup_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Notation_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Override_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/PatternFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Redefine_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Schema_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Selector_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Sequence_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/SimpleContent_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Union_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/Unique_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot create mode 100644 src/xmlpatterns/schema/doc/legend.dot create mode 100644 src/xmlpatterns/schema/qnamespacesupport.cpp create mode 100644 src/xmlpatterns/schema/qnamespacesupport_p.h create mode 100644 src/xmlpatterns/schema/qxsdalternative.cpp create mode 100644 src/xmlpatterns/schema/qxsdalternative_p.h create mode 100644 src/xmlpatterns/schema/qxsdannotated.cpp create mode 100644 src/xmlpatterns/schema/qxsdannotated_p.h create mode 100644 src/xmlpatterns/schema/qxsdannotation.cpp create mode 100644 src/xmlpatterns/schema/qxsdannotation_p.h create mode 100644 src/xmlpatterns/schema/qxsdapplicationinformation.cpp create mode 100644 src/xmlpatterns/schema/qxsdapplicationinformation_p.h create mode 100644 src/xmlpatterns/schema/qxsdassertion.cpp create mode 100644 src/xmlpatterns/schema/qxsdassertion_p.h create mode 100644 src/xmlpatterns/schema/qxsdattribute.cpp create mode 100644 src/xmlpatterns/schema/qxsdattribute_p.h create mode 100644 src/xmlpatterns/schema/qxsdattributegroup.cpp create mode 100644 src/xmlpatterns/schema/qxsdattributegroup_p.h create mode 100644 src/xmlpatterns/schema/qxsdattributereference.cpp create mode 100644 src/xmlpatterns/schema/qxsdattributereference_p.h create mode 100644 src/xmlpatterns/schema/qxsdattributeterm.cpp create mode 100644 src/xmlpatterns/schema/qxsdattributeterm_p.h create mode 100644 src/xmlpatterns/schema/qxsdattributeuse.cpp create mode 100644 src/xmlpatterns/schema/qxsdattributeuse_p.h create mode 100644 src/xmlpatterns/schema/qxsdcomplextype.cpp create mode 100644 src/xmlpatterns/schema/qxsdcomplextype_p.h create mode 100644 src/xmlpatterns/schema/qxsddocumentation.cpp create mode 100644 src/xmlpatterns/schema/qxsddocumentation_p.h create mode 100644 src/xmlpatterns/schema/qxsdelement.cpp create mode 100644 src/xmlpatterns/schema/qxsdelement_p.h create mode 100644 src/xmlpatterns/schema/qxsdfacet.cpp create mode 100644 src/xmlpatterns/schema/qxsdfacet_p.h create mode 100644 src/xmlpatterns/schema/qxsdidcache.cpp create mode 100644 src/xmlpatterns/schema/qxsdidcache_p.h create mode 100644 src/xmlpatterns/schema/qxsdidchelper.cpp create mode 100644 src/xmlpatterns/schema/qxsdidchelper_p.h create mode 100644 src/xmlpatterns/schema/qxsdidentityconstraint.cpp create mode 100644 src/xmlpatterns/schema/qxsdidentityconstraint_p.h create mode 100644 src/xmlpatterns/schema/qxsdinstancereader.cpp create mode 100644 src/xmlpatterns/schema/qxsdinstancereader_p.h create mode 100644 src/xmlpatterns/schema/qxsdmodelgroup.cpp create mode 100644 src/xmlpatterns/schema/qxsdmodelgroup_p.h create mode 100644 src/xmlpatterns/schema/qxsdnotation.cpp create mode 100644 src/xmlpatterns/schema/qxsdnotation_p.h create mode 100644 src/xmlpatterns/schema/qxsdparticle.cpp create mode 100644 src/xmlpatterns/schema/qxsdparticle_p.h create mode 100644 src/xmlpatterns/schema/qxsdparticlechecker.cpp create mode 100644 src/xmlpatterns/schema/qxsdparticlechecker_p.h create mode 100644 src/xmlpatterns/schema/qxsdreference.cpp create mode 100644 src/xmlpatterns/schema/qxsdreference_p.h create mode 100644 src/xmlpatterns/schema/qxsdschema.cpp create mode 100644 src/xmlpatterns/schema/qxsdschema_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemachecker.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemachecker_helper.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemachecker_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemachecker_setup.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemacontext.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemacontext_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemadebugger.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemadebugger_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemahelper.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemahelper_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemamerger.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemamerger_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemaparser.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemaparser_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemaparser_setup.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemaparsercontext.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemaparsercontext_p.h create mode 100644 src/xmlpatterns/schema/qxsdschemaresolver.cpp create mode 100644 src/xmlpatterns/schema/qxsdschemaresolver_p.h create mode 100644 src/xmlpatterns/schema/qxsdschematoken.cpp create mode 100644 src/xmlpatterns/schema/qxsdschematoken_p.h create mode 100644 src/xmlpatterns/schema/qxsdschematypesfactory.cpp create mode 100644 src/xmlpatterns/schema/qxsdschematypesfactory_p.h create mode 100644 src/xmlpatterns/schema/qxsdsimpletype.cpp create mode 100644 src/xmlpatterns/schema/qxsdsimpletype_p.h create mode 100644 src/xmlpatterns/schema/qxsdstatemachine.cpp create mode 100644 src/xmlpatterns/schema/qxsdstatemachine_p.h create mode 100644 src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp create mode 100644 src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h create mode 100644 src/xmlpatterns/schema/qxsdterm.cpp create mode 100644 src/xmlpatterns/schema/qxsdterm_p.h create mode 100644 src/xmlpatterns/schema/qxsdtypechecker.cpp create mode 100644 src/xmlpatterns/schema/qxsdtypechecker_p.h create mode 100644 src/xmlpatterns/schema/qxsduserschematype.cpp create mode 100644 src/xmlpatterns/schema/qxsduserschematype_p.h create mode 100644 src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp create mode 100644 src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h create mode 100644 src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp create mode 100644 src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h create mode 100644 src/xmlpatterns/schema/qxsdwildcard.cpp create mode 100644 src/xmlpatterns/schema/qxsdwildcard_p.h create mode 100644 src/xmlpatterns/schema/qxsdxpathexpression.cpp create mode 100644 src/xmlpatterns/schema/qxsdxpathexpression_p.h create mode 100644 src/xmlpatterns/schema/schema.pri create mode 100644 src/xmlpatterns/schema/schemas/xml.xsd create mode 100644 src/xmlpatterns/schema/tokens.xml create mode 100644 src/xmlpatterns/type/qnamedschemacomponent.cpp create mode 100644 src/xmlpatterns/type/qnamedschemacomponent_p.h create mode 100644 tests/auto/qxmlschema/.gitignore create mode 100644 tests/auto/qxmlschema/qxmlschema.pro create mode 100644 tests/auto/qxmlschema/tst_qxmlschema.cpp create mode 100644 tests/auto/qxmlschemavalidator/.gitignore create mode 100644 tests/auto/qxmlschemavalidator/qxmlschemavalidator.pro create mode 100644 tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp create mode 100644 tests/auto/xmlpatternsschema/.gitignore create mode 100644 tests/auto/xmlpatternsschema/tst_xmlpatternsschema.cpp create mode 100644 tests/auto/xmlpatternsschema/xmlpatternsschema.pro create mode 100644 tests/auto/xmlpatternsschemats/.gitignore create mode 100644 tests/auto/xmlpatternsschemats/Baseline.xml create mode 100644 tests/auto/xmlpatternsschemats/TESTSUITE/.gitignore create mode 100644 tests/auto/xmlpatternsschemats/TESTSUITE/unifyCatalog.xsl create mode 100755 tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh create mode 100644 tests/auto/xmlpatternsschemats/tst_xmlpatternsschemats.cpp create mode 100644 tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro create mode 100644 tests/auto/xmlpatternsvalidator/files/instance.xml create mode 100644 tests/auto/xmlpatternsvalidator/files/invalid_schema.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/other_valid_schema.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/sa_invalid_instance.xml create mode 100644 tests/auto/xmlpatternsvalidator/files/sa_valid_instance.xml create mode 100644 tests/auto/xmlpatternsvalidator/files/valid_schema.xsd create mode 100644 tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp create mode 100644 tests/auto/xmlpatternsvalidator/xmlpatternsvalidator.pro create mode 100644 tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp create mode 100644 tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h create mode 100644 tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp create mode 100644 tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h create mode 100644 tools/xmlpatternsvalidator/main.cpp create mode 100644 tools/xmlpatternsvalidator/main.h create mode 100644 tools/xmlpatternsvalidator/xmlpatternsvalidator.pro diff --git a/examples/tools/regexp/regexpdialog.cpp b/examples/tools/regexp/regexpdialog.cpp index 8fe7383..52805c1 100644 --- a/examples/tools/regexp/regexpdialog.cpp +++ b/examples/tools/regexp/regexpdialog.cpp @@ -69,6 +69,7 @@ RegExpDialog::RegExpDialog(QWidget *parent) syntaxComboBox->addItem(tr("Regular expression v2"), QRegExp::RegExp2); syntaxComboBox->addItem(tr("Wildcard"), QRegExp::Wildcard); syntaxComboBox->addItem(tr("Fixed string"), QRegExp::FixedString); + syntaxComboBox->addItem(tr("W3C Xml Schema 1.1"), QRegExp::W3CXmlSchema11); syntaxLabel = new QLabel(tr("&Pattern Syntax:")); syntaxLabel->setBuddy(syntaxComboBox); diff --git a/examples/xmlpatterns/schema/main.cpp b/examples/xmlpatterns/schema/main.cpp new file mode 100644 index 0000000..9537a87 --- /dev/null +++ b/examples/xmlpatterns/schema/main.cpp @@ -0,0 +1,24 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include +#include "mainwindow.h" + +//! [0] +int main(int argc, char* argv[]) +{ + Q_INIT_RESOURCE(schema); + QApplication app(argc, argv); + MainWindow* const window = new MainWindow; + window->show(); + return app.exec(); +} +//! [0] diff --git a/examples/xmlpatterns/schema/mainwindow.cpp b/examples/xmlpatterns/schema/mainwindow.cpp new file mode 100644 index 0000000..807a65b --- /dev/null +++ b/examples/xmlpatterns/schema/mainwindow.cpp @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "mainwindow.h" +#include "xmlsyntaxhighlighter.h" + +class MessageHandler : public QAbstractMessageHandler +{ + public: + MessageHandler() + : QAbstractMessageHandler(0) + { + } + + QString statusMessage() const + { + return m_description; + } + + int line() const + { + return m_sourceLocation.line(); + } + + int column() const + { + return m_sourceLocation.column(); + } + + protected: + virtual void handleMessage(QtMsgType type, const QString &description, const QUrl &identifier, const QSourceLocation &sourceLocation) + { + Q_UNUSED(type); + Q_UNUSED(identifier); + + m_messageType = type; + m_description = description; + m_sourceLocation = sourceLocation; + } + + private: + QtMsgType m_messageType; + QString m_description; + QSourceLocation m_sourceLocation; +}; + +MainWindow::MainWindow() +{ + setupUi(this); + + new XmlSyntaxHighlighter(schemaView->document()); + new XmlSyntaxHighlighter(instanceEdit->document()); + + schemaSelection->addItem(tr("Contact Schema")); + schemaSelection->addItem(tr("Recipe Schema")); + schemaSelection->addItem(tr("Order Schema")); + + instanceSelection->addItem(tr("Valid Contact Instance")); + instanceSelection->addItem(tr("Invalid Contact Instance")); + + connect(schemaSelection, SIGNAL(currentIndexChanged(int)), SLOT(schemaSelected(int))); + connect(instanceSelection, SIGNAL(currentIndexChanged(int)), SLOT(instanceSelected(int))); + connect(validateButton, SIGNAL(clicked()), SLOT(validate())); + connect(instanceEdit, SIGNAL(textChanged()), SLOT(textChanged())); + + validationStatus->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); + + schemaSelected(0); + instanceSelected(0); +} + +void MainWindow::schemaSelected(int index) +{ + instanceSelection->clear(); + if (index == 0) { + instanceSelection->addItem(tr("Valid Contact Instance")); + instanceSelection->addItem(tr("Invalid Contact Instance")); + } else if (index == 1) { + instanceSelection->addItem(tr("Valid Recipe Instance")); + instanceSelection->addItem(tr("Invalid Recipe Instance")); + } else if (index == 2) { + instanceSelection->addItem(tr("Valid Order Instance")); + instanceSelection->addItem(tr("Invalid Order Instance")); + } + textChanged(); + + QFile schemaFile(QString(":/schema_%1.xsd").arg(index)); + schemaFile.open(QIODevice::ReadOnly); + const QString schemaText(QString::fromLatin1(schemaFile.readAll())); + schemaView->setPlainText(schemaText); + + validate(); +} + +void MainWindow::instanceSelected(int index) +{ + QFile instanceFile(QString(":/instance_%1.xml").arg((2*schemaSelection->currentIndex()) + index)); + instanceFile.open(QIODevice::ReadOnly); + const QString instanceText(QString::fromLatin1(instanceFile.readAll())); + instanceEdit->setPlainText(instanceText); + + validate(); +} + +void MainWindow::validate() +{ + const QByteArray schemaData = schemaView->toPlainText().toLatin1(); + const QByteArray instanceData = instanceEdit->toPlainText().toLatin1(); + + MessageHandler messageHandler; + + QXmlSchema schema; + schema.setMessageHandler(&messageHandler); + + schema.load(schemaData, QUrl("http://dummySchemaUrl/")); + + bool errorOccurred = false; + if (!schema.isValid()) { + errorOccurred = true; + } else { + QXmlSchemaValidator validator(schema); + if (!validator.validate(instanceData, QUrl("http://dummyInstanceUrl"))) + errorOccurred = true; + } + + if (errorOccurred) { + validationStatus->setText(messageHandler.statusMessage()); + moveCursor(messageHandler.line(), messageHandler.column()); + } else { + validationStatus->setText(tr("validation successful")); + } + + QString styleSheet = QString("QLabel {background: %1; padding: 3px}").arg(errorOccurred ? QColor(Qt::red).lighter(160).name() : QColor(Qt::green).lighter(160).name()); + validationStatus->setStyleSheet(styleSheet); +} + +void MainWindow::textChanged() +{ + instanceEdit->setExtraSelections(QList()); +} + +void MainWindow::moveCursor(int line, int column) +{ + instanceEdit->moveCursor(QTextCursor::Start); + for (int i = 1; i < line; ++i) + instanceEdit->moveCursor(QTextCursor::Down); + + for (int i = 1; i < column; ++i) + instanceEdit->moveCursor(QTextCursor::Right); + + QList extraSelections; + QTextEdit::ExtraSelection selection; + + const QColor lineColor = QColor(Qt::red).lighter(160); + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = instanceEdit->textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + + instanceEdit->setExtraSelections(extraSelections); + + instanceEdit->setFocus(); +} diff --git a/examples/xmlpatterns/schema/mainwindow.h b/examples/xmlpatterns/schema/mainwindow.h new file mode 100644 index 0000000..e5dc2df --- /dev/null +++ b/examples/xmlpatterns/schema/mainwindow.h @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +#include "ui_schema.h" + +//! [0] +class MainWindow : public QMainWindow, + private Ui::SchemaMainWindow +{ + Q_OBJECT + + public: + MainWindow(); + + private Q_SLOTS: + void schemaSelected(int index); + void instanceSelected(int index); + void validate(); + void textChanged(); + + private: + void moveCursor(int line, int column); +}; +//! [0] +#endif diff --git a/examples/xmlpatterns/schema/schema.pro b/examples/xmlpatterns/schema/schema.pro new file mode 100644 index 0000000..af32e0a --- /dev/null +++ b/examples/xmlpatterns/schema/schema.pro @@ -0,0 +1,11 @@ +QT += xmlpatterns +FORMS += schema.ui +HEADERS = mainwindow.h ../shared/xmlsyntaxhighlighter.h +RESOURCES = schema.qrc +SOURCES = main.cpp mainwindow.cpp ../shared/xmlsyntaxhighlighter.cpp +INCLUDEPATH += ../shared/ + +target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xq *.html files +sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema +INSTALLS += target sources diff --git a/examples/xmlpatterns/schema/schema.qrc b/examples/xmlpatterns/schema/schema.qrc new file mode 100644 index 0000000..eb7ddfd --- /dev/null +++ b/examples/xmlpatterns/schema/schema.qrc @@ -0,0 +1,13 @@ + + + files/contact.xsd + files/recipe.xsd + files/order.xsd + files/valid_contact.xml + files/invalid_contact.xml + files/valid_recipe.xml + files/invalid_recipe.xml + files/valid_order.xml + files/invalid_order.xml + + diff --git a/examples/xmlpatterns/schema/schema.ui b/examples/xmlpatterns/schema/schema.ui new file mode 100644 index 0000000..af7020a --- /dev/null +++ b/examples/xmlpatterns/schema/schema.ui @@ -0,0 +1,71 @@ + + + SchemaMainWindow + + + + 0 + 0 + 417 + 594 + + + + MainWindow + + + + + + + XML Schema Document: + + + + + + + + + + + + + XML Instance Document: + + + + + + + + + + + + + Status: + + + + + + + not validated + + + + + + + Validate + + + + + + + + + + diff --git a/examples/xmlpatterns/xmlpatterns.pro b/examples/xmlpatterns/xmlpatterns.pro index 1a57005..3ff3e35 100644 --- a/examples/xmlpatterns/xmlpatterns.pro +++ b/examples/xmlpatterns/xmlpatterns.pro @@ -2,7 +2,8 @@ TEMPLATE = subdirs SUBDIRS = recipes \ trafficinfo \ xquery \ - filetree + filetree \ + schema # This example depends on QtWebkit as well. contains(QT_CONFIG, webkit):SUBDIRS += qobjectxmlmodel diff --git a/src/xmlpatterns/Doxyfile b/src/xmlpatterns/Doxyfile index 60a6c77..83f7062 100644 --- a/src/xmlpatterns/Doxyfile +++ b/src/xmlpatterns/Doxyfile @@ -1157,7 +1157,7 @@ DOT_PATH = # contain dot files that are included in the documentation (see the # \dotfile command). -DOTFILE_DIRS = +DOTFILE_DIRS = schema/doc/ # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. diff --git a/src/xmlpatterns/acceltree/qacceltree.cpp b/src/xmlpatterns/acceltree/qacceltree.cpp index 60e6e27..061021a 100644 --- a/src/xmlpatterns/acceltree/qacceltree.cpp +++ b/src/xmlpatterns/acceltree/qacceltree.cpp @@ -42,6 +42,7 @@ #include #include "qabstractxmlreceiver.h" +#include "qabstractxmlnodemodel_p.h" #include "qacceliterators_p.h" #include "qacceltree_p.h" #include "qatomicstring_p.h" @@ -55,6 +56,37 @@ QT_BEGIN_NAMESPACE using namespace QPatternist; +namespace QPatternist { + + class AccelTreePrivate : public QAbstractXmlNodeModelPrivate + { + public: + AccelTreePrivate(AccelTree *accelTree) + : m_accelTree(accelTree) + { + } + + virtual QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const + { + return m_accelTree->sourceLocation(index); + } + + private: + AccelTree *m_accelTree; + }; +} + +AccelTree::AccelTree(const QUrl &docURI, const QUrl &bURI) + : QAbstractXmlNodeModel(new AccelTreePrivate(this)) + , m_documentURI(docURI) + , m_baseURI(bURI) +{ + /* Pre-allocate at least a little bit. */ + // TODO. Do it according to what an average 4 KB doc contains. + basicData.reserve(100); + data.reserve(30); +} + void AccelTree::printStats(const NamePool::Ptr &np) const { Q_ASSERT(np); @@ -674,6 +706,17 @@ void AccelTree::copyNodeTo(const QXmlNodeModelIndex &node, } +QSourceLocation AccelTree::sourceLocation(const QXmlNodeModelIndex &index) const +{ + const PreNumber key = toPreNumber(index); + if (sourcePositions.contains(key)) { + const QPair position = sourcePositions.value(key); + return QSourceLocation(m_documentURI, position.first, position.second); + } else { + return QSourceLocation(); + } +} + void AccelTree::copyChildren(const QXmlNodeModelIndex &node, QAbstractXmlReceiver *const receiver, const NodeCopySettings &settings) const diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h index 10320ba..4c0d844 100644 --- a/src/xmlpatterns/acceltree/qacceltree_p.h +++ b/src/xmlpatterns/acceltree/qacceltree_p.h @@ -91,6 +91,7 @@ namespace QPatternist */ class AccelTree : public QAbstractXmlNodeModel { + friend class AccelTreePrivate; public: using QAbstractXmlNodeModel::createIndex; @@ -99,15 +100,7 @@ namespace QPatternist typedef PreNumber PostNumber; typedef qint8 Depth; - inline AccelTree(const QUrl &docURI, - const QUrl &bURI) : m_documentURI(docURI), - m_baseURI(bURI) - { - /* Pre-allocate at least a little bit. */ - // TODO. Do it according to what an average 4 KB doc contains. - basicData.reserve(100); - data.reserve(30); - } + AccelTree(const QUrl &docURI, const QUrl &bURI); /** * @short Houses data for a node, and that all node kinds have. @@ -280,6 +273,7 @@ namespace QPatternist QHash data; QVector basicData; + QHash > sourcePositions; inline QUrl documentUri() const { @@ -381,6 +375,11 @@ namespace QPatternist private: /** + * Returns the source location for the object with the given @p index. + */ + QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const; + + /** * Copies the children of @p node to @p receiver. */ inline void copyChildren(const QXmlNodeModelIndex &node, diff --git a/src/xmlpatterns/acceltree/qacceltreebuilder.cpp b/src/xmlpatterns/acceltree/qacceltreebuilder.cpp index 5b16cc3..ddc118c 100644 --- a/src/xmlpatterns/acceltree/qacceltreebuilder.cpp +++ b/src/xmlpatterns/acceltree/qacceltreebuilder.cpp @@ -49,15 +49,17 @@ template AccelTreeBuilder::AccelTreeBuilder(const QUrl &docURI, const QUrl &baseURI, const NamePool::Ptr &np, - ReportContext *const context) : m_preNumber(-1) - , m_isPreviousAtomic(false) - , m_hasCharacters(false) - , m_isCharactersCompressed(false) - , m_namePool(np) - , m_document(new AccelTree(docURI, baseURI)) - , m_skippedDocumentNodes(0) - , m_documentURI(docURI) - , m_context(context) + ReportContext *const context, + Features features) : m_preNumber(-1) + , m_isPreviousAtomic(false) + , m_hasCharacters(false) + , m_isCharactersCompressed(false) + , m_namePool(np) + , m_document(new AccelTree(docURI, baseURI)) + , m_skippedDocumentNodes(0) + , m_documentURI(docURI) + , m_context(context) + , m_features(features) { Q_ASSERT(m_namePool); @@ -126,9 +128,18 @@ void AccelTreeBuilder::item(const Item &it) template void AccelTreeBuilder::startElement(const QXmlName &name) { + startElement(name, 1, 1); +} + +template +void AccelTreeBuilder::startElement(const QXmlName &name, qint64 line, qint64 column) +{ startStructure(); - m_document->basicData.append(AccelTree::BasicNodeData(currentDepth(), currentParent(), QXmlNodeModelIndex::Element, -1, name)); + AccelTree::BasicNodeData data(currentDepth(), currentParent(), QXmlNodeModelIndex::Element, -1, name); + m_document->basicData.append(data); + if (m_features & SourceLocationsFeature) + m_document->sourcePositions.insert(m_document->maximumPreNumber(), qMakePair(line, column)); ++m_preNumber; m_ancestors.push(m_preNumber); diff --git a/src/xmlpatterns/acceltree/qacceltreebuilder_p.h b/src/xmlpatterns/acceltree/qacceltreebuilder_p.h index 653eb85..91e8d68 100644 --- a/src/xmlpatterns/acceltree/qacceltreebuilder_p.h +++ b/src/xmlpatterns/acceltree/qacceltreebuilder_p.h @@ -90,15 +90,27 @@ namespace QPatternist typedef QExplicitlySharedDataPointer Ptr; /** + * Describes the memory relevant features the builder shall support. + */ + enum Feature + { + NoneFeature, ///< No special features are enabled. + SourceLocationsFeature = 1 ///< The accel tree builder will store source locations for each start element. + }; + Q_DECLARE_FLAGS(Features, Feature) + + /** * @param context may be @c null. */ AccelTreeBuilder(const QUrl &docURI, const QUrl &baseURI, const NamePool::Ptr &np, - ReportContext *const context); + ReportContext *const context, + Features features = NoneFeature); virtual void startDocument(); virtual void endDocument(); virtual void startElement(const QXmlName &name); + void startElement(const QXmlName &name, qint64 line, qint64 column); virtual void endElement(); virtual void attribute(const QXmlName &name, const QStringRef &value); virtual void characters(const QStringRef &ch); @@ -175,8 +187,13 @@ namespace QPatternist * a member. */ ReportContext *const m_context; + + Features m_features; }; + Q_DECLARE_OPERATORS_FOR_FLAGS(AccelTreeBuilder::Features) + Q_DECLARE_OPERATORS_FOR_FLAGS(AccelTreeBuilder::Features) + #include "qacceltreebuilder.cpp" } diff --git a/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp b/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp index 4a5c219..7c3d2c0 100644 --- a/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp +++ b/src/xmlpatterns/acceltree/qacceltreeresourceloader.cpp @@ -46,7 +46,6 @@ #include -#include "qacceltreebuilder_p.h" #include "qatomicstring_p.h" #include "qautoptr_p.h" #include "qcommonsequencetypes_p.h" @@ -57,14 +56,12 @@ QT_BEGIN_NAMESPACE using namespace QPatternist; -static inline uint qHash(const QUrl &uri) -{ - return qHash(uri.toString()); -} - AccelTreeResourceLoader::AccelTreeResourceLoader(const NamePool::Ptr &np, - const NetworkAccessDelegator::Ptr &manager) : m_namePool(np) - , m_networkAccessDelegator(manager) + const NetworkAccessDelegator::Ptr &manager, + AccelTreeBuilder::Features features) + : m_namePool(np) + , m_networkAccessDelegator(manager) + , m_features(features) { Q_ASSERT(m_namePool); Q_ASSERT(m_networkAccessDelegator); @@ -74,7 +71,7 @@ bool AccelTreeResourceLoader::retrieveDocument(const QUrl &uri, const ReportContext::Ptr &context) { Q_ASSERT(uri.isValid()); - AccelTreeBuilder builder(uri, uri, m_namePool, context.data()); + AccelTreeBuilder builder(uri, uri, m_namePool, context.data(), m_features); const AutoPtr reply(load(uri, m_networkAccessDelegator, context)); @@ -88,18 +85,35 @@ bool AccelTreeResourceLoader::retrieveDocument(const QUrl &uri, return success; } +bool AccelTreeResourceLoader::retrieveDocument(QIODevice *source, const QUrl &documentUri, const ReportContext::Ptr &context) +{ + Q_ASSERT(source); + Q_ASSERT(source->isReadable()); + Q_ASSERT(documentUri.isValid()); + + AccelTreeBuilder builder(documentUri, documentUri, m_namePool, context.data(), m_features); + + bool success = false; + success = streamToReceiver(source, &builder, m_namePool, context, documentUri); + + m_loadedDocuments.insert(documentUri, builder.builtDocument()); + + return success; +} + QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri, const NetworkAccessDelegator::Ptr &networkDelegator, - const ReportContext::Ptr &context) + const ReportContext::Ptr &context, ErrorHandling errorHandling) { return load(uri, networkDelegator->managerFor(uri), - context); + context, errorHandling); } QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri, QNetworkAccessManager *const networkManager, - const ReportContext::Ptr &context) + const ReportContext::Ptr &context, ErrorHandling errorHandling) + { Q_ASSERT(networkManager); Q_ASSERT(uri.isValid()); @@ -120,7 +134,7 @@ QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri, const QSourceLocation location(uri); - if(context) + if(context && (errorHandling == FailOnError)) context->error(errorMessage, ReportContext::FODC0002, location); return 0; @@ -130,7 +144,7 @@ QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri, } bool AccelTreeResourceLoader::streamToReceiver(QIODevice *const dev, - QAbstractXmlReceiver *const receiver, + AccelTreeBuilder *const receiver, const NamePool::Ptr &np, const ReportContext::Ptr &context, const QUrl &uri) @@ -154,7 +168,7 @@ bool AccelTreeResourceLoader::streamToReceiver(QIODevice *const dev, { /* Send the name. */ receiver->startElement(np->allocateQName(reader.namespaceUri().toString(), reader.name().toString(), - reader.prefix().toString())); + reader.prefix().toString()), reader.lineNumber(), reader.columnNumber()); /* Send namespace declarations. */ const QXmlStreamNamespaceDeclarations &nss = reader.namespaceDeclarations(); @@ -263,6 +277,22 @@ Item AccelTreeResourceLoader::openDocument(const QUrl &uri, } } +Item AccelTreeResourceLoader::openDocument(QIODevice *source, const QUrl &documentUri, + const ReportContext::Ptr &context) +{ + const AccelTree::Ptr doc(m_loadedDocuments.value(documentUri)); + + if(doc) + return doc->root(QXmlNodeModelIndex()); /* Pass in dummy object. We know AccelTree doesn't use it. */ + else + { + if(retrieveDocument(source, documentUri, context)) + return m_loadedDocuments.value(documentUri)->root(QXmlNodeModelIndex()); /* Pass in dummy object. We know AccelTree doesn't use it. */ + else + return Item(); + } +} + SequenceType::Ptr AccelTreeResourceLoader::announceDocument(const QUrl &uri, const Usage) { // TODO deal with the usage thingy diff --git a/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h b/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h index 863fd65..56f547a 100644 --- a/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h +++ b/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h @@ -52,12 +52,12 @@ #ifndef Patternist_AccelTreeResourceLoader_H #define Patternist_AccelTreeResourceLoader_H -#include #include #include #include "qabstractxmlreceiver.h" #include "qacceltree_p.h" +#include "qacceltreebuilder_p.h" #include "qdeviceresourceloader_p.h" #include "qnamepool_p.h" #include "qnetworkaccessdelegator_p.h" @@ -115,13 +115,25 @@ namespace QPatternist { public: /** + * Describes the behaviour of the resource loader in case of an + * error. + */ + enum ErrorHandling + { + FailOnError, ///< The resource loader will report the error via the report context. + ContinueOnError ///< The resource loader will report no error and return an empty QNetworkReply. + }; + + /** * AccelTreeResourceLoader does not own @p context. */ AccelTreeResourceLoader(const NamePool::Ptr &np, - const NetworkAccessDelegator::Ptr &networkDelegator); + const NetworkAccessDelegator::Ptr &networkDelegator, AccelTreeBuilder::Features = AccelTreeBuilder::NoneFeature); virtual Item openDocument(const QUrl &uri, const ReportContext::Ptr &context); + virtual Item openDocument(QIODevice *source, const QUrl &documentUri, + const ReportContext::Ptr &context); virtual SequenceType::Ptr announceDocument(const QUrl &uri, const Usage usageHint); virtual bool isDocumentAvailable(const QUrl &uri); @@ -133,7 +145,6 @@ namespace QPatternist const ReportContext::Ptr &context, const SourceLocationReflection *const where); - /** * @short Helper function that do NetworkAccessDelegator::get(), but * does it blocked. @@ -149,14 +160,14 @@ namespace QPatternist */ static QNetworkReply *load(const QUrl &uri, QNetworkAccessManager *const networkManager, - const ReportContext::Ptr &context); + const ReportContext::Ptr &context, ErrorHandling handling = FailOnError); /** * @overload */ static QNetworkReply *load(const QUrl &uri, const NetworkAccessDelegator::Ptr &networkDelegator, - const ReportContext::Ptr &context); + const ReportContext::Ptr &context, ErrorHandling handling = FailOnError); /** * @short Returns the URIs this AccelTreeResourceLoader has loaded @@ -165,14 +176,17 @@ namespace QPatternist virtual QSet deviceURIs() const; virtual void clear(const QUrl &uri); + private: static bool streamToReceiver(QIODevice *const dev, - QAbstractXmlReceiver *const receiver, + AccelTreeBuilder *const receiver, const NamePool::Ptr &np, const ReportContext::Ptr &context, const QUrl &uri); bool retrieveDocument(const QUrl &uri, const ReportContext::Ptr &context); + bool retrieveDocument(QIODevice *source, const QUrl &documentUri, + const ReportContext::Ptr &context); /** * If @p context is @c null, no error reporting should be done. */ @@ -185,6 +199,7 @@ namespace QPatternist const NamePool::Ptr m_namePool; const NetworkAccessDelegator::Ptr m_networkAccessDelegator; QHash, QString> m_unparsedTexts; + AccelTreeBuilder::Features m_features; }; } diff --git a/src/xmlpatterns/api/api.pri b/src/xmlpatterns/api/api.pri index a0298f2..9fcc2f5 100644 --- a/src/xmlpatterns/api/api.pri +++ b/src/xmlpatterns/api/api.pri @@ -3,11 +3,13 @@ HEADERS += $$PWD/qabstractxmlforwarditerator_p.h \ $$PWD/qabstracturiresolver.h \ $$PWD/qabstractxmlnodemodel.h \ $$PWD/qabstractxmlnodemodel_p.h \ + $$PWD/qabstractxmlpullprovider_p.h \ $$PWD/qabstractxmlreceiver.h \ $$PWD/qabstractxmlreceiver_p.h \ $$PWD/qdeviceresourceloader_p.h \ $$PWD/qiodevicedelegate_p.h \ $$PWD/qnetworkaccessdelegator_p.h \ + $$PWD/qpullbridge_p.h \ $$PWD/qresourcedelegator_p.h \ $$PWD/qsimplexmlnodemodel.h \ $$PWD/qsourcelocation.h \ @@ -20,6 +22,10 @@ HEADERS += $$PWD/qabstractxmlforwarditerator_p.h \ $$PWD/qxmlquery_p.h \ $$PWD/qxmlresultitems.h \ $$PWD/qxmlresultitems_p.h \ + $$PWD/qxmlschema.h \ + $$PWD/qxmlschema_p.h \ + $$PWD/qxmlschemavalidator.h \ + $$PWD/qxmlschemavalidator_p.h \ $$PWD/qxmlserializer.h \ $$PWD/qxmlserializer_p.h \ $$PWD/../../../tools/xmlpatterns/qcoloringmessagehandler_p.h \ @@ -29,9 +35,11 @@ SOURCES += $$PWD/qvariableloader.cpp \ $$PWD/qabstractmessagehandler.cpp \ $$PWD/qabstracturiresolver.cpp \ $$PWD/qabstractxmlnodemodel.cpp \ + $$PWD/qabstractxmlpullprovider.cpp \ $$PWD/qabstractxmlreceiver.cpp \ $$PWD/qiodevicedelegate.cpp \ $$PWD/qnetworkaccessdelegator.cpp \ + $$PWD/qpullbridge.cpp \ $$PWD/qresourcedelegator.cpp \ $$PWD/qsimplexmlnodemodel.cpp \ $$PWD/qsourcelocation.cpp \ @@ -41,6 +49,9 @@ SOURCES += $$PWD/qvariableloader.cpp \ $$PWD/qxmlnamepool.cpp \ $$PWD/qxmlquery.cpp \ $$PWD/qxmlresultitems.cpp \ + $$PWD/qxmlschema.cpp \ + $$PWD/qxmlschema_p.cpp \ + $$PWD/qxmlschemavalidator.cpp \ $$PWD/qxmlserializer.cpp \ $$PWD/../../../tools/xmlpatterns/qcoloringmessagehandler.cpp \ $$PWD/../../../tools/xmlpatterns/qcoloroutput.cpp diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp index 0caa8c4..f535ec8 100644 --- a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp +++ b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp @@ -1666,4 +1666,20 @@ void QAbstractXmlNodeModel::copyNodeTo(const QXmlNodeModelIndex &node, "This function is not expected to be called."); } +/*! + Returns the source location for the object with the given \a index + or a default constructed QSourceLocation in case no location + information is available. + + \since TODO + */ +QSourceLocation QAbstractXmlNodeModel::sourceLocation(const QXmlNodeModelIndex &index) const +{ + // TODO: make this method virtual in Qt5 to allow source location support in custom models + if (d_ptr) + return d_ptr->sourceLocation(index); + else + return QSourceLocation(); +} + QT_END_NAMESPACE diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.h b/src/xmlpatterns/api/qabstractxmlnodemodel.h index 6c9574c..1d860a3 100644 --- a/src/xmlpatterns/api/qabstractxmlnodemodel.h +++ b/src/xmlpatterns/api/qabstractxmlnodemodel.h @@ -56,6 +56,7 @@ QT_MODULE(XmlPatterns) class QAbstractXmlNodeModel; class QAbstractXmlNodeModelPrivate; class QAbstractXmlReceiver; +class QSourceLocation; class QUrl; class QXmlName; class QXmlNodeModelIndex; @@ -69,6 +70,7 @@ namespace QPatternist class DynamicContext; class Item; class ItemType; + class XsdValidatedXmlNodeModel; template class ItemMappingIterator; template class SequenceMappingIterator; typedef QExplicitlySharedDataPointer ItemTypePtr; @@ -315,6 +317,8 @@ public: QAbstractXmlReceiver *const receiver, const NodeCopySettings &) const; + QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const; + protected: virtual QXmlNodeModelIndex nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const = 0; @@ -343,6 +347,7 @@ protected: private: friend class QPatternist::ItemMappingIterator >; friend class QPatternist::SequenceMappingIterator; + friend class QPatternist::XsdValidatedXmlNodeModel; inline QExplicitlySharedDataPointer > mapToSequence(const QXmlNodeModelIndex &ni, const QExplicitlySharedDataPointer &) const; diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel_p.h b/src/xmlpatterns/api/qabstractxmlnodemodel_p.h index 16ce613..0ab1b26 100644 --- a/src/xmlpatterns/api/qabstractxmlnodemodel_p.h +++ b/src/xmlpatterns/api/qabstractxmlnodemodel_p.h @@ -52,6 +52,9 @@ #ifndef QABSTRACTXMLNODEMODEL_P_H #define QABSTRACTXMLNODEMODEL_P_H +#include "qabstractxmlnodemodel.h" +#include "qsourcelocation.h" + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -62,6 +65,13 @@ public: virtual ~QAbstractXmlNodeModelPrivate() { } + + virtual QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const + { + Q_UNUSED(index); + + return QSourceLocation(); + } }; QT_END_NAMESPACE diff --git a/src/xmlpatterns/api/qabstractxmlpullprovider.cpp b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp new file mode 100644 index 0000000..a80604b --- /dev/null +++ b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qxmlname.h" +#include "qnamepool_p.h" +#include "qabstractxmlpullprovider_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +// TODO have example where query selects, and the events for the result are indented + +/*! + \internal + \class AbstractXmlPullProvider + \brief The AbstractXmlPullProvider class provides a pull-based stream interface for the XPath Data Model. + \reentrant + \ingroup xml-tools + + AbstractXmlPullProvider allows a stream of items from the XPath Data Model -- essentially XML -- + to be iterated over. The subclass of AbstractXmlPullProvider provides the events, and the + user calling next() and so on, consumes them. AbstractXmlPullProvider can be considered + a forward-only, non-reversible iterator. + + Note that the content the events describes, are not necessarily a well-formed XML document, but + rather an instance of the XPath Data model, to be specific. For instance, maybe a pull provider + returns two atomic values, followed by an element tree, and at the end two document nodes. + + If you are subclassing AbstractXmlPullProvider, be careful to correctly implement + the behaviors, as described for the individual members and events. + + \sa AbstractXmlPullProvider::Event + */ + +/*! + \enum AbstractXmlPullProvider::Event + \value StartOfInput The value AbstractXmlPullProvider::current() returns before the first call to next(). + \value AtomicValue an atomic value such as an \c xs:integer, \c xs:hexBinary, or \c xs:dateTime. Atomic values + can only be top level items. + \value StartDocument Signals the start of a document node. Note that a AbstractXmlPullProvider can provide + a sequence of document nodes. + \value EndDocument Signals the end of a document node. StartDocument and EndDocument are always balanced + and always top-level events. For instance, StartDocument can never appear after any StartElement + events that hasn't been balanced by the corresponding amount of EndElement events. + \value StartElement Signals an element start tag. + \value EndElement Signals the end of an element. StartElement and EndElement events are always balanced. + \value Text Signals a text node. Adjacent text nodes cannot occur. + \value ProcessingInstruction A processing instruction. Its name is returned from name(), and its value in stringValue(). + \value Comment a comment node. Its value can be retrieved with stingValue(). + \value Attribute Signals an attribute node. Attribute events can only appear after Namespace events, or + if no such are sent, after the StartElement. In addition they must appear sequentially, + and each name must be unique. The ordering of attribute events is undefined and insignificant. + \value Namespace Signals a namespace binding. They occur very infrequently and are not needed for attributes + and elements. Namespace events can only appear after the StartElement event. The + ordering of namespace events is undefined and insignificant. + \value EndOfInput When next() is called after the last event, EndOfInput is returned. + + \sa AbstractXmlPullProvider::current() + */ + +/*! + Constucts a AbstractXmlPullProvider instance. + */ +AbstractXmlPullProvider::AbstractXmlPullProvider() +{ +} + +/*! + Destructs this AbstractXmlPullProvider. + */ +AbstractXmlPullProvider::~AbstractXmlPullProvider() +{ +} + +/*! + \fn Event AbstractXmlPullProvider::next() = 0; + Advances this AbstractXmlPullProvider, and returns the new event. + + \sa current() + */ + +/*! + \fn Event AbstractXmlPullProvider::current() const = 0; + Returns the event that next() returned the last time it was called. It doesn't + alter this AbstractXmlPullProvider. + + current() may not modify this AbstractXmlPullProvider's state. Subsequent calls to current() + must return the same value. + + \sa AbstractXmlPullProvider::Event + */ + +/*! + \fn QName AbstractXmlPullProvider::name() const = 0; + If the current event is StartElement, + EndElement, ProcessingInstruction, Attribute, or Namespace, the node's name is returned. + + If the current event is ProcessingInstruction, + the processing instruction target is in in the local name. + + If the current event is Namespace, the name's namespace URI is the namespace, and + the local name is the prefix the name is binding to. + + In all other cases, an invalid QName is returned. + */ + +/*! + \fn QVariant AbstractXmlPullProvider::atomicValue() const = 0; + + If current() event is AtomicValue, the atomic value is returned as a QVariant. + In all other cases, this function returns a null QVariant. + */ + +/*! + \fn QString AbstractXmlPullProvider::stringValue() const = 0; + + If current() is Text, the text node's value is returned. + + If the current() event is Comment, its value is returned. The subclasser guarantees + it does not contain the string "-->". + + If the current() event is ProcessingInstruction, its data is returned. The subclasser + guarantees the data does not contain the string "?>". + + In other cases, it returns a default constructed string. + */ + +/*! + \fn QHash AbstractXmlPullProvider::attributes() = 0; + + If the current() is Element, the attributes of the element are returned, + an empty list of attributes otherwise. + */ + +QT_END_NAMESPACE + diff --git a/src/xmlpatterns/api/qabstractxmlpullprovider_p.h b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h new file mode 100644 index 0000000..d05e649 --- /dev/null +++ b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef QABSTRACTXMLPULLPROVIDER_H +#define QABSTRACTXMLPULLPROVIDER_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QXmlItem; +class QXmlName; +class QString; +class QVariant; +template class QHash; + +namespace QPatternist +{ + class AbstractXmlPullProviderPrivate; + + class AbstractXmlPullProvider + { + public: + AbstractXmlPullProvider(); + virtual ~AbstractXmlPullProvider(); + + enum Event + { + StartOfInput = 1, + AtomicValue = 1 << 1, + StartDocument = 1 << 2, + EndDocument = 1 << 3, + StartElement = 1 << 4, + EndElement = 1 << 5, + Text = 1 << 6, + ProcessingInstruction = 1 << 7, + Comment = 1 << 8, + Attribute = 1 << 9, + Namespace = 1 << 10, + EndOfInput = 1 << 11 + }; + + virtual Event next() = 0; + virtual Event current() const = 0; + virtual QXmlName name() const = 0; + virtual QVariant atomicValue() const = 0; + virtual QString stringValue() const = 0; + + virtual QHash attributes() = 0; + virtual QHash attributeItems() = 0; + + /* *** The functions below are internal. */ + private: + Q_DISABLE_COPY(AbstractXmlPullProvider) + AbstractXmlPullProviderPrivate *d; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/api/qpullbridge.cpp b/src/xmlpatterns/api/qpullbridge.cpp new file mode 100644 index 0000000..f347339 --- /dev/null +++ b/src/xmlpatterns/api/qpullbridge.cpp @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qabstractxmlnodemodel_p.h" +#include "qitemmappingiterator_p.h" +#include "qitem_p.h" +#include "qxmlname.h" +#include "qxmlquery_p.h" + +#include "qpullbridge_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +/*! + \brief Bridges a QPatternist::SequenceIterator to QAbstractXmlPullProvider. + \class QPatternist::PullBridge + \internal + \reentrant + \ingroup xml-tools + + The approach of this class is rather straight forward since QPatternist::SequenceIterator + and QAbstractXmlPullProvider are conceptually similar. While QPatternist::SequenceIterator only + delivers top level items(since it's not an event stream, it's a list of items), PullBridge + needs to recursively iterate the children of nodes too, which is achieved through the + stack m_iterators. + */ + +AbstractXmlPullProvider::Event PullBridge::next() +{ + m_index = m_iterators.top().second->next(); + + if(!m_index.isNull()) + { + Item item(m_index); + + if(item && item.isAtomicValue()) + m_current = AtomicValue; + else + { + Q_ASSERT(item.isNode()); + + switch(m_index.kind()) + { + case QXmlNodeModelIndex::Attribute: + { + m_current = Attribute; + break; + } + case QXmlNodeModelIndex::Comment: + { + m_current = Comment; + break; + } + case QXmlNodeModelIndex::Element: + { + m_iterators.push(qMakePair(StartElement, m_index.iterate(QXmlNodeModelIndex::AxisChild))); + m_current = StartElement; + break; + } + case QXmlNodeModelIndex::Document: + { + m_iterators.push(qMakePair(StartDocument, m_index.iterate(QXmlNodeModelIndex::AxisChild))); + m_current = StartDocument; + break; + } + case QXmlNodeModelIndex::Namespace: + { + m_current = Namespace; + break; + } + case QXmlNodeModelIndex::ProcessingInstruction: + { + m_current = ProcessingInstruction; + break; + } + case QXmlNodeModelIndex::Text: + { + m_current = Text; + break; + } + } + } + } + else + { + if(m_iterators.isEmpty()) + m_current = EndOfInput; + else + { + switch(m_iterators.top().first) + { + case StartOfInput: + { + m_current = EndOfInput; + break; + } + case StartElement: + { + m_current = EndElement; + m_iterators.pop(); + break; + } + case StartDocument: + { + m_current = EndDocument; + m_iterators.pop(); + break; + } + default: + { + Q_ASSERT_X(false, Q_FUNC_INFO, + "Invalid value."); + m_current = EndOfInput; + } + } + } + + } + + return m_current; +} + +AbstractXmlPullProvider::Event PullBridge::current() const +{ + return m_current; +} + +QXmlNodeModelIndex PullBridge::index() const +{ + return m_index; +} + +QSourceLocation PullBridge::sourceLocation() const +{ + return m_index.model()->sourceLocation(m_index); +} + +QXmlName PullBridge::name() const +{ + return m_index.name(); +} + +QVariant PullBridge::atomicValue() const +{ + return QVariant(); +} + +QString PullBridge::stringValue() const +{ + return QString(); +} + +QHash PullBridge::attributes() +{ + Q_ASSERT(m_current == StartElement); + + QHash attributes; + + QXmlNodeModelIndex::Iterator::Ptr it = m_index.iterate(QXmlNodeModelIndex::AxisAttribute); + QXmlNodeModelIndex index = it->next(); + while (!index.isNull()) { + const Item attribute(index); + attributes.insert(index.name(), index.stringValue()); + + index = it->next(); + } + + return attributes; +} + +QHash PullBridge::attributeItems() +{ + Q_ASSERT(m_current == StartElement); + + QHash attributes; + + QXmlNodeModelIndex::Iterator::Ptr it = m_index.iterate(QXmlNodeModelIndex::AxisAttribute); + QXmlNodeModelIndex index = it->next(); + while (!index.isNull()) { + const Item attribute(index); + attributes.insert(index.name(), QXmlItem(index)); + + index = it->next(); + } + + return attributes; +} + +QT_END_NAMESPACE + diff --git a/src/xmlpatterns/api/qpullbridge_p.h b/src/xmlpatterns/api/qpullbridge_p.h new file mode 100644 index 0000000..823d27b --- /dev/null +++ b/src/xmlpatterns/api/qpullbridge_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef PATTERNIST_PULLBRIDGE_P_H +#define PATTERNIST_PULLBRIDGE_P_H + +#include +#include + +#include "qabstractxmlforwarditerator_p.h" +#include "qabstractxmlpullprovider_p.h" +#include "qitem_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + class PullBridge : public AbstractXmlPullProvider + { + public: + inline PullBridge(const QXmlNodeModelIndex::Iterator::Ptr &it) : m_current(StartOfInput) + { + Q_ASSERT(it); + m_iterators.push(qMakePair(StartOfInput, it)); + } + + virtual Event next(); + virtual Event current() const; + virtual QXmlName name() const; + /** + * Returns always an empty QVariant. + */ + virtual QVariant atomicValue() const; + virtual QString stringValue() const; + virtual QHash attributes(); + virtual QHash attributeItems(); + + QXmlNodeModelIndex index() const; + QSourceLocation sourceLocation() const; + + private: + typedef QStack > IteratorStack; + IteratorStack m_iterators; + QXmlNodeModelIndex m_index; + Event m_current; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/api/qresourcedelegator.cpp b/src/xmlpatterns/api/qresourcedelegator.cpp index 9d43419..fceef30 100644 --- a/src/xmlpatterns/api/qresourcedelegator.cpp +++ b/src/xmlpatterns/api/qresourcedelegator.cpp @@ -45,14 +45,6 @@ QT_BEGIN_NAMESPACE using namespace QPatternist; -/** - * Duplicated in qacceltreeresourceloader.cpp. - */ -static inline uint qHash(const QUrl &uri) -{ - return qHash(uri.toString()); -} - bool ResourceDelegator::isUnparsedTextAvailable(const QUrl &uri, const QString &encoding) { diff --git a/src/xmlpatterns/api/qxmlnamepool.cpp b/src/xmlpatterns/api/qxmlnamepool.cpp index 2337f8d..11274ab 100644 --- a/src/xmlpatterns/api/qxmlnamepool.cpp +++ b/src/xmlpatterns/api/qxmlnamepool.cpp @@ -96,6 +96,10 @@ QXmlNamePool::~QXmlNamePool() { } +QXmlNamePool::QXmlNamePool(QPatternist::NamePool *namePool) : d(QExplicitlySharedDataPointer(namePool)) +{ +} + /*! Assigns the \a other name pool to this one. */ diff --git a/src/xmlpatterns/api/qxmlnamepool.h b/src/xmlpatterns/api/qxmlnamepool.h index 3c1e112..87856ee 100644 --- a/src/xmlpatterns/api/qxmlnamepool.h +++ b/src/xmlpatterns/api/qxmlnamepool.h @@ -54,6 +54,8 @@ QT_MODULE(XmlPatterns) namespace QPatternist { class NamePool; + class XsdSchemaParser; + class XsdValidatingInstanceReader; } namespace QPatternistSDK @@ -73,10 +75,15 @@ public: QXmlNamePool &operator=(const QXmlNamePool &other); private: + QXmlNamePool(QPatternist::NamePool *namePool); friend class QXmlQueryPrivate; friend class QXmlQuery; + friend class QXmlSchemaPrivate; + friend class QXmlSchemaValidatorPrivate; friend class QXmlSerializerPrivate; friend class QXmlName; + friend class QPatternist::XsdSchemaParser; + friend class QPatternist::XsdValidatingInstanceReader; friend class QPatternistSDK::Global; QExplicitlySharedDataPointer d; }; diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp index 5f9d87d..423da3e 100644 --- a/src/xmlpatterns/api/qxmlquery.cpp +++ b/src/xmlpatterns/api/qxmlquery.cpp @@ -231,6 +231,18 @@ QT_BEGIN_NAMESPACE \value XQuery10 XQuery 1.0. \value XSLT20 XSLT 2.0 + \omitvalue XmlSchema11IdentityConstraintSelector The selector, the restricted + XPath pattern found in W3C XML Schema 1.1 for uniqueness + contraints. Apart from restricting the syntax, the type check stage + for the expression assumes a sequence of nodes to be the focus. + \omitvalue XmlSchema11IdentityConstraintField The field, the restricted + XPath pattern found in W3C XML Schema 1.1 for uniqueness + contraints. Apart from restricting the syntax, the type check stage + for the expression assumes a sequence of nodes to be the focus. + \omitvalue XPath20 Signifies XPath 2.0. Has no effect in the public API, it's + used internally. As With XmlSchema11IdentityConstraintSelector and + XmlSchema11IdentityConstraintField, the type check stage + for the expression assumes a sequence of nodes to be the focus. \sa setQuery() */ diff --git a/src/xmlpatterns/api/qxmlquery.h b/src/xmlpatterns/api/qxmlquery.h index 138819c..c9f949e 100644 --- a/src/xmlpatterns/api/qxmlquery.h +++ b/src/xmlpatterns/api/qxmlquery.h @@ -71,6 +71,8 @@ namespace QPatternistSDK namespace QPatternist { + class XsdSchemaParser; + class XsdValidatingInstanceReader; class VariableLoader; }; @@ -79,8 +81,11 @@ class Q_XMLPATTERNS_EXPORT QXmlQuery public: enum QueryLanguage { - XQuery10 = 1, - XSLT20 = 2 + XQuery10 = 1, + XSLT20 = 2, + XmlSchema11IdentityConstraintSelector = 1024, + XmlSchema11IdentityConstraintField = 2048, + XPath20 = 4096 }; QXmlQuery(); @@ -135,6 +140,8 @@ private: friend class QXmlName; friend class QXmlSerializer; friend class QPatternistSDK::TestCase; + friend class QPatternist::XsdSchemaParser; + friend class QPatternist::XsdValidatingInstanceReader; friend class QPatternist::VariableLoader; template friend bool setFocusHelper(QXmlQuery *const queryInstance, const TInputType &focusValue); diff --git a/src/xmlpatterns/api/qxmlquery_p.h b/src/xmlpatterns/api/qxmlquery_p.h index c8ed441..7f58f97 100644 --- a/src/xmlpatterns/api/qxmlquery_p.h +++ b/src/xmlpatterns/api/qxmlquery_p.h @@ -142,13 +142,10 @@ public: if(!m_functionFactory) { - if(queryLanguage == QXmlQuery::XQuery10) - m_functionFactory = QPatternist::FunctionFactoryCollection::xpath20Factory(namePool.d); - else - { - Q_ASSERT(queryLanguage == QXmlQuery::XSLT20); + if(queryLanguage == QXmlQuery::XSLT20) m_functionFactory = QPatternist::FunctionFactoryCollection::xslt20Factory(namePool.d); - } + else + m_functionFactory = QPatternist::FunctionFactoryCollection::xpath20Factory(namePool.d); } const QPatternist::GenericStaticContext::Ptr genericStaticContext(new QPatternist::GenericStaticContext(namePool.d, @@ -164,6 +161,14 @@ public: if(!contextItem.isNull()) m_staticContext = QPatternist::StaticContext::Ptr(new QPatternist::StaticFocusContext(QPatternist::AtomicValue::qtToXDMType(contextItem), m_staticContext)); + else if( queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintField + || queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintSelector + || queryLanguage == QXmlQuery::XPath20) + m_staticContext = QPatternist::StaticContext::Ptr(new QPatternist::StaticFocusContext(QPatternist::BuiltinTypes::node, m_staticContext)); + + for (int i = 0; i < m_additionalNamespaceBindings.count(); ++i) { + m_staticContext->namespaceBindings()->addBinding(m_additionalNamespaceBindings.at(i)); + } return m_staticContext; } @@ -278,6 +283,11 @@ public: return m_expr; } + inline void addAdditionalNamespaceBinding(const QXmlName &binding) + { + m_additionalNamespaceBindings.append(binding); + } + QXmlNamePool namePool; QPointer messageHandler; /** @@ -321,6 +331,8 @@ public: QPatternist::SequenceType::Ptr m_requiredType; QPatternist::FunctionFactory::Ptr m_functionFactory; QPatternist::NetworkAccessDelegator::Ptr m_networkAccessDelegator; + + QList m_additionalNamespaceBindings; }; QT_END_NAMESPACE diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp new file mode 100644 index 0000000..55b96cd --- /dev/null +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -0,0 +1,229 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxmlschema.h" +#include "qxmlschema_p.h" + +#include +#include + +/*! + \class QXmlSchema + + \brief The QXmlSchema class provides loading and validation of a W3C XML Schema. + + \reentrant + \since 4.X + \ingroup xml-tools + + The QXmlSchema class loads, compiles and validates W3C XML Schema files + that can be used further for validation of XML instance documents via + \l{QXmlSchemaValidator}. +*/ + +/*! + Constructs an invalid, empty schema that cannot be used until + setSchema() is called. + */ +QXmlSchema::QXmlSchema() + : d(new QXmlSchemaPrivate(QXmlNamePool())) +{ +} + +/*! + Constructs a QXmlSchema that is a copy of \a other. The new + instance will share resources with the existing schema + to the extent possible. + */ +QXmlSchema::QXmlSchema(const QXmlSchema &other) + : d(other.d) +{ +} + +/*! + Destroys this QXmlSchema. + */ +QXmlSchema::~QXmlSchema() +{ +} + +/*! + Sets this QXmlSchema to a schema loaded from the \a source + URI. + */ +void QXmlSchema::load(const QUrl &source) +{ + d->load(source, QString()); +} + +/*! + Sets this QXmlSchema to a schema read from the \a source + device. The device must have been opened with at least + QIODevice::ReadOnly. + + \a documentUri represents the schema obtained from the \a source + device. It is the base URI of the schema, that is used + internally to resolve relative URIs that appear in the schema, and + for message reporting. + + If \a source is \c null or not readable, or if \a documentUri is not + a valid URI, behavior is undefined. + \sa isValid() + */ +void QXmlSchema::load(QIODevice *source, const QUrl &documentUri) +{ + d->load(source, documentUri, QString()); +} + +/*! + Sets this QXmlSchema to a schema read from the \a data + + \a documentUri represents the schema obtained from the \a data. + It is the base URI of the schema, that is used internally to + resolve relative URIs that appear in the schema, and + for message reporting. + + If \a documentUri is not a valid URI, behavior is undefined. + \sa isValid() + */ +void QXmlSchema::load(const QByteArray &data, const QUrl &documentUri) +{ + d->load(data, documentUri, QString()); +} + +/*! + Returns true if this schema is valid. Examples of invalid schemas + are ones that contain syntax errors or that do not conform the + W3C XML Schema specification. + */ +bool QXmlSchema::isValid() const +{ + return d->isValid(); +} + +/*! + Returns the name pool used by this QXmlSchema for constructing \l + {QXmlName} {names}. There is no setter for the name pool, because + mixing name pools causes errors due to name confusion. + */ +QXmlNamePool QXmlSchema::namePool() const +{ + return d->namePool(); +} + +/*! + Returns the document URI of the schema or an empty URI if no + schema has been set. + */ +QUrl QXmlSchema::documentUri() const +{ + return d->documentUri(); +} + +/*! + Changes the \l {QAbstractMessageHandler}{message handler} for this + QXmlSchema to \a handler. The schema sends all compile and + validation messages to this message handler. QXmlSchema does not take + ownership of \a handler. + + Normally, the default message handler is sufficient. It writes + compile and validation messages to \e stderr. The default message + handler includes color codes if \e stderr can render colors. + + When QXmlSchema calls QAbstractMessageHandler::message(), + the arguments are as follows: + + \table + \header + \o message() argument + \o Semantics + \row + \o QtMsgType type + \o Only QtWarningMsg and QtFatalMsg are used. The former + identifies a warning, while the latter identifies an error. + \row + \o const QString & description + \o An XHTML document which is the actual message. It is translated + into the current language. + \row + \o const QUrl &identifier + \o Identifies the error with a URI, where the fragment is + the error code, and the rest of the URI is the error namespace. + \row + \o const QSourceLocation & sourceLocation + \o Identifies where the error occurred. + \endtable + + */ +void QXmlSchema::setMessageHandler(QAbstractMessageHandler *handler) +{ + d->setMessageHandler(handler); +} + +/*! + Returns the message handler that handles compile and validation + messages for this QXmlSchema. + */ +QAbstractMessageHandler *QXmlSchema::messageHandler() const +{ + return d->messageHandler(); +} + +/*! + Sets the URI resolver to \a resolver. QXmlSchema does not take + ownership of \a resolver. + + \sa uriResolver() + */ +void QXmlSchema::setUriResolver(QAbstractUriResolver *resolver) +{ + d->setUriResolver(resolver); +} + +/*! + Returns the schema's URI resolver. If no URI resolver has been set, + QtXmlPatterns will use the URIs in queries as they are. + + The URI resolver provides a level of abstraction, or \e{polymorphic + URIs}. A resolver can rewrite \e{logical} URIs to physical ones, or + it can translate obsolete or invalid URIs to valid ones. + + When QtXmlPatterns calls QAbstractUriResolver::resolve() the + absolute URI is the URI mandated by the schema specification, and the + relative URI is the URI specified by the user. + + \sa setUriResolver() + */ +QAbstractUriResolver *QXmlSchema::uriResolver() const +{ + return d->uriResolver(); +} + +/*! + Sets the network manager to \a manager. + QXmlSchema does not take ownership of \a manager. + + \sa networkAccessManager() + */ +void QXmlSchema::setNetworkAccessManager(QNetworkAccessManager *manager) +{ + d->setNetworkAccessManager(manager); +} + +/*! + Returns the network manager, or 0 if it has not been set. + + \sa setNetworkAccessManager() + */ +QNetworkAccessManager *QXmlSchema::networkAccessManager() const +{ + return d->networkAccessManager(); +} diff --git a/src/xmlpatterns/api/qxmlschema.h b/src/xmlpatterns/api/qxmlschema.h new file mode 100644 index 0000000..225cce2 --- /dev/null +++ b/src/xmlpatterns/api/qxmlschema.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLSCHEMA_H +#define QXMLSCHEMA_H + +#include +#include + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QAbstractMessageHandler; +class QAbstractUriResolver; +class QIODevice; +class QNetworkAccessManager; +class QUrl; +class QXmlNamePool; +class QXmlSchemaPrivate; + +class Q_XMLPATTERNS_EXPORT QXmlSchema +{ + friend class QXmlSchemaValidatorPrivate; + + public: + QXmlSchema(); + QXmlSchema(const QXmlSchema &other); + ~QXmlSchema(); + + void load(const QUrl &source); + void load(QIODevice *source, const QUrl &documentUri); + void load(const QByteArray &data, const QUrl &documentUri); + + bool isValid() const; + + QXmlNamePool namePool() const; + QUrl documentUri() const; + + void setMessageHandler(QAbstractMessageHandler *handler); + QAbstractMessageHandler *messageHandler() const; + + void setUriResolver(QAbstractUriResolver *resolver); + QAbstractUriResolver *uriResolver() const; + + void setNetworkAccessManager(QNetworkAccessManager *networkmanager); + QNetworkAccessManager *networkAccessManager() const; + + private: + QSharedDataPointer d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/api/qxmlschema_p.cpp b/src/xmlpatterns/api/qxmlschema_p.cpp new file mode 100644 index 0000000..ebcccee --- /dev/null +++ b/src/xmlpatterns/api/qxmlschema_p.cpp @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qacceltreeresourceloader_p.h" +#include "qxmlschema.h" +#include "qxmlschema_p.h" + +#include +#include +#include + +QXmlSchemaPrivate::QXmlSchemaPrivate(const QXmlNamePool &namePool) + : m_namePool(namePool) + , m_userMessageHandler(0) + , m_uriResolver(0) + , m_userNetworkAccessManager(0) + , m_schemaContext(new QPatternist::XsdSchemaContext(m_namePool.d)) + , m_schemaParserContext(new QPatternist::XsdSchemaParserContext(m_namePool.d, m_schemaContext)) + , m_schemaIsValid(false) +{ + m_networkAccessManager = new QPatternist::ReferenceCountedValue(new QNetworkAccessManager()); + m_messageHandler = new QPatternist::ReferenceCountedValue(new QPatternist::ColoringMessageHandler()); +} + +QXmlSchemaPrivate::QXmlSchemaPrivate(const QPatternist::XsdSchemaContext::Ptr &schemaContext) + : m_namePool(QXmlNamePool(schemaContext->namePool().data())) + , m_userMessageHandler(0) + , m_uriResolver(0) + , m_userNetworkAccessManager(0) + , m_schemaContext(schemaContext) + , m_schemaParserContext(new QPatternist::XsdSchemaParserContext(m_namePool.d, m_schemaContext)) + , m_schemaIsValid(false) +{ + m_networkAccessManager = new QPatternist::ReferenceCountedValue(new QNetworkAccessManager()); + m_messageHandler = new QPatternist::ReferenceCountedValue(new QPatternist::ColoringMessageHandler()); +} + +QXmlSchemaPrivate::QXmlSchemaPrivate(const QXmlSchemaPrivate &other) + : QSharedData(other) +{ + m_namePool = other.m_namePool; + m_userMessageHandler = other.m_userMessageHandler; + m_uriResolver = other.m_uriResolver; + m_userNetworkAccessManager = other.m_userNetworkAccessManager; + m_messageHandler = other.m_messageHandler; + m_networkAccessManager = other.m_networkAccessManager; + + m_schemaContext = other.m_schemaContext; + m_schemaParserContext = other.m_schemaParserContext; + m_schemaIsValid = other.m_schemaIsValid; + m_documentUri = other.m_documentUri; +} + +void QXmlSchemaPrivate::load(const QUrl &source, const QString &targetNamespace) +{ + m_documentUri = source; + + m_schemaContext->setMessageHandler(messageHandler()); + m_schemaContext->setUriResolver(uriResolver()); + m_schemaContext->setNetworkAccessManager(networkAccessManager()); + + const QPatternist::AutoPtr reply(QPatternist::AccelTreeResourceLoader::load(source, m_schemaContext->networkAccessManager(), + m_schemaContext, QPatternist::AccelTreeResourceLoader::ContinueOnError)); + if (reply) + load(reply.data(), source, targetNamespace); +} + +void QXmlSchemaPrivate::load(const QByteArray &data, const QUrl &documentUri, const QString &targetNamespace) +{ + QByteArray localData(data); + + QBuffer buffer(&localData); + buffer.open(QIODevice::ReadOnly); + + load(&buffer, documentUri, targetNamespace); +} + +void QXmlSchemaPrivate::load(QIODevice *source, const QUrl &documentUri, const QString &targetNamespace) +{ + m_schemaParserContext = QPatternist::XsdSchemaParserContext::Ptr(new QPatternist::XsdSchemaParserContext(m_namePool.d, m_schemaContext)); + m_schemaIsValid = false; + + if (!source) { + qWarning("A null QIODevice pointer cannot be passed."); + return; + } + + if (!source->isReadable()) { + qWarning("The device must be readable."); + return; + } + + m_documentUri = documentUri; + m_schemaContext->setMessageHandler(messageHandler()); + m_schemaContext->setUriResolver(uriResolver()); + m_schemaContext->setNetworkAccessManager(networkAccessManager()); + + QPatternist::XsdSchemaParser parser(m_schemaContext, m_schemaParserContext, source); + parser.setDocumentURI(documentUri); + parser.setTargetNamespace(targetNamespace); + + try { + parser.parse(); + m_schemaParserContext->resolver()->resolve(); + + m_schemaIsValid = true; + } catch (QPatternist::Exception exception) { + m_schemaIsValid = false; + } +} + +bool QXmlSchemaPrivate::isValid() const +{ + return m_schemaIsValid; +} + +QXmlNamePool QXmlSchemaPrivate::namePool() const +{ + return m_namePool; +} + +QUrl QXmlSchemaPrivate::documentUri() const +{ + return m_documentUri; +} + +void QXmlSchemaPrivate::setMessageHandler(QAbstractMessageHandler *handler) +{ + m_userMessageHandler = handler; +} + +QAbstractMessageHandler *QXmlSchemaPrivate::messageHandler() const +{ + if (m_userMessageHandler) + return m_userMessageHandler; + + return m_messageHandler.data()->value; +} + +void QXmlSchemaPrivate::setUriResolver(QAbstractUriResolver *resolver) +{ + m_uriResolver = resolver; +} + +QAbstractUriResolver *QXmlSchemaPrivate::uriResolver() const +{ + return m_uriResolver; +} + +void QXmlSchemaPrivate::setNetworkAccessManager(QNetworkAccessManager *networkmanager) +{ + m_userNetworkAccessManager = networkmanager; +} + +QNetworkAccessManager *QXmlSchemaPrivate::networkAccessManager() const +{ + if (m_userNetworkAccessManager) + return m_userNetworkAccessManager; + + return m_networkAccessManager.data()->value; +} diff --git a/src/xmlpatterns/api/qxmlschema_p.h b/src/xmlpatterns/api/qxmlschema_p.h new file mode 100644 index 0000000..e625f1e --- /dev/null +++ b/src/xmlpatterns/api/qxmlschema_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef QXMLSCHEMA_P_H +#define QXMLSCHEMA_P_H + +#include "qabstractmessagehandler.h" +#include "qabstracturiresolver.h" +#include "qautoptr_p.h" +#include "qcoloringmessagehandler_p.h" +#include "qreferencecountedvalue_p.h" + +#include "qxsdschemacontext_p.h" +#include "qxsdschemaparser_p.h" +#include "qxsdschemaparsercontext_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QXmlSchemaPrivate : public QSharedData +{ + public: + QXmlSchemaPrivate(const QXmlNamePool &namePool); + QXmlSchemaPrivate(const QPatternist::XsdSchemaContext::Ptr &schemaContext); + QXmlSchemaPrivate(const QXmlSchemaPrivate &other); + + void load(const QUrl &source, const QString &targetNamespace); + void load(QIODevice *source, const QUrl &documentUri, const QString &targetNamespace); + void load(const QByteArray &data, const QUrl &documentUri, const QString &targetNamespace); + bool isValid() const; + QXmlNamePool namePool() const; + QUrl documentUri() const; + void setMessageHandler(QAbstractMessageHandler *handler); + QAbstractMessageHandler *messageHandler() const; + void setUriResolver(QAbstractUriResolver *resolver); + QAbstractUriResolver *uriResolver() const; + void setNetworkAccessManager(QNetworkAccessManager *networkmanager); + QNetworkAccessManager *networkAccessManager() const; + + QXmlNamePool m_namePool; + QAbstractMessageHandler* m_userMessageHandler; + QAbstractUriResolver* m_uriResolver; + QNetworkAccessManager* m_userNetworkAccessManager; + QPatternist::ReferenceCountedValue::Ptr m_messageHandler; + QPatternist::ReferenceCountedValue::Ptr m_networkAccessManager; + + QPatternist::XsdSchemaContext::Ptr m_schemaContext; + QPatternist::XsdSchemaParserContext::Ptr m_schemaParserContext; + bool m_schemaIsValid; + QUrl m_documentUri; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp new file mode 100644 index 0000000..aa80537 --- /dev/null +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -0,0 +1,264 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxmlschemavalidator.h" +#include "qxmlschemavalidator_p.h" + +#include "qacceltreeresourceloader_p.h" +#include "qxmlschema.h" +#include "qxmlschema_p.h" +#include "qxsdvalidatinginstancereader_p.h" + +#include +#include +#include + +/*! + \class QXmlSchemaValidator + + \brief The QXmlSchemaValidator class validates XML instance documents against a W3C XML Schema. + + \reentrant + \since 4.X + \ingroup xml-tools + + The QXmlSchemaValidator class loads, parses an XML instance document and validates it + against a W3C XML Schema that has been compiled with \l{QXmlSchema}. +*/ + +/*! + Constructs a schema validator that will use \a schema for validation. + */ +QXmlSchemaValidator::QXmlSchemaValidator(const QXmlSchema &schema) + : d(new QXmlSchemaValidatorPrivate(schema)) +{ +} + +/*! + Destroys this QXmlSchemaValidator. + */ +QXmlSchemaValidator::~QXmlSchemaValidator() +{ + delete d; +} + +/*! + Sets the \a schema that shall be used for further validation. + */ +void QXmlSchemaValidator::setSchema(const QXmlSchema &schema) +{ + d->setSchema(schema); +} + +/*! + Validates the XML instance document read from \a data with the + given \a documentUri against the schema. + + Returns \c true if the XML instance document is valid according the + schema, \c false otherwise. + */ +bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentUri) +{ + QByteArray localData(data); + + QBuffer buffer(&localData); + buffer.open(QIODevice::ReadOnly); + + return validate(&buffer, documentUri); +} + +/*! + Validates the XML instance document read from \a source against the schema. + + Returns \c true if the XML instance document is valid according the + schema, \c false otherwise. + */ +bool QXmlSchemaValidator::validate(const QUrl &source) +{ + d->m_context->setMessageHandler(messageHandler()); + d->m_context->setUriResolver(uriResolver()); + d->m_context->setNetworkAccessManager(networkAccessManager()); + + const QPatternist::AutoPtr reply(QPatternist::AccelTreeResourceLoader::load(source, d->m_context->networkAccessManager(), + d->m_context, QPatternist::AccelTreeResourceLoader::ContinueOnError)); + if (reply) + return validate(reply.data(), source); + else + return false; +} + +/*! + Validates the XML instance document read from \a source with the + given \a documentUri against the schema. + + Returns \c true if the XML instance document is valid according the + schema, \c false otherwise. + */ +bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) +{ + if (!source) { + qWarning("A null QIODevice pointer cannot be passed."); + return false; + } + + if (!source->isReadable()) { + qWarning("The device must be readable."); + return false; + } + + d->m_context->setMessageHandler(messageHandler()); + d->m_context->setUriResolver(uriResolver()); + d->m_context->setNetworkAccessManager(networkAccessManager()); + + QPatternist::NetworkAccessDelegator::Ptr delegator(new QPatternist::NetworkAccessDelegator(d->m_context->networkAccessManager(), + d->m_context->networkAccessManager())); + + QPatternist::AccelTreeResourceLoader loader(d->m_context->namePool(), delegator, QPatternist::AccelTreeBuilder::SourceLocationsFeature); + + QPatternist::Item item; + try { + item = loader.openDocument(source, documentUri, d->m_context); + } catch (QPatternist::Exception exception) { + return false; + } + + QXmlNodeModelIndex index = item.asNode(); + const QAbstractXmlNodeModel *model = item.asNode().model(); + + QPatternist::XsdValidatedXmlNodeModel *validatedModel = new QPatternist::XsdValidatedXmlNodeModel(model); + + QPatternist::XsdValidatingInstanceReader reader(validatedModel, documentUri, d->m_context); + if (d->m_schema) + reader.addSchema(d->m_schema, d->m_schemaDocumentUri); + try { + reader.read(); + } catch (QPatternist::Exception exception) { + return false; + } + + return true; +} + +/*! + Returns the name pool used by this QXmlSchemaValidator for constructing \l + {QXmlName} {names}. There is no setter for the name pool, because + mixing name pools causes errors due to name confusion. + */ +QXmlNamePool QXmlSchemaValidator::namePool() const +{ + return d->m_namePool; +} + +/*! + Changes the \l {QAbstractMessageHandler}{message handler} for this + QXmlSchemaValidator to \a handler. The schema validator sends all parsing and + validation messages to this message handler. QXmlSchemaValidator does not take + ownership of \a handler. + + Normally, the default message handler is sufficient. It writes + compile and validation messages to \e stderr. The default message + handler includes color codes if \e stderr can render colors. + + When QXmlSchemaValidator calls QAbstractMessageHandler::message(), + the arguments are as follows: + + \table + \header + \o message() argument + \o Semantics + \row + \o QtMsgType type + \o Only QtWarningMsg and QtFatalMsg are used. The former + identifies a warning, while the latter identifies an error. + \row + \o const QString & description + \o An XHTML document which is the actual message. It is translated + into the current language. + \row + \o const QUrl &identifier + \o Identifies the error with a URI, where the fragment is + the error code, and the rest of the URI is the error namespace. + \row + \o const QSourceLocation & sourceLocation + \o Identifies where the error occurred. + \endtable + + */ +void QXmlSchemaValidator::setMessageHandler(QAbstractMessageHandler *handler) +{ + d->m_userMessageHandler = handler; +} + +/*! + Returns the message handler that handles parsing and validation + messages for this QXmlSchemaValidator. + */ +QAbstractMessageHandler *QXmlSchemaValidator::messageHandler() const +{ + if (d->m_userMessageHandler) + return d->m_userMessageHandler; + + return d->m_messageHandler.data()->value; +} + +/*! + Sets the URI resolver to \a resolver. QXmlSchemaValidator does not take + ownership of \a resolver. + + \sa uriResolver() + */ +void QXmlSchemaValidator::setUriResolver(QAbstractUriResolver *resolver) +{ + d->m_uriResolver = resolver; +} + +/*! + Returns the schema's URI resolver. If no URI resolver has been set, + QtXmlPatterns will use the URIs in queries as they are. + + The URI resolver provides a level of abstraction, or \e{polymorphic + URIs}. A resolver can rewrite \e{logical} URIs to physical ones, or + it can translate obsolete or invalid URIs to valid ones. + + When QtXmlPatterns calls QAbstractUriResolver::resolve() the + absolute URI is the URI mandated by the schema specification, and the + relative URI is the URI specified by the user. + + \sa setUriResolver() + */ +QAbstractUriResolver *QXmlSchemaValidator::uriResolver() const +{ + return d->m_uriResolver; +} + +/*! + Sets the network manager to \a manager. + QXmlSchemaValidator does not take ownership of \a manager. + + \sa networkAccessManager() + */ +void QXmlSchemaValidator::setNetworkAccessManager(QNetworkAccessManager *manager) +{ + d->m_userNetworkAccessManager = manager; +} + +/*! + Returns the network manager, or 0 if it has not been set. + + \sa setNetworkAccessManager() + */ +QNetworkAccessManager *QXmlSchemaValidator::networkAccessManager() const +{ + if (d->m_userNetworkAccessManager) + return d->m_userNetworkAccessManager; + + return d->m_networkAccessManager.data()->value; +} diff --git a/src/xmlpatterns/api/qxmlschemavalidator.h b/src/xmlpatterns/api/qxmlschemavalidator.h new file mode 100644 index 0000000..e643995 --- /dev/null +++ b/src/xmlpatterns/api/qxmlschemavalidator.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#ifndef QXMLSCHEMAVALIDATOR_H +#define QXMLSCHEMAVALIDATOR_H + +#include + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(XmlPatterns) + +class QAbstractMessageHandler; +class QAbstractUriResolver; +class QIODevice; +class QNetworkAccessManager; +class QUrl; +class QXmlNamePool; +class QXmlSchema; +class QXmlSchemaValidatorPrivate; + +class Q_XMLPATTERNS_EXPORT QXmlSchemaValidator +{ + public: + QXmlSchemaValidator(const QXmlSchema &schema); + ~QXmlSchemaValidator(); + + void setSchema(const QXmlSchema &schema); + + bool validate(const QUrl &source); + bool validate(QIODevice *source, const QUrl &documentUri); + bool validate(const QByteArray &data, const QUrl &documentUri); + + QXmlNamePool namePool() const; + + void setMessageHandler(QAbstractMessageHandler *handler); + QAbstractMessageHandler *messageHandler() const; + + void setUriResolver(QAbstractUriResolver *resolver); + QAbstractUriResolver *uriResolver() const; + + void setNetworkAccessManager(QNetworkAccessManager *networkmanager); + QNetworkAccessManager *networkAccessManager() const; + + private: + QXmlSchemaValidatorPrivate* const d; + + Q_DISABLE_COPY(QXmlSchemaValidator) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/api/qxmlschemavalidator_p.h b/src/xmlpatterns/api/qxmlschemavalidator_p.h new file mode 100644 index 0000000..0990f73 --- /dev/null +++ b/src/xmlpatterns/api/qxmlschemavalidator_p.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef QXMLSCHEMAVALIDATOR_P_H +#define QXMLSCHEMAVALIDATOR_P_H + +#include "qabstractmessagehandler.h" +#include "qabstracturiresolver.h" +#include "qautoptr_p.h" +#include "qcoloringmessagehandler_p.h" +#include "qxmlschema.h" +#include "qxmlschema_p.h" + +#include "qxsdschemacontext_p.h" +#include "qxsdschema_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QXmlSchemaValidatorPrivate +{ +public: + QXmlSchemaValidatorPrivate(const QXmlSchema &schema) + : m_namePool(schema.namePool()) + , m_userMessageHandler(0) + , m_uriResolver(0) + , m_userNetworkAccessManager(0) + { + setSchema(schema); + + const QXmlSchemaPrivate *p = schema.d; + + // initialize the environment properties with the ones from the schema + + if (p->m_userNetworkAccessManager) // schema has user defined network access manager + m_userNetworkAccessManager = p->m_userNetworkAccessManager; + else + m_networkAccessManager = p->m_networkAccessManager; + + if (p->m_userMessageHandler) // schema has user defined message handler + m_userMessageHandler = p->m_userMessageHandler; + else + m_messageHandler = p->m_messageHandler; + + m_uriResolver = p->m_uriResolver; + } + + void setSchema(const QXmlSchema &schema) + { + // use same name pool as the schema + m_namePool = schema.namePool(); + m_schema = schema.d->m_schemaParserContext->schema(); + m_schemaDocumentUri = schema.documentUri(); + + // create a new schema context + m_context = QPatternist::XsdSchemaContext::Ptr(new QPatternist::XsdSchemaContext(m_namePool.d)); + m_context->m_schemaTypeFactory = schema.d->m_schemaContext->m_schemaTypeFactory; + m_context->m_builtinTypesFacetList = schema.d->m_schemaContext->m_builtinTypesFacetList; + } + + QXmlNamePool m_namePool; + QAbstractMessageHandler* m_userMessageHandler; + QAbstractUriResolver* m_uriResolver; + QNetworkAccessManager* m_userNetworkAccessManager; + QPatternist::ReferenceCountedValue::Ptr m_messageHandler; + QPatternist::ReferenceCountedValue::Ptr m_networkAccessManager; + + QPatternist::XsdSchemaContext::Ptr m_context; + QPatternist::XsdSchema::Ptr m_schema; + QUrl m_schemaDocumentUri; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/common.pri b/src/xmlpatterns/common.pri index 2573a26..27253d8 100644 --- a/src/xmlpatterns/common.pri +++ b/src/xmlpatterns/common.pri @@ -10,6 +10,7 @@ INCLUDEPATH += $$PWD/acceltree \ $$PWD/iterators \ $$PWD/janitors \ $$PWD/parser \ + $$PWD/schema \ $$PWD/type \ $$PWD/utils diff --git a/src/xmlpatterns/data/data.pri b/src/xmlpatterns/data/data.pri index 99591d4..ccfed42 100644 --- a/src/xmlpatterns/data/data.pri +++ b/src/xmlpatterns/data/data.pri @@ -1,8 +1,8 @@ HEADERS += $$PWD/qabstractdatetime_p.h \ $$PWD/qabstractduration_p.h \ $$PWD/qabstractfloatcasters_p.h \ - $$PWD/qabstractfloat_p.h \ $$PWD/qabstractfloatmathematician_p.h \ + $$PWD/qabstractfloat_p.h \ $$PWD/qanyuri_p.h \ $$PWD/qatomiccaster_p.h \ $$PWD/qatomiccasters_p.h \ @@ -14,8 +14,8 @@ HEADERS += $$PWD/qabstractdatetime_p.h \ $$PWD/qbase64binary_p.h \ $$PWD/qboolean_p.h \ $$PWD/qcommonvalues_p.h \ + $$PWD/qcomparisonfactory_p.h \ $$PWD/qdate_p.h \ - $$PWD/qschemadatetime_p.h \ $$PWD/qdaytimeduration_p.h \ $$PWD/qdecimal_p.h \ $$PWD/qderivedinteger_p.h \ @@ -24,19 +24,21 @@ HEADERS += $$PWD/qabstractdatetime_p.h \ $$PWD/qgday_p.h \ $$PWD/qgmonthday_p.h \ $$PWD/qgmonth_p.h \ - $$PWD/qgyear_p.h \ $$PWD/qgyearmonth_p.h \ + $$PWD/qgyear_p.h \ $$PWD/qhexbinary_p.h \ $$PWD/qinteger_p.h \ $$PWD/qitem_p.h \ $$PWD/qnodebuilder_p.h \ - $$PWD/qschemanumeric_p.h \ $$PWD/qqnamevalue_p.h \ $$PWD/qresourceloader_p.h \ - $$PWD/qsorttuple.cpp \ + $$PWD/qschemadatetime_p.h \ + $$PWD/qschemanumeric_p.h \ $$PWD/qschematime_p.h \ + $$PWD/qsorttuple.cpp \ $$PWD/quntypedatomic_p.h \ $$PWD/qvalidationerror_p.h \ + $$PWD/qvaluefactory_p.h \ $$PWD/qyearmonthduration_p.h SOURCES += $$PWD/qabstractdatetime.cpp \ @@ -53,8 +55,8 @@ SOURCES += $$PWD/qabstractdatetime.cpp \ $$PWD/qbase64binary.cpp \ $$PWD/qboolean.cpp \ $$PWD/qcommonvalues.cpp \ + $$PWD/qcomparisonfactory.cpp \ $$PWD/qdate.cpp \ - $$PWD/qschemadatetime.cpp \ $$PWD/qdaytimeduration.cpp \ $$PWD/qdecimal.cpp \ $$PWD/qduration.cpp \ @@ -68,11 +70,13 @@ SOURCES += $$PWD/qabstractdatetime.cpp \ $$PWD/qitem.cpp \ $$PWD/qnodebuilder.cpp \ $$PWD/qnodemodel.cpp \ - $$PWD/qschemanumeric.cpp \ $$PWD/qqnamevalue.cpp \ $$PWD/qresourceloader.cpp \ - $$PWD/qsorttuple.cpp \ + $$PWD/qschemadatetime.cpp \ + $$PWD/qschemanumeric.cpp \ $$PWD/qschematime.cpp \ + $$PWD/qsorttuple.cpp \ $$PWD/quntypedatomic.cpp \ $$PWD/qvalidationerror.cpp \ + $$PWD/qvaluefactory.cpp \ $$PWD/qyearmonthduration.cpp diff --git a/src/xmlpatterns/data/qcomparisonfactory.cpp b/src/xmlpatterns/data/qcomparisonfactory.cpp new file mode 100644 index 0000000..7fe298b --- /dev/null +++ b/src/xmlpatterns/data/qcomparisonfactory.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qatomiccomparators_p.h" +#include "qatomicstring_p.h" +#include "qcomparisonplatform_p.h" +#include "qvaluefactory_p.h" + +#include "qcomparisonfactory_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +/** + * @short Helper class for ComparisonFactory::fromLexical() which exposes + * CastingPlatform appropriately. + * + * @relates ComparisonFactory + */ +class PerformComparison : public ComparisonPlatform + , public SourceLocationReflection +{ +public: + PerformComparison(const SourceLocationReflection *const sourceLocationReflection, + const AtomicComparator::Operator op) : m_sourceReflection(sourceLocationReflection) + , m_operator(op) + { + Q_ASSERT(m_sourceReflection); + } + + bool operator()(const AtomicValue::Ptr &operand1, + const AtomicValue::Ptr &operand2, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context) + { + const ItemType::Ptr asItemType((AtomicType::Ptr(type))); + + /* One area where the Query Transform world differs from the Schema + * world is that @c xs:duration is not considedered comparable, because + * it's according to Schema is partially comparable. This means + * ComparisonPlatform::fetchComparator() flags it as impossible, and + * hence we need to override that. + * + * SchemaType::wxsTypeMatches() will return true for sub-types of @c + * xs:duration as well, but that's ok since AbstractDurationComparator + * works for them too. */ + if(BuiltinTypes::xsDuration->wxsTypeMatches(type)) + prepareComparison(AtomicComparator::Ptr(new AbstractDurationComparator())); + else if (BuiltinTypes::xsGYear->wxsTypeMatches(type) || + BuiltinTypes::xsGYearMonth->wxsTypeMatches(type) || + BuiltinTypes::xsGMonth->wxsTypeMatches(type) || + BuiltinTypes::xsGMonthDay->wxsTypeMatches(type) || + BuiltinTypes::xsGDay->wxsTypeMatches(type)) + prepareComparison(AtomicComparator::Ptr(new AbstractDateTimeComparator())); + else + prepareComparison(fetchComparator(asItemType, asItemType, context)); + + return flexibleCompare(operand1, operand2, context); + } + + const SourceLocationReflection *actualReflection() const + { + return m_sourceReflection; + } + + AtomicComparator::Operator operatorID() const + { + return m_operator; + } + +private: + const SourceLocationReflection *const m_sourceReflection; + const AtomicComparator::Operator m_operator; +}; + +bool ComparisonFactory::compare(const AtomicValue::Ptr &operand1, + const AtomicComparator::Operator op, + const AtomicValue::Ptr &operand2, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection) +{ + Q_ASSERT(operand1); + Q_ASSERT(operand2); + Q_ASSERT(context); + Q_ASSERT(sourceLocationReflection); + Q_ASSERT(type); + Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO, + "We can only compare atomic values."); + + return PerformComparison(sourceLocationReflection, op)(operand1, operand2, type, context); +} + +bool ComparisonFactory::constructAndCompare(const DerivedString::Ptr &operand1, + const AtomicComparator::Operator op, + const DerivedString::Ptr &operand2, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection) +{ + Q_ASSERT(operand1); + Q_ASSERT(operand2); + Q_ASSERT(context); + Q_ASSERT(sourceLocationReflection); + Q_ASSERT(type); + Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO, + "We can only compare atomic values."); + + const AtomicValue::Ptr value1 = ValueFactory::fromLexical(operand1->stringValue(), type, context, sourceLocationReflection); + const AtomicValue::Ptr value2 = ValueFactory::fromLexical(operand2->stringValue(), type, context, sourceLocationReflection); + + return compare(value1, op, value2, type, context, sourceLocationReflection); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/data/qcomparisonfactory_p.h b/src/xmlpatterns/data/qcomparisonfactory_p.h new file mode 100644 index 0000000..09fc50b --- /dev/null +++ b/src/xmlpatterns/data/qcomparisonfactory_p.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_ComparisonFactory_H +#define Patternist_ComparisonFactory_H + +#include "qatomiccomparator_p.h" +#include "qderivedstring_p.h" +#include "qitem_p.h" +#include "qreportcontext_p.h" +#include "qschematype_p.h" + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Provides compare(), which is a high-level helper function for + * comparing atomic values. + * + * This class wraps the helper class ComparisonPlatform with a more specific, + * high-level API. + * + * @see ComparisonPlatform + * @author Frans Englich + * @ingroup Patternist_schema + */ + class ComparisonFactory + { + public: + /** + * @short Returns the result of evaluating operator @p op applied to the atomic + * values @p operand1 and @p operand2. + * + * The caller guarantees that both values are of type @p type. + * + * ComparisonFactory does not take ownership of @p sourceLocationReflection. + */ + static bool compare(const AtomicValue::Ptr &operand1, + const AtomicComparator::Operator op, + const AtomicValue::Ptr &operand2, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection); + + /** + * @short Returns the result of evaluating operator @p op applied to the atomic + * values @p operand1 and @p operand2. + * + * In opposite to compare() it converts the operands from string type + * to @p type and compares these constructed types. + * + * The caller guarantees that both values are of type @p type. + * + * ComparisonFactory does not take ownership of @p sourceLocationReflection. + */ + static bool constructAndCompare(const DerivedString::Ptr &operand1, + const AtomicComparator::Operator op, + const DerivedString::Ptr &operand2, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection); + + private: + Q_DISABLE_COPY(ComparisonFactory) + }; +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/data/qitem_p.h b/src/xmlpatterns/data/qitem_p.h index 987a1c2..08b318d 100644 --- a/src/xmlpatterns/data/qitem_p.h +++ b/src/xmlpatterns/data/qitem_p.h @@ -128,6 +128,11 @@ namespace QPatternist typedef QExplicitlySharedDataPointer Ptr; /** + * A list if smart pointers wrapping AtomicValue instances. + */ + typedef QList List; + + /** * Determines whether this atomic value has an error. This is used * for implementing casting. * diff --git a/src/xmlpatterns/data/qvaluefactory.cpp b/src/xmlpatterns/data/qvaluefactory.cpp new file mode 100644 index 0000000..04df29d --- /dev/null +++ b/src/xmlpatterns/data/qvaluefactory.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qatomiccaster_p.h" +#include "qatomicstring_p.h" +#include "qcastingplatform_p.h" +#include "qvaluefactory_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +/** + * @short Helper class for ValueFactory::fromLexical() which exposes + * CastingPlatform appropriately. + * + * @relates ValueFactory + */ +class PerformValueConstruction : public CastingPlatform + , public SourceLocationReflection +{ +public: + PerformValueConstruction(const SourceLocationReflection *const sourceLocationReflection, + const SchemaType::Ptr &toType) : m_sourceReflection(sourceLocationReflection) + , m_targetType(AtomicType::Ptr(toType)) + { + Q_ASSERT(m_sourceReflection); + } + + AtomicValue::Ptr operator()(const AtomicValue::Ptr &lexicalValue, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context) + { + prepareCasting(context, BuiltinTypes::xsString); + return AtomicValue::Ptr(const_cast(cast(lexicalValue, context).asAtomicValue())); + } + + const SourceLocationReflection *actualReflection() const + { + return m_sourceReflection; + } + + ItemType::Ptr targetType() const + { + return m_targetType; + } + +private: + const SourceLocationReflection *const m_sourceReflection; + const ItemType::Ptr m_targetType; +}; + +AtomicValue::Ptr ValueFactory::fromLexical(const QString &lexicalValue, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection) +{ + Q_ASSERT(context); + Q_ASSERT(type); + Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO, + "We can only construct for atomic values."); + + return PerformValueConstruction(sourceLocationReflection, type)(AtomicString::fromValue(lexicalValue), + type, + context); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/data/qvaluefactory_p.h b/src/xmlpatterns/data/qvaluefactory_p.h new file mode 100644 index 0000000..80b6207 --- /dev/null +++ b/src/xmlpatterns/data/qvaluefactory_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_ValueFactory_H +#define Patternist_ValueFactory_H + +#include "qitem_p.h" +#include "qreportcontext_p.h" +#include "qschematype_p.h" + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Provides fromLexical(), which allows instantiation of atomic + * values from arbitrary types. + * + * This class wraps the helper class CastingPlatform with a more specific, + * high-level API. + * + * @see CastingPlatform + * @author Frans Englich + * @ingroup Patternist_schema + */ + class ValueFactory + { + public: + /** + * @short Returns an AtomicValue of type @p type from the lexical space + * @p lexicalValue, and raise an error through @p context if that's + * impossible. + * + * ValueFactory does not take ownership of @p sourceLocationReflection. + */ + static AtomicValue::Ptr fromLexical(const QString &lexicalValue, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection); + + private: + Q_DISABLE_COPY(ValueFactory) + }; +} + +QT_END_NAMESPACE +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/environment/createReportContext.xsl b/src/xmlpatterns/environment/createReportContext.xsl index e648c56..1db00e7 100644 --- a/src/xmlpatterns/environment/createReportContext.xsl +++ b/src/xmlpatterns/environment/createReportContext.xsl @@ -242,6 +242,11 @@ namespace QPatternist */]]> enum ErrorCode { + /** + * XML Schema error code. + */ + XSDError, + diff --git a/src/xmlpatterns/environment/qreportcontext.cpp b/src/xmlpatterns/environment/qreportcontext.cpp index 9704a54..acd6be0 100644 --- a/src/xmlpatterns/environment/qreportcontext.cpp +++ b/src/xmlpatterns/environment/qreportcontext.cpp @@ -448,6 +448,7 @@ QString ReportContext::codeToString(const ReportContext::ErrorCode code) case XTTE1545: result = "XTTE1545"; break; case XTTE1550: result = "XTTE1550"; break; case XTTE1555: result = "XTTE1555"; break; + case XSDError: result = "XSDError"; break; } Q_ASSERT_X(result, Q_FUNC_INFO, "Unknown enum value."); diff --git a/src/xmlpatterns/environment/qreportcontext_p.h b/src/xmlpatterns/environment/qreportcontext_p.h index bea2a97..8864756 100644 --- a/src/xmlpatterns/environment/qreportcontext_p.h +++ b/src/xmlpatterns/environment/qreportcontext_p.h @@ -151,6 +151,10 @@ namespace QPatternist */ enum ErrorCode { + /** + * XML Schema error code. + */ + XSDError, /** * It is a static error if analysis of an expression relies on some diff --git a/src/xmlpatterns/expr/qcastingplatform.cpp b/src/xmlpatterns/expr/qcastingplatform.cpp index 9e96fd8..16a1d60 100644 --- a/src/xmlpatterns/expr/qcastingplatform.cpp +++ b/src/xmlpatterns/expr/qcastingplatform.cpp @@ -83,7 +83,7 @@ Item CastingPlatform::cast(const Item &sourceValue, else { bool castImpossible = false; - const AtomicCaster::Ptr caster(locateCaster(sourceValue.type(), context, castImpossible)); + const AtomicCaster::Ptr caster(locateCaster(sourceValue.type(), context, castImpossible, static_cast(this), targetType())); if(!issueError && castImpossible) { @@ -112,7 +112,7 @@ bool CastingPlatform::prepareCasting(const ReportContext: or numeric at compile time. We'll do lookup at runtime instead. */ bool castImpossible = false; - m_caster = locateCaster(sourceType, context, castImpossible); + m_caster = locateCaster(sourceType, context, castImpossible, static_cast(this), targetType()); return !castImpossible; } @@ -120,20 +120,22 @@ bool CastingPlatform::prepareCasting(const ReportContext: template AtomicCaster::Ptr CastingPlatform::locateCaster(const ItemType::Ptr &sourceType, const ReportContext::Ptr &context, - bool &castImpossible) const + bool &castImpossible, + const SourceLocationReflection *const location, + const ItemType::Ptr &targetType) { Q_ASSERT(sourceType); - Q_ASSERT(targetType()); + Q_ASSERT(targetType); const AtomicCasterLocator::Ptr locator(static_cast( - targetType().data())->casterLocator()); + targetType.data())->casterLocator()); if(!locator) { if(issueError) { context->error(QtXmlPatterns::tr("No casting is possible with %1 as the target type.") - .arg(formatType(context->namePool(), targetType())), - ReportContext::XPTY0004, static_cast(this)); + .arg(formatType(context->namePool(), targetType)), + ReportContext::XPTY0004, location); } else castImpossible = true; @@ -141,15 +143,15 @@ AtomicCaster::Ptr CastingPlatform::locateCaster(const Ite return AtomicCaster::Ptr(); } - const AtomicCaster::Ptr caster(static_cast(sourceType.data())->accept(locator, static_cast(this))); + const AtomicCaster::Ptr caster(static_cast(sourceType.data())->accept(locator, location)); if(!caster) { if(issueError) { context->error(QtXmlPatterns::tr("It is not possible to cast from %1 to %2.") .arg(formatType(context->namePool(), sourceType)) - .arg(formatType(context->namePool(), targetType())), - ReportContext::XPTY0004, static_cast(this)); + .arg(formatType(context->namePool(), targetType)), + ReportContext::XPTY0004, location); } else castImpossible = true; diff --git a/src/xmlpatterns/expr/qcastingplatform_p.h b/src/xmlpatterns/expr/qcastingplatform_p.h index 458e9eb..a0144b2 100644 --- a/src/xmlpatterns/expr/qcastingplatform_p.h +++ b/src/xmlpatterns/expr/qcastingplatform_p.h @@ -52,16 +52,17 @@ #ifndef Patternist_CastingPlatform_H #define Patternist_CastingPlatform_H +#include "qatomiccasterlocator_p.h" #include "qatomiccaster_p.h" -#include "qqnamevalue_p.h" #include "qatomicstring_p.h" -#include "qvalidationerror_p.h" -#include "qatomiccasterlocator_p.h" #include "qatomictype_p.h" #include "qbuiltintypes_p.h" #include "qcommonsequencetypes_p.h" -#include "qschematypefactory_p.h" #include "qpatternistlocale_p.h" +#include "qqnamevalue_p.h" +#include "qschematypefactory_p.h" +#include "qstaticcontext_p.h" +#include "qvalidationerror_p.h" QT_BEGIN_HEADER @@ -101,6 +102,7 @@ namespace QPatternist * function targetType() must be implemented such that CastingPlatform knows * what type it shall cast to. * + * @see ValueFactory * @author Frans Englich * @ingroup Patternist_expressions */ @@ -167,9 +169,16 @@ namespace QPatternist * * @p castImpossible is not initialized. Initialize it to @c false. */ - AtomicCaster::Ptr locateCaster(const ItemType::Ptr &sourceType, - const ReportContext::Ptr &context, - bool &castImpossible) const; + static AtomicCaster::Ptr locateCaster(const ItemType::Ptr &sourceType, + const ReportContext::Ptr &context, + bool &castImpossible, + const SourceLocationReflection *const location, + const ItemType::Ptr &targetType); + private: + inline Item castWithCaster(const Item &sourceValue, + const AtomicCaster::Ptr &caster, + const DynamicContext::Ptr &context) const; + inline ItemType::Ptr targetType() const { diff --git a/src/xmlpatterns/expr/qexpressionfactory.cpp b/src/xmlpatterns/expr/qexpressionfactory.cpp index ec86be0..b41b0de 100644 --- a/src/xmlpatterns/expr/qexpressionfactory.cpp +++ b/src/xmlpatterns/expr/qexpressionfactory.cpp @@ -81,9 +81,13 @@ Expression::Ptr ExpressionFactory::createExpression(const QString &expr, const QUrl &queryURI, const QXmlName &initialTemplateName) { - if(lang == QXmlQuery::XQuery10) + if(lang == QXmlQuery::XSLT20) { - return createExpression(Tokenizer::Ptr(new XQueryTokenizer(expr, queryURI)), + QByteArray query(expr.toUtf8()); + QBuffer buffer(&query); + buffer.open(QIODevice::ReadOnly); + + return createExpression(&buffer, context, lang, requiredType, @@ -92,12 +96,7 @@ Expression::Ptr ExpressionFactory::createExpression(const QString &expr, } else { - Q_ASSERT(lang == QXmlQuery::XSLT20); - QByteArray query(expr.toUtf8()); - QBuffer buffer(&query); - buffer.open(QIODevice::ReadOnly); - - return createExpression(&buffer, + return createExpression(Tokenizer::Ptr(new XQueryTokenizer(expr, queryURI)), context, lang, requiredType, @@ -118,16 +117,10 @@ Expression::Ptr ExpressionFactory::createExpression(QIODevice *const device, Tokenizer::Ptr tokenizer; - if(lang == QXmlQuery::XQuery10) - { - - tokenizer = Tokenizer::Ptr(new XQueryTokenizer(QString::fromUtf8(device->readAll()), queryURI)); - } - else - { - Q_ASSERT(lang == QXmlQuery::XSLT20); + if(lang == QXmlQuery::XSLT20) tokenizer = Tokenizer::Ptr(new XSLTTokenizer(device, queryURI, context, context->namePool())); - } + else + tokenizer = Tokenizer::Ptr(new XQueryTokenizer(QString::fromUtf8(device->readAll()), queryURI)); return createExpression(tokenizer, context, lang, requiredType, queryURI, initialTemplateName); } diff --git a/src/xmlpatterns/functions/qpatternplatform.cpp b/src/xmlpatterns/functions/qpatternplatform.cpp index 0052a07..d99bac5 100644 --- a/src/xmlpatterns/functions/qpatternplatform.cpp +++ b/src/xmlpatterns/functions/qpatternplatform.cpp @@ -168,8 +168,15 @@ void PatternPlatform::applyFlags(const Flags flags, QRegExp &patternP) // TODO Apply the other flags, like 'x'. } +QRegExp PatternPlatform::parsePattern(const QString &pattern, + const ReportContext::Ptr &context) const +{ + return parsePattern(pattern, context, this); +} + QRegExp PatternPlatform::parsePattern(const QString &patternP, - const DynamicContext::Ptr &context) const + const ReportContext::Ptr &context, + const SourceLocationReflection *const location) { if(patternP == QLatin1String("(.)\\3") || patternP == QLatin1String("\\3") || @@ -177,7 +184,7 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP, { context->error(QLatin1String("We don't want to hang infinitely on K2-MatchesFunc-9, " "10 and 11. See Trolltech task 148505."), - ReportContext::FOER0000, this); + ReportContext::FOER0000, location); return QRegExp(); } @@ -189,14 +196,8 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP, * QChar::category(). */ rewrittenPattern.replace(QLatin1String("[\\i-[:]]"), QLatin1String("[a-zA-Z_]")); rewrittenPattern.replace(QLatin1String("[\\c-[:]]"), QLatin1String("[a-zA-Z0-9_\\-\\.]")); - rewrittenPattern.replace(QLatin1String("\\i"), QLatin1String("[a-zA-Z:_]")); - rewrittenPattern.replace(QLatin1String("\\c"), QLatin1String("[a-zA-Z0-9:_\\-\\.]")); - rewrittenPattern.replace(QLatin1String("\\p{L}"), QLatin1String("[a-zA-Z]")); - rewrittenPattern.replace(QLatin1String("\\p{Lu}"), QLatin1String("[A-Z]")); - rewrittenPattern.replace(QLatin1String("\\p{Ll}"), QLatin1String("[a-z]")); - rewrittenPattern.replace(QLatin1String("\\p{Nd}"), QLatin1String("[0-9]")); - QRegExp retval(rewrittenPattern); + QRegExp retval(rewrittenPattern, Qt::CaseSensitive, QRegExp::W3CXmlSchema11); if(retval.isValid()) return retval; @@ -204,7 +205,7 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP, { context->error(QtXmlPatterns::tr("%1 is an invalid regular expression pattern: %2") .arg(formatExpression(patternP), retval.errorString()), - ReportContext::FORX0002, this); + ReportContext::FORX0002, location); return QRegExp(); } } diff --git a/src/xmlpatterns/functions/qpatternplatform_p.h b/src/xmlpatterns/functions/qpatternplatform_p.h index ce0dbd4..28da452 100644 --- a/src/xmlpatterns/functions/qpatternplatform_p.h +++ b/src/xmlpatterns/functions/qpatternplatform_p.h @@ -122,6 +122,14 @@ namespace QPatternist */ inline int captureCount() const; + /** + * @short Parses pattern + */ + static QRegExp parsePattern(const QString &pattern, + const ReportContext::Ptr &context, + const SourceLocationReflection *const location); + + protected: /** * @short This constructor is protected, because this class is supposed to be sub-classed. @@ -146,14 +154,18 @@ namespace QPatternist }; typedef QFlags PreCompiledParts; + /** + * @short Calls the public parsePattern() function and passes in @c + * this as the location. + */ + inline QRegExp parsePattern(const QString &pattern, + const ReportContext::Ptr &context) const; + Q_DISABLE_COPY(PatternPlatform) Flags parseFlags(const QString &flags, const DynamicContext::Ptr &context) const; - QRegExp parsePattern(const QString &pattern, - const DynamicContext::Ptr &context) const; - static void applyFlags(const Flags flags, QRegExp &pattern); /** diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp index 60e3a0c..b2f8cd2 100644 --- a/src/xmlpatterns/parser/qquerytransformparser.cpp +++ b/src/xmlpatterns/parser/qquerytransformparser.cpp @@ -300,11 +300,18 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, } /** + * @internal + * @relates QXmlQuery + */ +typedef QFlags QueryLanguages; + +/** * @short Flags invalid expressions and declarations in the currently * parsed language. * - * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0 and - * XPath 2.0 inside XSL-T, it is the union of all the constructs in these + * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0, and + * XPath 2.0 inside XSL-T, and field and selector patterns in W3C XML Schema's + * identity constraints, it is the union of all the constructs in these * languages. However, when dealing with each language individually, we * regularly need to disallow some expressions, such as direct element * constructors when parsing XSL-T, or the typeswitch when parsing XPath. @@ -315,19 +322,46 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, * instance the @c let clause, should not be flagged as an error, because it's * used for internal purposes. * - * Hence, this function is called from each expression and declaration which is - * unavailable in XPath. + * Hence, this function is called from each expression and declaration with @p + * allowedLanguages stating what languages it is allowed in. * * If @p isInternal is @c true, no error is raised. Otherwise, if the current - * language is not XQuery, an error is raised. + * language is not in @p allowedLanguages, an error is raised. */ -static void disallowedConstruct(const ParserContext *const parseInfo, - const YYLTYPE &sourceLocator, - const bool isInternal = false) +static void allowedIn(const QueryLanguages allowedLanguages, + const ParserContext *const parseInfo, + const YYLTYPE &sourceLocator, + const bool isInternal = false) { - if(!isInternal && parseInfo->languageAccent != QXmlQuery::XQuery10) + /* We treat XPath 2.0 as a subset of XSL-T 2.0, so if XPath 2.0 is allowed + * and XSL-T is the language, it's ok. */ + if(!isInternal && + (!allowedLanguages.testFlag(parseInfo->languageAccent) && !(allowedLanguages.testFlag(QXmlQuery::XPath20) && parseInfo->languageAccent == QXmlQuery::XSLT20))) { - parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered which only is allowed in XQuery."), + + QString langName; + + switch(parseInfo->languageAccent) + { + case QXmlQuery::XPath20: + langName = QLatin1String("XPath 2.0"); + break; + case QXmlQuery::XSLT20: + langName = QLatin1String("XSL-T 2.0"); + break; + case QXmlQuery::XQuery10: + langName = QLatin1String("XQuery 1.0"); + break; + case QXmlQuery::XmlSchema11IdentityConstraintSelector: + langName = QtXmlPatterns::tr("W3C XML Schema identity constraint selector"); + break; + case QXmlQuery::XmlSchema11IdentityConstraintField: + langName = QtXmlPatterns::tr("W3C XML Schema identity constraint field"); + break; + } + + parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered " + "which is disallowed in the current language(%1).").arg(langName), ReportContext::XPST0003, fromYYLTYPE(sourceLocator, parseInfo)); @@ -1366,7 +1400,7 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ /* Line 221 of yacc.c. */ -#line 1289 "qquerytransformparser.cpp" +#line 1323 "qquerytransformparser.cpp" #ifdef short # undef short @@ -1850,54 +1884,54 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 1341, 1341, 1342, 1344, 1345, 1376, 1377, 1393, 1491, - 1493, 1499, 1501, 1508, 1514, 1520, 1527, 1530, 1534, 1538, - 1558, 1572, 1576, 1570, 1639, 1643, 1660, 1663, 1665, 1670, - 1671, 1675, 1676, 1680, 1684, 1688, 1690, 1691, 1693, 1695, - 1741, 1755, 1760, 1765, 1766, 1768, 1783, 1798, 1808, 1823, - 1827, 1832, 1846, 1850, 1855, 1869, 1874, 1879, 1884, 1889, - 1905, 1928, 1936, 1937, 1938, 1940, 1957, 1958, 1960, 1961, - 1963, 1964, 1966, 2021, 2025, 2031, 2034, 2039, 2053, 2057, - 2063, 2062, 2171, 2174, 2180, 2201, 2207, 2211, 2213, 2218, - 2228, 2229, 2234, 2235, 2244, 2314, 2325, 2326, 2330, 2335, - 2404, 2405, 2409, 2414, 2458, 2459, 2464, 2471, 2477, 2478, - 2479, 2480, 2481, 2482, 2488, 2493, 2499, 2502, 2507, 2513, - 2519, 2523, 2548, 2549, 2553, 2557, 2551, 2598, 2601, 2596, - 2617, 2618, 2619, 2622, 2626, 2634, 2633, 2647, 2646, 2655, - 2656, 2657, 2659, 2667, 2678, 2681, 2683, 2688, 2695, 2702, - 2708, 2728, 2733, 2739, 2742, 2744, 2745, 2752, 2758, 2762, - 2767, 2768, 2771, 2775, 2770, 2784, 2788, 2783, 2796, 2799, - 2803, 2798, 2812, 2816, 2811, 2824, 2826, 2854, 2853, 2865, - 2873, 2864, 2884, 2885, 2888, 2892, 2897, 2902, 2901, 2917, - 2922, 2923, 2928, 2929, 2934, 2935, 2936, 2937, 2939, 2940, - 2945, 2946, 2951, 2952, 2954, 2955, 2960, 2961, 2962, 2963, - 2965, 2966, 2971, 2972, 2977, 2978, 2980, 2984, 2989, 2990, - 2996, 2997, 3002, 3003, 3008, 3009, 3014, 3015, 3020, 3024, - 3029, 3030, 3031, 3033, 3038, 3039, 3040, 3041, 3042, 3043, - 3045, 3050, 3051, 3052, 3053, 3054, 3055, 3057, 3062, 3063, - 3064, 3066, 3080, 3081, 3082, 3084, 3100, 3104, 3109, 3110, - 3112, 3117, 3118, 3120, 3126, 3130, 3136, 3139, 3140, 3144, - 3153, 3158, 3162, 3163, 3168, 3167, 3182, 3189, 3188, 3203, - 3211, 3211, 3220, 3222, 3225, 3230, 3232, 3236, 3302, 3305, - 3311, 3314, 3323, 3327, 3331, 3336, 3337, 3342, 3343, 3346, - 3345, 3375, 3377, 3378, 3380, 3394, 3395, 3396, 3397, 3398, - 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3408, 3407, 3417, - 3428, 3433, 3435, 3440, 3441, 3443, 3447, 3449, 3453, 3462, - 3468, 3469, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, - 3491, 3492, 3497, 3501, 3506, 3511, 3516, 3521, 3525, 3530, - 3535, 3540, 3569, 3573, 3580, 3582, 3586, 3588, 3589, 3590, - 3624, 3633, 3622, 3874, 3878, 3898, 3901, 3907, 3912, 3917, - 3923, 3926, 3936, 3943, 3947, 3953, 3967, 3973, 3990, 3995, - 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4016, 4024, 4023, - 4063, 4066, 4071, 4086, 4091, 4098, 4110, 4114, 4110, 4120, - 4122, 4126, 4128, 4143, 4147, 4156, 4161, 4165, 4171, 4174, - 4179, 4184, 4189, 4190, 4191, 4192, 4194, 4195, 4196, 4197, - 4202, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4246, 4251, - 4256, 4262, 4263, 4265, 4270, 4275, 4280, 4285, 4301, 4302, - 4304, 4309, 4314, 4318, 4330, 4343, 4353, 4358, 4363, 4368, - 4382, 4396, 4397, 4399, 4409, 4411, 4416, 4423, 4430, 4432, - 4434, 4435, 4437, 4441, 4446, 4447, 4449, 4455, 4457, 4459, - 4460, 4462, 4474 + 0, 1375, 1375, 1376, 1378, 1379, 1410, 1411, 1427, 1525, + 1527, 1533, 1535, 1542, 1548, 1554, 1561, 1564, 1568, 1572, + 1592, 1606, 1610, 1604, 1673, 1677, 1694, 1697, 1699, 1704, + 1705, 1709, 1710, 1714, 1718, 1722, 1724, 1725, 1727, 1729, + 1775, 1789, 1794, 1799, 1800, 1802, 1817, 1832, 1842, 1857, + 1861, 1866, 1880, 1884, 1889, 1903, 1908, 1913, 1918, 1923, + 1939, 1962, 1970, 1971, 1972, 1974, 1991, 1992, 1994, 1995, + 1997, 1998, 2000, 2055, 2059, 2065, 2068, 2073, 2087, 2091, + 2097, 2096, 2205, 2208, 2214, 2235, 2241, 2245, 2247, 2252, + 2262, 2263, 2268, 2269, 2278, 2348, 2359, 2360, 2364, 2369, + 2438, 2439, 2443, 2448, 2492, 2493, 2498, 2505, 2511, 2512, + 2513, 2514, 2515, 2516, 2522, 2527, 2533, 2536, 2541, 2547, + 2553, 2557, 2582, 2583, 2587, 2591, 2585, 2632, 2635, 2630, + 2651, 2652, 2653, 2656, 2660, 2668, 2667, 2681, 2680, 2689, + 2690, 2691, 2693, 2701, 2712, 2715, 2717, 2722, 2729, 2736, + 2742, 2762, 2767, 2773, 2776, 2778, 2779, 2786, 2792, 2796, + 2801, 2802, 2805, 2809, 2804, 2819, 2823, 2818, 2831, 2834, + 2838, 2833, 2848, 2852, 2847, 2860, 2862, 2890, 2889, 2901, + 2909, 2900, 2920, 2921, 2924, 2928, 2933, 2938, 2937, 2953, + 2959, 2960, 2966, 2967, 2973, 2974, 2975, 2976, 2978, 2979, + 2985, 2986, 2992, 2993, 2995, 2996, 3002, 3003, 3004, 3005, + 3007, 3008, 3018, 3019, 3025, 3026, 3028, 3032, 3037, 3038, + 3045, 3046, 3052, 3053, 3059, 3060, 3066, 3067, 3073, 3077, + 3082, 3083, 3084, 3086, 3092, 3093, 3094, 3095, 3096, 3097, + 3099, 3104, 3105, 3106, 3107, 3108, 3109, 3111, 3116, 3117, + 3118, 3120, 3134, 3135, 3136, 3138, 3155, 3159, 3164, 3165, + 3167, 3172, 3173, 3175, 3181, 3185, 3191, 3194, 3195, 3199, + 3208, 3213, 3217, 3218, 3223, 3222, 3237, 3245, 3244, 3260, + 3268, 3268, 3277, 3279, 3282, 3287, 3289, 3293, 3359, 3362, + 3368, 3371, 3380, 3384, 3388, 3393, 3394, 3399, 3400, 3403, + 3402, 3432, 3434, 3435, 3437, 3481, 3482, 3483, 3484, 3485, + 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3495, 3494, 3505, + 3516, 3521, 3523, 3528, 3529, 3534, 3538, 3540, 3544, 3553, + 3560, 3561, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, + 3584, 3585, 3590, 3595, 3601, 3607, 3612, 3617, 3622, 3628, + 3633, 3638, 3668, 3672, 3679, 3681, 3685, 3690, 3691, 3692, + 3726, 3735, 3724, 3976, 3980, 4000, 4003, 4009, 4014, 4019, + 4025, 4028, 4038, 4045, 4049, 4055, 4069, 4075, 4092, 4097, + 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4118, 4126, 4125, + 4165, 4168, 4173, 4188, 4193, 4200, 4212, 4216, 4212, 4222, + 4224, 4228, 4230, 4245, 4249, 4258, 4263, 4267, 4273, 4276, + 4281, 4286, 4291, 4292, 4293, 4294, 4296, 4297, 4298, 4299, + 4304, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4348, 4353, + 4358, 4364, 4365, 4367, 4372, 4377, 4382, 4387, 4403, 4404, + 4406, 4411, 4416, 4420, 4432, 4445, 4455, 4460, 4465, 4470, + 4484, 4498, 4499, 4501, 4511, 4513, 4518, 4525, 4532, 4534, + 4536, 4537, 4539, 4543, 4548, 4549, 4551, 4557, 4559, 4561, + 4565, 4570, 4582 }; #endif @@ -3726,7 +3760,7 @@ yyreduce: { case 5: /* Line 1269 of yacc.c. */ -#line 1346 "querytransformparser.ypp" +#line 1380 "querytransformparser.ypp" { /* Suppress more compiler warnings about unused defines. */ @@ -3760,7 +3794,7 @@ yyreduce: case 7: /* Line 1269 of yacc.c. */ -#line 1378 "querytransformparser.ypp" +#line 1412 "querytransformparser.ypp" { const QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*")); @@ -3779,7 +3813,7 @@ yyreduce: case 8: /* Line 1269 of yacc.c. */ -#line 1394 "querytransformparser.ypp" +#line 1428 "querytransformparser.ypp" { /* In XSL-T, we can have dangling variable references, so resolve them * before we proceed with other steps, such as checking circularity. */ @@ -3880,7 +3914,7 @@ yyreduce: case 10: /* Line 1269 of yacc.c. */ -#line 1494 "querytransformparser.ypp" +#line 1528 "querytransformparser.ypp" { // TODO add to namespace context parseInfo->moduleNamespace = parseInfo->staticContext->namePool()->allocateNamespace((yyvsp[(3) - (6)].sval)); @@ -3889,9 +3923,9 @@ yyreduce: case 12: /* Line 1269 of yacc.c. */ -#line 1502 "querytransformparser.ypp" +#line 1536 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); if(parseInfo->hasSecondPrologPart) parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, " "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo)); @@ -3900,7 +3934,7 @@ yyreduce: case 13: /* Line 1269 of yacc.c. */ -#line 1509 "querytransformparser.ypp" +#line 1543 "querytransformparser.ypp" { if(parseInfo->hasSecondPrologPart) parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, " @@ -3910,7 +3944,7 @@ yyreduce: case 14: /* Line 1269 of yacc.c. */ -#line 1515 "querytransformparser.ypp" +#line 1549 "querytransformparser.ypp" { if(parseInfo->hasSecondPrologPart) parseInfo->staticContext->error(QtXmlPatterns::tr("Namespace declarations must occur before function, " @@ -3920,9 +3954,9 @@ yyreduce: case 15: /* Line 1269 of yacc.c. */ -#line 1521 "querytransformparser.ypp" +#line 1555 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); if(parseInfo->hasSecondPrologPart) parseInfo->staticContext->error(QtXmlPatterns::tr("Module imports must occur before function, " "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo)); @@ -3931,7 +3965,7 @@ yyreduce: case 17: /* Line 1269 of yacc.c. */ -#line 1531 "querytransformparser.ypp" +#line 1565 "querytransformparser.ypp" { parseInfo->hasSecondPrologPart = true; } @@ -3939,7 +3973,7 @@ yyreduce: case 18: /* Line 1269 of yacc.c. */ -#line 1535 "querytransformparser.ypp" +#line 1569 "querytransformparser.ypp" { parseInfo->hasSecondPrologPart = true; } @@ -3947,16 +3981,16 @@ yyreduce: case 19: /* Line 1269 of yacc.c. */ -#line 1539 "querytransformparser.ypp" +#line 1573 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); parseInfo->hasSecondPrologPart = true; } break; case 20: /* Line 1269 of yacc.c. */ -#line 1562 "querytransformparser.ypp" +#line 1596 "querytransformparser.ypp" { Template::Ptr temp(create(new Template(parseInfo->currentImportPrecedence, (yyvsp[(5) - (7)].sequenceType)), (yyloc), parseInfo)); @@ -3969,7 +4003,7 @@ yyreduce: case 21: /* Line 1269 of yacc.c. */ -#line 1572 "querytransformparser.ypp" +#line 1606 "querytransformparser.ypp" { parseInfo->isParsingPattern = true; } @@ -3977,7 +4011,7 @@ yyreduce: case 22: /* Line 1269 of yacc.c. */ -#line 1576 "querytransformparser.ypp" +#line 1610 "querytransformparser.ypp" { parseInfo->isParsingPattern = false; } @@ -3985,7 +4019,7 @@ yyreduce: case 23: /* Line 1269 of yacc.c. */ -#line 1585 "querytransformparser.ypp" +#line 1619 "querytransformparser.ypp" { /* In this grammar branch, we're guaranteed to be a template rule, but * may also be a named template. */ @@ -4042,7 +4076,7 @@ yyreduce: case 24: /* Line 1269 of yacc.c. */ -#line 1639 "querytransformparser.ypp" +#line 1673 "querytransformparser.ypp" { (yyval.enums.Double) = std::numeric_limits::quiet_NaN(); } @@ -4050,7 +4084,7 @@ yyreduce: case 25: /* Line 1269 of yacc.c. */ -#line 1644 "querytransformparser.ypp" +#line 1678 "querytransformparser.ypp" { const AtomicValue::Ptr val(Decimal::fromLexical((yyvsp[(2) - (2)].sval))); if(val->hasError()) @@ -4069,7 +4103,7 @@ yyreduce: case 26: /* Line 1269 of yacc.c. */ -#line 1660 "querytransformparser.ypp" +#line 1694 "querytransformparser.ypp" { (yyval.qName) = QXmlName(); } @@ -4077,7 +4111,7 @@ yyreduce: case 28: /* Line 1269 of yacc.c. */ -#line 1666 "querytransformparser.ypp" +#line 1700 "querytransformparser.ypp" { (yyval.qName) = (yyvsp[(2) - (2)].qName); } @@ -4085,42 +4119,42 @@ yyreduce: case 30: /* Line 1269 of yacc.c. */ -#line 1672 "querytransformparser.ypp" +#line 1706 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); } break; case 32: /* Line 1269 of yacc.c. */ -#line 1677 "querytransformparser.ypp" +#line 1711 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); } break; case 33: /* Line 1269 of yacc.c. */ -#line 1681 "querytransformparser.ypp" +#line 1715 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); } break; case 34: /* Line 1269 of yacc.c. */ -#line 1685 "querytransformparser.ypp" +#line 1719 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); } break; case 39: /* Line 1269 of yacc.c. */ -#line 1696 "querytransformparser.ypp" +#line 1730 "querytransformparser.ypp" { if(!(yyvsp[(6) - (7)].enums.Bool)) - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); if((yyvsp[(3) - (7)].sval) == QLatin1String("xmlns")) { @@ -4166,7 +4200,7 @@ yyreduce: case 40: /* Line 1269 of yacc.c. */ -#line 1742 "querytransformparser.ypp" +#line 1776 "querytransformparser.ypp" { if(parseInfo->hasDeclaration(ParserContext::BoundarySpaceDecl)) { @@ -4183,7 +4217,7 @@ yyreduce: case 41: /* Line 1269 of yacc.c. */ -#line 1756 "querytransformparser.ypp" +#line 1790 "querytransformparser.ypp" { (yyval.enums.boundarySpacePolicy) = StaticContext::BSPStrip; } @@ -4191,7 +4225,7 @@ yyreduce: case 42: /* Line 1269 of yacc.c. */ -#line 1761 "querytransformparser.ypp" +#line 1795 "querytransformparser.ypp" { (yyval.enums.boundarySpacePolicy) = StaticContext::BSPPreserve; } @@ -4199,7 +4233,7 @@ yyreduce: case 45: /* Line 1269 of yacc.c. */ -#line 1770 "querytransformparser.ypp" +#line 1804 "querytransformparser.ypp" { if(parseInfo->hasDeclaration(ParserContext::DeclareDefaultElementNamespace)) { @@ -4216,7 +4250,7 @@ yyreduce: case 46: /* Line 1269 of yacc.c. */ -#line 1785 "querytransformparser.ypp" +#line 1819 "querytransformparser.ypp" { if(parseInfo->hasDeclaration(ParserContext::DeclareDefaultFunctionNamespace)) { @@ -4233,7 +4267,7 @@ yyreduce: case 47: /* Line 1269 of yacc.c. */ -#line 1799 "querytransformparser.ypp" +#line 1833 "querytransformparser.ypp" { if((yyvsp[(3) - (5)].qName).prefix() == StandardPrefixes::empty) { @@ -4246,9 +4280,9 @@ yyreduce: case 48: /* Line 1269 of yacc.c. */ -#line 1809 "querytransformparser.ypp" +#line 1843 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); if(parseInfo->hasDeclaration(ParserContext::OrderingModeDecl)) { parseInfo->staticContext->error(prologMessage("declare ordering"), @@ -4264,7 +4298,7 @@ yyreduce: case 49: /* Line 1269 of yacc.c. */ -#line 1824 "querytransformparser.ypp" +#line 1858 "querytransformparser.ypp" { (yyval.enums.orderingMode) = StaticContext::Ordered; } @@ -4272,7 +4306,7 @@ yyreduce: case 50: /* Line 1269 of yacc.c. */ -#line 1828 "querytransformparser.ypp" +#line 1862 "querytransformparser.ypp" { (yyval.enums.orderingMode) = StaticContext::Unordered; } @@ -4280,7 +4314,7 @@ yyreduce: case 51: /* Line 1269 of yacc.c. */ -#line 1833 "querytransformparser.ypp" +#line 1867 "querytransformparser.ypp" { if(parseInfo->hasDeclaration(ParserContext::EmptyOrderDecl)) { @@ -4297,7 +4331,7 @@ yyreduce: case 52: /* Line 1269 of yacc.c. */ -#line 1847 "querytransformparser.ypp" +#line 1881 "querytransformparser.ypp" { (yyval.enums.orderingEmptySequence) = StaticContext::Least; } @@ -4305,7 +4339,7 @@ yyreduce: case 53: /* Line 1269 of yacc.c. */ -#line 1851 "querytransformparser.ypp" +#line 1885 "querytransformparser.ypp" { (yyval.enums.orderingEmptySequence) = StaticContext::Greatest; } @@ -4313,7 +4347,7 @@ yyreduce: case 54: /* Line 1269 of yacc.c. */ -#line 1857 "querytransformparser.ypp" +#line 1891 "querytransformparser.ypp" { if(parseInfo->hasDeclaration(ParserContext::CopyNamespacesDecl)) { @@ -4329,7 +4363,7 @@ yyreduce: case 55: /* Line 1269 of yacc.c. */ -#line 1870 "querytransformparser.ypp" +#line 1904 "querytransformparser.ypp" { parseInfo->preserveNamespacesMode = true; } @@ -4337,7 +4371,7 @@ yyreduce: case 56: /* Line 1269 of yacc.c. */ -#line 1875 "querytransformparser.ypp" +#line 1909 "querytransformparser.ypp" { parseInfo->preserveNamespacesMode = false; } @@ -4345,7 +4379,7 @@ yyreduce: case 57: /* Line 1269 of yacc.c. */ -#line 1880 "querytransformparser.ypp" +#line 1914 "querytransformparser.ypp" { parseInfo->inheritNamespacesMode = true; } @@ -4353,7 +4387,7 @@ yyreduce: case 58: /* Line 1269 of yacc.c. */ -#line 1885 "querytransformparser.ypp" +#line 1919 "querytransformparser.ypp" { parseInfo->inheritNamespacesMode = false; } @@ -4361,7 +4395,7 @@ yyreduce: case 59: /* Line 1269 of yacc.c. */ -#line 1890 "querytransformparser.ypp" +#line 1924 "querytransformparser.ypp" { if(parseInfo->hasDeclaration(ParserContext::DefaultCollationDecl)) { @@ -4380,9 +4414,9 @@ yyreduce: case 60: /* Line 1269 of yacc.c. */ -#line 1906 "querytransformparser.ypp" +#line 1940 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(3) - (5)].enums.Bool)); + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, (yyloc), (yyvsp[(3) - (5)].enums.Bool)); if(parseInfo->hasDeclaration(ParserContext::BaseURIDecl)) { parseInfo->staticContext->error(prologMessage("declare base-uri"), @@ -4406,7 +4440,7 @@ yyreduce: case 61: /* Line 1269 of yacc.c. */ -#line 1929 "querytransformparser.ypp" +#line 1963 "querytransformparser.ypp" { parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Import feature is not supported, " "and therefore %1 declarations cannot occur.") @@ -4417,7 +4451,7 @@ yyreduce: case 65: /* Line 1269 of yacc.c. */ -#line 1941 "querytransformparser.ypp" +#line 1975 "querytransformparser.ypp" { if((yyvsp[(4) - (6)].sval).isEmpty()) { @@ -4437,9 +4471,9 @@ yyreduce: case 72: /* Line 1269 of yacc.c. */ -#line 1968 "querytransformparser.ypp" +#line 2002 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(3) - (9)].enums.Bool)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (9)].enums.Bool)); if(variableByName((yyvsp[(5) - (9)].qName), parseInfo)) { parseInfo->staticContext->error(QtXmlPatterns::tr("A variable by name %1 has already " @@ -4494,7 +4528,7 @@ yyreduce: case 73: /* Line 1269 of yacc.c. */ -#line 2022 "querytransformparser.ypp" +#line 2056 "querytransformparser.ypp" { (yyval.expr).reset(); } @@ -4502,7 +4536,7 @@ yyreduce: case 74: /* Line 1269 of yacc.c. */ -#line 2026 "querytransformparser.ypp" +#line 2060 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(2) - (2)].expr); } @@ -4510,7 +4544,7 @@ yyreduce: case 75: /* Line 1269 of yacc.c. */ -#line 2031 "querytransformparser.ypp" +#line 2065 "querytransformparser.ypp" { (yyval.expr).reset(); } @@ -4518,7 +4552,7 @@ yyreduce: case 76: /* Line 1269 of yacc.c. */ -#line 2035 "querytransformparser.ypp" +#line 2069 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(2) - (2)].expr); } @@ -4526,7 +4560,7 @@ yyreduce: case 77: /* Line 1269 of yacc.c. */ -#line 2040 "querytransformparser.ypp" +#line 2074 "querytransformparser.ypp" { if(parseInfo->hasDeclaration(ParserContext::ConstructionDecl)) { @@ -4543,7 +4577,7 @@ yyreduce: case 78: /* Line 1269 of yacc.c. */ -#line 2054 "querytransformparser.ypp" +#line 2088 "querytransformparser.ypp" { (yyval.enums.constructionMode) = StaticContext::CMStrip; } @@ -4551,7 +4585,7 @@ yyreduce: case 79: /* Line 1269 of yacc.c. */ -#line 2058 "querytransformparser.ypp" +#line 2092 "querytransformparser.ypp" { (yyval.enums.constructionMode) = StaticContext::CMPreserve; } @@ -4559,7 +4593,7 @@ yyreduce: case 80: /* Line 1269 of yacc.c. */ -#line 2063 "querytransformparser.ypp" +#line 2097 "querytransformparser.ypp" { (yyval.enums.slot) = parseInfo->currentExpressionSlot() - (yyvsp[(6) - (7)].functionArguments).count(); } @@ -4567,10 +4601,10 @@ yyreduce: case 81: /* Line 1269 of yacc.c. */ -#line 2067 "querytransformparser.ypp" +#line 2101 "querytransformparser.ypp" { if(!(yyvsp[(3) - (11)].enums.Bool)) - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(3) - (11)].enums.Bool)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (11)].enums.Bool)); /* If FunctionBody is null, it is 'external', otherwise the value is the body. */ const QXmlName::NamespaceCode ns((yyvsp[(4) - (11)].qName).namespaceURI()); @@ -4674,7 +4708,7 @@ yyreduce: case 82: /* Line 1269 of yacc.c. */ -#line 2171 "querytransformparser.ypp" +#line 2205 "querytransformparser.ypp" { (yyval.functionArguments) = FunctionArgument::List(); } @@ -4682,7 +4716,7 @@ yyreduce: case 83: /* Line 1269 of yacc.c. */ -#line 2175 "querytransformparser.ypp" +#line 2209 "querytransformparser.ypp" { FunctionArgument::List l; l.append((yyvsp[(1) - (1)].functionArgument)); @@ -4692,7 +4726,7 @@ yyreduce: case 84: /* Line 1269 of yacc.c. */ -#line 2181 "querytransformparser.ypp" +#line 2215 "querytransformparser.ypp" { FunctionArgument::List::const_iterator it((yyvsp[(1) - (3)].functionArguments).constBegin()); const FunctionArgument::List::const_iterator end((yyvsp[(1) - (3)].functionArguments).constEnd()); @@ -4716,7 +4750,7 @@ yyreduce: case 85: /* Line 1269 of yacc.c. */ -#line 2202 "querytransformparser.ypp" +#line 2236 "querytransformparser.ypp" { pushVariable((yyvsp[(2) - (3)].qName), (yyvsp[(3) - (3)].sequenceType), Expression::Ptr(), VariableDeclaration::FunctionArgument, (yyloc), parseInfo); (yyval.functionArgument) = FunctionArgument::Ptr(new FunctionArgument((yyvsp[(2) - (3)].qName), (yyvsp[(3) - (3)].sequenceType))); @@ -4725,7 +4759,7 @@ yyreduce: case 86: /* Line 1269 of yacc.c. */ -#line 2208 "querytransformparser.ypp" +#line 2242 "querytransformparser.ypp" { (yyval.expr).reset(); } @@ -4733,7 +4767,7 @@ yyreduce: case 88: /* Line 1269 of yacc.c. */ -#line 2214 "querytransformparser.ypp" +#line 2248 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(2) - (3)].expr); } @@ -4741,7 +4775,7 @@ yyreduce: case 91: /* Line 1269 of yacc.c. */ -#line 2230 "querytransformparser.ypp" +#line 2264 "querytransformparser.ypp" { (yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), CombineNodes::Union, (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } @@ -4749,7 +4783,7 @@ yyreduce: case 93: /* Line 1269 of yacc.c. */ -#line 2236 "querytransformparser.ypp" +#line 2270 "querytransformparser.ypp" { /* We write this into a node test. The spec says, 5.5.3 The Meaning of a Pattern: * "Similarly, / matches a document node, and only a document node, @@ -4762,7 +4796,7 @@ yyreduce: case 94: /* Line 1269 of yacc.c. */ -#line 2245 "querytransformparser.ypp" +#line 2279 "querytransformparser.ypp" { /* /axis::node-test * => @@ -4836,7 +4870,7 @@ yyreduce: case 95: /* Line 1269 of yacc.c. */ -#line 2315 "querytransformparser.ypp" +#line 2349 "querytransformparser.ypp" { /* //axis::node-test * => @@ -4851,7 +4885,7 @@ yyreduce: case 97: /* Line 1269 of yacc.c. */ -#line 2327 "querytransformparser.ypp" +#line 2361 "querytransformparser.ypp" { createIdPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisParent, (yylsp[(2) - (3)]), parseInfo); } @@ -4859,7 +4893,7 @@ yyreduce: case 98: /* Line 1269 of yacc.c. */ -#line 2331 "querytransformparser.ypp" +#line 2365 "querytransformparser.ypp" { createIdPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisAncestor, (yylsp[(2) - (3)]), parseInfo); } @@ -4867,7 +4901,7 @@ yyreduce: case 99: /* Line 1269 of yacc.c. */ -#line 2336 "querytransformparser.ypp" +#line 2370 "querytransformparser.ypp" { const Expression::List ands((yyvsp[(1) - (1)].expr)->operands()); const FunctionSignature::Ptr signature((yyvsp[(1) - (1)].expr)->as()->signature()); @@ -4939,7 +4973,7 @@ yyreduce: case 101: /* Line 1269 of yacc.c. */ -#line 2406 "querytransformparser.ypp" +#line 2440 "querytransformparser.ypp" { (yyval.expr) = createPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisParent, (yylsp[(2) - (3)]), parseInfo); } @@ -4947,7 +4981,7 @@ yyreduce: case 102: /* Line 1269 of yacc.c. */ -#line 2410 "querytransformparser.ypp" +#line 2444 "querytransformparser.ypp" { (yyval.expr) = createPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisAncestor, (yylsp[(2) - (3)]), parseInfo); } @@ -4955,7 +4989,7 @@ yyreduce: case 103: /* Line 1269 of yacc.c. */ -#line 2415 "querytransformparser.ypp" +#line 2449 "querytransformparser.ypp" { const Expression::Ptr expr(findAxisStep((yyvsp[(1) - (1)].expr))); @@ -5002,7 +5036,7 @@ yyreduce: case 105: /* Line 1269 of yacc.c. */ -#line 2460 "querytransformparser.ypp" +#line 2494 "querytransformparser.ypp" { (yyval.expr) = create(new ExpressionSequence((yyvsp[(1) - (1)].expressionList)), (yyloc), parseInfo); } @@ -5010,7 +5044,7 @@ yyreduce: case 106: /* Line 1269 of yacc.c. */ -#line 2465 "querytransformparser.ypp" +#line 2499 "querytransformparser.ypp" { Expression::List l; l.append((yyvsp[(1) - (3)].expr)); @@ -5021,7 +5055,7 @@ yyreduce: case 107: /* Line 1269 of yacc.c. */ -#line 2472 "querytransformparser.ypp" +#line 2506 "querytransformparser.ypp" { (yyvsp[(1) - (3)].expressionList).append((yyvsp[(3) - (3)].expr)); (yyval.expressionList) = (yyvsp[(1) - (3)].expressionList); @@ -5030,7 +5064,7 @@ yyreduce: case 113: /* Line 1269 of yacc.c. */ -#line 2483 "querytransformparser.ypp" +#line 2517 "querytransformparser.ypp" { (yyval.expr) = createDirAttributeValue((yyvsp[(3) - (4)].expressionList), parseInfo, (yyloc)); } @@ -5038,7 +5072,7 @@ yyreduce: case 114: /* Line 1269 of yacc.c. */ -#line 2488 "querytransformparser.ypp" +#line 2522 "querytransformparser.ypp" { QVector result; result.append(QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default)); @@ -5048,7 +5082,7 @@ yyreduce: case 115: /* Line 1269 of yacc.c. */ -#line 2494 "querytransformparser.ypp" +#line 2528 "querytransformparser.ypp" { (yyval.qNameVector) = (yyvsp[(2) - (2)].qNameVector); } @@ -5056,7 +5090,7 @@ yyreduce: case 116: /* Line 1269 of yacc.c. */ -#line 2499 "querytransformparser.ypp" +#line 2533 "querytransformparser.ypp" { (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default); } @@ -5064,7 +5098,7 @@ yyreduce: case 117: /* Line 1269 of yacc.c. */ -#line 2503 "querytransformparser.ypp" +#line 2537 "querytransformparser.ypp" { (yyval.qName) = (yyvsp[(2) - (2)].qName); } @@ -5072,7 +5106,7 @@ yyreduce: case 118: /* Line 1269 of yacc.c. */ -#line 2508 "querytransformparser.ypp" +#line 2542 "querytransformparser.ypp" { QVector result; result.append((yyvsp[(1) - (1)].qName)); @@ -5082,7 +5116,7 @@ yyreduce: case 119: /* Line 1269 of yacc.c. */ -#line 2514 "querytransformparser.ypp" +#line 2548 "querytransformparser.ypp" { (yyvsp[(1) - (3)].qNameVector).append((yyvsp[(3) - (3)].qName)); (yyval.qNameVector) = (yyvsp[(1) - (3)].qNameVector); @@ -5091,7 +5125,7 @@ yyreduce: case 120: /* Line 1269 of yacc.c. */ -#line 2520 "querytransformparser.ypp" +#line 2554 "querytransformparser.ypp" { (yyval.qName) = (yyvsp[(1) - (1)].qName); } @@ -5099,7 +5133,7 @@ yyreduce: case 121: /* Line 1269 of yacc.c. */ -#line 2524 "querytransformparser.ypp" +#line 2558 "querytransformparser.ypp" { if((yyvsp[(1) - (1)].sval) == QLatin1String("#current")) (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::current); @@ -5126,7 +5160,7 @@ yyreduce: case 124: /* Line 1269 of yacc.c. */ -#line 2553 "querytransformparser.ypp" +#line 2587 "querytransformparser.ypp" { /* We're pushing the range variable here, not the positional. */ (yyval.expr) = pushVariable((yyvsp[(3) - (7)].qName), quantificationType((yyvsp[(4) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo); @@ -5135,7 +5169,7 @@ yyreduce: case 125: /* Line 1269 of yacc.c. */ -#line 2557 "querytransformparser.ypp" +#line 2591 "querytransformparser.ypp" { /* It is ok this appears after PositionalVar, because currentRangeSlot() * uses a different "channel" than currentPositionSlot(), so they can't trash @@ -5146,7 +5180,7 @@ yyreduce: case 126: /* Line 1269 of yacc.c. */ -#line 2564 "querytransformparser.ypp" +#line 2598 "querytransformparser.ypp" { Q_ASSERT((yyvsp[(7) - (10)].expr)); Q_ASSERT((yyvsp[(10) - (10)].expr)); @@ -5182,7 +5216,7 @@ yyreduce: case 127: /* Line 1269 of yacc.c. */ -#line 2598 "querytransformparser.ypp" +#line 2632 "querytransformparser.ypp" { pushVariable((yyvsp[(3) - (7)].qName), quantificationType((yyvsp[(4) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo); } @@ -5190,7 +5224,7 @@ yyreduce: case 128: /* Line 1269 of yacc.c. */ -#line 2601 "querytransformparser.ypp" +#line 2635 "querytransformparser.ypp" { /* It is ok this appears after PositionalVar, because currentRangeSlot() * uses a different "channel" than currentPositionSlot(), so they can't trash @@ -5201,7 +5235,7 @@ yyreduce: case 129: /* Line 1269 of yacc.c. */ -#line 2608 "querytransformparser.ypp" +#line 2642 "querytransformparser.ypp" { (yyval.expr) = create(new ForClause((yyvsp[(9) - (10)].enums.slot), (yyvsp[(7) - (10)].expr), (yyvsp[(10) - (10)].expr), (yyvsp[(5) - (10)].enums.slot)), (yyloc), parseInfo); @@ -5214,7 +5248,7 @@ yyreduce: case 133: /* Line 1269 of yacc.c. */ -#line 2622 "querytransformparser.ypp" +#line 2656 "querytransformparser.ypp" { (yyval.enums.slot) = -1; } @@ -5222,7 +5256,7 @@ yyreduce: case 134: /* Line 1269 of yacc.c. */ -#line 2627 "querytransformparser.ypp" +#line 2661 "querytransformparser.ypp" { pushVariable((yyvsp[(3) - (3)].qName), CommonSequenceTypes::ExactlyOneInteger, Expression::Ptr(), VariableDeclaration::PositionalVariable, (yyloc), parseInfo); @@ -5232,7 +5266,7 @@ yyreduce: case 135: /* Line 1269 of yacc.c. */ -#line 2634 "querytransformparser.ypp" +#line 2668 "querytransformparser.ypp" { (yyval.expr) = pushVariable((yyvsp[(4) - (7)].qName), quantificationType((yyvsp[(5) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::ExpressionVariable, (yyloc), parseInfo); } @@ -5240,9 +5274,9 @@ yyreduce: case 136: /* Line 1269 of yacc.c. */ -#line 2638 "querytransformparser.ypp" +#line 2672 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (9)].enums.Bool)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (9)].enums.Bool)); Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[(4) - (9)].qName)); (yyval.expr) = create(new LetClause((yyvsp[(8) - (9)].expr), (yyvsp[(9) - (9)].expr), parseInfo->variables.top()), (yyloc), parseInfo); @@ -5252,13 +5286,13 @@ yyreduce: case 137: /* Line 1269 of yacc.c. */ -#line 2647 "querytransformparser.ypp" +#line 2681 "querytransformparser.ypp" { (yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr), VariableDeclaration::ExpressionVariable, (yyloc), parseInfo);} break; case 138: /* Line 1269 of yacc.c. */ -#line 2649 "querytransformparser.ypp" +#line 2683 "querytransformparser.ypp" { Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[(3) - (8)].qName)); (yyval.expr) = create(new LetClause((yyvsp[(7) - (8)].expr), (yyvsp[(8) - (8)].expr), parseInfo->variables.top()), (yyloc), parseInfo); @@ -5268,7 +5302,7 @@ yyreduce: case 142: /* Line 1269 of yacc.c. */ -#line 2660 "querytransformparser.ypp" +#line 2694 "querytransformparser.ypp" { if((yyvsp[(1) - (3)].orderSpecs).isEmpty()) (yyval.expr) = (yyvsp[(3) - (3)].expr); @@ -5279,7 +5313,7 @@ yyreduce: case 143: /* Line 1269 of yacc.c. */ -#line 2668 "querytransformparser.ypp" +#line 2702 "querytransformparser.ypp" { if((yyvsp[(3) - (5)].orderSpecs).isEmpty()) (yyval.expr) = create(new IfThenClause((yyvsp[(2) - (5)].expr), (yyvsp[(5) - (5)].expr), create(new EmptySequence, (yyloc), parseInfo)), (yyloc), parseInfo); @@ -5292,7 +5326,7 @@ yyreduce: case 144: /* Line 1269 of yacc.c. */ -#line 2678 "querytransformparser.ypp" +#line 2712 "querytransformparser.ypp" { (yyval.orderSpecs) = OrderSpecTransfer::List(); } @@ -5300,7 +5334,7 @@ yyreduce: case 146: /* Line 1269 of yacc.c. */ -#line 2684 "querytransformparser.ypp" +#line 2718 "querytransformparser.ypp" { (yyval.orderSpecs) = (yyvsp[(2) - (2)].orderSpecs); } @@ -5308,7 +5342,7 @@ yyreduce: case 147: /* Line 1269 of yacc.c. */ -#line 2689 "querytransformparser.ypp" +#line 2723 "querytransformparser.ypp" { OrderSpecTransfer::List list; list += (yyvsp[(1) - (3)].orderSpecs); @@ -5319,7 +5353,7 @@ yyreduce: case 148: /* Line 1269 of yacc.c. */ -#line 2696 "querytransformparser.ypp" +#line 2730 "querytransformparser.ypp" { OrderSpecTransfer::List list; list.append((yyvsp[(1) - (1)].orderSpec)); @@ -5329,7 +5363,7 @@ yyreduce: case 149: /* Line 1269 of yacc.c. */ -#line 2703 "querytransformparser.ypp" +#line 2737 "querytransformparser.ypp" { (yyval.orderSpec) = OrderSpecTransfer((yyvsp[(1) - (4)].expr), OrderBy::OrderSpec((yyvsp[(2) - (4)].enums.sortDirection), (yyvsp[(3) - (4)].enums.orderingEmptySequence))); } @@ -5337,7 +5371,7 @@ yyreduce: case 150: /* Line 1269 of yacc.c. */ -#line 2708 "querytransformparser.ypp" +#line 2742 "querytransformparser.ypp" { /* Where does the specification state the default value is ascending? * @@ -5361,7 +5395,7 @@ yyreduce: case 151: /* Line 1269 of yacc.c. */ -#line 2729 "querytransformparser.ypp" +#line 2763 "querytransformparser.ypp" { (yyval.enums.sortDirection) = OrderBy::OrderSpec::Ascending; } @@ -5369,7 +5403,7 @@ yyreduce: case 152: /* Line 1269 of yacc.c. */ -#line 2734 "querytransformparser.ypp" +#line 2768 "querytransformparser.ypp" { (yyval.enums.sortDirection) = OrderBy::OrderSpec::Descending; } @@ -5377,7 +5411,7 @@ yyreduce: case 153: /* Line 1269 of yacc.c. */ -#line 2739 "querytransformparser.ypp" +#line 2773 "querytransformparser.ypp" { (yyval.enums.orderingEmptySequence) = parseInfo->staticContext->orderingEmptySequence(); } @@ -5385,7 +5419,7 @@ yyreduce: case 156: /* Line 1269 of yacc.c. */ -#line 2746 "querytransformparser.ypp" +#line 2780 "querytransformparser.ypp" { if(parseInfo->isXSLT()) resolveAndCheckCollation((yyvsp[(2) - (2)].sval), parseInfo, (yyloc)); @@ -5396,7 +5430,7 @@ yyreduce: case 157: /* Line 1269 of yacc.c. */ -#line 2753 "querytransformparser.ypp" +#line 2787 "querytransformparser.ypp" { /* We do nothing. We don't use collations, and we have this non-terminal * in order to accept expressions. */ @@ -5405,7 +5439,7 @@ yyreduce: case 158: /* Line 1269 of yacc.c. */ -#line 2759 "querytransformparser.ypp" +#line 2793 "querytransformparser.ypp" { parseInfo->orderStability.push(OrderBy::StableOrder); } @@ -5413,7 +5447,7 @@ yyreduce: case 159: /* Line 1269 of yacc.c. */ -#line 2763 "querytransformparser.ypp" +#line 2797 "querytransformparser.ypp" { parseInfo->orderStability.push(OrderBy::UnstableOrder); } @@ -5421,7 +5455,7 @@ yyreduce: case 162: /* Line 1269 of yacc.c. */ -#line 2771 "querytransformparser.ypp" +#line 2805 "querytransformparser.ypp" { pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo); @@ -5430,14 +5464,15 @@ yyreduce: case 163: /* Line 1269 of yacc.c. */ -#line 2775 "querytransformparser.ypp" +#line 2809 "querytransformparser.ypp" {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();} break; case 164: /* Line 1269 of yacc.c. */ -#line 2777 "querytransformparser.ypp" +#line 2811 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot), QuantifiedExpression::Some, (yyvsp[(6) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo); parseInfo->finalizePushedVariable(); @@ -5446,7 +5481,7 @@ yyreduce: case 165: /* Line 1269 of yacc.c. */ -#line 2784 "querytransformparser.ypp" +#line 2819 "querytransformparser.ypp" { (yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo); @@ -5455,13 +5490,13 @@ yyreduce: case 166: /* Line 1269 of yacc.c. */ -#line 2788 "querytransformparser.ypp" +#line 2823 "querytransformparser.ypp" {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();} break; case 167: /* Line 1269 of yacc.c. */ -#line 2790 "querytransformparser.ypp" +#line 2825 "querytransformparser.ypp" { (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot), QuantifiedExpression::Some, (yyvsp[(7) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo); @@ -5471,7 +5506,7 @@ yyreduce: case 169: /* Line 1269 of yacc.c. */ -#line 2799 "querytransformparser.ypp" +#line 2834 "querytransformparser.ypp" { pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo); @@ -5480,14 +5515,15 @@ yyreduce: case 170: /* Line 1269 of yacc.c. */ -#line 2803 "querytransformparser.ypp" +#line 2838 "querytransformparser.ypp" {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();} break; case 171: /* Line 1269 of yacc.c. */ -#line 2805 "querytransformparser.ypp" +#line 2840 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot), QuantifiedExpression::Every, (yyvsp[(6) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo); parseInfo->finalizePushedVariable(); @@ -5496,7 +5532,7 @@ yyreduce: case 172: /* Line 1269 of yacc.c. */ -#line 2812 "querytransformparser.ypp" +#line 2848 "querytransformparser.ypp" { (yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo); @@ -5505,13 +5541,13 @@ yyreduce: case 173: /* Line 1269 of yacc.c. */ -#line 2816 "querytransformparser.ypp" +#line 2852 "querytransformparser.ypp" {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();} break; case 174: /* Line 1269 of yacc.c. */ -#line 2818 "querytransformparser.ypp" +#line 2854 "querytransformparser.ypp" { (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot), QuantifiedExpression::Every, (yyvsp[(7) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo); @@ -5521,7 +5557,7 @@ yyreduce: case 176: /* Line 1269 of yacc.c. */ -#line 2827 "querytransformparser.ypp" +#line 2863 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(2) - (2)].expr); } @@ -5529,7 +5565,7 @@ yyreduce: case 177: /* Line 1269 of yacc.c. */ -#line 2854 "querytransformparser.ypp" +#line 2890 "querytransformparser.ypp" { parseInfo->typeswitchSource.push((yyvsp[(3) - (4)].expr)); } @@ -5537,9 +5573,9 @@ yyreduce: case 178: /* Line 1269 of yacc.c. */ -#line 2858 "querytransformparser.ypp" +#line 2894 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); parseInfo->typeswitchSource.pop(); (yyval.expr) = (yyvsp[(6) - (6)].expr); } @@ -5547,7 +5583,7 @@ yyreduce: case 179: /* Line 1269 of yacc.c. */ -#line 2865 "querytransformparser.ypp" +#line 2901 "querytransformparser.ypp" { if(!(yyvsp[(2) - (3)].qName).isNull()) { @@ -5559,7 +5595,7 @@ yyreduce: case 180: /* Line 1269 of yacc.c. */ -#line 2873 "querytransformparser.ypp" +#line 2909 "querytransformparser.ypp" { /* The variable shouldn't be in-scope for other case branches. */ if(!(yyvsp[(2) - (6)].qName).isNull()) @@ -5569,7 +5605,7 @@ yyreduce: case 181: /* Line 1269 of yacc.c. */ -#line 2879 "querytransformparser.ypp" +#line 2915 "querytransformparser.ypp" { const Expression::Ptr instanceOf(create(new InstanceOf(parseInfo->typeswitchSource.top(), (yyvsp[(3) - (8)].sequenceType)), (yyloc), parseInfo)); (yyval.expr) = create(new IfThenClause(instanceOf, (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].expr)), (yyloc), parseInfo); @@ -5578,7 +5614,7 @@ yyreduce: case 184: /* Line 1269 of yacc.c. */ -#line 2888 "querytransformparser.ypp" +#line 2924 "querytransformparser.ypp" { (yyval.qName) = QXmlName(); } @@ -5586,7 +5622,7 @@ yyreduce: case 185: /* Line 1269 of yacc.c. */ -#line 2893 "querytransformparser.ypp" +#line 2929 "querytransformparser.ypp" { (yyval.qName) = (yyvsp[(2) - (3)].qName); } @@ -5594,7 +5630,7 @@ yyreduce: case 186: /* Line 1269 of yacc.c. */ -#line 2898 "querytransformparser.ypp" +#line 2934 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(3) - (3)].expr); } @@ -5602,7 +5638,7 @@ yyreduce: case 187: /* Line 1269 of yacc.c. */ -#line 2902 "querytransformparser.ypp" +#line 2938 "querytransformparser.ypp" { if(!(yyvsp[(3) - (3)].qName).isNull()) { @@ -5615,7 +5651,7 @@ yyreduce: case 188: /* Line 1269 of yacc.c. */ -#line 2911 "querytransformparser.ypp" +#line 2947 "querytransformparser.ypp" { if(!(yyvsp[(3) - (6)].qName).isNull()) parseInfo->finalizePushedVariable(); @@ -5625,107 +5661,119 @@ yyreduce: case 189: /* Line 1269 of yacc.c. */ -#line 2918 "querytransformparser.ypp" +#line 2954 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new IfThenClause((yyvsp[(3) - (8)].expr), (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].expr)), (yyloc), parseInfo); } break; case 191: /* Line 1269 of yacc.c. */ -#line 2924 "querytransformparser.ypp" +#line 2961 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new OrExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } break; case 193: /* Line 1269 of yacc.c. */ -#line 2930 "querytransformparser.ypp" +#line 2968 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new AndExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } break; case 199: /* Line 1269 of yacc.c. */ -#line 2941 "querytransformparser.ypp" +#line 2980 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new RangeExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } break; case 201: /* Line 1269 of yacc.c. */ -#line 2947 "querytransformparser.ypp" +#line 2987 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new ArithmeticExpression((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.mathOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } break; case 202: /* Line 1269 of yacc.c. */ -#line 2951 "querytransformparser.ypp" +#line 2992 "querytransformparser.ypp" {(yyval.enums.mathOperator) = AtomicMathematician::Add;} break; case 203: /* Line 1269 of yacc.c. */ -#line 2952 "querytransformparser.ypp" +#line 2993 "querytransformparser.ypp" {(yyval.enums.mathOperator) = AtomicMathematician::Substract;} break; case 205: /* Line 1269 of yacc.c. */ -#line 2956 "querytransformparser.ypp" +#line 2997 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new ArithmeticExpression((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.mathOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } break; case 206: /* Line 1269 of yacc.c. */ -#line 2960 "querytransformparser.ypp" +#line 3002 "querytransformparser.ypp" {(yyval.enums.mathOperator) = AtomicMathematician::Multiply;} break; case 207: /* Line 1269 of yacc.c. */ -#line 2961 "querytransformparser.ypp" +#line 3003 "querytransformparser.ypp" {(yyval.enums.mathOperator) = AtomicMathematician::Div;} break; case 208: /* Line 1269 of yacc.c. */ -#line 2962 "querytransformparser.ypp" +#line 3004 "querytransformparser.ypp" {(yyval.enums.mathOperator) = AtomicMathematician::IDiv;} break; case 209: /* Line 1269 of yacc.c. */ -#line 2963 "querytransformparser.ypp" +#line 3005 "querytransformparser.ypp" {(yyval.enums.mathOperator) = AtomicMathematician::Mod;} break; case 211: /* Line 1269 of yacc.c. */ -#line 2967 "querytransformparser.ypp" +#line 3009 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 + | QXmlQuery::XPath20 + | QXmlQuery::XmlSchema11IdentityConstraintField + | QXmlQuery::XmlSchema11IdentityConstraintSelector), + parseInfo, (yyloc)); (yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), CombineNodes::Union, (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } break; case 213: /* Line 1269 of yacc.c. */ -#line 2973 "querytransformparser.ypp" +#line 3020 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.combinedNodeOp), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } break; case 216: /* Line 1269 of yacc.c. */ -#line 2981 "querytransformparser.ypp" +#line 3029 "querytransformparser.ypp" { (yyval.enums.combinedNodeOp) = CombineNodes::Intersect; } @@ -5733,7 +5781,7 @@ yyreduce: case 217: /* Line 1269 of yacc.c. */ -#line 2985 "querytransformparser.ypp" +#line 3033 "querytransformparser.ypp" { (yyval.enums.combinedNodeOp) = CombineNodes::Except; } @@ -5741,48 +5789,53 @@ yyreduce: case 219: /* Line 1269 of yacc.c. */ -#line 2991 "querytransformparser.ypp" +#line 3039 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new InstanceOf((yyvsp[(1) - (4)].expr), - SequenceType::Ptr((yyvsp[(4) - (4)].sequenceType))), (yyloc), parseInfo); + SequenceType::Ptr((yyvsp[(4) - (4)].sequenceType))), (yyloc), parseInfo); } break; case 221: /* Line 1269 of yacc.c. */ -#line 2998 "querytransformparser.ypp" +#line 3047 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new TreatAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo); } break; case 223: /* Line 1269 of yacc.c. */ -#line 3004 "querytransformparser.ypp" +#line 3054 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new CastableAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo); } break; case 225: /* Line 1269 of yacc.c. */ -#line 3010 "querytransformparser.ypp" +#line 3061 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new CastAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo); } break; case 227: /* Line 1269 of yacc.c. */ -#line 3016 "querytransformparser.ypp" +#line 3068 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new UnaryExpression((yyvsp[(1) - (2)].enums.mathOperator), (yyvsp[(2) - (2)].expr), parseInfo->staticContext), (yyloc), parseInfo); } break; case 228: /* Line 1269 of yacc.c. */ -#line 3021 "querytransformparser.ypp" +#line 3074 "querytransformparser.ypp" { (yyval.enums.mathOperator) = AtomicMathematician::Add; } @@ -5790,7 +5843,7 @@ yyreduce: case 229: /* Line 1269 of yacc.c. */ -#line 3025 "querytransformparser.ypp" +#line 3078 "querytransformparser.ypp" { (yyval.enums.mathOperator) = AtomicMathematician::Substract; } @@ -5798,51 +5851,52 @@ yyreduce: case 233: /* Line 1269 of yacc.c. */ -#line 3034 "querytransformparser.ypp" +#line 3087 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new GeneralComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.valueOperator), (yyvsp[(3) - (3)].expr), parseInfo->isBackwardsCompat.top()), (yyloc), parseInfo); } break; case 234: /* Line 1269 of yacc.c. */ -#line 3038 "querytransformparser.ypp" +#line 3092 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;} break; case 235: /* Line 1269 of yacc.c. */ -#line 3039 "querytransformparser.ypp" +#line 3093 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;} break; case 236: /* Line 1269 of yacc.c. */ -#line 3040 "querytransformparser.ypp" +#line 3094 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;} break; case 237: /* Line 1269 of yacc.c. */ -#line 3041 "querytransformparser.ypp" +#line 3095 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;} break; case 238: /* Line 1269 of yacc.c. */ -#line 3042 "querytransformparser.ypp" +#line 3096 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;} break; case 239: /* Line 1269 of yacc.c. */ -#line 3043 "querytransformparser.ypp" +#line 3097 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;} break; case 240: /* Line 1269 of yacc.c. */ -#line 3046 "querytransformparser.ypp" +#line 3100 "querytransformparser.ypp" { (yyval.expr) = create(new ValueComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.valueOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } @@ -5850,43 +5904,43 @@ yyreduce: case 241: /* Line 1269 of yacc.c. */ -#line 3050 "querytransformparser.ypp" +#line 3104 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;} break; case 242: /* Line 1269 of yacc.c. */ -#line 3051 "querytransformparser.ypp" +#line 3105 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;} break; case 243: /* Line 1269 of yacc.c. */ -#line 3052 "querytransformparser.ypp" +#line 3106 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;} break; case 244: /* Line 1269 of yacc.c. */ -#line 3053 "querytransformparser.ypp" +#line 3107 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;} break; case 245: /* Line 1269 of yacc.c. */ -#line 3054 "querytransformparser.ypp" +#line 3108 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;} break; case 246: /* Line 1269 of yacc.c. */ -#line 3055 "querytransformparser.ypp" +#line 3109 "querytransformparser.ypp" {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;} break; case 247: /* Line 1269 of yacc.c. */ -#line 3058 "querytransformparser.ypp" +#line 3112 "querytransformparser.ypp" { (yyval.expr) = create(new NodeComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.nodeOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } @@ -5894,27 +5948,27 @@ yyreduce: case 248: /* Line 1269 of yacc.c. */ -#line 3062 "querytransformparser.ypp" +#line 3116 "querytransformparser.ypp" {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Is;} break; case 249: /* Line 1269 of yacc.c. */ -#line 3063 "querytransformparser.ypp" +#line 3117 "querytransformparser.ypp" {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Precedes;} break; case 250: /* Line 1269 of yacc.c. */ -#line 3064 "querytransformparser.ypp" +#line 3118 "querytransformparser.ypp" {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Follows;} break; case 251: /* Line 1269 of yacc.c. */ -#line 3067 "querytransformparser.ypp" +#line 3121 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Validation Feature is not supported. " "Hence, %1-expressions may not be used.") .arg(formatKeyword("validate")), @@ -5927,26 +5981,27 @@ yyreduce: case 252: /* Line 1269 of yacc.c. */ -#line 3080 "querytransformparser.ypp" +#line 3134 "querytransformparser.ypp" {(yyval.enums.validationMode) = Validate::Strict;} break; case 253: /* Line 1269 of yacc.c. */ -#line 3081 "querytransformparser.ypp" +#line 3135 "querytransformparser.ypp" {(yyval.enums.validationMode) = Validate::Strict;} break; case 254: /* Line 1269 of yacc.c. */ -#line 3082 "querytransformparser.ypp" +#line 3136 "querytransformparser.ypp" {(yyval.enums.validationMode) = Validate::Lax;} break; case 255: /* Line 1269 of yacc.c. */ -#line 3085 "querytransformparser.ypp" +#line 3139 "querytransformparser.ypp" { + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); /* We don't support any pragmas, so we only do the * necessary validation and use the fallback expression. */ @@ -5964,7 +6019,7 @@ yyreduce: case 256: /* Line 1269 of yacc.c. */ -#line 3101 "querytransformparser.ypp" +#line 3156 "querytransformparser.ypp" { (yyval.expr).reset(); } @@ -5972,7 +6027,7 @@ yyreduce: case 257: /* Line 1269 of yacc.c. */ -#line 3105 "querytransformparser.ypp" +#line 3160 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(2) - (3)].expr); } @@ -5980,15 +6035,15 @@ yyreduce: case 260: /* Line 1269 of yacc.c. */ -#line 3113 "querytransformparser.ypp" +#line 3168 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); } break; case 263: /* Line 1269 of yacc.c. */ -#line 3121 "querytransformparser.ypp" +#line 3176 "querytransformparser.ypp" { /* This is "/step". That is, fn:root(self::node()) treat as document-node()/RelativePathExpr. */ (yyval.expr) = create(new Path(createRootExpression(parseInfo, (yyloc)), (yyvsp[(2) - (2)].expr)), (yyloc), parseInfo); @@ -5997,7 +6052,7 @@ yyreduce: case 264: /* Line 1269 of yacc.c. */ -#line 3127 "querytransformparser.ypp" +#line 3182 "querytransformparser.ypp" { (yyval.expr) = createSlashSlashPath(createRootExpression(parseInfo, (yyloc)), (yyvsp[(2) - (2)].expr), (yyloc), parseInfo); } @@ -6005,7 +6060,7 @@ yyreduce: case 265: /* Line 1269 of yacc.c. */ -#line 3131 "querytransformparser.ypp" +#line 3186 "querytransformparser.ypp" { /* This is "/". That is, fn:root(self::node()) treat as document-node(). */ (yyval.expr) = createRootExpression(parseInfo, (yyloc)); @@ -6014,7 +6069,7 @@ yyreduce: case 268: /* Line 1269 of yacc.c. */ -#line 3141 "querytransformparser.ypp" +#line 3196 "querytransformparser.ypp" { (yyval.expr) = create(new Path((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].enums.pathKind)), (yyloc), parseInfo); } @@ -6022,7 +6077,7 @@ yyreduce: case 269: /* Line 1269 of yacc.c. */ -#line 3145 "querytransformparser.ypp" +#line 3200 "querytransformparser.ypp" { const Expression::Ptr orderBy(createReturnOrderBy((yyvsp[(4) - (7)].orderSpecs), (yyvsp[(6) - (7)].expr), parseInfo->orderStability.pop(), (yyloc), parseInfo)); @@ -6035,7 +6090,7 @@ yyreduce: case 270: /* Line 1269 of yacc.c. */ -#line 3154 "querytransformparser.ypp" +#line 3209 "querytransformparser.ypp" { (yyval.expr) = createSlashSlashPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyloc), parseInfo); } @@ -6043,7 +6098,7 @@ yyreduce: case 271: /* Line 1269 of yacc.c. */ -#line 3159 "querytransformparser.ypp" +#line 3214 "querytransformparser.ypp" { (yyval.expr) = NodeSortExpression::wrapAround((yyvsp[(1) - (1)].expr), parseInfo->staticContext); } @@ -6051,7 +6106,7 @@ yyreduce: case 273: /* Line 1269 of yacc.c. */ -#line 3164 "querytransformparser.ypp" +#line 3219 "querytransformparser.ypp" { (yyval.expr) = create(new CurrentItemStore((yyvsp[(2) - (2)].expr)), (yyloc), parseInfo); } @@ -6059,7 +6114,7 @@ yyreduce: case 274: /* Line 1269 of yacc.c. */ -#line 3168 "querytransformparser.ypp" +#line 3223 "querytransformparser.ypp" { const xsDouble version = (yyvsp[(1) - (1)].sval).toDouble(); @@ -6071,7 +6126,7 @@ yyreduce: case 275: /* Line 1269 of yacc.c. */ -#line 3176 "querytransformparser.ypp" +#line 3231 "querytransformparser.ypp" { if((yyvsp[(2) - (3)].enums.Double) < 2) (yyval.expr) = createCompatStore((yyvsp[(3) - (3)].expr), (yyloc), parseInfo); @@ -6082,8 +6137,9 @@ yyreduce: case 276: /* Line 1269 of yacc.c. */ -#line 3183 "querytransformparser.ypp" +#line 3238 "querytransformparser.ypp" { + allowedIn(QXmlQuery::XSLT20, parseInfo, (yyloc)); Q_ASSERT(!(yyvsp[(2) - (5)].sval).isEmpty()); (yyval.expr) = create(new StaticBaseURIStore((yyvsp[(2) - (5)].sval), (yyvsp[(4) - (5)].expr)), (yyloc), parseInfo); } @@ -6091,8 +6147,9 @@ yyreduce: case 277: /* Line 1269 of yacc.c. */ -#line 3189 "querytransformparser.ypp" +#line 3245 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, (yyloc)); parseInfo->resolvers.push(parseInfo->staticContext->namespaceBindings()); const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings())); resolver->addBinding(QXmlName(parseInfo->staticContext->namePool()->allocateNamespace((yyvsp[(5) - (6)].sval)), @@ -6104,7 +6161,7 @@ yyreduce: case 278: /* Line 1269 of yacc.c. */ -#line 3199 "querytransformparser.ypp" +#line 3256 "querytransformparser.ypp" { parseInfo->staticContext->setNamespaceBindings(parseInfo->resolvers.pop()); (yyval.expr) = (yyvsp[(8) - (9)].expr); @@ -6113,7 +6170,7 @@ yyreduce: case 279: /* Line 1269 of yacc.c. */ -#line 3204 "querytransformparser.ypp" +#line 3261 "querytransformparser.ypp" { (yyval.expr) = create(new CallTemplate((yyvsp[(2) - (5)].qName), parseInfo->templateWithParams), (yyloc), parseInfo); parseInfo->templateWithParametersHandled(); @@ -6123,7 +6180,7 @@ yyreduce: case 280: /* Line 1269 of yacc.c. */ -#line 3211 "querytransformparser.ypp" +#line 3268 "querytransformparser.ypp" { parseInfo->startParsingWithParam(); } @@ -6131,7 +6188,7 @@ yyreduce: case 281: /* Line 1269 of yacc.c. */ -#line 3215 "querytransformparser.ypp" +#line 3272 "querytransformparser.ypp" { parseInfo->endParsingWithParam(); } @@ -6139,42 +6196,42 @@ yyreduce: case 282: /* Line 1269 of yacc.c. */ -#line 3220 "querytransformparser.ypp" +#line 3277 "querytransformparser.ypp" { } break; case 283: /* Line 1269 of yacc.c. */ -#line 3223 "querytransformparser.ypp" +#line 3280 "querytransformparser.ypp" { } break; case 284: /* Line 1269 of yacc.c. */ -#line 3226 "querytransformparser.ypp" +#line 3283 "querytransformparser.ypp" { } break; case 285: /* Line 1269 of yacc.c. */ -#line 3230 "querytransformparser.ypp" +#line 3287 "querytransformparser.ypp" { } break; case 286: /* Line 1269 of yacc.c. */ -#line 3233 "querytransformparser.ypp" +#line 3290 "querytransformparser.ypp" { } break; case 287: /* Line 1269 of yacc.c. */ -#line 3237 "querytransformparser.ypp" +#line 3294 "querytransformparser.ypp" { /* Note, this grammar rule is invoked for @c xsl:param @em and @c * xsl:with-param. */ @@ -6242,7 +6299,7 @@ yyreduce: case 288: /* Line 1269 of yacc.c. */ -#line 3302 "querytransformparser.ypp" +#line 3359 "querytransformparser.ypp" { (yyval.enums.Bool) = false; } @@ -6250,7 +6307,7 @@ yyreduce: case 289: /* Line 1269 of yacc.c. */ -#line 3306 "querytransformparser.ypp" +#line 3363 "querytransformparser.ypp" { (yyval.enums.Bool) = true; } @@ -6258,7 +6315,7 @@ yyreduce: case 290: /* Line 1269 of yacc.c. */ -#line 3311 "querytransformparser.ypp" +#line 3368 "querytransformparser.ypp" { (yyval.expr) = Expression::Ptr(); } @@ -6266,7 +6323,7 @@ yyreduce: case 291: /* Line 1269 of yacc.c. */ -#line 3315 "querytransformparser.ypp" +#line 3372 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(2) - (2)].expr); } @@ -6274,7 +6331,7 @@ yyreduce: case 292: /* Line 1269 of yacc.c. */ -#line 3324 "querytransformparser.ypp" +#line 3381 "querytransformparser.ypp" { (yyval.enums.pathKind) = Path::RegularPath; } @@ -6282,7 +6339,7 @@ yyreduce: case 293: /* Line 1269 of yacc.c. */ -#line 3328 "querytransformparser.ypp" +#line 3385 "querytransformparser.ypp" { (yyval.enums.pathKind) = Path::XSLTForEach; } @@ -6290,7 +6347,7 @@ yyreduce: case 294: /* Line 1269 of yacc.c. */ -#line 3332 "querytransformparser.ypp" +#line 3389 "querytransformparser.ypp" { (yyval.enums.pathKind) = Path::ForApplyTemplate; } @@ -6298,7 +6355,7 @@ yyreduce: case 296: /* Line 1269 of yacc.c. */ -#line 3338 "querytransformparser.ypp" +#line 3395 "querytransformparser.ypp" { (yyval.expr) = create(GenericPredicate::create((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr), parseInfo->staticContext, fromYYLTYPE((yyloc), parseInfo)), (yyloc), parseInfo); } @@ -6306,7 +6363,7 @@ yyreduce: case 299: /* Line 1269 of yacc.c. */ -#line 3346 "querytransformparser.ypp" +#line 3403 "querytransformparser.ypp" { if((yyvsp[(1) - (1)].enums.axis) == QXmlNodeModelIndex::AxisAttribute) parseInfo->nodeTestSource = BuiltinTypes::attribute; @@ -6315,7 +6372,7 @@ yyreduce: case 300: /* Line 1269 of yacc.c. */ -#line 3351 "querytransformparser.ypp" +#line 3408 "querytransformparser.ypp" { if((yyvsp[(3) - (3)].itemType)) { @@ -6344,7 +6401,7 @@ yyreduce: case 304: /* Line 1269 of yacc.c. */ -#line 3381 "querytransformparser.ypp" +#line 3438 "querytransformparser.ypp" { if((yyvsp[(1) - (2)].enums.axis) == QXmlNodeModelIndex::AxisNamespace) { @@ -6356,84 +6413,114 @@ yyreduce: } else (yyval.enums.axis) = (yyvsp[(1) - (2)].enums.axis); + + switch((yyvsp[(1) - (2)].enums.axis)) + { + case QXmlNodeModelIndex::AxisAttribute: + { + allowedIn(QueryLanguages( QXmlQuery::XPath20 + | QXmlQuery::XQuery10 + | QXmlQuery::XmlSchema11IdentityConstraintField + | QXmlQuery::XSLT20), + parseInfo, (yyloc)); + break; + } + case QXmlNodeModelIndex::AxisChild: + { + allowedIn(QueryLanguages( QXmlQuery::XPath20 + | QXmlQuery::XQuery10 + | QXmlQuery::XmlSchema11IdentityConstraintField + | QXmlQuery::XmlSchema11IdentityConstraintSelector + | QXmlQuery::XSLT20), + parseInfo, (yyloc)); + break; + } + default: + { + allowedIn(QueryLanguages( QXmlQuery::XPath20 + | QXmlQuery::XQuery10 + | QXmlQuery::XSLT20), + parseInfo, (yyloc)); + } + } } break; case 305: /* Line 1269 of yacc.c. */ -#line 3394 "querytransformparser.ypp" +#line 3481 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestorOrSelf ;} break; case 306: /* Line 1269 of yacc.c. */ -#line 3395 "querytransformparser.ypp" +#line 3482 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestor ;} break; case 307: /* Line 1269 of yacc.c. */ -#line 3396 "querytransformparser.ypp" +#line 3483 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAttribute ;} break; case 308: /* Line 1269 of yacc.c. */ -#line 3397 "querytransformparser.ypp" +#line 3484 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisChild ;} break; case 309: /* Line 1269 of yacc.c. */ -#line 3398 "querytransformparser.ypp" +#line 3485 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendantOrSelf;} break; case 310: /* Line 1269 of yacc.c. */ -#line 3399 "querytransformparser.ypp" +#line 3486 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendant ;} break; case 311: /* Line 1269 of yacc.c. */ -#line 3400 "querytransformparser.ypp" +#line 3487 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowing ;} break; case 312: /* Line 1269 of yacc.c. */ -#line 3401 "querytransformparser.ypp" +#line 3488 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisPreceding ;} break; case 313: /* Line 1269 of yacc.c. */ -#line 3402 "querytransformparser.ypp" +#line 3489 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowingSibling;} break; case 314: /* Line 1269 of yacc.c. */ -#line 3403 "querytransformparser.ypp" +#line 3490 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisPrecedingSibling;} break; case 315: /* Line 1269 of yacc.c. */ -#line 3404 "querytransformparser.ypp" +#line 3491 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisParent ;} break; case 316: /* Line 1269 of yacc.c. */ -#line 3405 "querytransformparser.ypp" +#line 3492 "querytransformparser.ypp" {(yyval.enums.axis) = QXmlNodeModelIndex::AxisSelf ;} break; case 317: /* Line 1269 of yacc.c. */ -#line 3408 "querytransformparser.ypp" +#line 3495 "querytransformparser.ypp" { parseInfo->nodeTestSource = BuiltinTypes::attribute; } @@ -6441,8 +6528,9 @@ yyreduce: case 318: /* Line 1269 of yacc.c. */ -#line 3412 "querytransformparser.ypp" +#line 3499 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20 | QXmlQuery::XmlSchema11IdentityConstraintField), parseInfo, (yyloc)); (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[(3) - (3)].itemType)), (yyloc), parseInfo); parseInfo->restoreNodeTestSource(); @@ -6451,7 +6539,7 @@ yyreduce: case 319: /* Line 1269 of yacc.c. */ -#line 3418 "querytransformparser.ypp" +#line 3506 "querytransformparser.ypp" { ItemType::Ptr nodeTest; @@ -6466,7 +6554,7 @@ yyreduce: case 320: /* Line 1269 of yacc.c. */ -#line 3429 "querytransformparser.ypp" +#line 3517 "querytransformparser.ypp" { (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[(1) - (1)].itemType)), (yyloc), parseInfo); } @@ -6474,15 +6562,23 @@ yyreduce: case 322: /* Line 1269 of yacc.c. */ -#line 3436 "querytransformparser.ypp" +#line 3524 "querytransformparser.ypp" { (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::node), (yyloc), parseInfo); } break; + case 324: +/* Line 1269 of yacc.c. */ +#line 3530 "querytransformparser.ypp" + { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); + } + break; + case 325: /* Line 1269 of yacc.c. */ -#line 3444 "querytransformparser.ypp" +#line 3535 "querytransformparser.ypp" { (yyval.itemType) = QNameTest::create(parseInfo->nodeTestSource, (yyvsp[(1) - (1)].qName)); } @@ -6490,7 +6586,7 @@ yyreduce: case 327: /* Line 1269 of yacc.c. */ -#line 3450 "querytransformparser.ypp" +#line 3541 "querytransformparser.ypp" { (yyval.itemType) = parseInfo->nodeTestSource; } @@ -6498,7 +6594,7 @@ yyreduce: case 328: /* Line 1269 of yacc.c. */ -#line 3454 "querytransformparser.ypp" +#line 3545 "querytransformparser.ypp" { const NamePool::Ptr np(parseInfo->staticContext->namePool()); const ReflectYYLTYPE ryy((yyloc), parseInfo); @@ -6511,8 +6607,9 @@ yyreduce: case 329: /* Line 1269 of yacc.c. */ -#line 3463 "querytransformparser.ypp" +#line 3554 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); const QXmlName::LocalNameCode c = parseInfo->staticContext->namePool()->allocateLocalName((yyvsp[(1) - (1)].sval)); (yyval.itemType) = LocalNameTest::create(parseInfo->nodeTestSource, c); } @@ -6520,15 +6617,16 @@ yyreduce: case 331: /* Line 1269 of yacc.c. */ -#line 3470 "querytransformparser.ypp" +#line 3562 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(GenericPredicate::create((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr), parseInfo->staticContext, fromYYLTYPE((yylsp[(4) - (4)]), parseInfo)), (yyloc), parseInfo); } break; case 339: /* Line 1269 of yacc.c. */ -#line 3482 "querytransformparser.ypp" +#line 3575 "querytransformparser.ypp" { (yyval.expr) = create(new ApplyTemplate(parseInfo->modeFor((yyvsp[(2) - (5)].qName)), parseInfo->templateWithParams, @@ -6541,7 +6639,7 @@ yyreduce: case 341: /* Line 1269 of yacc.c. */ -#line 3493 "querytransformparser.ypp" +#line 3586 "querytransformparser.ypp" { (yyval.expr) = create(new Literal(AtomicString::fromValue((yyvsp[(1) - (1)].sval))), (yyloc), parseInfo); } @@ -6549,31 +6647,34 @@ yyreduce: case 342: /* Line 1269 of yacc.c. */ -#line 3498 "querytransformparser.ypp" +#line 3591 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = createNumericLiteral((yyvsp[(1) - (1)].sval), (yyloc), parseInfo); } break; case 343: /* Line 1269 of yacc.c. */ -#line 3502 "querytransformparser.ypp" +#line 3596 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = createNumericLiteral((yyvsp[(1) - (1)].sval), (yyloc), parseInfo); } break; case 344: /* Line 1269 of yacc.c. */ -#line 3507 "querytransformparser.ypp" +#line 3602 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = resolveVariable((yyvsp[(2) - (2)].qName), (yyloc), parseInfo, false); } break; case 345: /* Line 1269 of yacc.c. */ -#line 3512 "querytransformparser.ypp" +#line 3608 "querytransformparser.ypp" { /* See: http://www.w3.org/TR/xpath20/#id-variables */ (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(QString(), (yyvsp[(1) - (1)].sval)); @@ -6582,7 +6683,7 @@ yyreduce: case 346: /* Line 1269 of yacc.c. */ -#line 3517 "querytransformparser.ypp" +#line 3613 "querytransformparser.ypp" { (yyval.qName) = (yyvsp[(1) - (1)].qName); } @@ -6590,23 +6691,25 @@ yyreduce: case 347: /* Line 1269 of yacc.c. */ -#line 3522 "querytransformparser.ypp" +#line 3618 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = (yyvsp[(2) - (3)].expr); } break; case 348: /* Line 1269 of yacc.c. */ -#line 3526 "querytransformparser.ypp" +#line 3623 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); (yyval.expr) = create(new EmptySequence, (yyloc), parseInfo); } break; case 349: /* Line 1269 of yacc.c. */ -#line 3531 "querytransformparser.ypp" +#line 3629 "querytransformparser.ypp" { (yyval.expr) = create(new ContextItem(), (yyloc), parseInfo); } @@ -6614,7 +6717,7 @@ yyreduce: case 350: /* Line 1269 of yacc.c. */ -#line 3536 "querytransformparser.ypp" +#line 3634 "querytransformparser.ypp" { (yyval.expr) = (yyvsp[(2) - (2)].expr); } @@ -6622,8 +6725,9 @@ yyreduce: case 351: /* Line 1269 of yacc.c. */ -#line 3541 "querytransformparser.ypp" +#line 3639 "querytransformparser.ypp" { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); if(XPathHelper::isReservedNamespace((yyvsp[(1) - (4)].qName).namespaceURI()) || (yyvsp[(1) - (4)].qName).namespaceURI() == StandardNamespaces::InternalXSLT) { /* We got a call to a builtin function. */ const ReflectYYLTYPE ryy((yyloc), parseInfo); @@ -6653,7 +6757,7 @@ yyreduce: case 352: /* Line 1269 of yacc.c. */ -#line 3569 "querytransformparser.ypp" +#line 3668 "querytransformparser.ypp" { (yyval.expressionList) = Expression::List(); } @@ -6661,7 +6765,7 @@ yyreduce: case 353: /* Line 1269 of yacc.c. */ -#line 3574 "querytransformparser.ypp" +#line 3673 "querytransformparser.ypp" { Expression::List list; list.append((yyvsp[(1) - (1)].expr)); @@ -6671,15 +6775,15 @@ yyreduce: case 355: /* Line 1269 of yacc.c. */ -#line 3583 "querytransformparser.ypp" +#line 3682 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc)); } break; case 360: /* Line 1269 of yacc.c. */ -#line 3624 "querytransformparser.ypp" +#line 3726 "querytransformparser.ypp" { (yyval.enums.tokenizerPosition) = parseInfo->tokenizer->commenceScanOnly(); parseInfo->scanOnlyStack.push(true); @@ -6688,7 +6792,7 @@ yyreduce: case 361: /* Line 1269 of yacc.c. */ -#line 3633 "querytransformparser.ypp" +#line 3735 "querytransformparser.ypp" { ++parseInfo->elementConstructorDepth; Expression::List constructors; @@ -6836,7 +6940,7 @@ yyreduce: case 362: /* Line 1269 of yacc.c. */ -#line 3779 "querytransformparser.ypp" +#line 3881 "querytransformparser.ypp" { /* We add the content constructor after the attribute constructors. This might result * in nested ExpressionSequences, but it will be optimized away later on. */ @@ -6935,7 +7039,7 @@ yyreduce: case 363: /* Line 1269 of yacc.c. */ -#line 3875 "querytransformparser.ypp" +#line 3977 "querytransformparser.ypp" { (yyval.expr) = create(new EmptySequence(), (yyloc), parseInfo); } @@ -6943,7 +7047,7 @@ yyreduce: case 364: /* Line 1269 of yacc.c. */ -#line 3879 "querytransformparser.ypp" +#line 3981 "querytransformparser.ypp" { if(!(yyvsp[(4) - (5)].qName).isLexicallyEqual(parseInfo->tagStack.top())) { @@ -6965,7 +7069,7 @@ yyreduce: case 365: /* Line 1269 of yacc.c. */ -#line 3898 "querytransformparser.ypp" +#line 4000 "querytransformparser.ypp" { (yyval.attributeHolders) = AttributeHolderVector(); } @@ -6973,7 +7077,7 @@ yyreduce: case 366: /* Line 1269 of yacc.c. */ -#line 3902 "querytransformparser.ypp" +#line 4004 "querytransformparser.ypp" { (yyvsp[(1) - (2)].attributeHolders).append((yyvsp[(2) - (2)].attributeHolder)); (yyval.attributeHolders) = (yyvsp[(1) - (2)].attributeHolders); @@ -6982,7 +7086,7 @@ yyreduce: case 367: /* Line 1269 of yacc.c. */ -#line 3908 "querytransformparser.ypp" +#line 4010 "querytransformparser.ypp" { (yyval.attributeHolder) = qMakePair((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].expr)); } @@ -6990,7 +7094,7 @@ yyreduce: case 368: /* Line 1269 of yacc.c. */ -#line 3913 "querytransformparser.ypp" +#line 4015 "querytransformparser.ypp" { (yyval.expr) = createDirAttributeValue((yyvsp[(2) - (3)].expressionList), parseInfo, (yyloc)); } @@ -6998,7 +7102,7 @@ yyreduce: case 369: /* Line 1269 of yacc.c. */ -#line 3918 "querytransformparser.ypp" +#line 4020 "querytransformparser.ypp" { (yyval.expr) = createDirAttributeValue((yyvsp[(2) - (3)].expressionList), parseInfo, (yyloc)); } @@ -7006,7 +7110,7 @@ yyreduce: case 370: /* Line 1269 of yacc.c. */ -#line 3923 "querytransformparser.ypp" +#line 4025 "querytransformparser.ypp" { (yyval.expressionList) = Expression::List(); } @@ -7014,7 +7118,7 @@ yyreduce: case 371: /* Line 1269 of yacc.c. */ -#line 3927 "querytransformparser.ypp" +#line 4029 "querytransformparser.ypp" { Expression::Ptr content((yyvsp[(1) - (2)].expr)); @@ -7028,7 +7132,7 @@ yyreduce: case 372: /* Line 1269 of yacc.c. */ -#line 3937 "querytransformparser.ypp" +#line 4039 "querytransformparser.ypp" { (yyvsp[(2) - (2)].expressionList).prepend(create(new Literal(AtomicString::fromValue((yyvsp[(1) - (2)].sval))), (yyloc), parseInfo)); (yyval.expressionList) = (yyvsp[(2) - (2)].expressionList); @@ -7037,7 +7141,7 @@ yyreduce: case 373: /* Line 1269 of yacc.c. */ -#line 3943 "querytransformparser.ypp" +#line 4045 "querytransformparser.ypp" { (yyval.expressionList) = Expression::List(); parseInfo->isPreviousEnclosedExpr = false; @@ -7046,7 +7150,7 @@ yyreduce: case 374: /* Line 1269 of yacc.c. */ -#line 3948 "querytransformparser.ypp" +#line 4050 "querytransformparser.ypp" { (yyvsp[(1) - (2)].expressionList).append((yyvsp[(2) - (2)].expr)); (yyval.expressionList) = (yyvsp[(1) - (2)].expressionList); @@ -7056,7 +7160,7 @@ yyreduce: case 375: /* Line 1269 of yacc.c. */ -#line 3954 "querytransformparser.ypp" +#line 4056 "querytransformparser.ypp" { if(parseInfo->staticContext->boundarySpacePolicy() == StaticContext::BSPStrip && XPathHelper::isWhitespaceOnly((yyvsp[(2) - (2)].sval))) @@ -7074,7 +7178,7 @@ yyreduce: case 376: /* Line 1269 of yacc.c. */ -#line 3968 "querytransformparser.ypp" +#line 4070 "querytransformparser.ypp" { (yyvsp[(1) - (2)].expressionList).append(create(new TextNodeConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(2) - (2)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo)); (yyval.expressionList) = (yyvsp[(1) - (2)].expressionList); @@ -7084,7 +7188,7 @@ yyreduce: case 377: /* Line 1269 of yacc.c. */ -#line 3974 "querytransformparser.ypp" +#line 4076 "querytransformparser.ypp" { /* We insert a text node constructor that send an empty text node between * the two enclosed expressions, in order to ensure that no space is inserted. @@ -7104,7 +7208,7 @@ yyreduce: case 378: /* Line 1269 of yacc.c. */ -#line 3991 "querytransformparser.ypp" +#line 4093 "querytransformparser.ypp" { (yyval.expr) = create(new CommentConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(2) - (2)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo); } @@ -7112,7 +7216,7 @@ yyreduce: case 379: /* Line 1269 of yacc.c. */ -#line 3996 "querytransformparser.ypp" +#line 4098 "querytransformparser.ypp" { const ReflectYYLTYPE ryy((yyloc), parseInfo); NCNameConstructor::validateTargetNameelementConstructorDepth; @@ -7147,10 +7251,10 @@ yyreduce: case 389: /* Line 1269 of yacc.c. */ -#line 4029 "querytransformparser.ypp" +#line 4131 "querytransformparser.ypp" { Q_ASSERT(5); - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (5)].enums.Bool)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (5)].enums.Bool)); Expression::Ptr effExpr; @@ -7184,7 +7288,7 @@ yyreduce: case 390: /* Line 1269 of yacc.c. */ -#line 4063 "querytransformparser.ypp" +#line 4165 "querytransformparser.ypp" { (yyval.enums.Bool) = false; } @@ -7192,7 +7296,7 @@ yyreduce: case 391: /* Line 1269 of yacc.c. */ -#line 4067 "querytransformparser.ypp" +#line 4169 "querytransformparser.ypp" { (yyval.enums.Bool) = true; } @@ -7200,9 +7304,9 @@ yyreduce: case 392: /* Line 1269 of yacc.c. */ -#line 4075 "querytransformparser.ypp" +#line 4177 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (4)].enums.Bool)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (4)].enums.Bool)); const Expression::Ptr name(create(new AttributeNameValidator((yyvsp[(3) - (4)].expr)), (yyloc), parseInfo)); @@ -7215,7 +7319,7 @@ yyreduce: case 393: /* Line 1269 of yacc.c. */ -#line 4087 "querytransformparser.ypp" +#line 4189 "querytransformparser.ypp" { (yyval.expr) = create(new TextNodeConstructor(createSimpleContent((yyvsp[(3) - (3)].expr), (yyloc), parseInfo)), (yyloc), parseInfo); } @@ -7223,9 +7327,9 @@ yyreduce: case 394: /* Line 1269 of yacc.c. */ -#line 4092 "querytransformparser.ypp" +#line 4194 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool)); (yyval.expr) = create(new CommentConstructor(createSimpleContent((yyvsp[(3) - (3)].expr), (yyloc), parseInfo)), (yyloc), parseInfo); } @@ -7233,9 +7337,9 @@ yyreduce: case 395: /* Line 1269 of yacc.c. */ -#line 4099 "querytransformparser.ypp" +#line 4201 "querytransformparser.ypp" { - disallowedConstruct(parseInfo, (yyloc), (yyvsp[(2) - (3)].expr)); + allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].expr)); if((yyvsp[(3) - (3)].expr)) { @@ -7248,7 +7352,7 @@ yyreduce: case 396: /* Line 1269 of yacc.c. */ -#line 4110 "querytransformparser.ypp" +#line 4212 "querytransformparser.ypp" { parseInfo->nodeTestSource = BuiltinTypes::attribute; } @@ -7256,7 +7360,7 @@ yyreduce: case 397: /* Line 1269 of yacc.c. */ -#line 4114 "querytransformparser.ypp" +#line 4216 "querytransformparser.ypp" { parseInfo->restoreNodeTestSource(); } @@ -7264,7 +7368,7 @@ yyreduce: case 398: /* Line 1269 of yacc.c. */ -#line 4117 "querytransformparser.ypp" +#line 4219 "querytransformparser.ypp" { (yyval.expr) = create(new Literal(toItem(QNameValue::fromValue(parseInfo->staticContext->namePool(), (yyvsp[(2) - (3)].qName)))), (yyloc), parseInfo); } @@ -7272,7 +7376,7 @@ yyreduce: case 400: /* Line 1269 of yacc.c. */ -#line 4123 "querytransformparser.ypp" +#line 4225 "querytransformparser.ypp" { (yyval.expr) = create(new Literal(toItem(QNameValue::fromValue(parseInfo->staticContext->namePool(), (yyvsp[(1) - (1)].qName)))), (yyloc), parseInfo); } @@ -7280,7 +7384,7 @@ yyreduce: case 402: /* Line 1269 of yacc.c. */ -#line 4129 "querytransformparser.ypp" +#line 4231 "querytransformparser.ypp" { if(BuiltinTypes::xsQName->xdtTypeMatches((yyvsp[(1) - (1)].expr)->staticType()->itemType())) (yyval.expr) = (yyvsp[(1) - (1)].expr); @@ -7295,7 +7399,7 @@ yyreduce: case 403: /* Line 1269 of yacc.c. */ -#line 4144 "querytransformparser.ypp" +#line 4246 "querytransformparser.ypp" { (yyval.expr) = create(new NCNameConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(1) - (1)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo); } @@ -7303,7 +7407,7 @@ yyreduce: case 404: /* Line 1269 of yacc.c. */ -#line 4148 "querytransformparser.ypp" +#line 4250 "querytransformparser.ypp" { (yyval.expr) = create(new NCNameConstructor((yyvsp[(1) - (1)].expr)), (yyloc), parseInfo); } @@ -7311,7 +7415,7 @@ yyreduce: case 405: /* Line 1269 of yacc.c. */ -#line 4157 "querytransformparser.ypp" +#line 4259 "querytransformparser.ypp" { (yyval.expr) = create(new ComputedNamespaceConstructor((yyvsp[(2) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo); } @@ -7319,7 +7423,7 @@ yyreduce: case 406: /* Line 1269 of yacc.c. */ -#line 4162 "querytransformparser.ypp" +#line 4264 "querytransformparser.ypp" { (yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (1)].itemType), Cardinality::exactlyOne()); } @@ -7327,7 +7431,7 @@ yyreduce: case 407: /* Line 1269 of yacc.c. */ -#line 4166 "querytransformparser.ypp" +#line 4268 "querytransformparser.ypp" { (yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (2)].itemType), Cardinality::zeroOrOne()); } @@ -7335,7 +7439,7 @@ yyreduce: case 408: /* Line 1269 of yacc.c. */ -#line 4171 "querytransformparser.ypp" +#line 4273 "querytransformparser.ypp" { (yyval.sequenceType) = CommonSequenceTypes::ZeroOrMoreItems; } @@ -7343,7 +7447,7 @@ yyreduce: case 409: /* Line 1269 of yacc.c. */ -#line 4175 "querytransformparser.ypp" +#line 4277 "querytransformparser.ypp" { (yyval.sequenceType) = (yyvsp[(2) - (2)].sequenceType); } @@ -7351,7 +7455,7 @@ yyreduce: case 410: /* Line 1269 of yacc.c. */ -#line 4180 "querytransformparser.ypp" +#line 4282 "querytransformparser.ypp" { (yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (2)].itemType), (yyvsp[(2) - (2)].cardinality)); } @@ -7359,7 +7463,7 @@ yyreduce: case 411: /* Line 1269 of yacc.c. */ -#line 4185 "querytransformparser.ypp" +#line 4287 "querytransformparser.ypp" { (yyval.sequenceType) = CommonSequenceTypes::Empty; } @@ -7367,31 +7471,31 @@ yyreduce: case 412: /* Line 1269 of yacc.c. */ -#line 4189 "querytransformparser.ypp" +#line 4291 "querytransformparser.ypp" {(yyval.cardinality) = Cardinality::exactlyOne();} break; case 413: /* Line 1269 of yacc.c. */ -#line 4190 "querytransformparser.ypp" +#line 4292 "querytransformparser.ypp" {(yyval.cardinality) = Cardinality::oneOrMore();} break; case 414: /* Line 1269 of yacc.c. */ -#line 4191 "querytransformparser.ypp" +#line 4293 "querytransformparser.ypp" {(yyval.cardinality) = Cardinality::zeroOrMore();} break; case 415: /* Line 1269 of yacc.c. */ -#line 4192 "querytransformparser.ypp" +#line 4294 "querytransformparser.ypp" {(yyval.cardinality) = Cardinality::zeroOrOne();} break; case 419: /* Line 1269 of yacc.c. */ -#line 4198 "querytransformparser.ypp" +#line 4300 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::item; } @@ -7399,7 +7503,7 @@ yyreduce: case 420: /* Line 1269 of yacc.c. */ -#line 4203 "querytransformparser.ypp" +#line 4305 "querytransformparser.ypp" { const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(1) - (1)].qName))); @@ -7435,7 +7539,7 @@ yyreduce: case 428: /* Line 1269 of yacc.c. */ -#line 4247 "querytransformparser.ypp" +#line 4349 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::node; } @@ -7443,7 +7547,7 @@ yyreduce: case 429: /* Line 1269 of yacc.c. */ -#line 4252 "querytransformparser.ypp" +#line 4354 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::document; } @@ -7451,7 +7555,7 @@ yyreduce: case 430: /* Line 1269 of yacc.c. */ -#line 4257 "querytransformparser.ypp" +#line 4359 "querytransformparser.ypp" { // TODO support for document element testing (yyval.itemType) = BuiltinTypes::document; @@ -7460,7 +7564,7 @@ yyreduce: case 433: /* Line 1269 of yacc.c. */ -#line 4266 "querytransformparser.ypp" +#line 4368 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::text; } @@ -7468,7 +7572,7 @@ yyreduce: case 434: /* Line 1269 of yacc.c. */ -#line 4271 "querytransformparser.ypp" +#line 4373 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::comment; } @@ -7476,7 +7580,7 @@ yyreduce: case 435: /* Line 1269 of yacc.c. */ -#line 4276 "querytransformparser.ypp" +#line 4378 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::pi; } @@ -7484,7 +7588,7 @@ yyreduce: case 436: /* Line 1269 of yacc.c. */ -#line 4281 "querytransformparser.ypp" +#line 4383 "querytransformparser.ypp" { (yyval.itemType) = LocalNameTest::create(BuiltinTypes::pi, parseInfo->staticContext->namePool()->allocateLocalName((yyvsp[(3) - (4)].sval))); } @@ -7492,7 +7596,7 @@ yyreduce: case 437: /* Line 1269 of yacc.c. */ -#line 4286 "querytransformparser.ypp" +#line 4388 "querytransformparser.ypp" { if(QXmlUtils::isNCName((yyvsp[(3) - (4)].sval))) { @@ -7511,7 +7615,7 @@ yyreduce: case 440: /* Line 1269 of yacc.c. */ -#line 4305 "querytransformparser.ypp" +#line 4407 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::attribute; } @@ -7519,7 +7623,7 @@ yyreduce: case 441: /* Line 1269 of yacc.c. */ -#line 4310 "querytransformparser.ypp" +#line 4412 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::attribute; } @@ -7527,7 +7631,7 @@ yyreduce: case 442: /* Line 1269 of yacc.c. */ -#line 4315 "querytransformparser.ypp" +#line 4417 "querytransformparser.ypp" { (yyval.itemType) = QNameTest::create(BuiltinTypes::attribute, (yyvsp[(3) - (4)].qName)); } @@ -7535,7 +7639,7 @@ yyreduce: case 443: /* Line 1269 of yacc.c. */ -#line 4319 "querytransformparser.ypp" +#line 4421 "querytransformparser.ypp" { const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (6)].qName))); @@ -7551,7 +7655,7 @@ yyreduce: case 444: /* Line 1269 of yacc.c. */ -#line 4331 "querytransformparser.ypp" +#line 4433 "querytransformparser.ypp" { const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (6)].qName))); @@ -7567,7 +7671,7 @@ yyreduce: case 445: /* Line 1269 of yacc.c. */ -#line 4344 "querytransformparser.ypp" +#line 4446 "querytransformparser.ypp" { parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not in the in-scope attribute " "declarations. Note that the schema import " @@ -7580,7 +7684,7 @@ yyreduce: case 446: /* Line 1269 of yacc.c. */ -#line 4354 "querytransformparser.ypp" +#line 4456 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::element; } @@ -7588,7 +7692,7 @@ yyreduce: case 447: /* Line 1269 of yacc.c. */ -#line 4359 "querytransformparser.ypp" +#line 4461 "querytransformparser.ypp" { (yyval.itemType) = BuiltinTypes::element; } @@ -7596,7 +7700,7 @@ yyreduce: case 448: /* Line 1269 of yacc.c. */ -#line 4364 "querytransformparser.ypp" +#line 4466 "querytransformparser.ypp" { (yyval.itemType) = QNameTest::create(BuiltinTypes::element, (yyvsp[(3) - (4)].qName)); } @@ -7604,7 +7708,7 @@ yyreduce: case 449: /* Line 1269 of yacc.c. */ -#line 4369 "querytransformparser.ypp" +#line 4471 "querytransformparser.ypp" { const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (7)].qName))); @@ -7621,7 +7725,7 @@ yyreduce: case 450: /* Line 1269 of yacc.c. */ -#line 4383 "querytransformparser.ypp" +#line 4485 "querytransformparser.ypp" { const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (7)].qName))); @@ -7638,7 +7742,7 @@ yyreduce: case 453: /* Line 1269 of yacc.c. */ -#line 4400 "querytransformparser.ypp" +#line 4502 "querytransformparser.ypp" { parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not in the in-scope attribute " "declarations. Note that the schema import " @@ -7651,7 +7755,7 @@ yyreduce: case 455: /* Line 1269 of yacc.c. */ -#line 4412 "querytransformparser.ypp" +#line 4514 "querytransformparser.ypp" { (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::empty, (yyvsp[(1) - (1)].sval)); } @@ -7659,7 +7763,7 @@ yyreduce: case 457: /* Line 1269 of yacc.c. */ -#line 4424 "querytransformparser.ypp" +#line 4526 "querytransformparser.ypp" { if(parseInfo->nodeTestSource == BuiltinTypes::element) (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(parseInfo->staticContext->namespaceBindings()->lookupNamespaceURI(StandardPrefixes::empty), (yyvsp[(1) - (1)].sval)); @@ -7670,7 +7774,7 @@ yyreduce: case 462: /* Line 1269 of yacc.c. */ -#line 4438 "querytransformparser.ypp" +#line 4540 "querytransformparser.ypp" { (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(parseInfo->staticContext->defaultFunctionNamespace(), (yyvsp[(1) - (1)].sval)); } @@ -7678,7 +7782,7 @@ yyreduce: case 463: /* Line 1269 of yacc.c. */ -#line 4442 "querytransformparser.ypp" +#line 4544 "querytransformparser.ypp" { (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::InternalXSLT, (yyvsp[(2) - (2)].sval)); } @@ -7686,7 +7790,7 @@ yyreduce: case 466: /* Line 1269 of yacc.c. */ -#line 4450 "querytransformparser.ypp" +#line 4552 "querytransformparser.ypp" { parseInfo->staticContext->error(QtXmlPatterns::tr("The name of an extension expression must be in " "a namespace."), @@ -7694,9 +7798,25 @@ yyreduce: } break; + case 469: +/* Line 1269 of yacc.c. */ +#line 4562 "querytransformparser.ypp" + { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); + } + break; + + case 470: +/* Line 1269 of yacc.c. */ +#line 4566 "querytransformparser.ypp" + { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, (yyloc)); + } + break; + case 471: /* Line 1269 of yacc.c. */ -#line 4463 "querytransformparser.ypp" +#line 4571 "querytransformparser.ypp" { const ReflectYYLTYPE ryy((yyloc), parseInfo); @@ -7712,7 +7832,7 @@ yyreduce: case 472: /* Line 1269 of yacc.c. */ -#line 4475 "querytransformparser.ypp" +#line 4583 "querytransformparser.ypp" { (yyval.qName) = parseInfo->staticContext->namePool()->fromClarkName((yyvsp[(1) - (1)].sval)); } @@ -7720,7 +7840,7 @@ yyreduce: /* Line 1269 of yacc.c. */ -#line 7643 "qquerytransformparser.cpp" +#line 7763 "qquerytransformparser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -7938,7 +8058,7 @@ yyreturn: /* Line 1486 of yacc.c. */ -#line 4479 "querytransformparser.ypp" +#line 4587 "querytransformparser.ypp" QString Tokenizer::tokenToString(const Token &token) diff --git a/src/xmlpatterns/parser/qquerytransformparser_p.h b/src/xmlpatterns/parser/qquerytransformparser_p.h index fcf8896..759c39f 100644 --- a/src/xmlpatterns/parser/qquerytransformparser_p.h +++ b/src/xmlpatterns/parser/qquerytransformparser_p.h @@ -49,6 +49,27 @@ // // We mean it. +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + /* A Bison parser, made by GNU Bison 2.3a. */ /* Skeleton interface for Bison's Yacc-like parsers in C @@ -104,6 +125,25 @@ # undef SELF #endif +/* These tokens are defined to nothing on Windows because they're + * used in their documentation parser, for use in things like: + * + * int foo(IN char* name, OUT char* path); + * + * Hence this un-break fix. Note that this file was auto generated. */ +#ifdef IN +# undef IN +#endif +#ifdef INSTANCE +# undef INSTANCE +#endif +#ifdef STRICT +# undef STRICT +#endif +#ifdef SELF +# undef SELF +#endif + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE diff --git a/src/xmlpatterns/parser/querytransformparser.ypp b/src/xmlpatterns/parser/querytransformparser.ypp index 93974a4..e4f6b2d 100644 --- a/src/xmlpatterns/parser/querytransformparser.ypp +++ b/src/xmlpatterns/parser/querytransformparser.ypp @@ -227,11 +227,18 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, } /** + * @internal + * @relates QXmlQuery + */ +typedef QFlags QueryLanguages; + +/** * @short Flags invalid expressions and declarations in the currently * parsed language. * - * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0 and - * XPath 2.0 inside XSL-T, it is the union of all the constructs in these + * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0, and + * XPath 2.0 inside XSL-T, and field and selector patterns in W3C XML Schema's + * identity constraints, it is the union of all the constructs in these * languages. However, when dealing with each language individually, we * regularly need to disallow some expressions, such as direct element * constructors when parsing XSL-T, or the typeswitch when parsing XPath. @@ -242,19 +249,46 @@ static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, * instance the @c let clause, should not be flagged as an error, because it's * used for internal purposes. * - * Hence, this function is called from each expression and declaration which is - * unavailable in XPath. + * Hence, this function is called from each expression and declaration with @p + * allowedLanguages stating what languages it is allowed in. * * If @p isInternal is @c true, no error is raised. Otherwise, if the current - * language is not XQuery, an error is raised. + * language is not in @p allowedLanguages, an error is raised. */ -static void disallowedConstruct(const ParserContext *const parseInfo, - const YYLTYPE &sourceLocator, - const bool isInternal = false) +static void allowedIn(const QueryLanguages allowedLanguages, + const ParserContext *const parseInfo, + const YYLTYPE &sourceLocator, + const bool isInternal = false) { - if(!isInternal && parseInfo->languageAccent != QXmlQuery::XQuery10) + /* We treat XPath 2.0 as a subset of XSL-T 2.0, so if XPath 2.0 is allowed + * and XSL-T is the language, it's ok. */ + if(!isInternal && + (!allowedLanguages.testFlag(parseInfo->languageAccent) && !(allowedLanguages.testFlag(QXmlQuery::XPath20) && parseInfo->languageAccent == QXmlQuery::XSLT20))) { - parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered which only is allowed in XQuery."), + + QString langName; + + switch(parseInfo->languageAccent) + { + case QXmlQuery::XPath20: + langName = QLatin1String("XPath 2.0"); + break; + case QXmlQuery::XSLT20: + langName = QLatin1String("XSL-T 2.0"); + break; + case QXmlQuery::XQuery10: + langName = QLatin1String("XQuery 1.0"); + break; + case QXmlQuery::XmlSchema11IdentityConstraintSelector: + langName = QtXmlPatterns::tr("W3C XML Schema identity constraint selector"); + break; + case QXmlQuery::XmlSchema11IdentityConstraintField: + langName = QtXmlPatterns::tr("W3C XML Schema identity constraint field"); + break; + } + + parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered " + "which is disallowed in the current language(%1).").arg(langName), ReportContext::XPST0003, fromYYLTYPE(sourceLocator, parseInfo)); @@ -1560,7 +1594,7 @@ Prolog: /* Empty. */ /* First part. */ | Prolog DefaultNamespaceDecl { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); if(parseInfo->hasSecondPrologPart) parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, " "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE(@$, parseInfo)); @@ -1579,7 +1613,7 @@ Prolog: /* Empty. */ } | Prolog Import { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); if(parseInfo->hasSecondPrologPart) parseInfo->staticContext->error(QtXmlPatterns::tr("Module imports must occur before function, " "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE(@$, parseInfo)); @@ -1597,7 +1631,7 @@ Prolog: /* Empty. */ } | Prolog OptionDecl { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); parseInfo->hasSecondPrologPart = true; } @@ -1730,20 +1764,20 @@ TemplateName: NAME ElementName Setter: BoundarySpaceDecl /* [7] */ | DefaultCollationDecl { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); } | BaseURIDecl | ConstructionDecl { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); } | OrderingModeDecl { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); } | EmptyOrderDecl { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); } | CopyNamespacesDecl @@ -1755,7 +1789,7 @@ Separator: SEMI_COLON NamespaceDecl: DECLARE NAMESPACE NCNAME G_EQ URILiteral IsInternal Separator /* [10] */ { if(!$6) - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); if($3 == QLatin1String("xmlns")) { @@ -1867,7 +1901,7 @@ OptionDecl: DECLARE OPTION ElementName StringLiteral Separator OrderingModeDecl: DECLARE ORDERING OrderingMode Separator /* [14] */ { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); if(parseInfo->hasDeclaration(ParserContext::OrderingModeDecl)) { parseInfo->staticContext->error(prologMessage("declare ordering"), @@ -1964,7 +1998,7 @@ DefaultCollationDecl: DECLARE DEFAULT COLLATION StringLiteral Separator BaseURIDecl: DECLARE BASEURI IsInternal URILiteral Separator /* [20] */ { - disallowedConstruct(parseInfo, @$, $3); + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, @$, $3); if(parseInfo->hasDeclaration(ParserContext::BaseURIDecl)) { parseInfo->staticContext->error(prologMessage("declare base-uri"), @@ -2026,7 +2060,7 @@ FileLocation: URILiteral VarDecl: DECLARE VARIABLE IsInternal DOLLAR VarName TypeDeclaration VariableValue OptionalDefaultValue Separator /* [24] */ { - disallowedConstruct(parseInfo, @$, $3); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $3); if(variableByName($5, parseInfo)) { parseInfo->staticContext->error(QtXmlPatterns::tr("A variable by name %1 has already " @@ -2126,7 +2160,7 @@ FunctionDecl: DECLARE FUNCTION IsInternal FunctionName LPAREN ParamList RPAREN TypeDeclaration FunctionBody Separator /* [26] */ { if(!$3) - disallowedConstruct(parseInfo, @$, $3); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $3); /* If FunctionBody is null, it is 'external', otherwise the value is the body. */ const QXmlName::NamespaceCode ns($4.namespaceURI()); @@ -2696,7 +2730,7 @@ LetClause: LET IsInternal DOLLAR VarName TypeDeclaration ASSIGN ExprSingle } LetTail /* [36] */ { - disallowedConstruct(parseInfo, @$, $2); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2); Q_ASSERT(parseInfo->variables.top()->name == $4); $$ = create(new LetClause($8, $9, parseInfo->variables.top()), @$, parseInfo); @@ -2835,6 +2869,7 @@ SomeQuantificationExpr: SOME DOLLAR VarName TypeDeclaration IN ExprSingle {$$ = parseInfo->staticContext->currentRangeSlot();} SomeQuantificationTail /* [X] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new QuantifiedExpression($8, QuantifiedExpression::Some, $6, $9), @$, parseInfo); parseInfo->finalizePushedVariable(); @@ -2863,6 +2898,7 @@ EveryQuantificationExpr: EVERY DOLLAR VarName TypeDeclaration IN ExprSingle {$$ = parseInfo->staticContext->currentRangeSlot();} EveryQuantificationTail /* [X] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new QuantifiedExpression($8, QuantifiedExpression::Every, $6, $9), @$, parseInfo); parseInfo->finalizePushedVariable(); @@ -2916,7 +2952,7 @@ TypeswitchExpr: TYPESWITCH LPAREN Expr RPAREN } CaseClause /* [43] */ { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); parseInfo->typeswitchSource.pop(); $$ = $6; } @@ -2976,18 +3012,21 @@ CaseDefault: DEFAULT RETURN ExprSingle IfExpr: IF LPAREN Expr RPAREN THEN ExprSingle ELSE ExprSingle /* [45] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new IfThenClause($3, $6, $8), @$, parseInfo); } OrExpr: AndExpr /* [46] */ | OrExpr OR AndExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new OrExpression($1, $3), @$, parseInfo); } AndExpr: ComparisonExpr /* [47] */ | AndExpr AND ComparisonExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new AndExpression($1, $3), @$, parseInfo); } @@ -2999,12 +3038,14 @@ ComparisonExpr: RangeExpr RangeExpr: AdditiveExpr /* [49] */ | AdditiveExpr TO AdditiveExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new RangeExpression($1, $3), @$, parseInfo); } AdditiveExpr: MultiplicativeExpr /* [50] */ | AdditiveExpr AdditiveOperator MultiplicativeExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new ArithmeticExpression($1, $2, $3), @$, parseInfo); } @@ -3014,6 +3055,7 @@ AdditiveOperator: PLUS {$$ = AtomicMathematician::Add;} MultiplicativeExpr: UnionExpr /* [51] */ | MultiplicativeExpr MultiplyOperator UnionExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new ArithmeticExpression($1, $2, $3), @$, parseInfo); } @@ -3025,12 +3067,18 @@ MultiplyOperator: STAR {$$ = AtomicMathematician::Multiply;} UnionExpr: IntersectExceptExpr /* [52] */ | UnionExpr UnionOperator IntersectExceptExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 + | QXmlQuery::XPath20 + | QXmlQuery::XmlSchema11IdentityConstraintField + | QXmlQuery::XmlSchema11IdentityConstraintSelector), + parseInfo, @$); $$ = create(new CombineNodes($1, CombineNodes::Union, $3), @$, parseInfo); } IntersectExceptExpr: InstanceOfExpr /* [53] */ | IntersectExceptExpr IntersectOperator InstanceOfExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new CombineNodes($1, $2, $3), @$, parseInfo); } @@ -3049,31 +3097,36 @@ IntersectOperator: INTERSECT InstanceOfExpr: TreatExpr /* [54] */ | TreatExpr INSTANCE OF SequenceType { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new InstanceOf($1, - SequenceType::Ptr($4)), @$, parseInfo); + SequenceType::Ptr($4)), @$, parseInfo); } TreatExpr: CastableExpr /* [55] */ | CastableExpr TREAT AS SequenceType { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new TreatAs($1, $4), @$, parseInfo); } CastableExpr: CastExpr /* [56] */ | CastExpr CASTABLE AS SingleType { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new CastableAs($1, $4), @$, parseInfo); } CastExpr: UnaryExpr /* [57] */ | UnaryExpr CAST AS SingleType { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new CastAs($1, $4), @$, parseInfo); } UnaryExpr: ValueExpr /* [58] */ | UnaryOperator UnaryExpr { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new UnaryExpression($1, $2, parseInfo->staticContext), @$, parseInfo); } @@ -3092,6 +3145,7 @@ ValueExpr: ValidateExpr GeneralComp: RangeExpr GeneralComparisonOperator RangeExpr /* [60] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new GeneralComparison($1, $2, $3, parseInfo->isBackwardsCompat.top()), @$, parseInfo); } @@ -3125,7 +3179,7 @@ NodeOperator: IS {$$ = QXmlNodeModelIndex::Is;} ValidateExpr: ValidationMode EnclosedExpr /* [63] */ { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Validation Feature is not supported. " "Hence, %1-expressions may not be used.") .arg(formatKeyword("validate")), @@ -3143,6 +3197,7 @@ ValidationMode: VALIDATE {$$ = Validate::Strict;} ExtensionExpr: Pragmas EnclosedOptionalExpr /* [65] */ { + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); /* We don't support any pragmas, so we only do the * necessary validation and use the fallback expression. */ @@ -3171,7 +3226,7 @@ Pragmas: Pragmas Pragma Pragma: PRAGMA_START PragmaName PragmaContents PRAGMA_END /* [66] */ { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); } PragmaContents: /* empty */ /* [67] */ @@ -3241,12 +3296,14 @@ StepExpr: FilteredAxisStep } | BASEURI StringLiteral CURLY_LBRACE Expr CURLY_RBRACE /* [X] */ { + allowedIn(QXmlQuery::XSLT20, parseInfo, @$); Q_ASSERT(!$2.isEmpty()); $$ = create(new StaticBaseURIStore($2, $4), @$, parseInfo); } | DECLARE NAMESPACE NCNAME G_EQ STRING_LITERAL CURLY_LBRACE /* [X] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, @$); parseInfo->resolvers.push(parseInfo->staticContext->namespaceBindings()); const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings())); resolver->addBinding(QXmlName(parseInfo->staticContext->namePool()->allocateNamespace($5), @@ -3449,6 +3506,36 @@ Axis: AxisToken COLONCOLON } else $$ = $1; + + switch($1) + { + case QXmlNodeModelIndex::AxisAttribute: + { + allowedIn(QueryLanguages( QXmlQuery::XPath20 + | QXmlQuery::XQuery10 + | QXmlQuery::XmlSchema11IdentityConstraintField + | QXmlQuery::XSLT20), + parseInfo, @$); + break; + } + case QXmlNodeModelIndex::AxisChild: + { + allowedIn(QueryLanguages( QXmlQuery::XPath20 + | QXmlQuery::XQuery10 + | QXmlQuery::XmlSchema11IdentityConstraintField + | QXmlQuery::XmlSchema11IdentityConstraintSelector + | QXmlQuery::XSLT20), + parseInfo, @$); + break; + } + default: + { + allowedIn(QueryLanguages( QXmlQuery::XPath20 + | QXmlQuery::XQuery10 + | QXmlQuery::XSLT20), + parseInfo, @$); + } + } } AxisToken: ANCESTOR_OR_SELF {$$ = QXmlNodeModelIndex::AxisAncestorOrSelf ;} @@ -3470,6 +3557,7 @@ AbbrevForwardStep: AT_SIGN } NodeTest /* [72] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20 | QXmlQuery::XmlSchema11IdentityConstraintField), parseInfo, @$); $$ = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, $3), @$, parseInfo); parseInfo->restoreNodeTestSource(); @@ -3499,6 +3587,9 @@ AbbrevReverseStep: DOTDOT NodeTest: NameTest /* [78] */ | KindTest + { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); + } NameTest: ElementName /* [79] */ { @@ -3521,6 +3612,7 @@ WildCard: STAR } | ANY_PREFIX { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); const QXmlName::LocalNameCode c = parseInfo->staticContext->namePool()->allocateLocalName($1); $$ = LocalNameTest::create(parseInfo->nodeTestSource, c); } @@ -3528,6 +3620,7 @@ WildCard: STAR FilterExpr: PrimaryExpr /* [81] */ | FilterExpr LBRACKET Expr RBRACKET { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(GenericPredicate::create($1, $3, parseInfo->staticContext, fromYYLTYPE(@4, parseInfo)), @$, parseInfo); } @@ -3556,15 +3649,18 @@ Literal: NumericLiteral NumericLiteral: XPATH2_NUMBER /* [86] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = createNumericLiteral($1, @$, parseInfo); } | NUMBER { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = createNumericLiteral($1, @$, parseInfo); } VarRef: DOLLAR VarName /* [87] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = resolveVariable($2, @$, parseInfo, false); } @@ -3580,10 +3676,12 @@ VarName: NCNAME ParenthesizedExpr: LPAREN Expr RPAREN /* [89] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = $2; } | LPAREN RPAREN { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); $$ = create(new EmptySequence, @$, parseInfo); } @@ -3599,6 +3697,7 @@ OrderingExpr: OrderingMode EnclosedExpr FunctionCallExpr: FunctionName LPAREN FunctionArguments RPAREN /* [93] */ { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); if(XPathHelper::isReservedNamespace($1.namespaceURI()) || $1.namespaceURI() == StandardNamespaces::InternalXSLT) { /* We got a call to a builtin function. */ const ReflectYYLTYPE ryy(@$, parseInfo); @@ -3641,9 +3740,12 @@ FunctionArguments: /* empty */ Constructor: DirectConstructor /* [94] */ { - disallowedConstruct(parseInfo, @$); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$); } | ComputedConstructor +/* The reason we cannot call alloweIn() as the action for ComputedConstructor, + * is that we use the computed constructors for XSL-T, and therefore generate + * INTERNAL tokens. */ DirectConstructor: DirElemConstructor /* [95] */ | DirCommentConstructor @@ -4075,7 +4177,7 @@ ComputedConstructor: CompDocConstructor CompDocConstructor: DOCUMENT IsInternal EnclosedExpr /* [110] */ { - disallowedConstruct(parseInfo, @$, $2); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2); $$ = create(new DocumentConstructor($3), @$, parseInfo); } @@ -4088,7 +4190,7 @@ CompElemConstructor: ELEMENT IsInternal CompElementName EnclosedOptionalExpr /* [111] */ { Q_ASSERT(5); - disallowedConstruct(parseInfo, @$, $2); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2); Expression::Ptr effExpr; @@ -4133,7 +4235,7 @@ CompAttrConstructor: ATTRIBUTE CompAttributeName EnclosedOptionalExpr /* [113] */ { - disallowedConstruct(parseInfo, @$, $2); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2); const Expression::Ptr name(create(new AttributeNameValidator($3), @$, parseInfo)); @@ -4150,14 +4252,14 @@ CompTextConstructor: TEXT IsInternal EnclosedExpr CompCommentConstructor: COMMENT IsInternal EnclosedExpr /* [115] */ { - disallowedConstruct(parseInfo, @$, $2); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2); $$ = create(new CommentConstructor(createSimpleContent($3, @$, parseInfo)), @$, parseInfo); } CompPIConstructor: PROCESSING_INSTRUCTION CompPIName EnclosedOptionalExpr /* [116] */ { - disallowedConstruct(parseInfo, @$, $2); + allowedIn(QXmlQuery::XQuery10, parseInfo, @$, $2); if($3) { @@ -4517,7 +4619,13 @@ PragmaName: NCNAME URILiteral: StringLiteral /* [140] */ StringLiteral: STRING_LITERAL /* [144] */ + { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); + } | XPATH2_STRING_LITERAL + { + allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, @$); + } QName: QNAME /* [154] */ { diff --git a/src/xmlpatterns/schema/.gitignore b/src/xmlpatterns/schema/.gitignore new file mode 100644 index 0000000..2b29f27 --- /dev/null +++ b/src/xmlpatterns/schema/.gitignore @@ -0,0 +1 @@ +tests diff --git a/src/xmlpatterns/schema/builtinschemas.qrc b/src/xmlpatterns/schema/builtinschemas.qrc new file mode 100644 index 0000000..fb43d78 --- /dev/null +++ b/src/xmlpatterns/schema/builtinschemas.qrc @@ -0,0 +1,5 @@ + + + schemas/xml.xsd + + diff --git a/src/xmlpatterns/schema/doc/All_diagram.dot b/src/xmlpatterns/schema/doc/All_diagram.dot new file mode 100644 index 0000000..3352b723 --- /dev/null +++ b/src/xmlpatterns/schema/doc/All_diagram.dot @@ -0,0 +1,13 @@ +digraph All { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="any"] + 1 -> 3 [label="element"] + 2 -> 3 [label="any"] + 2 -> 3 [label="element"] + 3 -> 3 [label="any"] + 3 -> 3 [label="element"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Alternative_diagram.dot b/src/xmlpatterns/schema/doc/Alternative_diagram.dot new file mode 100644 index 0000000..2119c49 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Alternative_diagram.dot @@ -0,0 +1,11 @@ +digraph Alternative { + mindist = 2.0 + 1 -> 3 [label="complexType"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="simpleType"] + 2 -> 3 [label="complexType"] + 2 -> 3 [label="simpleType"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Annotation_diagram.dot b/src/xmlpatterns/schema/doc/Annotation_diagram.dot new file mode 100644 index 0000000..260b6f7 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Annotation_diagram.dot @@ -0,0 +1,9 @@ +digraph Annotation { + mindist = 2.0 + 1 -> 2 [label="appinfo"] + 1 -> 2 [label="documentation"] + 2 -> 2 [label="appinfo"] + 2 -> 2 [label="documentation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot b/src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot new file mode 100644 index 0000000..d252ebd --- /dev/null +++ b/src/xmlpatterns/schema/doc/AnyAttribute_diagram.dot @@ -0,0 +1,6 @@ +digraph AnyAttribute { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Any_diagram.dot b/src/xmlpatterns/schema/doc/Any_diagram.dot new file mode 100644 index 0000000..f54063f --- /dev/null +++ b/src/xmlpatterns/schema/doc/Any_diagram.dot @@ -0,0 +1,6 @@ +digraph Any { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Assert_diagram.dot b/src/xmlpatterns/schema/doc/Assert_diagram.dot new file mode 100644 index 0000000..7093bef --- /dev/null +++ b/src/xmlpatterns/schema/doc/Assert_diagram.dot @@ -0,0 +1,6 @@ +digraph Assert { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Choice_diagram.dot b/src/xmlpatterns/schema/doc/Choice_diagram.dot new file mode 100644 index 0000000..7b32016 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Choice_diagram.dot @@ -0,0 +1,22 @@ +digraph Choice { + mindist = 2.0 + 1 -> 3 [label="choice"] + 1 -> 3 [label="group"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="sequence"] + 1 -> 3 [label="any"] + 1 -> 3 [label="element"] + 2 -> 3 [label="choice"] + 2 -> 3 [label="group"] + 2 -> 3 [label="sequence"] + 2 -> 3 [label="any"] + 2 -> 3 [label="element"] + 3 -> 3 [label="choice"] + 3 -> 3 [label="group"] + 3 -> 3 [label="sequence"] + 3 -> 3 [label="any"] + 3 -> 3 [label="element"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot b/src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot new file mode 100644 index 0000000..6131612 --- /dev/null +++ b/src/xmlpatterns/schema/doc/ComplexContentExtension_diagram.dot @@ -0,0 +1,47 @@ +digraph ComplexContentExtension { + mindist = 2.0 + 1 -> 4 [label="choice"] + 1 -> 4 [label="group"] + 1 -> 4 [label="all"] + 1 -> 2 [label="annotation"] + 1 -> 4 [label="sequence"] + 1 -> 6 [label="anyAttribute"] + 1 -> 7 [label="assert"] + 1 -> 3 [label="openContent"] + 1 -> 5 [label="attribute"] + 1 -> 5 [label="attributeGroup"] + 2 -> 4 [label="choice"] + 2 -> 4 [label="group"] + 2 -> 4 [label="all"] + 2 -> 4 [label="sequence"] + 2 -> 6 [label="anyAttribute"] + 2 -> 7 [label="assert"] + 2 -> 3 [label="openContent"] + 2 -> 5 [label="attribute"] + 2 -> 5 [label="attributeGroup"] + 3 -> 4 [label="choice"] + 3 -> 4 [label="group"] + 3 -> 4 [label="all"] + 3 -> 4 [label="sequence"] + 3 -> 6 [label="anyAttribute"] + 3 -> 7 [label="assert"] + 3 -> 5 [label="attribute"] + 3 -> 5 [label="attributeGroup"] + 4 -> 6 [label="anyAttribute"] + 4 -> 7 [label="assert"] + 4 -> 5 [label="attribute"] + 4 -> 5 [label="attributeGroup"] + 5 -> 6 [label="anyAttribute"] + 5 -> 7 [label="assert"] + 5 -> 5 [label="attribute"] + 5 -> 5 [label="attributeGroup"] + 6 -> 7 [label="assert"] + 7 -> 7 [label="assert"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] + 6 [shape=doublecircle, style=filled, color=green] + 7 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot b/src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot new file mode 100644 index 0000000..bfda892 --- /dev/null +++ b/src/xmlpatterns/schema/doc/ComplexContentRestriction_diagram.dot @@ -0,0 +1,47 @@ +digraph ComplexContentRestriction { + mindist = 2.0 + 1 -> 4 [label="choice"] + 1 -> 4 [label="group"] + 1 -> 4 [label="all"] + 1 -> 2 [label="annotation"] + 1 -> 4 [label="sequence"] + 1 -> 6 [label="anyAttribute"] + 1 -> 7 [label="assert"] + 1 -> 3 [label="openContent"] + 1 -> 5 [label="attribute"] + 1 -> 5 [label="attributeGroup"] + 2 -> 4 [label="choice"] + 2 -> 4 [label="group"] + 2 -> 4 [label="all"] + 2 -> 4 [label="sequence"] + 2 -> 6 [label="anyAttribute"] + 2 -> 7 [label="assert"] + 2 -> 3 [label="openContent"] + 2 -> 5 [label="attribute"] + 2 -> 5 [label="attributeGroup"] + 3 -> 4 [label="choice"] + 3 -> 4 [label="group"] + 3 -> 4 [label="all"] + 3 -> 4 [label="sequence"] + 3 -> 6 [label="anyAttribute"] + 3 -> 7 [label="assert"] + 3 -> 5 [label="attribute"] + 3 -> 5 [label="attributeGroup"] + 4 -> 6 [label="anyAttribute"] + 4 -> 7 [label="assert"] + 4 -> 5 [label="attribute"] + 4 -> 5 [label="attributeGroup"] + 5 -> 6 [label="anyAttribute"] + 5 -> 7 [label="assert"] + 5 -> 5 [label="attribute"] + 5 -> 5 [label="attributeGroup"] + 6 -> 7 [label="assert"] + 7 -> 7 [label="assert"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] + 6 [shape=doublecircle, style=filled, color=green] + 7 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/ComplexContent_diagram.dot b/src/xmlpatterns/schema/doc/ComplexContent_diagram.dot new file mode 100644 index 0000000..949c27e --- /dev/null +++ b/src/xmlpatterns/schema/doc/ComplexContent_diagram.dot @@ -0,0 +1,11 @@ +digraph ComplexContent { + mindist = 2.0 + 1 -> 3 [label="restriction"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="extension"] + 2 -> 3 [label="restriction"] + 2 -> 3 [label="extension"] + 1 [shape=circle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot b/src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot new file mode 100644 index 0000000..61e7d14 --- /dev/null +++ b/src/xmlpatterns/schema/doc/DefaultOpenContent_diagram.dot @@ -0,0 +1,9 @@ +digraph DefaultOpenContent { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="any"] + 2 -> 3 [label="any"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot b/src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot new file mode 100644 index 0000000..91be76b --- /dev/null +++ b/src/xmlpatterns/schema/doc/EnumerationFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph EnumerationFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Field_diagram.dot b/src/xmlpatterns/schema/doc/Field_diagram.dot new file mode 100644 index 0000000..1c597b3 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Field_diagram.dot @@ -0,0 +1,6 @@ +digraph Field { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot b/src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot new file mode 100644 index 0000000..5e098b3 --- /dev/null +++ b/src/xmlpatterns/schema/doc/FractionDigitsFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph FractionDigitsFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot b/src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot new file mode 100644 index 0000000..25a1a43 --- /dev/null +++ b/src/xmlpatterns/schema/doc/GlobalAttribute_diagram.dot @@ -0,0 +1,9 @@ +digraph GlobalAttribute { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="simpleType"] + 2 -> 3 [label="simpleType"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot b/src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot new file mode 100644 index 0000000..05e40b7 --- /dev/null +++ b/src/xmlpatterns/schema/doc/GlobalComplexType_diagram.dot @@ -0,0 +1,52 @@ +digraph GlobalComplexType { + mindist = 2.0 + 1 -> 5 [label="choice"] + 1 -> 3 [label="complexContent"] + 1 -> 5 [label="group"] + 1 -> 5 [label="all"] + 1 -> 2 [label="annotation"] + 1 -> 5 [label="sequence"] + 1 -> 3 [label="simpleContent"] + 1 -> 7 [label="anyAttribute"] + 1 -> 8 [label="assert"] + 1 -> 4 [label="openContent"] + 1 -> 6 [label="attribute"] + 1 -> 6 [label="attributeGroup"] + 2 -> 5 [label="choice"] + 2 -> 3 [label="complexContent"] + 2 -> 5 [label="group"] + 2 -> 5 [label="all"] + 2 -> 5 [label="sequence"] + 2 -> 3 [label="simpleContent"] + 2 -> 7 [label="anyAttribute"] + 2 -> 8 [label="assert"] + 2 -> 4 [label="openContent"] + 2 -> 6 [label="attribute"] + 2 -> 6 [label="attributeGroup"] + 4 -> 5 [label="choice"] + 4 -> 5 [label="group"] + 4 -> 5 [label="all"] + 4 -> 5 [label="sequence"] + 4 -> 7 [label="anyAttribute"] + 4 -> 8 [label="assert"] + 4 -> 6 [label="attribute"] + 4 -> 6 [label="attributeGroup"] + 5 -> 7 [label="anyAttribute"] + 5 -> 8 [label="assert"] + 5 -> 6 [label="attribute"] + 5 -> 6 [label="attributeGroup"] + 6 -> 7 [label="anyAttribute"] + 6 -> 8 [label="assert"] + 6 -> 6 [label="attribute"] + 6 -> 6 [label="attributeGroup"] + 7 -> 8 [label="assert"] + 8 -> 8 [label="assert"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] + 6 [shape=doublecircle, style=filled, color=green] + 7 [shape=doublecircle, style=filled, color=green] + 8 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/GlobalElement_diagram.dot b/src/xmlpatterns/schema/doc/GlobalElement_diagram.dot new file mode 100644 index 0000000..20447a7 --- /dev/null +++ b/src/xmlpatterns/schema/doc/GlobalElement_diagram.dot @@ -0,0 +1,32 @@ +digraph GlobalElement { + mindist = 2.0 + 1 -> 3 [label="complexType"] + 1 -> 4 [label="alternative"] + 1 -> 2 [label="annotation"] + 1 -> 5 [label="key"] + 1 -> 3 [label="simpleType"] + 1 -> 5 [label="keyref"] + 1 -> 5 [label="unique"] + 2 -> 3 [label="complexType"] + 2 -> 4 [label="alternative"] + 2 -> 5 [label="key"] + 2 -> 3 [label="simpleType"] + 2 -> 5 [label="keyref"] + 2 -> 5 [label="unique"] + 3 -> 4 [label="alternative"] + 3 -> 5 [label="key"] + 3 -> 5 [label="keyref"] + 3 -> 5 [label="unique"] + 4 -> 4 [label="alternative"] + 4 -> 5 [label="key"] + 4 -> 5 [label="keyref"] + 4 -> 5 [label="unique"] + 5 -> 5 [label="key"] + 5 -> 5 [label="keyref"] + 5 -> 5 [label="unique"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot b/src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot new file mode 100644 index 0000000..ccb7f54 --- /dev/null +++ b/src/xmlpatterns/schema/doc/GlobalSimpleType_diagram.dot @@ -0,0 +1,13 @@ +digraph GlobalSimpleType { + mindist = 2.0 + 1 -> 3 [label="restriction"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="list"] + 1 -> 3 [label="union"] + 2 -> 3 [label="restriction"] + 2 -> 3 [label="list"] + 2 -> 3 [label="union"] + 1 [shape=circle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Import_diagram.dot b/src/xmlpatterns/schema/doc/Import_diagram.dot new file mode 100644 index 0000000..3484bc3 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Import_diagram.dot @@ -0,0 +1,6 @@ +digraph Import { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Include_diagram.dot b/src/xmlpatterns/schema/doc/Include_diagram.dot new file mode 100644 index 0000000..357e4c9 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Include_diagram.dot @@ -0,0 +1,6 @@ +digraph Include { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/KeyRef_diagram.dot b/src/xmlpatterns/schema/doc/KeyRef_diagram.dot new file mode 100644 index 0000000..ff425b9 --- /dev/null +++ b/src/xmlpatterns/schema/doc/KeyRef_diagram.dot @@ -0,0 +1,12 @@ +digraph KeyRef { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="selector"] + 2 -> 3 [label="selector"] + 3 -> 4 [label="field"] + 4 -> 4 [label="field"] + 1 [shape=circle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=circle, style=filled, color=red] + 4 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Key_diagram.dot b/src/xmlpatterns/schema/doc/Key_diagram.dot new file mode 100644 index 0000000..bbc09cd --- /dev/null +++ b/src/xmlpatterns/schema/doc/Key_diagram.dot @@ -0,0 +1,12 @@ +digraph Key { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="selector"] + 2 -> 3 [label="selector"] + 3 -> 4 [label="field"] + 4 -> 4 [label="field"] + 1 [shape=circle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=circle, style=filled, color=red] + 4 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LengthFacet_diagram.dot b/src/xmlpatterns/schema/doc/LengthFacet_diagram.dot new file mode 100644 index 0000000..1f9205b --- /dev/null +++ b/src/xmlpatterns/schema/doc/LengthFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph LengthFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/List_diagram.dot b/src/xmlpatterns/schema/doc/List_diagram.dot new file mode 100644 index 0000000..44cc698 --- /dev/null +++ b/src/xmlpatterns/schema/doc/List_diagram.dot @@ -0,0 +1,9 @@ +digraph List { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="simpleType"] + 2 -> 3 [label="simpleType"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LocalAll_diagram.dot b/src/xmlpatterns/schema/doc/LocalAll_diagram.dot new file mode 100644 index 0000000..88f1b61 --- /dev/null +++ b/src/xmlpatterns/schema/doc/LocalAll_diagram.dot @@ -0,0 +1,13 @@ +digraph LocalAll { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="any"] + 1 -> 3 [label="element"] + 2 -> 3 [label="any"] + 2 -> 3 [label="element"] + 3 -> 3 [label="any"] + 3 -> 3 [label="element"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot b/src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot new file mode 100644 index 0000000..b01f0cf --- /dev/null +++ b/src/xmlpatterns/schema/doc/LocalAttribute_diagram.dot @@ -0,0 +1,9 @@ +digraph LocalAttribute { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="simpleType"] + 2 -> 3 [label="simpleType"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LocalChoice_diagram.dot b/src/xmlpatterns/schema/doc/LocalChoice_diagram.dot new file mode 100644 index 0000000..b16c47f --- /dev/null +++ b/src/xmlpatterns/schema/doc/LocalChoice_diagram.dot @@ -0,0 +1,22 @@ +digraph LocalChoice { + mindist = 2.0 + 1 -> 3 [label="choice"] + 1 -> 3 [label="group"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="sequence"] + 1 -> 3 [label="any"] + 1 -> 3 [label="element"] + 2 -> 3 [label="choice"] + 2 -> 3 [label="group"] + 2 -> 3 [label="sequence"] + 2 -> 3 [label="any"] + 2 -> 3 [label="element"] + 3 -> 3 [label="choice"] + 3 -> 3 [label="group"] + 3 -> 3 [label="sequence"] + 3 -> 3 [label="any"] + 3 -> 3 [label="element"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot b/src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot new file mode 100644 index 0000000..92c54b7 --- /dev/null +++ b/src/xmlpatterns/schema/doc/LocalComplexType_diagram.dot @@ -0,0 +1,52 @@ +digraph LocalComplexType { + mindist = 2.0 + 1 -> 5 [label="choice"] + 1 -> 3 [label="complexContent"] + 1 -> 5 [label="group"] + 1 -> 5 [label="all"] + 1 -> 2 [label="annotation"] + 1 -> 5 [label="sequence"] + 1 -> 3 [label="simpleContent"] + 1 -> 7 [label="anyAttribute"] + 1 -> 8 [label="assert"] + 1 -> 4 [label="openContent"] + 1 -> 6 [label="attribute"] + 1 -> 6 [label="attributeGroup"] + 2 -> 5 [label="choice"] + 2 -> 3 [label="complexContent"] + 2 -> 5 [label="group"] + 2 -> 5 [label="all"] + 2 -> 5 [label="sequence"] + 2 -> 3 [label="simpleContent"] + 2 -> 7 [label="anyAttribute"] + 2 -> 8 [label="assert"] + 2 -> 4 [label="openContent"] + 2 -> 6 [label="attribute"] + 2 -> 6 [label="attributeGroup"] + 4 -> 5 [label="choice"] + 4 -> 5 [label="group"] + 4 -> 5 [label="all"] + 4 -> 5 [label="sequence"] + 4 -> 7 [label="anyAttribute"] + 4 -> 8 [label="assert"] + 4 -> 6 [label="attribute"] + 4 -> 6 [label="attributeGroup"] + 5 -> 7 [label="anyAttribute"] + 5 -> 8 [label="assert"] + 5 -> 6 [label="attribute"] + 5 -> 6 [label="attributeGroup"] + 6 -> 7 [label="anyAttribute"] + 6 -> 8 [label="assert"] + 6 -> 6 [label="attribute"] + 6 -> 6 [label="attributeGroup"] + 7 -> 8 [label="assert"] + 8 -> 8 [label="assert"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] + 6 [shape=doublecircle, style=filled, color=green] + 7 [shape=doublecircle, style=filled, color=green] + 8 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LocalElement_diagram.dot b/src/xmlpatterns/schema/doc/LocalElement_diagram.dot new file mode 100644 index 0000000..397397a --- /dev/null +++ b/src/xmlpatterns/schema/doc/LocalElement_diagram.dot @@ -0,0 +1,32 @@ +digraph LocalElement { + mindist = 2.0 + 1 -> 3 [label="complexType"] + 1 -> 4 [label="alternative"] + 1 -> 2 [label="annotation"] + 1 -> 5 [label="key"] + 1 -> 3 [label="simpleType"] + 1 -> 5 [label="keyref"] + 1 -> 5 [label="unique"] + 2 -> 3 [label="complexType"] + 2 -> 4 [label="alternative"] + 2 -> 5 [label="key"] + 2 -> 3 [label="simpleType"] + 2 -> 5 [label="keyref"] + 2 -> 5 [label="unique"] + 3 -> 4 [label="alternative"] + 3 -> 5 [label="key"] + 3 -> 5 [label="keyref"] + 3 -> 5 [label="unique"] + 4 -> 4 [label="alternative"] + 4 -> 5 [label="key"] + 4 -> 5 [label="keyref"] + 4 -> 5 [label="unique"] + 5 -> 5 [label="key"] + 5 -> 5 [label="keyref"] + 5 -> 5 [label="unique"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LocalSequence_diagram.dot b/src/xmlpatterns/schema/doc/LocalSequence_diagram.dot new file mode 100644 index 0000000..0dc7f39 --- /dev/null +++ b/src/xmlpatterns/schema/doc/LocalSequence_diagram.dot @@ -0,0 +1,22 @@ +digraph LocalSequence { + mindist = 2.0 + 1 -> 3 [label="choice"] + 1 -> 3 [label="group"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="sequence"] + 1 -> 3 [label="any"] + 1 -> 3 [label="element"] + 2 -> 3 [label="choice"] + 2 -> 3 [label="group"] + 2 -> 3 [label="sequence"] + 2 -> 3 [label="any"] + 2 -> 3 [label="element"] + 3 -> 3 [label="choice"] + 3 -> 3 [label="group"] + 3 -> 3 [label="sequence"] + 3 -> 3 [label="any"] + 3 -> 3 [label="element"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot b/src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot new file mode 100644 index 0000000..ac13305 --- /dev/null +++ b/src/xmlpatterns/schema/doc/LocalSimpleType_diagram.dot @@ -0,0 +1,13 @@ +digraph LocalSimpleType { + mindist = 2.0 + 1 -> 3 [label="restriction"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="list"] + 1 -> 3 [label="union"] + 2 -> 3 [label="restriction"] + 2 -> 3 [label="list"] + 2 -> 3 [label="union"] + 1 [shape=circle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot new file mode 100644 index 0000000..28364f7 --- /dev/null +++ b/src/xmlpatterns/schema/doc/MaxExclusiveFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph MaxExclusiveFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot new file mode 100644 index 0000000..9e2c265 --- /dev/null +++ b/src/xmlpatterns/schema/doc/MaxInclusiveFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph MaxInclusiveFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot b/src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot new file mode 100644 index 0000000..d565217 --- /dev/null +++ b/src/xmlpatterns/schema/doc/MaxLengthFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph MaxLengthFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot new file mode 100644 index 0000000..d3b3f1f --- /dev/null +++ b/src/xmlpatterns/schema/doc/MinExclusiveFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph MinExclusiveFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot b/src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot new file mode 100644 index 0000000..e5ca65d --- /dev/null +++ b/src/xmlpatterns/schema/doc/MinInclusiveFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph MinInclusiveFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot b/src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot new file mode 100644 index 0000000..1dcced4 --- /dev/null +++ b/src/xmlpatterns/schema/doc/MinLengthFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph MinLengthFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot b/src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot new file mode 100644 index 0000000..1754f67 --- /dev/null +++ b/src/xmlpatterns/schema/doc/NamedAttributeGroup_diagram.dot @@ -0,0 +1,17 @@ +digraph NamedAttributeGroup { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 4 [label="anyAttribute"] + 1 -> 3 [label="attribute"] + 1 -> 3 [label="attributeGroup"] + 2 -> 4 [label="anyAttribute"] + 2 -> 3 [label="attribute"] + 2 -> 3 [label="attributeGroup"] + 3 -> 4 [label="anyAttribute"] + 3 -> 3 [label="attribute"] + 3 -> 3 [label="attributeGroup"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/NamedGroup_diagram.dot b/src/xmlpatterns/schema/doc/NamedGroup_diagram.dot new file mode 100644 index 0000000..6d9a289 --- /dev/null +++ b/src/xmlpatterns/schema/doc/NamedGroup_diagram.dot @@ -0,0 +1,13 @@ +digraph NamedGroup { + mindist = 2.0 + 1 -> 3 [label="choice"] + 1 -> 3 [label="all"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="sequence"] + 2 -> 3 [label="choice"] + 2 -> 3 [label="all"] + 2 -> 3 [label="sequence"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Notation_diagram.dot b/src/xmlpatterns/schema/doc/Notation_diagram.dot new file mode 100644 index 0000000..951f26a --- /dev/null +++ b/src/xmlpatterns/schema/doc/Notation_diagram.dot @@ -0,0 +1,6 @@ +digraph Notation { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Override_diagram.dot b/src/xmlpatterns/schema/doc/Override_diagram.dot new file mode 100644 index 0000000..448451a --- /dev/null +++ b/src/xmlpatterns/schema/doc/Override_diagram.dot @@ -0,0 +1,21 @@ +digraph Override { + mindist = 2.0 + 1 -> 2 [label="group"] + 1 -> 2 [label="complexType"] + 1 -> 2 [label="annotation"] + 1 -> 2 [label="simpleType"] + 1 -> 2 [label="element"] + 1 -> 2 [label="notation"] + 1 -> 2 [label="attribute"] + 1 -> 2 [label="attributeGroup"] + 2 -> 2 [label="group"] + 2 -> 2 [label="complexType"] + 2 -> 2 [label="annotation"] + 2 -> 2 [label="simpleType"] + 2 -> 2 [label="element"] + 2 -> 2 [label="notation"] + 2 -> 2 [label="attribute"] + 2 -> 2 [label="attributeGroup"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/PatternFacet_diagram.dot b/src/xmlpatterns/schema/doc/PatternFacet_diagram.dot new file mode 100644 index 0000000..794d74c --- /dev/null +++ b/src/xmlpatterns/schema/doc/PatternFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph PatternFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Redefine_diagram.dot b/src/xmlpatterns/schema/doc/Redefine_diagram.dot new file mode 100644 index 0000000..ba4871d --- /dev/null +++ b/src/xmlpatterns/schema/doc/Redefine_diagram.dot @@ -0,0 +1,15 @@ +digraph Redefine { + mindist = 2.0 + 1 -> 2 [label="group"] + 1 -> 2 [label="complexType"] + 1 -> 2 [label="annotation"] + 1 -> 2 [label="simpleType"] + 1 -> 2 [label="attributeGroup"] + 2 -> 2 [label="group"] + 2 -> 2 [label="complexType"] + 2 -> 2 [label="annotation"] + 2 -> 2 [label="simpleType"] + 2 -> 2 [label="attributeGroup"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot b/src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot new file mode 100644 index 0000000..fd08872 --- /dev/null +++ b/src/xmlpatterns/schema/doc/ReferredAttributeGroup_diagram.dot @@ -0,0 +1,6 @@ +digraph ReferredAttributeGroup { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot b/src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot new file mode 100644 index 0000000..c32f69f --- /dev/null +++ b/src/xmlpatterns/schema/doc/ReferredGroup_diagram.dot @@ -0,0 +1,13 @@ +digraph ReferredGroup { + mindist = 2.0 + 1 -> 3 [label="choice"] + 1 -> 3 [label="all"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="sequence"] + 2 -> 3 [label="choice"] + 2 -> 3 [label="all"] + 2 -> 3 [label="sequence"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Schema_diagram.dot b/src/xmlpatterns/schema/doc/Schema_diagram.dot new file mode 100644 index 0000000..7d39337 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Schema_diagram.dot @@ -0,0 +1,66 @@ +digraph Schema { + mindist = 2.0 + 1 -> 5 [label="group"] + 1 -> 5 [label="complexType"] + 1 -> 2 [label="import"] + 1 -> 2 [label="include"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="defaultOpenContent"] + 1 -> 5 [label="simpleType"] + 1 -> 5 [label="element"] + 1 -> 5 [label="notation"] + 1 -> 2 [label="override"] + 1 -> 5 [label="attribute"] + 1 -> 5 [label="attributeGroup"] + 1 -> 2 [label="redefine"] + 2 -> 5 [label="group"] + 2 -> 5 [label="complexType"] + 2 -> 2 [label="import"] + 2 -> 2 [label="include"] + 2 -> 2 [label="annotation"] + 2 -> 3 [label="defaultOpenContent"] + 2 -> 5 [label="simpleType"] + 2 -> 5 [label="element"] + 2 -> 5 [label="notation"] + 2 -> 2 [label="override"] + 2 -> 5 [label="attribute"] + 2 -> 5 [label="attributeGroup"] + 2 -> 2 [label="redefine"] + 3 -> 5 [label="group"] + 3 -> 5 [label="complexType"] + 3 -> 4 [label="annotation"] + 3 -> 5 [label="simpleType"] + 3 -> 5 [label="element"] + 3 -> 5 [label="notation"] + 3 -> 5 [label="attribute"] + 3 -> 5 [label="attributeGroup"] + 4 -> 5 [label="group"] + 4 -> 5 [label="complexType"] + 4 -> 5 [label="simpleType"] + 4 -> 5 [label="element"] + 4 -> 5 [label="notation"] + 4 -> 5 [label="attribute"] + 4 -> 5 [label="attributeGroup"] + 5 -> 5 [label="group"] + 5 -> 5 [label="complexType"] + 5 -> 6 [label="annotation"] + 5 -> 5 [label="simpleType"] + 5 -> 5 [label="element"] + 5 -> 5 [label="notation"] + 5 -> 5 [label="attribute"] + 5 -> 5 [label="attributeGroup"] + 6 -> 5 [label="group"] + 6 -> 5 [label="complexType"] + 6 -> 6 [label="annotation"] + 6 -> 5 [label="simpleType"] + 6 -> 5 [label="element"] + 6 -> 5 [label="notation"] + 6 -> 5 [label="attribute"] + 6 -> 5 [label="attributeGroup"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] + 6 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Selector_diagram.dot b/src/xmlpatterns/schema/doc/Selector_diagram.dot new file mode 100644 index 0000000..f3e93dc --- /dev/null +++ b/src/xmlpatterns/schema/doc/Selector_diagram.dot @@ -0,0 +1,6 @@ +digraph Selector { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Sequence_diagram.dot b/src/xmlpatterns/schema/doc/Sequence_diagram.dot new file mode 100644 index 0000000..9172744 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Sequence_diagram.dot @@ -0,0 +1,22 @@ +digraph Sequence { + mindist = 2.0 + 1 -> 3 [label="choice"] + 1 -> 3 [label="group"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="sequence"] + 1 -> 3 [label="any"] + 1 -> 3 [label="element"] + 2 -> 3 [label="choice"] + 2 -> 3 [label="group"] + 2 -> 3 [label="sequence"] + 2 -> 3 [label="any"] + 2 -> 3 [label="element"] + 3 -> 3 [label="choice"] + 3 -> 3 [label="group"] + 3 -> 3 [label="sequence"] + 3 -> 3 [label="any"] + 3 -> 3 [label="element"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot b/src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot new file mode 100644 index 0000000..3ceebfd --- /dev/null +++ b/src/xmlpatterns/schema/doc/SimpleContentExtension_diagram.dot @@ -0,0 +1,23 @@ +digraph SimpleContentExtension { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 4 [label="anyAttribute"] + 1 -> 5 [label="assert"] + 1 -> 3 [label="attribute"] + 1 -> 3 [label="attributeGroup"] + 2 -> 4 [label="anyAttribute"] + 2 -> 5 [label="assert"] + 2 -> 3 [label="attribute"] + 2 -> 3 [label="attributeGroup"] + 3 -> 4 [label="anyAttribute"] + 3 -> 5 [label="assert"] + 3 -> 3 [label="attribute"] + 3 -> 3 [label="attributeGroup"] + 4 -> 5 [label="assert"] + 5 -> 5 [label="assert"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot b/src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot new file mode 100644 index 0000000..75b0b71 --- /dev/null +++ b/src/xmlpatterns/schema/doc/SimpleContentRestriction_diagram.dot @@ -0,0 +1,87 @@ +digraph SimpleContentRestriction { + mindist = 2.0 + 1 -> 3 [label="simpleType"] + 1 -> 2 [label="annotation"] + 1 -> 4 [label="length"] + 1 -> 6 [label="anyAttribute"] + 1 -> 4 [label="maxExclusive"] + 1 -> 4 [label="totalDigits"] + 1 -> 4 [label="maxInclusive"] + 1 -> 4 [label="maxLength"] + 1 -> 7 [label="assert"] + 1 -> 4 [label="assertion"] + 1 -> 5 [label="attribute"] + 1 -> 4 [label="minExclusive"] + 1 -> 5 [label="attributeGroup"] + 1 -> 4 [label="minInclusive"] + 1 -> 4 [label="minLength"] + 1 -> 4 [label="whiteSpace"] + 1 -> 4 [label="pattern"] + 1 -> 4 [label="enumeration"] + 1 -> 4 [label="fractionDigits"] + 2 -> 3 [label="simpleType"] + 2 -> 4 [label="length"] + 2 -> 6 [label="anyAttribute"] + 2 -> 4 [label="maxExclusive"] + 2 -> 4 [label="totalDigits"] + 2 -> 4 [label="maxInclusive"] + 2 -> 4 [label="maxLength"] + 2 -> 7 [label="assert"] + 2 -> 4 [label="assertion"] + 2 -> 5 [label="attribute"] + 2 -> 4 [label="minExclusive"] + 2 -> 5 [label="attributeGroup"] + 2 -> 4 [label="minInclusive"] + 2 -> 4 [label="minLength"] + 2 -> 4 [label="whiteSpace"] + 2 -> 4 [label="pattern"] + 2 -> 4 [label="enumeration"] + 2 -> 4 [label="fractionDigits"] + 3 -> 4 [label="fractionDigits"] + 3 -> 4 [label="minLength"] + 3 -> 4 [label="whiteSpace"] + 3 -> 6 [label="anyAttribute"] + 3 -> 4 [label="length"] + 3 -> 7 [label="assert"] + 3 -> 4 [label="maxExclusive"] + 3 -> 4 [label="enumeration"] + 3 -> 4 [label="assertion"] + 3 -> 4 [label="maxInclusive"] + 3 -> 5 [label="attribute"] + 3 -> 4 [label="maxLength"] + 3 -> 4 [label="pattern"] + 3 -> 4 [label="totalDigits"] + 3 -> 5 [label="attributeGroup"] + 3 -> 4 [label="minExclusive"] + 3 -> 4 [label="minInclusive"] + 4 -> 4 [label="fractionDigits"] + 4 -> 4 [label="minLength"] + 4 -> 4 [label="whiteSpace"] + 4 -> 6 [label="anyAttribute"] + 4 -> 4 [label="length"] + 4 -> 7 [label="assert"] + 4 -> 4 [label="maxExclusive"] + 4 -> 4 [label="enumeration"] + 4 -> 4 [label="assertion"] + 4 -> 4 [label="maxInclusive"] + 4 -> 5 [label="attribute"] + 4 -> 4 [label="maxLength"] + 4 -> 4 [label="pattern"] + 4 -> 4 [label="totalDigits"] + 4 -> 5 [label="attributeGroup"] + 4 -> 4 [label="minExclusive"] + 4 -> 4 [label="minInclusive"] + 5 -> 6 [label="anyAttribute"] + 5 -> 7 [label="assert"] + 5 -> 5 [label="attribute"] + 5 -> 5 [label="attributeGroup"] + 6 -> 7 [label="assert"] + 7 -> 7 [label="assert"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] + 5 [shape=doublecircle, style=filled, color=green] + 6 [shape=doublecircle, style=filled, color=green] + 7 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/SimpleContent_diagram.dot b/src/xmlpatterns/schema/doc/SimpleContent_diagram.dot new file mode 100644 index 0000000..c996329 --- /dev/null +++ b/src/xmlpatterns/schema/doc/SimpleContent_diagram.dot @@ -0,0 +1,11 @@ +digraph SimpleContent { + mindist = 2.0 + 1 -> 3 [label="restriction"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="extension"] + 2 -> 3 [label="restriction"] + 2 -> 3 [label="extension"] + 1 [shape=circle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot b/src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot new file mode 100644 index 0000000..09cb041 --- /dev/null +++ b/src/xmlpatterns/schema/doc/SimpleRestriction_diagram.dot @@ -0,0 +1,62 @@ +digraph SimpleRestriction { + mindist = 2.0 + 1 -> 4 [label="fractionDigits"] + 1 -> 4 [label="minLength"] + 1 -> 4 [label="whiteSpace"] + 1 -> 2 [label="annotation"] + 1 -> 3 [label="simpleType"] + 1 -> 4 [label="length"] + 1 -> 4 [label="maxExclusive"] + 1 -> 4 [label="enumeration"] + 1 -> 4 [label="assertion"] + 1 -> 4 [label="maxInclusive"] + 1 -> 4 [label="maxLength"] + 1 -> 4 [label="pattern"] + 1 -> 4 [label="totalDigits"] + 1 -> 4 [label="minExclusive"] + 1 -> 4 [label="minInclusive"] + 2 -> 4 [label="fractionDigits"] + 2 -> 4 [label="minLength"] + 2 -> 4 [label="whiteSpace"] + 2 -> 3 [label="simpleType"] + 2 -> 4 [label="length"] + 2 -> 4 [label="maxExclusive"] + 2 -> 4 [label="enumeration"] + 2 -> 4 [label="assertion"] + 2 -> 4 [label="maxInclusive"] + 2 -> 4 [label="maxLength"] + 2 -> 4 [label="pattern"] + 2 -> 4 [label="totalDigits"] + 2 -> 4 [label="minExclusive"] + 2 -> 4 [label="minInclusive"] + 3 -> 4 [label="fractionDigits"] + 3 -> 4 [label="minLength"] + 3 -> 4 [label="whiteSpace"] + 3 -> 4 [label="length"] + 3 -> 4 [label="maxExclusive"] + 3 -> 4 [label="enumeration"] + 3 -> 4 [label="assertion"] + 3 -> 4 [label="maxInclusive"] + 3 -> 4 [label="maxLength"] + 3 -> 4 [label="pattern"] + 3 -> 4 [label="totalDigits"] + 3 -> 4 [label="minExclusive"] + 3 -> 4 [label="minInclusive"] + 4 -> 4 [label="fractionDigits"] + 4 -> 4 [label="minLength"] + 4 -> 4 [label="whiteSpace"] + 4 -> 4 [label="length"] + 4 -> 4 [label="maxExclusive"] + 4 -> 4 [label="enumeration"] + 4 -> 4 [label="assertion"] + 4 -> 4 [label="maxInclusive"] + 4 -> 4 [label="maxLength"] + 4 -> 4 [label="pattern"] + 4 -> 4 [label="totalDigits"] + 4 -> 4 [label="minExclusive"] + 4 -> 4 [label="minInclusive"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] + 4 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot b/src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot new file mode 100644 index 0000000..0ef4cd6 --- /dev/null +++ b/src/xmlpatterns/schema/doc/TotalDigitsFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph TotalDigitsFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Union_diagram.dot b/src/xmlpatterns/schema/doc/Union_diagram.dot new file mode 100644 index 0000000..d6c1865 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Union_diagram.dot @@ -0,0 +1,10 @@ +digraph Union { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="simpleType"] + 2 -> 3 [label="simpleType"] + 3 -> 3 [label="simpleType"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] + 3 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/Unique_diagram.dot b/src/xmlpatterns/schema/doc/Unique_diagram.dot new file mode 100644 index 0000000..5b1d098 --- /dev/null +++ b/src/xmlpatterns/schema/doc/Unique_diagram.dot @@ -0,0 +1,12 @@ +digraph Unique { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 -> 3 [label="selector"] + 2 -> 3 [label="selector"] + 3 -> 4 [label="field"] + 4 -> 4 [label="field"] + 1 [shape=circle, style=filled, color=blue] + 2 [shape=circle, style=filled, color=red] + 3 [shape=circle, style=filled, color=red] + 4 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot b/src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot new file mode 100644 index 0000000..596403c --- /dev/null +++ b/src/xmlpatterns/schema/doc/WhiteSpaceFacet_diagram.dot @@ -0,0 +1,6 @@ +digraph WhiteSpaceFacet { + mindist = 2.0 + 1 -> 2 [label="annotation"] + 1 [shape=doublecircle, style=filled, color=blue] + 2 [shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/doc/legend.dot b/src/xmlpatterns/schema/doc/legend.dot new file mode 100644 index 0000000..4f5792e --- /dev/null +++ b/src/xmlpatterns/schema/doc/legend.dot @@ -0,0 +1,7 @@ +digraph { + size="5,4" + 1 [label=" start state ", shape=circle, style=filled, color=blue] + 2 [label="start/end state", shape=doublecircle, style=filled, color=blue] + 3 [label=" internal state", shape=circle, style=filled, color=red] + 4 [label=" end state ", shape=doublecircle, style=filled, color=green] +} diff --git a/src/xmlpatterns/schema/qnamespacesupport.cpp b/src/xmlpatterns/schema/qnamespacesupport.cpp new file mode 100644 index 0000000..00698d6 --- /dev/null +++ b/src/xmlpatterns/schema/qnamespacesupport.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#include "qnamespacesupport_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +NamespaceSupport::NamespaceSupport() +{ +} + +NamespaceSupport::NamespaceSupport(const NamePool::Ptr &namePool) + : m_namePool(namePool) +{ + // the XML namespace + const QXmlName binding = namePool->allocateBinding(QLatin1String("xml"), + QLatin1String("http://www.w3.org/XML/1998/namespace")); + m_ns.insert(binding.prefix(), binding.namespaceURI()); +} + +void NamespaceSupport::setPrefix(const QXmlName::PrefixCode prefixCode, const QXmlName::NamespaceCode namespaceCode) +{ + m_ns.insert(prefixCode, namespaceCode); +} + +void NamespaceSupport::setPrefixes(const QXmlStreamNamespaceDeclarations &declarations) +{ + for (int i = 0; i < declarations.count(); i++) { + const QXmlStreamNamespaceDeclaration declaration = declarations.at(i); + + const QXmlName::PrefixCode prefixCode = m_namePool->allocatePrefix(declaration.prefix().toString()); + const QXmlName::NamespaceCode namespaceCode = m_namePool->allocateNamespace(declaration.namespaceUri().toString()); + m_ns.insert(prefixCode, namespaceCode); + } +} + +void NamespaceSupport::setTargetNamespace(const QXmlName::NamespaceCode namespaceCode) +{ + m_ns.insert(0, namespaceCode); +} + +QXmlName::PrefixCode NamespaceSupport::prefix(const QXmlName::NamespaceCode namespaceCode) const +{ + NamespaceHash::const_iterator itc, it = m_ns.constBegin(); + while ((itc=it) != m_ns.constEnd()) { + ++it; + if (*itc == namespaceCode) + return itc.key(); + } + return 0; +} + +QXmlName::NamespaceCode NamespaceSupport::uri(const QXmlName::PrefixCode prefixCode) const +{ + return m_ns.value(prefixCode); +} + +bool NamespaceSupport::processName(const QString& qname, NameType type, QXmlName &name) const +{ + int len = qname.size(); + const QChar *data = qname.constData(); + for (int pos = 0; pos < len; ++pos) { + if (data[pos] == QLatin1Char(':')) { + const QXmlName::PrefixCode prefixCode = m_namePool->allocatePrefix(qname.left(pos)); + if (!m_ns.contains(prefixCode)) + return false; + const QXmlName::NamespaceCode namespaceCode = uri(prefixCode); + const QXmlName::LocalNameCode localNameCode = m_namePool->allocateLocalName(qname.mid(pos + 1)); + name = QXmlName(namespaceCode, localNameCode, prefixCode); + return true; + } + } + + // there was no ':' + QXmlName::NamespaceCode namespaceCode = 0; + // attributes don't take default namespace + if (type == ElementName && !m_ns.isEmpty()) { + namespaceCode = m_ns.value(0); // get default namespace + } + + const QXmlName::LocalNameCode localNameCode = m_namePool->allocateLocalName(qname); + name = QXmlName(namespaceCode, localNameCode, 0); + + return true; +} + +void NamespaceSupport::pushContext() +{ + m_nsStack.push(m_ns); +} + +void NamespaceSupport::popContext() +{ + m_ns.clear(); + if(!m_nsStack.isEmpty()) + m_ns = m_nsStack.pop(); +} + +QList NamespaceSupport::namespaceBindings() const +{ + QList bindings; + + QHashIterator it(m_ns); + while (it.hasNext()) { + it.next(); + bindings.append(QXmlName(it.value(), StandardLocalNames::empty, it.key())); + } + + return bindings; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qnamespacesupport_p.h b/src/xmlpatterns/schema/qnamespacesupport_p.h new file mode 100644 index 0000000..d338eae --- /dev/null +++ b/src/xmlpatterns/schema/qnamespacesupport_p.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_NamespaceSupport_H +#define Patternist_NamespaceSupport_H + +#include "qnamepool_p.h" + +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A helper class for handling nested namespace declarations. + * + * This class is mostly an adaption of QXmlNamespaceSupport to the NamePool + * mechanism used in XmlPatterns. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class NamespaceSupport + { + public: + /** + * Describes whether the name to process is an attribute or element. + */ + enum NameType + { + AttributeName, ///< An attribute name to process. + ElementName ///< An element name to process. + }; + + /** + * Creates an empty namespace support object. + */ + NamespaceSupport(); + + /** + * Creates a new namespace support object. + * + * @param namePool The name pool where all processed names are stored in. + */ + NamespaceSupport(const NamePool::Ptr &namePool); + + /** + * Adds a new prefix-to-namespace binding. + * + * @param prefixCode The name pool code for the prefix. + * @param namespaceCode The name pool code for the namespace. + */ + void setPrefix(const QXmlName::PrefixCode prefixCode, const QXmlName::NamespaceCode namespaceCode); + + /** + * Adds the prefix-to-namespace bindings from @p declarations to + * the namespace support. + */ + void setPrefixes(const QXmlStreamNamespaceDeclarations &declarations); + + /** + * Sets the name pool code of the target namespace of the schema the + * namespace support works on. + */ + void setTargetNamespace(const QXmlName::NamespaceCode code); + + /** + * Returns the prefix code for the given namespace @p code. + */ + QXmlName::PrefixCode prefix(const QXmlName::NamespaceCode code) const; + + /** + * Returns the namespace code for the given prefix @p code. + */ + QXmlName::NamespaceCode uri(const QXmlName::PrefixCode code) const; + + /** + * Converts the given @p qualifiedName to a resolved QXmlName @p name according + * to the current namespace mapping. + * + * @param qualifiedName The full qualified name. + * @param type The type of name processing. + * @param name The resolved QXmlName. + * + * @returns @c true if the name could be processed correctly or @c false if the + * namespace prefix is unknown. + */ + bool processName(const QString &qualifiedName, NameType type, QXmlName &name) const; + + /** + * Pushes the current namespace mapping onto the stack. + */ + void pushContext(); + + /** + * Pops the current namespace mapping from the stack. + */ + void popContext(); + + /** + * Returns the list of namespace bindings. + */ + QList namespaceBindings() const; + + private: + typedef QHash NamespaceHash; + + NamePool::Ptr m_namePool; + QStack m_nsStack; + NamespaceHash m_ns; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdalternative.cpp b/src/xmlpatterns/schema/qxsdalternative.cpp new file mode 100644 index 0000000..f3f589a --- /dev/null +++ b/src/xmlpatterns/schema/qxsdalternative.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdalternative_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdAlternative::setTest(const XsdXPathExpression::Ptr &test) +{ + m_test = test; +} + +XsdXPathExpression::Ptr XsdAlternative::test() const +{ + return m_test; +} + +void XsdAlternative::setType(const SchemaType::Ptr &type) +{ + m_type = type; +} + +SchemaType::Ptr XsdAlternative::type() const +{ + return m_type; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdalternative_p.h b/src/xmlpatterns/schema/qxsdalternative_p.h new file mode 100644 index 0000000..451441e --- /dev/null +++ b/src/xmlpatterns/schema/qxsdalternative_p.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAlternative_H +#define Patternist_XsdAlternative_H + +#include "qnamedschemacomponent_p.h" +#include "qschematype_p.h" +#include "qxsdannotated_p.h" +#include "qxsdxpathexpression_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD alternative object. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAlternative : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Sets the xpath @p test of the alternative. + * + * @see Test Definition + */ + void setTest(const XsdXPathExpression::Ptr &test); + + /** + * Returns the xpath test of the alternative. + */ + XsdXPathExpression::Ptr test() const; + + /** + * Sets the @p type of the alternative. + * + * @see Type Definition + */ + void setType(const SchemaType::Ptr &type); + + /** + * Returns the type of the alternative. + */ + SchemaType::Ptr type() const; + + private: + XsdXPathExpression::Ptr m_test; + SchemaType::Ptr m_type; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdannotated.cpp b/src/xmlpatterns/schema/qxsdannotated.cpp new file mode 100644 index 0000000..a29b5c4 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdannotated.cpp @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdannotated_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdAnnotated::addAnnotation(const XsdAnnotation::Ptr &annotation) +{ + m_annotations.append(annotation); +} + +void XsdAnnotated::addAnnotations(const XsdAnnotation::List &annotations) +{ + m_annotations << annotations; +} + +XsdAnnotation::List XsdAnnotated::annotations() const +{ + return m_annotations; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdannotated_p.h b/src/xmlpatterns/schema/qxsdannotated_p.h new file mode 100644 index 0000000..251b252 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdannotated_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAnnotated_H +#define Patternist_XsdAnnotated_H + +#include "qxsdannotation_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Base class for all XSD components with annotation content. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAnnotated + { + public: + /** + * Adds a new @p annotation to the component. + */ + void addAnnotation(const XsdAnnotation::Ptr &annotation); + + /** + * Adds a list of new @p annotations to the component. + */ + void addAnnotations(const XsdAnnotation::List &annotations); + + /** + * Returns the list of all annotations of the component. + */ + XsdAnnotation::List annotations() const; + + private: + XsdAnnotation::List m_annotations; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdannotation.cpp b/src/xmlpatterns/schema/qxsdannotation.cpp new file mode 100644 index 0000000..0a9dc04 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdannotation.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdannotation_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdAnnotation::setId(const DerivedString::Ptr &id) +{ + m_id = id; +} + +DerivedString::Ptr XsdAnnotation::id() const +{ + return m_id; +} + +void XsdAnnotation::addApplicationInformation(const XsdApplicationInformation::Ptr &information) +{ + m_applicationInformation.append(information); +} + +XsdApplicationInformation::List XsdAnnotation::applicationInformation() const +{ + return m_applicationInformation; +} + +void XsdAnnotation::addDocumentation(const XsdDocumentation::Ptr &documentation) +{ + m_documentations.append(documentation); +} + +XsdDocumentation::List XsdAnnotation::documentation() const +{ + return m_documentations; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdannotation_p.h b/src/xmlpatterns/schema/qxsdannotation_p.h new file mode 100644 index 0000000..8c23bae --- /dev/null +++ b/src/xmlpatterns/schema/qxsdannotation_p.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAnnotation_H +#define Patternist_XsdAnnotation_H + +#include "qderivedstring_p.h" +#include "qxsdapplicationinformation_p.h" +#include "qxsddocumentation_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD annotation object. + * + * This class represents the annotation object of a XML schema as described + * here. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAnnotation : public NamedSchemaComponent + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Sets the @p id of the annotation. + */ + void setId(const DerivedString::Ptr &id); + + /** + * Returns the @p id of the annotation. + */ + DerivedString::Ptr id() const; + + /** + * Adds an application @p information to the annotation. + * + * The application information is meant to be interpreted by + * a software system, e.g. other parts of the XML processor pipeline. + */ + void addApplicationInformation(const XsdApplicationInformation::Ptr &information); + + /** + * Returns the list of all application information of the annotation. + */ + XsdApplicationInformation::List applicationInformation() const; + + /** + * Adds a @p documentation to the annotation. + * + * The documentation is meant to be read by human being, e.g. additional + * constraints or information about schema components. + */ + void addDocumentation(const XsdDocumentation::Ptr &documentation); + + /** + * Returns the list of all documentations of the annotation. + */ + XsdDocumentation::List documentation() const; + + private: + DerivedString::Ptr m_id; + XsdApplicationInformation::List m_applicationInformation; + XsdDocumentation::List m_documentations; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation.cpp b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp new file mode 100644 index 0000000..5669220 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdapplicationinformation_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdApplicationInformation::setSource(const AnyURI::Ptr &source) +{ + m_source = source; +} + +AnyURI::Ptr XsdApplicationInformation::source() const +{ + return m_source; +} + +void XsdApplicationInformation::setContent(const QString &content) +{ + m_content = content; +} + +QString XsdApplicationInformation::content() const +{ + return m_content; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation_p.h b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h new file mode 100644 index 0000000..30839d3 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdApplicationInformation_H +#define Patternist_XsdApplicationInformation_H + +#include "qanytype_p.h" +#include "qanyuri_p.h" +#include "qnamedschemacomponent_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD appinfo object. + * + * This class represents the appinfo component of an annotation object + * of a XML schema as described here. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdApplicationInformation : public NamedSchemaComponent + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Sets the @p source of the application information. + * + * The source points to an URL that contains more + * information. + */ + void setSource(const AnyURI::Ptr &source); + + /** + * Returns the source of the application information. + */ + AnyURI::Ptr source() const; + + /** + * Sets the @p content of the application information. + * + * The content can be of abritrary type. + */ + void setContent(const QString &content); + + /** + * Returns the content of the application information. + */ + QString content() const; + + private: + AnyURI::Ptr m_source; + QString m_content; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdassertion.cpp b/src/xmlpatterns/schema/qxsdassertion.cpp new file mode 100644 index 0000000..f6cbf81 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdassertion.cpp @@ -0,0 +1,28 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdassertion_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdAssertion::setTest(const XsdXPathExpression::Ptr &test) +{ + m_test = test; +} + +XsdXPathExpression::Ptr XsdAssertion::test() const +{ + return m_test; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdassertion_p.h b/src/xmlpatterns/schema/qxsdassertion_p.h new file mode 100644 index 0000000..0ae5ff6 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdassertion_p.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAssertion_H +#define Patternist_XsdAssertion_H + +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" +#include "qxsdxpathexpression_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD assertion object. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + * @see Assertion Definition + */ + class XsdAssertion : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Sets the @p test of the assertion. + * + * @see Test Definition + */ + void setTest(const XsdXPathExpression::Ptr &test); + + /** + * Returns the test of the assertion. + */ + XsdXPathExpression::Ptr test() const; + + private: + XsdXPathExpression::Ptr m_test; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdattribute.cpp b/src/xmlpatterns/schema/qxsdattribute.cpp new file mode 100644 index 0000000..6cf60ec --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattribute.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdattribute_p.h" +#include "qxsdcomplextype_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + + +void XsdAttribute::Scope::setVariety(Variety variety) +{ + m_variety = variety; +} + +XsdAttribute::Scope::Variety XsdAttribute::Scope::variety() const +{ + return m_variety; +} + +void XsdAttribute::Scope::setParent(const NamedSchemaComponent::Ptr &parent) +{ + m_parent = parent; +} + +NamedSchemaComponent::Ptr XsdAttribute::Scope::parent() const +{ + return m_parent; +} + +void XsdAttribute::ValueConstraint::setVariety(Variety variety) +{ + m_variety = variety; +} + +XsdAttribute::ValueConstraint::Variety XsdAttribute::ValueConstraint::variety() const +{ + return m_variety; +} + +void XsdAttribute::ValueConstraint::setValue(const QString &value) +{ + m_value = value; +} + +QString XsdAttribute::ValueConstraint::value() const +{ + return m_value; +} + +void XsdAttribute::ValueConstraint::setLexicalForm(const QString &form) +{ + m_lexicalForm = form; +} + +QString XsdAttribute::ValueConstraint::lexicalForm() const +{ + return m_lexicalForm; +} + +void XsdAttribute::setType(const AnySimpleType::Ptr &type) +{ + m_type = type; +} + +AnySimpleType::Ptr XsdAttribute::type() const +{ + return m_type; +} + +void XsdAttribute::setScope(const Scope::Ptr &scope) +{ + m_scope = scope; +} + +XsdAttribute::Scope::Ptr XsdAttribute::scope() const +{ + return m_scope; +} + +void XsdAttribute::setValueConstraint(const ValueConstraint::Ptr &constraint) +{ + m_valueConstraint = constraint; +} + +XsdAttribute::ValueConstraint::Ptr XsdAttribute::valueConstraint() const +{ + return m_valueConstraint; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdattribute_p.h b/src/xmlpatterns/schema/qxsdattribute_p.h new file mode 100644 index 0000000..46d7355 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattribute_p.h @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAttribute_H +#define Patternist_XsdAttribute_H + +#include "qanysimpletype_p.h" +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD attribute object. + * + * This class represents the attribute object of a XML schema as described + * here. + * + * It contains information from either a top-level attribute declaration (as child of + * a schema object) or of a local attribute declaration (as child of complexType + * or attributeGroup object without a 'ref' attribute). + * + * All other occurrences of the attribute object are represented by the XsdAttributeUse class. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAttribute : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * @short Describes the scope of an attribute. + * + * @see Scope Definition + */ + class Scope : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the scope of an attribute. + */ + enum Variety + { + Global, ///< The attribute is defined globally as child of the schema object. + Local ///< The attribute is defined locally as child of a complex type or attribute group definition. + }; + + /** + * Sets the @p variety of the attribute scope. + * + * @see Variety Definition + */ + void setVariety(Variety variety); + + /** + * Returns the variety of the attribute scope. + */ + Variety variety() const; + + /** + * Sets the @p parent complex type or attribute group definition of the attribute scope. + * + * @see Parent Definition + */ + void setParent(const NamedSchemaComponent::Ptr &parent); + + /** + * Returns the parent complex type or attribute group definition of the attribute scope. + */ + NamedSchemaComponent::Ptr parent() const; + + private: + Variety m_variety; + NamedSchemaComponent::Ptr m_parent; + }; + + + /** + * @short Describes the value constraint of an attribute. + * + * @see Value Constraint Definition + */ + class ValueConstraint : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the value constraint of an attribute. + */ + enum Variety + { + Default, ///< The attribute has a default value set. + Fixed ///< The attribute has a fixed value set. + }; + + /** + * Sets the @p variety of the attribute value constraint. + * + * @see Variety Definition + */ + void setVariety(Variety variety); + + /** + * Returns the variety of the attribute value constraint. + */ + Variety variety() const; + + /** + * Sets the @p value of the constraint. + * + * @see Value Definition + */ + void setValue(const QString &value); + + /** + * Returns the value of the constraint. + */ + QString value() const; + + /** + * Sets the lexical @p form of the constraint. + * + * @see Lexical Form Definition + */ + void setLexicalForm(const QString &form); + + /** + * Returns the lexical form of the constraint. + */ + QString lexicalForm() const; + + private: + Variety m_variety; + QString m_value; + QString m_lexicalForm; + }; + + /** + * Sets the simple @p type definition of the attribute. + * + * @see Simple Type Definition + */ + void setType(const AnySimpleType::Ptr &type); + + /** + * Returns the simple type definition of the attribute. + */ + AnySimpleType::Ptr type() const; + + /** + * Sets the @p scope of the attribute. + * + * @see Scope Definition + */ + void setScope(const Scope::Ptr &scope); + + /** + * Returns the scope of the attribute. + */ + Scope::Ptr scope() const; + + /** + * Sets the value @p constraint of the attribute. + * + * @see Value Constraint Definition + */ + void setValueConstraint(const ValueConstraint::Ptr &constraint); + + /** + * Returns the value constraint of the attribute. + */ + ValueConstraint::Ptr valueConstraint() const; + + private: + AnySimpleType::Ptr m_type; + Scope::Ptr m_scope; + ValueConstraint::Ptr m_valueConstraint; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdattributegroup.cpp b/src/xmlpatterns/schema/qxsdattributegroup.cpp new file mode 100644 index 0000000..8f2a47e --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributegroup.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdattributegroup_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdAttributeGroup::setAttributeUses(const XsdAttributeUse::List &attributeUses) +{ + m_attributeUses = attributeUses; +} + +void XsdAttributeGroup::addAttributeUse(const XsdAttributeUse::Ptr &attributeUse) +{ + m_attributeUses.append(attributeUse); +} + +XsdAttributeUse::List XsdAttributeGroup::attributeUses() const +{ + return m_attributeUses; +} + +void XsdAttributeGroup::setWildcard(const XsdWildcard::Ptr &wildcard) +{ + m_wildcard = wildcard; +} + +XsdWildcard::Ptr XsdAttributeGroup::wildcard() const +{ + return m_wildcard; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdattributegroup_p.h b/src/xmlpatterns/schema/qxsdattributegroup_p.h new file mode 100644 index 0000000..7a3bd79 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributegroup_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAttributeGroup_H +#define Patternist_XsdAttributeGroup_H + +#include "qxsdannotated_p.h" +#include "qxsdattributeuse_p.h" +#include "qxsdwildcard_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents the XSD attributeGroup object. + * + * This class represents the attributeGroup object of a XML schema as described + * here. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAttributeGroup : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Sets the list of attribute @p uses that are defined in the attribute group. + * + * @see Attribute Uses + */ + void setAttributeUses(const XsdAttributeUse::List &uses); + + /** + * Adds a new attribute @p use to the attribute group. + */ + void addAttributeUse(const XsdAttributeUse::Ptr &use); + + /** + * Returns the list of all attribute uses of the attribute group. + */ + XsdAttributeUse::List attributeUses() const; + + /** + * Sets the attribute @p wildcard of the attribute group. + * + * @see Attribute Wildcard + */ + void setWildcard(const XsdWildcard::Ptr &wildcard); + + /** + * Returns the attribute wildcard of the attribute group. + */ + XsdWildcard::Ptr wildcard() const; + + private: + XsdAttributeUse::List m_attributeUses; + XsdWildcard::Ptr m_wildcard; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdattributereference.cpp b/src/xmlpatterns/schema/qxsdattributereference.cpp new file mode 100644 index 0000000..3c36a4e --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributereference.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdattributereference_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +bool XsdAttributeReference::isAttributeUse() const +{ + return false; +} + +bool XsdAttributeReference::isReference() const +{ + return true; +} + +void XsdAttributeReference::setType(Type type) +{ + m_type = type; +} + +XsdAttributeReference::Type XsdAttributeReference::type() const +{ + return m_type; +} + +void XsdAttributeReference::setReferenceName(const QXmlName &referenceName) +{ + m_referenceName = referenceName; +} + +QXmlName XsdAttributeReference::referenceName() const +{ + return m_referenceName; +} + +void XsdAttributeReference::setSourceLocation(const QSourceLocation &location) +{ + m_sourceLocation = location; +} + +QSourceLocation XsdAttributeReference::sourceLocation() const +{ + return m_sourceLocation; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdattributereference_p.h b/src/xmlpatterns/schema/qxsdattributereference_p.h new file mode 100644 index 0000000..be48b3a --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributereference_p.h @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAttributeReference_H +#define Patternist_XsdAttributeReference_H + +#include "qxsdattributeuse_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A helper class for attribute reference resolving. + * + * For easy resolving of attribute references, we have this class + * that can be used as a place holder for the real attribute use + * object it is referring to. + * So whenever the parser detects an attribute reference, it creates + * a XsdAttributeReference and returns it instead of the XsdAttributeUse. + * During a later phase, the resolver will look for all XsdAttributeReferences + * in the schema and will replace them with their referring XsdAttributeUse + * objects. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAttributeReference : public XsdAttributeUse + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the type of the attribute reference. + */ + enum Type + { + AttributeUse, ///< The reference points to an attribute use. + AttributeGroup ///< The reference points to an attribute group. + }; + + /** + * Always returns false, used to avoid dynamic casts. + */ + virtual bool isAttributeUse() const; + + /** + * Always returns true, used to avoid dynamic casts. + */ + virtual bool isReference() const; + + /** + * Sets the @p type of the attribute reference. + */ + void setType(Type type); + + /** + * Returns the type of the attribute reference. + */ + Type type() const; + + /** + * Sets the @p name of the attribute or attribute group the + * attribute reference refers to. + */ + void setReferenceName(const QXmlName &name); + + /** + * Returns the name of the attribute or attribute group the + * attribute reference refers to. + */ + QXmlName referenceName() const; + + /** + * Sets the source @p location where the reference is located. + */ + void setSourceLocation(const QSourceLocation &location); + + /** + * Returns the source location where the reference is located. + */ + QSourceLocation sourceLocation() const; + + private: + Type m_type; + QXmlName m_referenceName; + QSourceLocation m_sourceLocation; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdattributeterm.cpp b/src/xmlpatterns/schema/qxsdattributeterm.cpp new file mode 100644 index 0000000..a9c3898 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributeterm.cpp @@ -0,0 +1,28 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdattributeterm_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +bool XsdAttributeTerm::isAttributeUse() const +{ + return false; +} + +bool XsdAttributeTerm::isReference() const +{ + return false; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdattributeterm_p.h b/src/xmlpatterns/schema/qxsdattributeterm_p.h new file mode 100644 index 0000000..507df32 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributeterm_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAttributeTerm_H +#define Patternist_XsdAttributeTerm_H + +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A base class for all attribute types. + * + * For easy resolving of attribute references, we use this as + * common base class for XsdAttribute and XsdAttributeReference. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAttributeTerm : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Returns @c true if the term is an attribute use, @c false otherwise. + */ + virtual bool isAttributeUse() const; + + /** + * Returns @c true if the term is an attribute use reference, @c false otherwise. + * + * @note The reference term is only used internally as helper during type resolving. + */ + virtual bool isReference() const; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdattributeuse.cpp b/src/xmlpatterns/schema/qxsdattributeuse.cpp new file mode 100644 index 0000000..96d81bc --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributeuse.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdattributeuse_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdAttributeUse::ValueConstraint::setVariety(Variety variety) +{ + m_variety = variety; +} + +XsdAttributeUse::ValueConstraint::Variety XsdAttributeUse::ValueConstraint::variety() const +{ + return m_variety; +} + +void XsdAttributeUse::ValueConstraint::setValue(const QString &value) +{ + m_value = value; +} + +QString XsdAttributeUse::ValueConstraint::value() const +{ + return m_value; +} + +void XsdAttributeUse::ValueConstraint::setLexicalForm(const QString &form) +{ + m_lexicalForm = form; +} + +QString XsdAttributeUse::ValueConstraint::lexicalForm() const +{ + return m_lexicalForm; +} + +XsdAttributeUse::ValueConstraint::Ptr XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(const XsdAttribute::ValueConstraint::Ptr &constraint) +{ + XsdAttributeUse::ValueConstraint::Ptr newConstraint(new XsdAttributeUse::ValueConstraint()); + switch (constraint->variety()) { + case XsdAttribute::ValueConstraint::Fixed: newConstraint->setVariety(Fixed); break; + case XsdAttribute::ValueConstraint::Default: newConstraint->setVariety(Default); break; + } + newConstraint->setValue(constraint->value()); + newConstraint->setLexicalForm(constraint->lexicalForm()); + + return newConstraint; +} + +XsdAttributeUse::XsdAttributeUse() + : m_useType(OptionalUse) +{ +} + +bool XsdAttributeUse::isAttributeUse() const +{ + return true; +} + +void XsdAttributeUse::setUseType(UseType type) +{ + m_useType = type; +} + +XsdAttributeUse::UseType XsdAttributeUse::useType() const +{ + return m_useType; +} + +bool XsdAttributeUse::isRequired() const +{ + return (m_useType == RequiredUse); +} + +void XsdAttributeUse::setAttribute(const XsdAttribute::Ptr &attribute) +{ + m_attribute = attribute; +} + +XsdAttribute::Ptr XsdAttributeUse::attribute() const +{ + return m_attribute; +} + +void XsdAttributeUse::setValueConstraint(const ValueConstraint::Ptr &constraint) +{ + m_valueConstraint = constraint; +} + +XsdAttributeUse::ValueConstraint::Ptr XsdAttributeUse::valueConstraint() const +{ + return m_valueConstraint; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdattributeuse_p.h b/src/xmlpatterns/schema/qxsdattributeuse_p.h new file mode 100644 index 0000000..86021e1 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdattributeuse_p.h @@ -0,0 +1,194 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdAttributeUse_H +#define Patternist_XsdAttributeUse_H + +#include "qxsdattribute_p.h" +#include "qxsdattributeterm_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD attribute use object. + * + * This class represents the attribute use object of a XML schema as described + * here. + * + * It contains information from a local attribute declaration (as child of complexType + * or attributeGroup object). + * + * All other occurrences of the attribute object are represented by the XsdAttribute class. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdAttributeUse : public XsdAttributeTerm + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Describes the value constraint of an attribute use. + * + * @see Value Constraint Definition + */ + class ValueConstraint : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the value constraint of an attribute use. + */ + enum Variety + { + Default, ///< The attribute use has a default value set. + Fixed ///< The attribute use has a fixed value set. + }; + + /** + * Sets the @p variety of the attribute use value constraint. + */ + void setVariety(Variety variety); + + /** + * Returns the variety of the attribute use value constraint. + */ + Variety variety() const; + + /** + * Sets the @p value of the constraint. + */ + void setValue(const QString &value); + + /** + * Returns the value of the constraint. + */ + QString value() const; + + /** + * Sets the lexical @p form of the constraint. + */ + void setLexicalForm(const QString &form); + + /** + * Returns the lexical form of the constraint. + */ + QString lexicalForm() const; + + /** + * Creates a new value constraint from a XsdAttribute::ValueConstraint. + */ + static ValueConstraint::Ptr fromAttributeValueConstraint(const XsdAttribute::ValueConstraint::Ptr &constraint); + + private: + Variety m_variety; + QString m_value; + QString m_lexicalForm; + }; + + /** + * Describes the use type of the attribute use. + */ + enum UseType + { + OptionalUse, ///< The attribute can be there but doesn't need to. + RequiredUse, ///< The attribute must be there. + ProhibitedUse ///< The attribute is not allowed to be there. + }; + + /** + * Creates a new attribute use object. + */ + XsdAttributeUse(); + + /** + * Always returns true, used to avoid dynamic casts. + */ + virtual bool isAttributeUse() const; + + /** + * Sets the use @p type of the attribute use. + * + * @see UseType + */ + void setUseType(UseType type); + + /** + * Returns the use type of the attribute use. + */ + UseType useType() const; + + /** + * Returns whether the attribute use is required. + * + * @see Required Definition + */ + bool isRequired() const; + + /** + * Sets the @p attribute the attribute use is referring to. + * That is either a local definition as child of a complexType + * or attributeGroup object, or a reference defined by the + * 'ref' attribute. + * + * @see Attribute Declaration + */ + void setAttribute(const XsdAttribute::Ptr &attribute); + + /** + * Returns the attribute the attribute use is referring to. + */ + XsdAttribute::Ptr attribute() const; + + /** + * Sets the value @p constraint of the attribute use. + * + * @see http://www.w3.org/TR/xmlschema11-1/#vc_au + */ + void setValueConstraint(const ValueConstraint::Ptr &constraint); + + /** + * Returns the value constraint of the attribute use. + */ + ValueConstraint::Ptr valueConstraint() const; + + private: + UseType m_useType; + XsdAttribute::Ptr m_attribute; + ValueConstraint::Ptr m_valueConstraint; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdcomplextype.cpp b/src/xmlpatterns/schema/qxsdcomplextype.cpp new file mode 100644 index 0000000..ddc9110 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdcomplextype.cpp @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdcomplextype_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdComplexType::OpenContent::setMode(Mode mode) +{ + m_mode = mode; +} + +XsdComplexType::OpenContent::Mode XsdComplexType::OpenContent::mode() const +{ + return m_mode; +} + +void XsdComplexType::OpenContent::setWildcard(const XsdWildcard::Ptr &wildcard) +{ + m_wildcard = wildcard; +} + +XsdWildcard::Ptr XsdComplexType::OpenContent::wildcard() const +{ + return m_wildcard; +} + +void XsdComplexType::ContentType::setVariety(Variety variety) +{ + m_variety = variety; +} + +XsdComplexType::ContentType::Variety XsdComplexType::ContentType::variety() const +{ + return m_variety; +} + +void XsdComplexType::ContentType::setParticle(const XsdParticle::Ptr &particle) +{ + m_particle = particle; +} + +XsdParticle::Ptr XsdComplexType::ContentType::particle() const +{ + return m_particle; +} + +void XsdComplexType::ContentType::setOpenContent(const OpenContent::Ptr &content) +{ + m_openContent = content; +} + +XsdComplexType::OpenContent::Ptr XsdComplexType::ContentType::openContent() const +{ + return m_openContent; +} + +void XsdComplexType::ContentType::setSimpleType(const AnySimpleType::Ptr &type) +{ + m_simpleType = type; +} + +AnySimpleType::Ptr XsdComplexType::ContentType::simpleType() const +{ + return m_simpleType; +} + + +XsdComplexType::XsdComplexType() + : m_isAbstract(false) + , m_contentType(new ContentType()) +{ + m_contentType->setVariety(ContentType::Empty); +} + +void XsdComplexType::setIsAbstract(bool abstract) +{ + m_isAbstract = abstract; +} + +bool XsdComplexType::isAbstract() const +{ + return m_isAbstract; +} + +QString XsdComplexType::displayName(const NamePool::Ptr &np) const +{ + return np->displayName(name(np)); +} + +void XsdComplexType::setWxsSuperType(const SchemaType::Ptr &type) +{ + m_superType = type; +} + +SchemaType::Ptr XsdComplexType::wxsSuperType() const +{ + return m_superType; +} + +void XsdComplexType::setContext(const NamedSchemaComponent::Ptr &component) +{ + m_context = component; +} + +NamedSchemaComponent::Ptr XsdComplexType::context() const +{ + return m_context; +} + +void XsdComplexType::setContentType(const ContentType::Ptr &type) +{ + m_contentType = type; +} + +XsdComplexType::ContentType::Ptr XsdComplexType::contentType() const +{ + return m_contentType; +} + +void XsdComplexType::setAttributeUses(const XsdAttributeUse::List &attributeUses) +{ + m_attributeUses = attributeUses; +} + +void XsdComplexType::addAttributeUse(const XsdAttributeUse::Ptr &attributeUse) +{ + m_attributeUses.append(attributeUse); +} + +XsdAttributeUse::List XsdComplexType::attributeUses() const +{ + return m_attributeUses; +} + +void XsdComplexType::setAttributeWildcard(const XsdWildcard::Ptr &wildcard) +{ + m_attributeWildcard = wildcard; +} + +XsdWildcard::Ptr XsdComplexType::attributeWildcard() const +{ + return m_attributeWildcard; +} + +XsdComplexType::TypeCategory XsdComplexType::category() const +{ + return ComplexType; +} + +void XsdComplexType::setDerivationMethod(DerivationMethod method) +{ + m_derivationMethod = method; +} + +XsdComplexType::DerivationMethod XsdComplexType::derivationMethod() const +{ + return m_derivationMethod; +} + +void XsdComplexType::setProhibitedSubstitutions(const BlockingConstraints &substitutions) +{ + m_prohibitedSubstitutions = substitutions; +} + +XsdComplexType::BlockingConstraints XsdComplexType::prohibitedSubstitutions() const +{ + return m_prohibitedSubstitutions; +} + +void XsdComplexType::setAssertions(const XsdAssertion::List &assertions) +{ + m_assertions = assertions; +} + +void XsdComplexType::addAssertion(const XsdAssertion::Ptr &assertion) +{ + m_assertions.append(assertion); +} + +XsdAssertion::List XsdComplexType::assertions() const +{ + return m_assertions; +} + +bool XsdComplexType::isDefinedBySchema() const +{ + return true; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdcomplextype_p.h b/src/xmlpatterns/schema/qxsdcomplextype_p.h new file mode 100644 index 0000000..078c8f0 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdcomplextype_p.h @@ -0,0 +1,374 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdComplexType_H +#define Patternist_XsdComplexType_H + +#include "qanytype_p.h" +#include "qxsdassertion_p.h" +#include "qxsdattributeuse_p.h" +#include "qxsdparticle_p.h" +#include "qxsdsimpletype_p.h" +#include "qxsduserschematype_p.h" +#include "qxsdwildcard_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD complexType object. + * + * This class represents the complexType object of a XML schema as described + * here. + * + * It contains information from either a top-level complex type declaration (as child of a schema object) + * or a local complex type declaration (as descendant of an element object). + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdComplexType : public XsdUserSchemaType + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * @short Describes the open content object of a complex type. + * + * @see Open Content Definition + */ + class OpenContent : public QSharedData, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the mode of the open content. + * + * @see Mode Definition + */ + enum Mode + { + None, + Interleave, + Suffix + }; + + /** + * Sets the @p mode of the open content. + * + * @see Mode Definition + */ + void setMode(Mode mode); + + /** + * Returns the mode of the open content. + */ + Mode mode() const; + + /** + * Sets the @p wildcard of the open content. + * + * @see Wildcard Definition + */ + void setWildcard(const XsdWildcard::Ptr &wildcard); + + /** + * Returns the wildcard of the open content. + */ + XsdWildcard::Ptr wildcard() const; + + private: + Mode m_mode; + XsdWildcard::Ptr m_wildcard; + }; + + /** + * @short Describes the content type of a complex type. + */ + class ContentType : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the variety of the content type. + */ + enum Variety + { + Empty = 0, ///< The complex type has no further content. + Simple, ///< The complex type has only simple type content (e.g. text, number etc.) + ElementOnly, ///< The complex type has further elements or attributes but no text as content. + Mixed ///< The complex type has further elements or attributes and text as content. + }; + + /** + * Sets the @p variety of the content type. + * + * @see Variety Definition + */ + void setVariety(Variety variety); + + /** + * Returns the variety of the content type. + */ + Variety variety() const; + + /** + * Sets the @p particle object of the content type. + * + * The content type has only a particle object if + * its variety is ElementOnly or Mixed. + * + * @see XsdParticle + * @see Particle Declaration + */ + void setParticle(const XsdParticle::Ptr &particle); + + /** + * Returns the particle object of the content type, + * or an empty pointer if its variety is neither + * ElementOnly nor Mixed. + */ + XsdParticle::Ptr particle() const; + + /** + * Sets the open @p content object of the content type. + * + * The content type has only an open content object if + * its variety is ElementOnly or Mixed. + * + * @see OpenContent + * @see Open Content Declaration + */ + void setOpenContent(const OpenContent::Ptr &content); + + /** + * Returns the open content object of the content type, + * or an empty pointer if its variety is neither + * ElementOnly nor Mixed. + */ + OpenContent::Ptr openContent() const; + + /** + * Sets the simple @p type object of the content type. + * + * The content type has only a simple type object if + * its variety is Simple. + * + * @see Simple Type Definition + */ + void setSimpleType(const AnySimpleType::Ptr &type); + + /** + * Returns the simple type object of the content type, + * or an empty pointer if its variety is not Simple. + */ + AnySimpleType::Ptr simpleType() const; + + private: + Variety m_variety; + XsdParticle::Ptr m_particle; + OpenContent::Ptr m_openContent; + XsdSimpleType::Ptr m_simpleType; + }; + + + /** + * Creates a complex type object with empty content. + */ + XsdComplexType(); + + /** + * Destroys the complex type object. + */ + ~XsdComplexType() {}; + + /** + * Returns the display name of the complex type. + * + * The display name can be used to show the type name + * to the user. + * + * @param namePool The name pool where the type name is stored in. + */ + virtual QString displayName(const NamePool::Ptr &namePool) const; + + /** + * Sets the base type of the complex type. + * + * @see Base Type Definition + */ + void setWxsSuperType(const SchemaType::Ptr &type); + + /** + * Returns the base type of the complex type. + */ + virtual SchemaType::Ptr wxsSuperType() const; + + /** + * Sets the context @p component of the complex type. + * + * The component is either an element declaration or a complex type definition. + */ + void setContext(const NamedSchemaComponent::Ptr &component); + + /** + * Returns the context component of the complex type. + */ + NamedSchemaComponent::Ptr context() const; + + /** + * Sets the derivation @p method of the complex type. + * + * The derivation method depends on whether the complex + * type object has an extension or restriction object as child. + * + * @see Derivation Method Definition + * @see DerivationMethod + */ + void setDerivationMethod(DerivationMethod method); + + /** + * Returns the derivation method of the complex type. + */ + virtual DerivationMethod derivationMethod() const; + + /** + * Sets whether the complex type is @p abstract. + * + * @see Abstract Definition + */ + void setIsAbstract(bool abstract); + + /** + * Returns whether the complex type is abstract. + */ + virtual bool isAbstract() const; + + /** + * Sets the list of all attribute @p uses of the complex type. + * + * @see Attribute Uses Declaration + */ + void setAttributeUses(const XsdAttributeUse::List &uses); + + /** + * Adds a new attribute @p use to the complex type. + */ + void addAttributeUse(const XsdAttributeUse::Ptr &use); + + /** + * Returns the list of all attribute uses of the complex type. + */ + XsdAttributeUse::List attributeUses() const; + + /** + * Sets the attribute @p wildcard of the complex type. + * + * @see Attribute Wildcard Declaration + */ + void setAttributeWildcard(const XsdWildcard::Ptr &wildcard); + + /** + * Returns the attribute wildcard of the complex type. + */ + XsdWildcard::Ptr attributeWildcard() const; + + /** + * Always returns SchemaType::ComplexType + */ + virtual TypeCategory category() const; + + /** + * Sets the content @p type of the complex type. + * + * @see ContentType + */ + void setContentType(const ContentType::Ptr &type); + + /** + * Returns the content type of the complex type. + */ + ContentType::Ptr contentType() const; + + /** + * Sets the prohibited @p substitutions of the complex type. + * + * Only ExtensionConstraint and RestrictionConstraint are allowed. + * + * @see Prohibited Substitutions Definition + */ + void setProhibitedSubstitutions(const BlockingConstraints &substitutions); + + /** + * Returns the prohibited substitutions of the complex type. + */ + BlockingConstraints prohibitedSubstitutions() const; + + /** + * Sets the @p assertions of the complex type. + * + * @see Assertions Definition + */ + void setAssertions(const XsdAssertion::List &assertions); + + /** + * Adds an @p assertion to the complex type. + * + * @see Assertions Definition + */ + void addAssertion(const XsdAssertion::Ptr &assertion); + + /** + * Returns the assertions of the complex type. + */ + XsdAssertion::List assertions() const; + + /** + * Always returns @c true. + */ + virtual bool isDefinedBySchema() const; + + private: + SchemaType::Ptr m_superType; + NamedSchemaComponent::Ptr m_context; + DerivationMethod m_derivationMethod; + bool m_isAbstract; + XsdAttributeUse::List m_attributeUses; + XsdWildcard::Ptr m_attributeWildcard; + ContentType::Ptr m_contentType; + BlockingConstraints m_prohibitedSubstitutions; + XsdAssertion::List m_assertions; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsddocumentation.cpp b/src/xmlpatterns/schema/qxsddocumentation.cpp new file mode 100644 index 0000000..4994143 --- /dev/null +++ b/src/xmlpatterns/schema/qxsddocumentation.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsddocumentation_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdDocumentation::XsdDocumentation() +{ +} + +XsdDocumentation::~XsdDocumentation() +{ +} + +void XsdDocumentation::setSource(const AnyURI::Ptr &source) +{ + m_source = source; +} + +AnyURI::Ptr XsdDocumentation::source() const +{ + return m_source; +} + +void XsdDocumentation::setLanguage(const DerivedString::Ptr &language) +{ + m_language = language; +} + +DerivedString::Ptr XsdDocumentation::language() const +{ + return m_language; +} + +void XsdDocumentation::setContent(const QString &content) +{ + m_content = content; +} + +QString XsdDocumentation::content() const +{ + return m_content; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsddocumentation_p.h b/src/xmlpatterns/schema/qxsddocumentation_p.h new file mode 100644 index 0000000..c44a2bb --- /dev/null +++ b/src/xmlpatterns/schema/qxsddocumentation_p.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdDocumentation_H +#define Patternist_XsdDocumentation_H + +#include "qanytype_p.h" +#include "qanyuri_p.h" +#include "qderivedstring_p.h" +#include "qnamedschemacomponent_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD documentation object. + * + * This class represents the documentation component of an annotation object + * of a XML schema as described here. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdDocumentation : public NamedSchemaComponent + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Creates a new documentation object. + */ + XsdDocumentation(); + + /** + * Destroys the documentation object. + */ + ~XsdDocumentation(); + + /** + * Sets the @p source of the documentation. + * + * The source points to an URL that contains more + * information. + */ + void setSource(const AnyURI::Ptr &source); + + /** + * Returns the source of the documentation. + */ + AnyURI::Ptr source() const; + + /** + * Sets the @p language of the documentation. + */ + void setLanguage(const DerivedString::Ptr &language); + + /** + * Returns the language of the documentation. + */ + DerivedString::Ptr language() const; + + /** + * Sets the @p content of the documentation. + * + * The content can be of abritrary type. + */ + void setContent(const QString &content); + + /** + * Returns the content of the documentation. + */ + QString content() const; + + private: + AnyURI::Ptr m_source; + DerivedString::Ptr m_language; + QString m_content; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdelement.cpp b/src/xmlpatterns/schema/qxsdelement.cpp new file mode 100644 index 0000000..2b8ccab --- /dev/null +++ b/src/xmlpatterns/schema/qxsdelement.cpp @@ -0,0 +1,214 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdelement_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdElement::Scope::setVariety(Variety variety) +{ + m_variety = variety; +} + +XsdElement::Scope::Variety XsdElement::Scope::variety() const +{ + return m_variety; +} + +void XsdElement::Scope::setParent(const NamedSchemaComponent::Ptr &parent) +{ + m_parent = parent; +} + +NamedSchemaComponent::Ptr XsdElement::Scope::parent() const +{ + return m_parent; +} + +void XsdElement::ValueConstraint::setVariety(Variety variety) +{ + m_variety = variety; +} + +XsdElement::ValueConstraint::Variety XsdElement::ValueConstraint::variety() const +{ + return m_variety; +} + +void XsdElement::ValueConstraint::setValue(const QString &value) +{ + m_value = value; +} + +QString XsdElement::ValueConstraint::value() const +{ + return m_value; +} + +void XsdElement::ValueConstraint::setLexicalForm(const QString &form) +{ + m_lexicalForm = form; +} + +QString XsdElement::ValueConstraint::lexicalForm() const +{ + return m_lexicalForm; +} + +void XsdElement::TypeTable::addAlternative(const XsdAlternative::Ptr &alternative) +{ + m_alternatives.append(alternative); +} + +XsdAlternative::List XsdElement::TypeTable::alternatives() const +{ + return m_alternatives; +} + +void XsdElement::TypeTable::setDefaultTypeDefinition(const XsdAlternative::Ptr &type) +{ + m_defaultTypeDefinition = type; +} + +XsdAlternative::Ptr XsdElement::TypeTable::defaultTypeDefinition() const +{ + return m_defaultTypeDefinition; +} + + +XsdElement::XsdElement() + : m_isAbstract(false) +{ +} + +bool XsdElement::isElement() const +{ + return true; +} + +void XsdElement::setType(const SchemaType::Ptr &type) +{ + m_type = type; +} + +SchemaType::Ptr XsdElement::type() const +{ + return m_type; +} + +void XsdElement::setScope(const Scope::Ptr &scope) +{ + m_scope = scope; +} + +XsdElement::Scope::Ptr XsdElement::scope() const +{ + return m_scope; +} + +void XsdElement::setValueConstraint(const ValueConstraint::Ptr &constraint) +{ + m_valueConstraint = constraint; +} + +XsdElement::ValueConstraint::Ptr XsdElement::valueConstraint() const +{ + return m_valueConstraint; +} + +void XsdElement::setTypeTable(const TypeTable::Ptr &table) +{ + m_typeTable = table; +} + +XsdElement::TypeTable::Ptr XsdElement::typeTable() const +{ + return m_typeTable; +} + +void XsdElement::setIsAbstract(bool abstract) +{ + m_isAbstract = abstract; +} + +bool XsdElement::isAbstract() const +{ + return m_isAbstract; +} + +void XsdElement::setIsNillable(bool nillable) +{ + m_isNillable = nillable; +} + +bool XsdElement::isNillable() const +{ + return m_isNillable; +} + +void XsdElement::setDisallowedSubstitutions(const BlockingConstraints &substitutions) +{ + m_disallowedSubstitutions = substitutions; +} + +XsdElement::BlockingConstraints XsdElement::disallowedSubstitutions() const +{ + return m_disallowedSubstitutions; +} + +void XsdElement::setSubstitutionGroupExclusions(const SchemaType::DerivationConstraints &exclusions) +{ + m_substitutionGroupExclusions = exclusions; +} + +SchemaType::DerivationConstraints XsdElement::substitutionGroupExclusions() const +{ + return m_substitutionGroupExclusions; +} + +void XsdElement::setIdentityConstraints(const XsdIdentityConstraint::List &constraints) +{ + m_identityConstraints = constraints; +} + +void XsdElement::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint) +{ + m_identityConstraints.append(constraint); +} + +XsdIdentityConstraint::List XsdElement::identityConstraints() const +{ + return m_identityConstraints; +} + +void XsdElement::setSubstitutionGroupAffiliations(const XsdElement::List &affiliations) +{ + m_substitutionGroupAffiliations = affiliations; +} + +XsdElement::List XsdElement::substitutionGroupAffiliations() const +{ + return m_substitutionGroupAffiliations; +} + +void XsdElement::addSubstitutionGroup(const XsdElement::Ptr &element) +{ + m_substitutionGroups.insert(element); +} + +XsdElement::List XsdElement::substitutionGroups() const +{ + return m_substitutionGroups.toList(); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdelement_p.h b/src/xmlpatterns/schema/qxsdelement_p.h new file mode 100644 index 0000000..e571687 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdelement_p.h @@ -0,0 +1,373 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdElement_H +#define Patternist_XsdElement_H + +#include "qschemacomponent_p.h" +#include "qschematype_p.h" +#include "qxsdalternative_p.h" +#include "qxsdidentityconstraint_p.h" +#include "qxsdcomplextype_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD element object. + * + * This class represents the element object of a XML schema as described + * here. + * + * It contains information from either a top-level element declaration (as child of a schema object) + * or a local element declaration (as descendant of an complexType object). + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdElement : public XsdTerm + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + + /** + * Describes the constraint type of the element. + */ + enum ConstraintType + { + NoneConstraint, ///< The value of the element has no constraints. + DefaultConstraint, ///< The element has a default value set. + FixedConstraint ///< The element has a fixed value set. + }; + + /** + * Describes the scope of an element. + * + * @see Scope Definition + */ + class Scope : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the scope of an attribute. + */ + enum Variety + { + Global, ///< The element is defined globally as child of the schema object. + Local ///< The element is defined locally as child of a complex type or model group definition. + }; + + /** + * Sets the @p variety of the element scope. + */ + void setVariety(Variety variety); + + /** + * Returns the variety of the element scope. + */ + Variety variety() const; + + /** + * Sets the @p parent complex type or model group definition of the element scope. + */ + void setParent(const NamedSchemaComponent::Ptr &parent); + + /** + * Returns the parent complex type or model group definition of the element scope. + */ + NamedSchemaComponent::Ptr parent() const; + + private: + Variety m_variety; + NamedSchemaComponent::Ptr m_parent; + }; + + /** + * Describes a type table of an element. + * + * @see Type Table Definition + */ + class TypeTable : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Adds an @p alternative to the type table. + */ + void addAlternative(const XsdAlternative::Ptr &alternative); + + /** + * Returns the alternatives of the type table. + */ + XsdAlternative::List alternatives() const; + + /** + * Sets the default @p type definition. + */ + void setDefaultTypeDefinition(const XsdAlternative::Ptr &type); + + /** + * Returns the default type definition. + */ + XsdAlternative::Ptr defaultTypeDefinition() const; + + private: + XsdAlternative::List m_alternatives; + XsdAlternative::Ptr m_defaultTypeDefinition; + }; + + + /** + * Describes the value constraint of an element. + * + * @see Value Constraint Definition + */ + class ValueConstraint : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the value constraint of an element. + */ + enum Variety + { + Default, ///< The element has a default value set. + Fixed ///< The element has a fixed value set. + }; + + /** + * Sets the @p variety of the element value constraint. + */ + void setVariety(Variety variety); + + /** + * Returns the variety of the element value constraint. + */ + Variety variety() const; + + /** + * Sets the @p value of the constraint. + */ + void setValue(const QString &value); + + /** + * Returns the value of the constraint. + */ + QString value() const; + + /** + * Sets the lexical @p form of the constraint. + */ + void setLexicalForm(const QString &form); + + /** + * Returns the lexical form of the constraint. + */ + QString lexicalForm() const; + + private: + Variety m_variety; + QString m_value; + QString m_lexicalForm; + }; + + /** + * Creates a new element object. + */ + XsdElement(); + + /** + * Always returns @c true, used to avoid dynamic casts. + */ + virtual bool isElement() const; + + /** + * Sets the @p type of the element. + * + * @see Type Definition + */ + void setType(const SchemaType::Ptr &type); + + /** + * Returns the type of the element. + */ + SchemaType::Ptr type() const; + + /** + * Sets the @p scope of the element. + * + * @see Scope Definition + */ + void setScope(const Scope::Ptr &scope); + + /** + * Returns the scope of the element. + */ + Scope::Ptr scope() const; + + /** + * Sets the value @p constraint of the element. + * + * @see Value Constraint Definition + */ + void setValueConstraint(const ValueConstraint::Ptr &constraint); + + /** + * Returns the value constraint of the element. + */ + ValueConstraint::Ptr valueConstraint() const; + + /** + * Sets the type table of the element. + * + * @see Type Table Definition + */ + void setTypeTable(const TypeTable::Ptr &table); + + /** + * Returns the type table of the element. + */ + TypeTable::Ptr typeTable() const; + + /** + * Sets whether the element is @p abstract. + * + * @see Abstract Definition + */ + void setIsAbstract(bool abstract); + + /** + * Returns whether the element is abstract. + */ + bool isAbstract() const; + + /** + * Sets whether the element is @p nillable. + * + * @see Nillable Definition + */ + void setIsNillable(bool nillable); + + /** + * Returns whether the element is nillable. + */ + bool isNillable() const; + + /** + * Sets the disallowed @p substitutions of the element. + * + * Only ExtensionConstraint, RestrictionConstraint and SubstitutionConstraint are allowed. + * + * @see Disallowed Substitutions Definition + */ + void setDisallowedSubstitutions(const BlockingConstraints &substitutions); + + /** + * Returns the disallowed substitutions of the element. + */ + BlockingConstraints disallowedSubstitutions() const; + + /** + * Sets the substitution group @p exclusions of the element. + * + * Only SchemaType::ExtensionConstraint and SchemaType::RestrictionConstraint are allowed. + * + * @see Substitution Group Exclusions Definition + */ + void setSubstitutionGroupExclusions(const SchemaType::DerivationConstraints &exclusions); + + /** + * Returns the substitution group exclusions of the element. + */ + SchemaType::DerivationConstraints substitutionGroupExclusions() const; + + /** + * Sets the identity @p constraints of the element. + * + * @see Identity Constraint Definition + */ + void setIdentityConstraints(const XsdIdentityConstraint::List &constraints); + + /** + * Adds a new identity @p constraint to the element. + */ + void addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint); + + /** + * Returns a list of all identity constraints of the element. + */ + XsdIdentityConstraint::List identityConstraints() const; + + /** + * Sets the substitution group @p affiliations of the element. + * + * @see Substitution Group Affiliations + */ + void setSubstitutionGroupAffiliations(const XsdElement::List &affiliations); + + /** + * Returns the substitution group affiliations of the element. + */ + XsdElement::List substitutionGroupAffiliations() const; + + /** + * Adds a substitution group to the element. + */ + void addSubstitutionGroup(const XsdElement::Ptr &elements); + + /** + * Returns the substitution groups of the element. + */ + XsdElement::List substitutionGroups() const; + + private: + SchemaType::Ptr m_type; + Scope::Ptr m_scope; + ValueConstraint::Ptr m_valueConstraint; + TypeTable::Ptr m_typeTable; + bool m_isAbstract; + bool m_isNillable; + BlockingConstraints m_disallowedSubstitutions; + SchemaType::DerivationConstraints m_substitutionGroupExclusions; + XsdIdentityConstraint::List m_identityConstraints; + XsdElement::List m_substitutionGroupAffiliations; + QSet m_substitutionGroups; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdfacet.cpp b/src/xmlpatterns/schema/qxsdfacet.cpp new file mode 100644 index 0000000..513eee8 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdfacet.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdfacet_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdFacet::XsdFacet() + : m_type(None) +{ +} + +void XsdFacet::setType(Type type) +{ + m_type = type; +} + +XsdFacet::Type XsdFacet::type() const +{ + return m_type; +} + +void XsdFacet::setValue(const AtomicValue::Ptr &value) +{ + m_value = value; +} + +AtomicValue::Ptr XsdFacet::value() const +{ + return m_value; +} + +void XsdFacet::setMultiValue(const AtomicValue::List &value) +{ + m_multiValue = value; +} + +AtomicValue::List XsdFacet::multiValue() const +{ + return m_multiValue; +} + +void XsdFacet::setAssertions(const XsdAssertion::List &assertions) +{ + m_assertions = assertions; +} + +XsdAssertion::List XsdFacet::assertions() const +{ + return m_assertions; +} + +void XsdFacet::setFixed(bool fixed) +{ + m_fixed = fixed; +} + +bool XsdFacet::fixed() const +{ + return m_fixed; +} + +QString XsdFacet::typeName(Type type) +{ + switch (type) { + case Length: return QLatin1String("length"); break; + case MinimumLength: return QLatin1String("minLength"); break; + case MaximumLength: return QLatin1String("maxLength"); break; + case Pattern: return QLatin1String("pattern"); break; + case WhiteSpace: return QLatin1String("whiteSpace"); break; + case MaximumInclusive: return QLatin1String("maxInclusive"); break; + case MaximumExclusive: return QLatin1String("maxExclusive"); break; + case MinimumInclusive: return QLatin1String("minInclusive"); break; + case MinimumExclusive: return QLatin1String("minExclusive"); break; + case TotalDigits: return QLatin1String("totalDigits"); break; + case FractionDigits: return QLatin1String("fractionDigits"); break; + case Enumeration: return QLatin1String("enumeration"); break; + case Assertion: return QLatin1String("assertion"); break; + case None: // fall through + default: return QLatin1String("none"); break; + } +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdfacet_p.h b/src/xmlpatterns/schema/qxsdfacet_p.h new file mode 100644 index 0000000..f1f8110 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdfacet_p.h @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdFacet_H +#define Patternist_XsdFacet_H + +#include "qitem_p.h" +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" +#include "qxsdassertion_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD facet object. + * + * This class represents one of the following XML schema objects: + * + * + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdFacet : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the type of the facet. + */ + enum Type + { + None = 0, ///< An invalid facet. + Length = 1 << 0, ///< Match the exact length (Length Definition) + MinimumLength = 1 << 1, ///< Match the minimum length (Minimum Length Definition) + MaximumLength = 1 << 2, ///< Match the maximum length (Maximum Length Definition) + Pattern = 1 << 3, ///< Match a regular expression (Pattern Definition) + WhiteSpace = 1 << 4, ///< Match a whitespace rule (White Space Definition) + MaximumInclusive = 1 << 5, ///< Match a maximum inclusive (Maximum Inclusive Definition) + MaximumExclusive = 1 << 6, ///< Match a maximum exclusive (Maximum Exclusive Definition) + MinimumInclusive = 1 << 7, ///< Match a minimum inclusive (Minimum Inclusive Definition) + MinimumExclusive = 1 << 8, ///< Match a minimum exclusive (Minimum Exclusive Definition) + TotalDigits = 1 << 9, ///< Match some integer digits (Total Digits Definition) + FractionDigits = 1 << 10, ///< Match some double digits (Fraction Digits Definition) + Enumeration = 1 << 11, ///< Match an enumeration (Enumeration Definition) + Assertion = 1 << 12, ///< Match an assertion (Assertion Definition) + }; + typedef QHash Hash; + typedef QHashIterator HashIterator; + + /** + * Creates a new facet object of type None. + */ + XsdFacet(); + + /** + * Sets the @p type of the facet. + * + * @see Type + */ + void setType(Type type); + + /** + * Returns the type of the facet. + */ + Type type() const; + + /** + * Sets the @p value of the facet. + * + * Depending on the type of the facet the + * value can be a string, interger, double etc. + * + * @note This method should be used for all types of facets + * except Pattern, Enumeration and Assertion. + */ + void setValue(const AtomicValue::Ptr &value); + + /** + * Returns the value of the facet or an empty pointer if facet + * type is Pattern, Enumeration or Assertion. + */ + AtomicValue::Ptr value() const; + + /** + * Sets the @p value of the facet. + * + * @note This method should be used for if the type of the + * facet is Pattern or Enumeration. + */ + void setMultiValue(const AtomicValue::List &value); + + /** + * Returns the value of the facet or an empty pointer if facet + * type is not of type Pattern or Enumeration. + */ + AtomicValue::List multiValue() const; + + /** + * Sets the @p assertions of the facet. + * + * @note This method should be used if the type of the + * facet is Assertion. + */ + void setAssertions(const XsdAssertion::List &assertions); + + /** + * Returns the assertions of the facet or an empty pointer if facet + * type is not of type Assertion. + */ + XsdAssertion::List assertions() const; + + /** + * Sets whether the facet is @p fixed. + * + * All facets except pattern, enumeration and assertion can be fixed. + */ + void setFixed(bool fixed); + + /** + * Returns whether the facet is fixed. + */ + bool fixed() const; + + /** + * Returns the textual description of the facet @p type. + */ + static QString typeName(Type type); + + private: + Type m_type; + AtomicValue::Ptr m_value; + AtomicValue::List m_multiValue; + XsdAssertion::List m_assertions; + bool m_fixed; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdidcache.cpp b/src/xmlpatterns/schema/qxsdidcache.cpp new file mode 100644 index 0000000..d4a7b64 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdidcache.cpp @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdidcache_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdIdCache::addId(const QString &id) +{ + const QWriteLocker locker(&m_lock); + Q_ASSERT(!m_ids.contains(id)); + + m_ids.insert(id); +} + +bool XsdIdCache::hasId(const QString &id) const +{ + const QReadLocker locker(&m_lock); + + return m_ids.contains(id); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdidcache_p.h b/src/xmlpatterns/schema/qxsdidcache_p.h new file mode 100644 index 0000000..b1d3c0f --- /dev/null +++ b/src/xmlpatterns/schema/qxsdidcache_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdIdCache_H +#define Patternist_XsdIdCache_H + +#include "qschemacomponent_p.h" + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Helper class for keeping track of all existing IDs in a schema. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdIdCache : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Adds an @p id to the id cache. + */ + void addId(const QString &id); + + /** + * Returns whether the id cache contains the given @p id already. + */ + bool hasId(const QString &id) const; + + private: + QSet m_ids; + mutable QReadWriteLock m_lock; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdidchelper.cpp b/src/xmlpatterns/schema/qxsdidchelper.cpp new file mode 100644 index 0000000..70980cb --- /dev/null +++ b/src/xmlpatterns/schema/qxsdidchelper.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdidchelper_p.h" + +#include "qderivedstring_p.h" +#include "qxsdschemahelper_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +FieldNode::FieldNode() +{ +} + +FieldNode::FieldNode(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type) + : m_item(item) + , m_data(data) + , m_type(type) +{ +} + +bool FieldNode::isEmpty() const +{ + return m_item.isNull(); +} + +bool FieldNode::isEqualTo(const FieldNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const +{ + if (m_type != other.m_type) + return false; + + const DerivedString::Ptr string = DerivedString::fromLexical(namePool, m_data); + const DerivedString::Ptr otherString = DerivedString::fromLexical(namePool, other.m_data); + + return XsdSchemaHelper::constructAndCompare(string, AtomicComparator::OperatorEqual, otherString, m_type, context, reflection); +} + +QXmlItem FieldNode::item() const +{ + return m_item; +} + +TargetNode::TargetNode(const QXmlItem &item) + : m_item(item) +{ +} + +QXmlItem TargetNode::item() const +{ + return m_item; +} + +QVector TargetNode::fieldItems() const +{ + QVector items; + + for (int i = 0; i < m_fields.count(); ++i) + items.append(m_fields.at(i).item()); + + return items; +} + +int TargetNode::emptyFieldsCount() const +{ + int counter = 0; + for (int i = 0; i < m_fields.count(); ++i) { + if (m_fields.at(i).isEmpty()) + ++counter; + } + + return counter; +} + +bool TargetNode::fieldsAreEqual(const TargetNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const +{ + if (m_fields.count() != other.m_fields.count()) + return false; + + for (int i = 0; i < m_fields.count(); ++i) { + if (!m_fields.at(i).isEqualTo(other.m_fields.at(i), namePool, context, reflection)) + return false; + } + + return true; +} + +void TargetNode::addField(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type) +{ + m_fields.append(FieldNode(item, data, type)); +} + +bool TargetNode::operator==(const TargetNode &other) const +{ + return (m_item.toNodeModelIndex() == other.m_item.toNodeModelIndex()); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdidchelper_p.h b/src/xmlpatterns/schema/qxsdidchelper_p.h new file mode 100644 index 0000000..3034292 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdidchelper_p.h @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdIdcHelper_H +#define Patternist_XsdIdcHelper_H + +#include "qreportcontext_p.h" +#include "qschematype_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + + /** + * @short A helper class for validating identity constraints. + * + * This class represents a field node from the key-sequence as defined in + * the validation rules at http://www.w3.org/TR/xmlschema11-1/#d0e32243. + */ + class FieldNode + { + public: + /** + * Creates an empty field node. + */ + FieldNode(); + + /** + * Creates a field node that is bound to a xml node. + * + * @param item The xml node the field is bound to. + * @param data The string content of that field. + * @param type The type that is bound to that field. + */ + FieldNode(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type); + + /** + * Returns whether this field is empty. + * + * A field can be empty, if the xpath expression selects an absent attribute + * or element. + */ + bool isEmpty() const; + + /** + * Returns whether this field is equal to the @p other field. + * + * Equal means that both have the same type and there content is equal in the + * types value space. + */ + bool isEqualTo(const FieldNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const; + + /** + * Returns the xml node item the field is bound to. + */ + QXmlItem item() const; + + private: + QXmlItem m_item; + QString m_data; + SchemaType::Ptr m_type; + }; + + /** + * @short A helper class for validating identity constraints. + * + * This class represents a target or qualified node from the target or qualified + * node set as defined in the validation rules at http://www.w3.org/TR/xmlschema11-1/#d0e32243. + * + * A target node is part of the qualified node set, if all of its fields are not empty. + */ + class TargetNode + { + public: + /** + * Defines a set of target nodes. + */ + typedef QSet Set; + + /** + * Creates a new target node that is bound to the xml node @p item. + */ + explicit TargetNode(const QXmlItem &item); + + /** + * Returns the xml node item the target node is bound to. + */ + QXmlItem item() const; + + /** + * Returns all xml node items, the fields of that target node are bound to. + */ + QVector fieldItems() const; + + /** + * Returns the number of fields that are empty. + */ + int emptyFieldsCount() const; + + /** + * Returns whether the target node has the same fields as the @p other target node. + */ + bool fieldsAreEqual(const TargetNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const; + + /** + * Adds a new field to the target node with the given values. + */ + void addField(const QXmlItem &item, const QString &data, const SchemaType::Ptr &type); + + /** + * Returns whether the target node is equal to the @p other target node. + */ + bool operator==(const TargetNode &other) const; + + private: + QXmlItem m_item; + QVector m_fields; + }; + + /** + * Creates a hash value for the given target @p node. + */ + inline uint qHash(const QPatternist::TargetNode &node) + { + return qHash(node.item().toNodeModelIndex()); + } +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint.cpp b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp new file mode 100644 index 0000000..e72a005 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdidentityconstraint_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdIdentityConstraint::setCategory(Category category) +{ + m_category = category; +} + +XsdIdentityConstraint::Category XsdIdentityConstraint::category() const +{ + return m_category; +} + +void XsdIdentityConstraint::setSelector(const XsdXPathExpression::Ptr &selector) +{ + m_selector = selector; +} + +XsdXPathExpression::Ptr XsdIdentityConstraint::selector() const +{ + return m_selector; +} + +void XsdIdentityConstraint::setFields(const XsdXPathExpression::List &fields) +{ + m_fields = fields; +} + +void XsdIdentityConstraint::addField(const XsdXPathExpression::Ptr &field) +{ + m_fields.append(field); +} + +XsdXPathExpression::List XsdIdentityConstraint::fields() const +{ + return m_fields; +} + +void XsdIdentityConstraint::setReferencedKey(const XsdIdentityConstraint::Ptr &referencedKey) +{ + m_referencedKey = referencedKey; +} + +XsdIdentityConstraint::Ptr XsdIdentityConstraint::referencedKey() const +{ + return m_referencedKey; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint_p.h b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h new file mode 100644 index 0000000..6870b1e --- /dev/null +++ b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdIdentityConstraint_H +#define Patternist_XsdIdentityConstraint_H + +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" +#include "qxsdxpathexpression_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD identity constraint object. + * + * This class represents the identity constraint object of a XML schema as described + * here. + * + * It contains information from either a key object, a keyref object or an + * unique object. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdIdentityConstraint : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Describes the category of the identity constraint. + */ + enum Category + { + Key = 1, ///< The constraint is a key constraint + KeyReference, ///< The constraint is a keyref constraint + Unique ///< The constraint is an unique constraint + }; + + /** + * Sets the @p category of the identity constraint. + * + * @see Category + */ + void setCategory(Category category); + + /** + * Returns the category of the identity constraint. + */ + Category category() const; + + /** + * Sets the @p selector of the identity constraint. + * + * The selector is a restricted XPath 1.0 expression, + * that selects a set of nodes. + * + * @see + */ + void setSelector(const XsdXPathExpression::Ptr &selector); + + /** + * Returns the selector of the identity constraint. + */ + XsdXPathExpression::Ptr selector() const; + + /** + * Sets the @p fields of the identity constraint. + * + * Each field is a restricted XPath 1.0 expression, + * that selects a set of nodes. + * + * @see + */ + void setFields(const XsdXPathExpression::List &fields); + + /** + * Adds a new @p field to the identity constraint. + */ + void addField(const XsdXPathExpression::Ptr &field); + + /** + * Returns all fields of the identity constraint. + */ + XsdXPathExpression::List fields() const; + + /** + * Sets the referenced @p key of the identity constraint. + * + * The key points to a identity constraint of type Key or Unique. + * + * The identity constraint has only a referenced key if its + * type is KeyReference. + * + * @see + */ + void setReferencedKey(const XsdIdentityConstraint::Ptr &key); + + /** + * Returns the referenced key of the identity constraint or an empty + * pointer if its type is not KeyReference. + */ + XsdIdentityConstraint::Ptr referencedKey() const; + + private: + Category m_category; + XsdXPathExpression::Ptr m_selector; + XsdXPathExpression::List m_fields; + XsdIdentityConstraint::Ptr m_referencedKey; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdinstancereader.cpp b/src/xmlpatterns/schema/qxsdinstancereader.cpp new file mode 100644 index 0000000..81c40c9 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdinstancereader.cpp @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdinstancereader_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdInstanceReader::XsdInstanceReader(const QAbstractXmlNodeModel *model, const XsdSchemaContext::Ptr &context) + : m_context(context) + , m_model(model->iterate(model->root(QXmlNodeModelIndex()), QXmlNodeModelIndex::AxisChild)) +{ +} + +bool XsdInstanceReader::atEnd() const +{ + return (m_model.current() == AbstractXmlPullProvider::EndOfInput); +} + +void XsdInstanceReader::readNext() +{ + m_model.next(); + + if (m_model.current() == AbstractXmlPullProvider::StartElement) { + m_cachedAttributes = m_model.attributes(); + m_cachedAttributeItems = m_model.attributeItems(); + m_cachedSourceLocation = m_model.sourceLocation(); + m_cachedItem = QXmlItem(m_model.index()); + } +} + +bool XsdInstanceReader::isStartElement() const +{ + return (m_model.current() == AbstractXmlPullProvider::StartElement); +} + +bool XsdInstanceReader::isEndElement() const +{ + return (m_model.current() == AbstractXmlPullProvider::EndElement); +} + +bool XsdInstanceReader::hasChildText() const +{ + const QXmlNodeModelIndex index = m_model.index(); + QXmlNodeModelIndex::Iterator::Ptr it = index.model()->iterate(index, QXmlNodeModelIndex::AxisChild); + + QXmlNodeModelIndex currentIndex = it->next(); + while (!currentIndex.isNull()) { + if (currentIndex.kind() == QXmlNodeModelIndex::Text) + return true; + + currentIndex = it->next(); + } + + return false; +} + +bool XsdInstanceReader::hasChildElement() const +{ + const QXmlNodeModelIndex index = m_model.index(); + QXmlNodeModelIndex::Iterator::Ptr it = index.model()->iterate(index, QXmlNodeModelIndex::AxisChild); + + QXmlNodeModelIndex currentIndex = it->next(); + while (!currentIndex.isNull()) { + if (currentIndex.kind() == QXmlNodeModelIndex::Element) + return true; + + currentIndex = it->next(); + } + + return false; +} + +QXmlName XsdInstanceReader::name() const +{ + return m_model.name(); +} + +QXmlName XsdInstanceReader::convertToQName(const QString &name) const +{ + const int pos = name.indexOf(QLatin1Char(':')); + + QXmlName::PrefixCode prefixCode = 0; + QXmlName::NamespaceCode namespaceCode; + QXmlName::LocalNameCode localNameCode; + if (pos != -1) { + prefixCode = m_context->namePool()->allocatePrefix(name.left(pos)); + namespaceCode = m_cachedItem.toNodeModelIndex().namespaceForPrefix(prefixCode); + localNameCode = m_context->namePool()->allocateLocalName(name.mid(pos + 1)); + } else { + prefixCode = StandardPrefixes::empty; + namespaceCode = m_cachedItem.toNodeModelIndex().namespaceForPrefix(prefixCode); + if (namespaceCode == -1) + namespaceCode = StandardNamespaces::empty; + localNameCode = m_context->namePool()->allocateLocalName(name); + } + + return QXmlName(namespaceCode, localNameCode, prefixCode); +} + +bool XsdInstanceReader::hasAttribute(const QXmlName &name) const +{ + return m_cachedAttributes.contains(name); +} + +QString XsdInstanceReader::attribute(const QXmlName &name) const +{ + Q_ASSERT(m_cachedAttributes.contains(name)); + + return m_cachedAttributes.value(name); +} + +QSet XsdInstanceReader::attributeNames() const +{ + return m_cachedAttributes.keys().toSet(); +} + +QString XsdInstanceReader::text() const +{ + const QXmlNodeModelIndex index = m_model.index(); + QXmlNodeModelIndex::Iterator::Ptr it = index.model()->iterate(index, QXmlNodeModelIndex::AxisChild); + + QString result; + + QXmlNodeModelIndex currentIndex = it->next(); + while (!currentIndex.isNull()) { + if (currentIndex.kind() == QXmlNodeModelIndex::Text) { + result.append(Item(currentIndex).stringValue()); + } + + currentIndex = it->next(); + } + + return result; +} + +QXmlItem XsdInstanceReader::item() const +{ + return m_cachedItem; +} + +QXmlItem XsdInstanceReader::attributeItem(const QXmlName &name) const +{ + return m_cachedAttributeItems.value(name); +} + +QSourceLocation XsdInstanceReader::sourceLocation() const +{ + return m_cachedSourceLocation; +} + +QVector XsdInstanceReader::namespaceBindings(const QXmlNodeModelIndex &index) const +{ + return index.namespaceBindings(); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdinstancereader_p.h b/src/xmlpatterns/schema/qxsdinstancereader_p.h new file mode 100644 index 0000000..9df02d6 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdinstancereader_p.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdInstanceReader_H +#define Patternist_XsdInstanceReader_H + +#include "qabstractxmlnodemodel.h" +#include "qpullbridge_p.h" +#include "qxsdschemacontext_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short The schema instance reader. + * + * This class reads in a xml instance document from a QAbstractXmlNodeModel + * and provides a QXmlStreamReader like interface with some additional context + * information. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdInstanceReader + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Creates a new instance reader that will read the data from + * the given @p model. + * + * @param model The model the data are read from. + * @param context The context that is used for error reporting etc. + */ + XsdInstanceReader(const QAbstractXmlNodeModel *model, const XsdSchemaContext::Ptr &context); + + protected: + /** + * Returns @c true if the end of the document is reached, @c false otherwise. + */ + bool atEnd() const; + + /** + * Reads the next node from the document. + */ + void readNext(); + + /** + * Returns whether the current node is a start element. + */ + bool isStartElement() const; + + /** + * Returns whether the current node is an end element. + */ + bool isEndElement() const; + + /** + * Returns whether the current node has a text node among its children. + */ + bool hasChildText() const; + + /** + * Returns whether the current node has an element node among its children. + */ + bool hasChildElement() const; + + /** + * Returns the name of the current node. + */ + QXmlName name() const; + + /** + * Returns whether the current node has an attribute with the given @p name. + */ + bool hasAttribute(const QXmlName &name) const; + + /** + * Returns the attribute with the given @p name of the current node. + */ + QString attribute(const QXmlName &name) const; + + /** + * Returns the list of attribute names of the current node. + */ + QSet attributeNames() const; + + /** + * Returns the concatenated text of all direct child text nodes. + */ + QString text() const; + + /** + * Converts a qualified name into a QXmlName according to the namespace + * mappings of the current node. + */ + QXmlName convertToQName(const QString &name) const; + + /** + * Returns a source location object for the current position. + */ + QSourceLocation sourceLocation() const; + + /** + * Returns the QXmlItem for the current position. + */ + QXmlItem item() const; + + /** + * Returns the QXmlItem for the attribute with the given @p name at the current position. + */ + QXmlItem attributeItem(const QXmlName &name) const; + + /** + * Returns the namespace bindings for the given node model @p index. + */ + QVector namespaceBindings(const QXmlNodeModelIndex &index) const; + + /** + * The shared schema context. + */ + XsdSchemaContext::Ptr m_context; + + private: + PullBridge m_model; + QHash m_cachedAttributes; + QHash m_cachedAttributeItems; + QSourceLocation m_cachedSourceLocation; + QXmlItem m_cachedItem; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdmodelgroup.cpp b/src/xmlpatterns/schema/qxsdmodelgroup.cpp new file mode 100644 index 0000000..1245822 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdmodelgroup.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdmodelgroup_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdModelGroup::XsdModelGroup() + : m_compositor(SequenceCompositor) +{ +} + +bool XsdModelGroup::isModelGroup() const +{ + return true; +} + +void XsdModelGroup::setCompositor(ModelCompositor compositor) +{ + m_compositor = compositor; +} + +XsdModelGroup::ModelCompositor XsdModelGroup::compositor() const +{ + return m_compositor; +} + +void XsdModelGroup::setParticles(const XsdParticle::List &particles) +{ + m_particles = particles; +} + +XsdParticle::List XsdModelGroup::particles() const +{ + return m_particles; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdmodelgroup_p.h b/src/xmlpatterns/schema/qxsdmodelgroup_p.h new file mode 100644 index 0000000..b7b59ac --- /dev/null +++ b/src/xmlpatterns/schema/qxsdmodelgroup_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdModelGroup_H +#define Patternist_XsdModelGroup_H + +#include "qxsdparticle_p.h" +#include "qxsdterm_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +template class QList; + +namespace QPatternist +{ + /** + * @short Represents a XSD model group object. + * + * This class represents the model group object of a XML schema as described + * here. + * + * It contains information from either a sequence object, a choice object or an + * all object. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdModelGroup : public XsdTerm + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Describes the compositor of the model group. + */ + enum ModelCompositor + { + SequenceCompositor, ///< The model group is a sequence. + ChoiceCompositor, ///< The model group is a choice. + AllCompositor ///< The model group contains elements only. + }; + + /** + * Creates a new model group object. + */ + XsdModelGroup(); + + /** + * Returns always @c true, used to avoid dynamic casts. + */ + virtual bool isModelGroup() const; + + /** + * Sets the @p compositor of the model group. + * + * @see ModelCompositor + */ + void setCompositor(ModelCompositor compositor); + + /** + * Returns the compositor of the model group. + */ + ModelCompositor compositor() const; + + /** + * Sets the list of @p particles of the model group. + * + * @see Particles Definition + */ + void setParticles(const XsdParticle::List &particles); + + /** + * Returns the list of particles of the model group. + */ + XsdParticle::List particles() const; + + private: + ModelCompositor m_compositor; + XsdParticle::List m_particles; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdnotation.cpp b/src/xmlpatterns/schema/qxsdnotation.cpp new file mode 100644 index 0000000..cfa0cd3 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdnotation.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdnotation_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdNotation::setPublicId(const DerivedString::Ptr &id) +{ + m_publicId = id; +} + +DerivedString::Ptr XsdNotation::publicId() const +{ + return m_publicId; +} + +void XsdNotation::setSystemId(const AnyURI::Ptr &id) +{ + m_systemId = id; +} + +AnyURI::Ptr XsdNotation::systemId() const +{ + return m_systemId; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdnotation_p.h b/src/xmlpatterns/schema/qxsdnotation_p.h new file mode 100644 index 0000000..dc1d597 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdnotation_p.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdNotation_H +#define Patternist_XsdNotation_H + +#include "qanyuri_p.h" +#include "qderivedstring_p.h" +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD notation object, which should not + * be confused with the atomic type @c xs:NOTATION. + * + * This class represents the notation object of a XML schema as described + * here. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdNotation : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Sets the public @p identifier of the notation. + * + * @see Public Identifier Definition + */ + void setPublicId(const DerivedString::Ptr &identifier); + + /** + * Returns the public identifier of the notation. + */ + DerivedString::Ptr publicId() const; + + /** + * Sets the system @p identifier of the notation. + * + * @see System Identifier Definition + */ + void setSystemId(const AnyURI::Ptr &identifier); + + /** + * Returns the system identifier of the notation. + */ + AnyURI::Ptr systemId() const; + + private: + DerivedString::Ptr m_publicId; + AnyURI::Ptr m_systemId; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdparticle.cpp b/src/xmlpatterns/schema/qxsdparticle.cpp new file mode 100644 index 0000000..a2671fa --- /dev/null +++ b/src/xmlpatterns/schema/qxsdparticle.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdparticle_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdParticle::XsdParticle() + : m_minimumOccurs(1) + , m_maximumOccurs(1) + , m_maximumOccursUnbounded(false) +{ +} + +void XsdParticle::setMinimumOccurs(unsigned int occurs) +{ + m_minimumOccurs = occurs; +} + +unsigned int XsdParticle::minimumOccurs() const +{ + return m_minimumOccurs; +} + +void XsdParticle::setMaximumOccurs(unsigned int occurs) +{ + m_maximumOccurs = occurs; +} + +unsigned int XsdParticle::maximumOccurs() const +{ + return m_maximumOccurs; +} + +void XsdParticle::setMaximumOccursUnbounded(bool unbounded) +{ + m_maximumOccursUnbounded = unbounded; +} + +bool XsdParticle::maximumOccursUnbounded() const +{ + return m_maximumOccursUnbounded; +} + +void XsdParticle::setTerm(const XsdTerm::Ptr &term) +{ + m_term = term; +} + +XsdTerm::Ptr XsdParticle::term() const +{ + return m_term; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdparticle_p.h b/src/xmlpatterns/schema/qxsdparticle_p.h new file mode 100644 index 0000000..61e3eb3 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdparticle_p.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdParticle_H +#define Patternist_XsdParticle_H + +#include "qnamedschemacomponent_p.h" +#include "qxsdterm_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD particle object. + * + * This class represents the particle object of a XML schema as described + * here. + * + * It contains information about the number of occurrence and a reference to + * either an element object, a group object or an any object. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdParticle : public NamedSchemaComponent + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Creates a new particle object. + */ + XsdParticle(); + + /** + * Sets the minimum @p occurrence of the particle. + * + * @see Minimum Occurrence Definition + */ + void setMinimumOccurs(unsigned int occurrence); + + /** + * Returns the minimum occurrence of the particle. + */ + unsigned int minimumOccurs() const; + + /** + * Sets the maximum @p occurrence of the particle. + * + * @see Maximum Occurrence Definition + */ + void setMaximumOccurs(unsigned int occurrence); + + /** + * Returns the maximum occurrence of the particle. + * + * @note This value has only a meaning if maximumOccursUnbounded is @c false. + */ + unsigned int maximumOccurs() const; + + /** + * Sets whether the maximum occurrence of the particle is unbounded. + * + * @see Maximum Occurrence Definition + */ + void setMaximumOccursUnbounded(bool unbounded); + + /** + * Returns whether the maximum occurrence of the particle is unbounded. + */ + bool maximumOccursUnbounded() const; + + /** + * Sets the @p term of the particle. + * + * The term can be an element, a model group or an element wildcard. + * + * @see Term Definition + */ + void setTerm(const XsdTerm::Ptr &term); + + /** + * Returns the term of the particle. + */ + XsdTerm::Ptr term() const; + + private: + unsigned int m_minimumOccurs; + unsigned int m_maximumOccurs; + bool m_maximumOccursUnbounded; + XsdTerm::Ptr m_term; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdparticlechecker.cpp b/src/xmlpatterns/schema/qxsdparticlechecker.cpp new file mode 100644 index 0000000..1bdef00 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdparticlechecker.cpp @@ -0,0 +1,510 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdparticlechecker_p.h" + +#include "qxsdelement_p.h" +#include "qxsdmodelgroup_p.h" +#include "qxsdschemahelper_p.h" +#include "qxsdstatemachine_p.h" +#include "qxsdstatemachinebuilder_p.h" +#include "qxsdtypechecker_p.h" + +#include + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +namespace QPatternist +{ + /** + * This template specialization is picked up by XsdStateMachine and allows us + * to print nice edge labels. + */ + template <> + QString XsdStateMachine::transitionTypeToString(XsdTerm::Ptr term) const + { + if (!term) + return QLatin1String("(empty)"); + + if (term->isElement()) { + return XsdElement::Ptr(term)->displayName(m_namePool); + } else if (term->isWildcard()) { + const XsdWildcard::Ptr wildcard(term); + return QLatin1String("(wildcard)"); + } else { + return QString(); + } + } +} + +/** + * This method is used by the isUPAConform method to check whether @p term and @p otherTerm + * are the same resp. match each other. + */ +static bool termMatches(const XsdTerm::Ptr &term, const XsdTerm::Ptr &otherTerm, const NamePool::Ptr &namePool) +{ + if (term->isElement()) { + const XsdElement::Ptr element(term); + + if (otherTerm->isElement()) { + // both, the term and the other term are elements + + const XsdElement::Ptr otherElement(otherTerm); + + // if they have the same name they match + if (element->name(namePool) == otherElement->name(namePool)) + return true; + + } else if (otherTerm->isWildcard()) { + // the term is an element and the other term a wildcard + + const XsdWildcard::Ptr wildcard(otherTerm); + + // wildcards using XsdWildcard::absentNamespace, so we have to fix that here + QXmlName name = element->name(namePool); + if (name.namespaceURI() == StandardNamespaces::empty) + name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace())); + + // if the wildcards namespace constraint allows the elements name, they match + if (XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, namePool)) + return true; + } + } else if (term->isWildcard()) { + const XsdWildcard::Ptr wildcard(term); + + if (otherTerm->isElement()) { + // the term is a wildcard and the other term an element + + const XsdElement::Ptr otherElement(otherTerm); + + // wildcards using XsdWildcard::absentNamespace, so we have to fix that here + QXmlName name = otherElement->name(namePool); + if (name.namespaceURI() == StandardNamespaces::empty) + name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace())); + + // if the wildcards namespace constraint allows the elements name, they match + if (XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, namePool)) + return true; + + } else if (otherTerm->isWildcard()) { + // both, the term and the other term are wildcards + + const XsdWildcard::Ptr otherWildcard(otherTerm); + + // check if the range of the wildcard overlaps. + const XsdWildcard::Ptr intersectionWildcard = XsdSchemaHelper::wildcardIntersection(wildcard, otherWildcard); + if (!intersectionWildcard || + (intersectionWildcard && !(intersectionWildcard->namespaceConstraint()->variety() != XsdWildcard::NamespaceConstraint::Not && intersectionWildcard->namespaceConstraint()->namespaces().isEmpty()))) + return true; + } + } + + return false; +} + +/** + * This method is used by the subsumes algorithm to check whether the @p derivedTerm is validly derived from the @p baseTerm. + * + * @param baseTerm The term of the base component (type or group). + * @param derivedTerm The term of the derived component (type or group). + * @param particles A hash to map the passed base and derived term to the particles they belong to. + * @param context The schema context. + * @param errorMsg The error message in the case that an error occurs. + */ +static bool derivedTermValid(const XsdTerm::Ptr &baseTerm, const XsdTerm::Ptr &derivedTerm, const QHash &particles, const XsdSchemaContext::Ptr &context, QString &errorMsg) +{ + const NamePool::Ptr namePool(context->namePool()); + + // find the particles where the base and derived term belongs to + const XsdParticle::Ptr baseParticle = particles.value(baseTerm); + const XsdParticle::Ptr derivedParticle = particles.value(derivedTerm); + + // check that an empty particle can not be derived from a non-empty particle + if (derivedParticle && baseParticle) { + if (XsdSchemaHelper::isParticleEmptiable(derivedParticle) && !XsdSchemaHelper::isParticleEmptiable(baseParticle)) { + errorMsg = QtXmlPatterns::tr("empty particle cannot be derived from non-empty particle"); + return false; + } + } + + if (baseTerm->isElement()) { + const XsdElement::Ptr element(baseTerm); + + if (derivedTerm->isElement()) { + // if both terms are elements + + const XsdElement::Ptr derivedElement(derivedTerm); + + // check names are equal + if (element->name(namePool) != derivedElement->name(namePool)) { + errorMsg = QtXmlPatterns::tr("derived particle is missing element %1").arg(formatKeyword(element->displayName(namePool))); + return false; + } + + // check value constraints are equal (if available) + if (element->valueConstraint() && element->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { + if (!derivedElement->valueConstraint()) { + errorMsg = QtXmlPatterns::tr("derived element %1 is missing value constraint as defined in base particle").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + + if (derivedElement->valueConstraint()->variety() != XsdElement::ValueConstraint::Fixed) { + errorMsg = QtXmlPatterns::tr("derived element %1 has weaker value constraint than base particle").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + + const QSourceLocation dummyLocation(QUrl(QLatin1String("http://dummy.org")), 1, 1); + const XsdTypeChecker checker(context, QVector(), dummyLocation); + if (!checker.valuesAreEqual(element->valueConstraint()->value(), derivedElement->valueConstraint()->value(), derivedElement->type())) { + errorMsg = QtXmlPatterns::tr("fixed value constraint of element %1 differs from value constraint in base particle").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + } + + // check that a derived element can not be nillable if the base element is not nillable + if (!element->isNillable() && derivedElement->isNillable()) { + errorMsg = QtXmlPatterns::tr("derived element %1 cannot be nillable as base element is not nillable").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + + // check that the constraints of the derived element are more strict then the constraints of the base element + const XsdElement::BlockingConstraints baseConstraints = element->disallowedSubstitutions(); + const XsdElement::BlockingConstraints derivedConstraints = derivedElement->disallowedSubstitutions(); + if ((baseConstraints & XsdElement::RestrictionConstraint) && !(derivedConstraints & XsdElement::RestrictionConstraint) || + (baseConstraints & XsdElement::ExtensionConstraint) && !(derivedConstraints & XsdElement::ExtensionConstraint) || + (baseConstraints & XsdElement::SubstitutionConstraint) && !(derivedConstraints & XsdElement::SubstitutionConstraint)) { + errorMsg = QtXmlPatterns::tr("block constraints of derived element %1 must not be more weaker than in the base element").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + + // if the type of both elements is the same we can stop testing here + if (element->type()->name(namePool) == derivedElement->type()->name(namePool)) + return true; + + // check that the type of the derived element can validly derived from the type of the base element + if (derivedElement->type()->isSimpleType()) { + if (!XsdSchemaHelper::isSimpleDerivationOk(derivedElement->type(), element->type(), SchemaType::DerivationConstraints())) { + errorMsg = QtXmlPatterns::tr("simple type of derived element %1 cannot be validly derived from base element").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + } else if (derivedElement->type()->isComplexType()) { + if (!XsdSchemaHelper::isComplexDerivationOk(derivedElement->type(), element->type(), SchemaType::DerivationConstraints())) { + errorMsg = QtXmlPatterns::tr("complex type of derived element %1 cannot be validly derived from base element").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + } + + // if both, derived and base element, have a complex type that contains a particle itself, apply the subsumes algorithm + // recursive on their particles + if (element->type()->isComplexType() && derivedElement->type()->isComplexType()) { + if (element->type()->isDefinedBySchema() && derivedElement->type()->isDefinedBySchema()) { + const XsdComplexType::Ptr baseType(element->type()); + const XsdComplexType::Ptr derivedType(derivedElement->type()); + if ((baseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || + baseType->contentType()->variety() == XsdComplexType::ContentType::Mixed) && + (derivedType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || + derivedType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) { + + return XsdParticleChecker::subsumes(baseType->contentType()->particle(), derivedType->contentType()->particle(), context, errorMsg); + } + } + } + + return true; + } else if (derivedTerm->isWildcard()) { + // derive a wildcard from an element is not allowed + errorMsg = QtXmlPatterns::tr("element %1 is missing in derived particle").arg(formatKeyword(element->displayName(namePool))); + return false; + } + } else if (baseTerm->isWildcard()) { + const XsdWildcard::Ptr wildcard(baseTerm); + + if (derivedTerm->isElement()) { + // the base term is a wildcard and derived term an element + + const XsdElement::Ptr derivedElement(derivedTerm); + + // wildcards using XsdWildcard::absentNamespace, so we have to fix that here + QXmlName name = derivedElement->name(namePool); + if (name.namespaceURI() == StandardNamespaces::empty) + name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace())); + + // check that name of the element is allowed by the wildcards namespace constraint + if (!XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, namePool)) { + errorMsg = QtXmlPatterns::tr("element %1 does not match namespace constraint of wildcard in base particle").arg(formatKeyword(derivedElement->displayName(namePool))); + return false; + } + + } else if (derivedTerm->isWildcard()) { + // both, derived and base term are wildcards + + const XsdWildcard::Ptr derivedWildcard(derivedTerm); + + // check that the derived wildcard is a valid subset of the base wildcard + if (!XsdSchemaHelper::isWildcardSubset(derivedWildcard, wildcard)) { + errorMsg = QtXmlPatterns::tr("wildcard in derived particle is not a valid subset of wildcard in base particle"); + return false; + } + + if (!XsdSchemaHelper::checkWildcardProcessContents(wildcard, derivedWildcard)) { + errorMsg = QtXmlPatterns::tr("processContent of wildcard in derived particle is weaker than wildcard in base particle"); + return false; + } + } + + return true; + } + + return false; +} + +typedef QHash ElementHash; + +/** + * Internal helper method that checks if the given @p particle contains an element with the + * same name and type twice. + */ +static bool hasDuplicatedElementsInternal(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool, ElementHash &hash, XsdElement::Ptr &conflictingElement) +{ + const XsdTerm::Ptr term = particle->term(); + if (term->isElement()) { + const XsdElement::Ptr mainElement(term); + XsdElement::List substGroups = mainElement->substitutionGroups(); + if (substGroups.isEmpty()) + substGroups << mainElement; + + for (int i = 0; i < substGroups.count(); ++i) { + const XsdElement::Ptr element = substGroups.at(i); + if (hash.contains(element->name(namePool))) { + if (element->type()->name(namePool) != hash.value(element->name(namePool))->type()->name(namePool)) { + conflictingElement = element; + return true; + } + } else { + hash.insert(element->name(namePool), element); + } + } + } else if (term->isModelGroup()) { + const XsdModelGroup::Ptr group(term); + const XsdParticle::List particles = group->particles(); + for (int i = 0; i < particles.count(); ++i) { + if (hasDuplicatedElementsInternal(particles.at(i), namePool, hash, conflictingElement)) + return true; + } + } + + return false; +} + +bool XsdParticleChecker::hasDuplicatedElements(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool, XsdElement::Ptr &conflictingElement) +{ + ElementHash hash; + return hasDuplicatedElementsInternal(particle, namePool, hash, conflictingElement); +} + +bool XsdParticleChecker::isUPAConform(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool) +{ + /** + * The algorithm is implemented like described in http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.2 + */ + + // create a state machine for the given particle + XsdStateMachine stateMachine(namePool); + + XsdStateMachineBuilder builder(&stateMachine, namePool); + const XsdStateMachine::StateId endState = builder.reset(); + const XsdStateMachine::StateId startState = builder.buildParticle(particle, endState); + builder.addStartState(startState); + +/* + static int counter = 0; + { + QFile file(QString("/tmp/file_upa%1.dot").arg(counter)); + file.open(QIODevice::WriteOnly); + stateMachine.outputGraph(&file, "Base"); + file.close(); + } + ::system(QString("dot -Tpng /tmp/file_upa%1.dot -o/tmp/file_upa%1.png").arg(counter).toLatin1().data()); +*/ + const XsdStateMachine dfa = stateMachine.toDFA(); +/* + { + QFile file(QString("/tmp/file_upa%1dfa.dot").arg(counter)); + file.open(QIODevice::WriteOnly); + dfa.outputGraph(&file, "Base"); + file.close(); + } + ::system(QString("dot -Tpng /tmp/file_upa%1dfa.dot -o/tmp/file_upa%1dfa.png").arg(counter).toLatin1().data()); +*/ + const QHash::StateId, XsdStateMachine::StateType> states = dfa.states(); + const QHash::StateId, QHash::StateId> > > transitions = dfa.transitions(); + + // the basic idea of that algorithm is to iterate over all states of that machine and check that no two edges + // that match on the same term leave a state, so for a given term it should always be obvious which edge to take + QHashIterator::StateId, XsdStateMachine::StateType> stateIt(states); + while (stateIt.hasNext()) { // iterate over all states + stateIt.next(); + + // fetch all transitions the current state allows + const QHash::StateId> > currentTransitions = transitions.value(stateIt.key()); + QHashIterator::StateId> > transitionIt(currentTransitions); + while (transitionIt.hasNext()) { // iterate over all transitions + transitionIt.next(); + + if (transitionIt.value().size() > 1) { + // we have one state with two edges leaving it, that means + // the XsdTerm::Ptr exists twice, that is an error + return false; + } + + QHashIterator::StateId> > innerTransitionIt(currentTransitions); + while (innerTransitionIt.hasNext()) { // iterate over all transitions again, as we have to compare all transitions with all + innerTransitionIt.next(); + + if (transitionIt.key() == innerTransitionIt.key()) // do no compare with ourself + continue; + + // use the helper method termMatches to check if both term matches + if (termMatches(transitionIt.key(), innerTransitionIt.key(), namePool)) + return false; + } + } + } + + return true; +} + +bool XsdParticleChecker::subsumes(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &derivedParticle, const XsdSchemaContext::Ptr &context, QString &errorMsg) +{ + /** + * The algorithm is implemented like described in http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.3 + */ + + const NamePool::Ptr namePool(context->namePool()); + + XsdStateMachine baseStateMachine(namePool); + XsdStateMachine derivedStateMachine(namePool); + + // build up state machines for both particles + { + XsdStateMachineBuilder builder(&baseStateMachine, namePool); + const XsdStateMachine::StateId endState = builder.reset(); + const XsdStateMachine::StateId startState = builder.buildParticle(particle, endState); + builder.addStartState(startState); + + baseStateMachine = baseStateMachine.toDFA(); + } + { + XsdStateMachineBuilder builder(&derivedStateMachine, namePool); + const XsdStateMachine::StateId endState = builder.reset(); + const XsdStateMachine::StateId startState = builder.buildParticle(derivedParticle, endState); + builder.addStartState(startState); + + derivedStateMachine = derivedStateMachine.toDFA(); + } + + QHash particlesHash = XsdStateMachineBuilder::particleLookupMap(particle); + particlesHash.unite(XsdStateMachineBuilder::particleLookupMap(derivedParticle)); + +/* + static int counter = 0; + { + QFile file(QString("/tmp/file_base%1.dot").arg(counter)); + file.open(QIODevice::WriteOnly); + baseStateMachine.outputGraph(&file, QLatin1String("Base")); + file.close(); + } + { + QFile file(QString("/tmp/file_derived%1.dot").arg(counter)); + file.open(QIODevice::WriteOnly); + derivedStateMachine.outputGraph(&file, QLatin1String("Base")); + file.close(); + } + ::system(QString("dot -Tpng /tmp/file_base%1.dot -o/tmp/file_base%1.png").arg(counter).toLatin1().data()); + ::system(QString("dot -Tpng /tmp/file_derived%1.dot -o/tmp/file_derived%1.png").arg(counter).toLatin1().data()); +*/ + + const XsdStateMachine::StateId baseStartState = baseStateMachine.startState(); + const QHash::StateId, XsdStateMachine::StateType> baseStates = baseStateMachine.states(); + const QHash::StateId, QHash::StateId> > > baseTransitions = baseStateMachine.transitions(); + + const XsdStateMachine::StateId derivedStartState = derivedStateMachine.startState(); + const QHash::StateId, XsdStateMachine::StateType> derivedStates = derivedStateMachine.states(); + const QHash::StateId, QHash::StateId> > > derivedTransitions = derivedStateMachine.transitions(); + + // @see http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.3.1 + + // define working set + QList::StateId, XsdStateMachine::StateId> > workSet; + QList::StateId, XsdStateMachine::StateId> > processedSet; + + // 1) fill working set initially with start states + workSet.append(qMakePair::StateId, XsdStateMachine::StateId>(baseStartState, derivedStartState)); + processedSet.append(qMakePair::StateId, XsdStateMachine::StateId>(baseStartState, derivedStartState)); + + while (!workSet.isEmpty()) { // while there are state sets to process + + // 3) dequeue on state set + const QPair::StateId, XsdStateMachine::StateId> set = workSet.takeFirst(); + + const QHash::StateId> > derivedTrans = derivedTransitions.value(set.second); + QHashIterator::StateId> > derivedIt(derivedTrans); + + const QHash::StateId> > baseTrans = baseTransitions.value(set.first); + + while (derivedIt.hasNext()) { + derivedIt.next(); + + bool found = false; + QHashIterator::StateId> > baseIt(baseTrans); + while (baseIt.hasNext()) { + baseIt.next(); + if (derivedTermValid(baseIt.key(), derivedIt.key(), particlesHash, context, errorMsg)) { + const QPair::StateId, XsdStateMachine::StateId> endSet = + qMakePair::StateId, XsdStateMachine::StateId>(baseIt.value().first(), derivedIt.value().first()); + if (!processedSet.contains(endSet) && !workSet.contains(endSet)) { + workSet.append(endSet); + processedSet.append(endSet); + } + + found = true; + } + } + + if (!found) { + return false; + } + } + } + + // 5) + QHashIterator::StateId, XsdStateMachine::StateType> it(derivedStates); + while (it.hasNext()) { + it.next(); + + if (it.value() == XsdStateMachine::EndState || it.value() == XsdStateMachine::StartEndState) { + for (int i = 0; i < processedSet.count(); ++i) { + if (processedSet.at(i).second == it.key() && + (baseStates.value(processedSet.at(i).first) != XsdStateMachine::EndState && + baseStates.value(processedSet.at(i).first) != XsdStateMachine::StartEndState)) { + errorMsg = QtXmlPatterns::tr("derived particle allows content that is not allowed in the base particle"); + return false; + } + } + } + } + + return true; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdparticlechecker_p.h b/src/xmlpatterns/schema/qxsdparticlechecker_p.h new file mode 100644 index 0000000..16a8d95 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdparticlechecker_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdParticleChecker_H +#define Patternist_XsdParticleChecker_H + +#include "qxsdelement_p.h" +#include "qxsdparticle_p.h" +#include "qxsdschemacontext_p.h" +#include "qxsdwildcard_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A helper class to check validity of particles. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdParticleChecker + { + public: + /** + * Checks whether the given @p particle has two or more element + * declarations with the same name but different type definitions. + */ + static bool hasDuplicatedElements(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool, XsdElement::Ptr &conflictingElement); + + /** + * Checks whether the given @p particle is valid according the + * UPA (http://www.w3.org/TR/xmlschema-1/#cos-nonambig) constraint. + */ + static bool isUPAConform(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool); + + /** + * Checks whether the given @p particle subsumes the given @p derivedParticle. + * (http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict) + */ + static bool subsumes(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &derivedParticle, const XsdSchemaContext::Ptr &context, QString &errorMsg); + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdreference.cpp b/src/xmlpatterns/schema/qxsdreference.cpp new file mode 100644 index 0000000..0a934dd --- /dev/null +++ b/src/xmlpatterns/schema/qxsdreference.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdreference_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +bool XsdReference::isReference() const +{ + return true; +} + +void XsdReference::setType(Type type) +{ + m_type = type; +} + +XsdReference::Type XsdReference::type() const +{ + return m_type; +} + +void XsdReference::setReferenceName(const QXmlName &referenceName) +{ + m_referenceName = referenceName; +} + +QXmlName XsdReference::referenceName() const +{ + return m_referenceName; +} + +void XsdReference::setSourceLocation(const QSourceLocation &location) +{ + m_sourceLocation = location; +} + +QSourceLocation XsdReference::sourceLocation() const +{ + return m_sourceLocation; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdreference_p.h b/src/xmlpatterns/schema/qxsdreference_p.h new file mode 100644 index 0000000..afcca25 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdreference_p.h @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdReference_H +#define Patternist_XsdReference_H + +#include "qxsdterm_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A helper class for element and group reference resolving. + * + * For easy resolving of element and group references, we have this class + * that can be used as a place holder for the real element or group + * object it is referring to. + * So whenever the parser detects an element or group reference, it creates + * a XsdReference and returns it instead of the XsdElement or XsdModelGroup. + * During a later phase, the resolver will look for all XsdReferences + * in the schema and will replace them with their referring XsdElement or + * XsdModelGroup objects. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdReference : public XsdTerm + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the type of the reference. + */ + enum Type + { + Element, ///< The reference points to an element. + ModelGroup ///< The reference points to a model group. + }; + + /** + * Returns always @c true, used to avoid dynamic casts. + */ + virtual bool isReference() const; + + /** + * Sets the @p type of the reference. + * + * @see Type + */ + void setType(Type type); + + /** + * Returns the type of the reference. + */ + Type type() const; + + /** + * Sets the @p name of the referenced object. + * + * The name can either be a top-level element declaration + * or a top-level group declaration. + */ + void setReferenceName(const QXmlName &ame); + + /** + * Returns the name of the referenced object. + */ + QXmlName referenceName() const; + + /** + * Sets the source @p location where the reference is located. + */ + void setSourceLocation(const QSourceLocation &location); + + /** + * Returns the source location where the reference is located. + */ + QSourceLocation sourceLocation() const; + + private: + Type m_type; + QXmlName m_referenceName; + QSourceLocation m_sourceLocation; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschema.cpp b/src/xmlpatterns/schema/qxsdschema.cpp new file mode 100644 index 0000000..260b06b --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschema.cpp @@ -0,0 +1,242 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschema_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchema::XsdSchema(const NamePool::Ptr &namePool) + : m_namePool(namePool) +{ +} + +XsdSchema::~XsdSchema() +{ +} + +NamePool::Ptr XsdSchema::namePool() const +{ + return m_namePool; +} + +void XsdSchema::setTargetNamespace(const QString &targetNamespace) +{ + m_targetNamespace = targetNamespace; +} + +QString XsdSchema::targetNamespace() const +{ + return m_targetNamespace; +} + +void XsdSchema::addElement(const XsdElement::Ptr &element) +{ + const QWriteLocker locker(&m_lock); + + m_elements.insert(element->name(m_namePool), element); +} + +XsdElement::Ptr XsdSchema::element(const QXmlName &name) const +{ + const QReadLocker locker(&m_lock); + + return m_elements.value(name); +} + +XsdElement::List XsdSchema::elements() const +{ + const QReadLocker locker(&m_lock); + + return m_elements.values(); +} + +void XsdSchema::addAttribute(const XsdAttribute::Ptr &attribute) +{ + const QWriteLocker locker(&m_lock); + + m_attributes.insert(attribute->name(m_namePool), attribute); +} + +XsdAttribute::Ptr XsdSchema::attribute(const QXmlName &name) const +{ + const QReadLocker locker(&m_lock); + + return m_attributes.value(name); +} + +XsdAttribute::List XsdSchema::attributes() const +{ + const QReadLocker locker(&m_lock); + + return m_attributes.values(); +} + +void XsdSchema::addType(const SchemaType::Ptr &type) +{ + const QWriteLocker locker(&m_lock); + + m_types.insert(type->name(m_namePool), type); +} + +SchemaType::Ptr XsdSchema::type(const QXmlName &name) const +{ + const QReadLocker locker(&m_lock); + + return m_types.value(name); +} + +SchemaType::List XsdSchema::types() const +{ + const QReadLocker locker(&m_lock); + + return m_types.values(); +} + +XsdSimpleType::List XsdSchema::simpleTypes() const +{ + QReadLocker locker(&m_lock); + + XsdSimpleType::List retval; + + const SchemaType::List types = m_types.values(); + for (int i = 0; i < types.count(); ++i) { + if (types.at(i)->isSimpleType() && types.at(i)->isDefinedBySchema()) + retval.append(types.at(i)); + } + + return retval; +} + +XsdComplexType::List XsdSchema::complexTypes() const +{ + QReadLocker locker(&m_lock); + + XsdComplexType::List retval; + + const SchemaType::List types = m_types.values(); + for (int i = 0; i < types.count(); ++i) { + if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema()) + retval.append(types.at(i)); + } + + return retval; +} + +void XsdSchema::addAnonymousType(const SchemaType::Ptr &type) +{ + const QWriteLocker locker(&m_lock); + + // search for not used anonymous type name + QXmlName typeName = type->name(m_namePool); + while (m_anonymousTypes.contains(typeName)) { + typeName = m_namePool->allocateQName(QString(), QLatin1String("merged_") + m_namePool->stringForLocalName(typeName.localName()), QString()); + } + + m_anonymousTypes.insert(typeName, type); +} + +SchemaType::List XsdSchema::anonymousTypes() const +{ + const QReadLocker locker(&m_lock); + + return m_anonymousTypes.values(); +} + +void XsdSchema::addAttributeGroup(const XsdAttributeGroup::Ptr &group) +{ + const QWriteLocker locker(&m_lock); + + m_attributeGroups.insert(group->name(m_namePool), group); +} + +XsdAttributeGroup::Ptr XsdSchema::attributeGroup(const QXmlName name) const +{ + const QReadLocker locker(&m_lock); + + return m_attributeGroups.value(name); +} + +XsdAttributeGroup::List XsdSchema::attributeGroups() const +{ + const QReadLocker locker(&m_lock); + + return m_attributeGroups.values(); +} + +void XsdSchema::addElementGroup(const XsdModelGroup::Ptr &group) +{ + const QWriteLocker locker(&m_lock); + + m_elementGroups.insert(group->name(m_namePool), group); +} + +XsdModelGroup::Ptr XsdSchema::elementGroup(const QXmlName &name) const +{ + const QReadLocker locker(&m_lock); + + return m_elementGroups.value(name); +} + +XsdModelGroup::List XsdSchema::elementGroups() const +{ + const QReadLocker locker(&m_lock); + + return m_elementGroups.values(); +} + +void XsdSchema::addNotation(const XsdNotation::Ptr ¬ation) +{ + const QWriteLocker locker(&m_lock); + + m_notations.insert(notation->name(m_namePool), notation); +} + +XsdNotation::Ptr XsdSchema::notation(const QXmlName &name) const +{ + const QReadLocker locker(&m_lock); + + return m_notations.value(name); +} + +XsdNotation::List XsdSchema::notations() const +{ + const QReadLocker locker(&m_lock); + + return m_notations.values(); +} + +void XsdSchema::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint) +{ + const QWriteLocker locker(&m_lock); + + m_identityConstraints.insert(constraint->name(m_namePool), constraint); +} + +XsdIdentityConstraint::Ptr XsdSchema::identityConstraint(const QXmlName &name) const +{ + const QReadLocker locker(&m_lock); + + return m_identityConstraints.value(name); +} + +XsdIdentityConstraint::List XsdSchema::identityConstraints() const +{ + const QReadLocker locker(&m_lock); + + return m_identityConstraints.values(); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschema_p.h b/src/xmlpatterns/schema/qxsdschema_p.h new file mode 100644 index 0000000..b41a2d5 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschema_p.h @@ -0,0 +1,271 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchema_H +#define Patternist_XsdSchema_H + +#include "qschematype_p.h" +#include "qxsdannotated_p.h" +#include "qxsdattribute_p.h" +#include "qxsdattributegroup_p.h" +#include "qxsdcomplextype_p.h" +#include "qxsdelement_p.h" +#include "qxsdidentityconstraint_p.h" +#include "qxsdmodelgroup_p.h" +#include "qxsdnotation_p.h" +#include "qxsdsimpletype_p.h" + +#include +#include + +/** + * @defgroup Patternist_schema XML Schema Processing + */ + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD schema object. + * + * The class provides access to all components of a parsed XSD. + * + * @note In the documentation of this class objects, which are direct + * children of the schema object, are called top-level objects. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchema : public QSharedData, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Creates a new schema object. + * + * @param namePool The namepool that should be used for names of + * all schema components. + */ + XsdSchema(const NamePool::Ptr &namePool); + + /** + * Destroys the schema object. + */ + ~XsdSchema(); + + /** + * Returns the namepool that is used for names of + * all schema components. + */ + NamePool::Ptr namePool() const; + + /** + * Sets the @p targetNamespace of the schema. + */ + void setTargetNamespace(const QString &targetNamespace); + + /** + * Returns the target namespace of the schema. + */ + QString targetNamespace() const; + + /** + * Adds a new top-level @p element to the schema. + * + * @param element The new element. + * @see Element Declaration + */ + void addElement(const XsdElement::Ptr &element); + + /** + * Returns the top-level element of the schema with + * the given @p name or an empty pointer if none exist. + */ + XsdElement::Ptr element(const QXmlName &name) const; + + /** + * Returns the list of all top-level elements. + */ + XsdElement::List elements() const; + + /** + * Adds a new top-level @p attribute to the schema. + * + * @param attribute The new attribute. + * @see Attribute Declaration + */ + void addAttribute(const XsdAttribute::Ptr &attribute); + + /** + * Returns the top-level attribute of the schema with + * the given @p name or an empty pointer if none exist. + */ + XsdAttribute::Ptr attribute(const QXmlName &name) const; + + /** + * Returns the list of all top-level attributes. + */ + XsdAttribute::List attributes() const; + + /** + * Adds a new top-level @p type to the schema. + * That can be a simple or a complex type. + * + * @param type The new type. + * @see Simple Type Declaration + * @see Complex Type Declaration + */ + void addType(const SchemaType::Ptr &type); + + /** + * Returns the top-level type of the schema with + * the given @p name or an empty pointer if none exist. + */ + SchemaType::Ptr type(const QXmlName &name) const; + + /** + * Returns the list of all top-level types. + */ + SchemaType::List types() const; + + /** + * Returns the list of all top-level simple types. + */ + XsdSimpleType::List simpleTypes() const; + + /** + * Returns the list of all top-level complex types. + */ + XsdComplexType::List complexTypes() const; + + /** + * Adds an anonymous @p type to the schema. + * Anonymous types have no name and are declared + * locally inside an element object. + * + * @param type The new anonymous type. + */ + void addAnonymousType(const SchemaType::Ptr &type); + + /** + * Returns the list of all anonymous types. + */ + SchemaType::List anonymousTypes() const; + + /** + * Adds a new top-level attribute @p group to the schema. + * + * @param group The new attribute group. + * @see Attribute Group Declaration + */ + void addAttributeGroup(const XsdAttributeGroup::Ptr &group); + + /** + * Returns the top-level attribute group of the schema with + * the given @p name or an empty pointer if none exist. + */ + XsdAttributeGroup::Ptr attributeGroup(const QXmlName name) const; + + /** + * Returns the list of all top-level attribute groups. + */ + XsdAttributeGroup::List attributeGroups() const; + + /** + * Adds a new top-level element @p group to the schema. + * + * @param group The new element group. + * @see Element Group Declaration + */ + void addElementGroup(const XsdModelGroup::Ptr &group); + + /** + * Returns the top-level element group of the schema with + * the given @p name or an empty pointer if none exist. + */ + XsdModelGroup::Ptr elementGroup(const QXmlName &name) const; + + /** + * Returns the list of all top-level element groups. + */ + XsdModelGroup::List elementGroups() const; + + /** + * Adds a new top-level @p notation to the schema. + * + * @param notation The new notation. + * @see Notation Declaration + */ + void addNotation(const XsdNotation::Ptr ¬ation); + + /** + * Returns the top-level notation of the schema with + * the given @p name or an empty pointer if none exist. + */ + XsdNotation::Ptr notation(const QXmlName &name) const; + + /** + * Returns the list of all top-level notations. + */ + XsdNotation::List notations() const; + + /** + * Adds a new identity @p constraint to the schema. + */ + void addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint); + + /** + * Returns the identity constraint with the given @p name + * or an empty pointer if none exist. + */ + XsdIdentityConstraint::Ptr identityConstraint(const QXmlName &name) const; + + /** + * Returns the list of all identity constraints in this schema. + */ + XsdIdentityConstraint::List identityConstraints() const; + + private: + NamePool::Ptr m_namePool; + QString m_targetNamespace; + QHash m_elements; + QHash m_attributes; + QHash m_types; + QHash m_anonymousTypes; + QHash m_attributeGroups; + QHash m_elementGroups; + QHash m_notations; + QHash m_identityConstraints; + mutable QReadWriteLock m_lock; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemachecker.cpp b/src/xmlpatterns/schema/qxsdschemachecker.cpp new file mode 100644 index 0000000..2a64327 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemachecker.cpp @@ -0,0 +1,2031 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschemachecker_p.h" + +#include "qderivedinteger_p.h" +#include "qderivedstring_p.h" +#include "qpatternplatform_p.h" +#include "qqnamevalue_p.h" +#include "qsourcelocationreflection_p.h" +#include "qvaluefactory_p.h" +#include "qxsdattributereference_p.h" +#include "qxsdparticlechecker_p.h" +#include "qxsdreference_p.h" +#include "qxsdschemacontext_p.h" +#include "qxsdschemahelper_p.h" +#include "qxsdschemaparsercontext_p.h" +#include "qxsdschematypesfactory_p.h" +#include "qxsdtypechecker_p.h" + +#include "qxsdschemachecker_helper.cpp" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaChecker::XsdSchemaChecker(const QExplicitlySharedDataPointer &context, const XsdSchemaParserContext *parserContext) + : m_context(context) + , m_namePool(parserContext->namePool()) + , m_schema(parserContext->schema()) +{ + setupAllowedAtomicFacets(); +} + +XsdSchemaChecker::~XsdSchemaChecker() +{ +} + +/* + * This method is called after the resolver has set the base type for every + * type and information about deriavtion and 'is simple type vs. is complex type' + * are available. + */ +void XsdSchemaChecker::basicCheck() +{ + // first check that there is no circular inheritance, only the + // wxsSuperType is used here + checkBasicCircularInheritances(); + + // check the basic constraints like simple type can not inherit from complex type etc. + checkBasicSimpleTypeConstraints(); + checkBasicComplexTypeConstraints(); +} + +void XsdSchemaChecker::check() +{ + checkCircularInheritances(); + checkInheritanceRestrictions(); + checkSimpleDerivationRestrictions(); + checkSimpleTypeConstraints(); + checkComplexTypeConstraints(); + checkDuplicatedAttributeUses(); + + checkElementConstraints(); + checkAttributeConstraints(); + checkAttributeUseConstraints(); +// checkElementDuplicates(); +} + +void XsdSchemaChecker::addComponentLocationHash(const ComponentLocationHash &hash) +{ + m_componentLocationHash.unite(hash); +} + +/** + * Checks whether the @p otherType is the same as @p myType or if one of its + * ancestors is the same as @p myType. + */ +static bool matchesType(const SchemaType::Ptr &myType, const SchemaType::Ptr &otherType, QSet visitedTypes) +{ + bool retval = false; + + if (otherType) { + if (visitedTypes.contains(otherType)) { + return true; + } else { + visitedTypes.insert(otherType); + } + // simple types can have different varieties, so we have to check each of them + if (otherType->isSimpleType()) { + const XsdSimpleType::Ptr simpleType = otherType; + if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) { + // for atomic type we use the same test as in SchemaType::wxsTypeMatches + retval = (myType == simpleType ? true : matchesType(myType, simpleType->wxsSuperType(), visitedTypes)); + } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) { + // for list type we test against the itemType property + retval = (myType == simpleType->itemType() ? true : matchesType(myType, simpleType->itemType()->wxsSuperType(), visitedTypes)); + } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) { + // for union type we test against each member type + const XsdSimpleType::List members = simpleType->memberTypes(); + for (int i = 0; i < members.count(); ++i) { + if (myType == members.at(i) ? true : matchesType(myType, members.at(i)->wxsSuperType(), visitedTypes)) { + retval = true; + break; + } + } + } else { + // reached xsAnySimple type whichs category is None + retval = false; + } + } else { + // if no simple type we handle it like in SchemaType::wxsTypeMatches + retval = (myType == otherType ? true : matchesType(myType, otherType->wxsSuperType(), visitedTypes)); + } + } else // if otherType is null it doesn't match + retval = false; + + return retval; +} + +/** + * Checks whether there is a circular inheritance for the union inheritance. + */ +static bool hasCircularUnionInheritance(const XsdSimpleType::Ptr &type, const SchemaType::Ptr &otherType, NamePool::Ptr &namePool) +{ + if (type == otherType) { + return true; + } + + if (!otherType->isSimpleType() || !otherType->isDefinedBySchema()) { + return false; + } + + const XsdSimpleType::Ptr simpleOtherType = otherType; + + if (simpleOtherType->category() == XsdSimpleType::SimpleTypeUnion) { + const XsdSimpleType::List memberTypes = simpleOtherType->memberTypes(); + for (int i = 0; i < memberTypes.count(); ++i) { + if (otherType->wxsSuperType() == type) { + return true; + } + if (hasCircularUnionInheritance(type, memberTypes.at(i), namePool)) { + return true; + } + } + } + + return false; +} + +static inline bool wxsTypeMatches(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, QSet &visitedTypes, SchemaType::Ptr &conflictingType) +{ + if (!otherType) + return false; + + if (visitedTypes.contains(otherType)) { // inheritance loop detected + conflictingType = otherType; + return true; + } else { + visitedTypes.insert(otherType); + } + + if (type == otherType) + return true; + + return wxsTypeMatches(type, otherType->wxsSuperType(), visitedTypes, conflictingType); +} + +void XsdSchemaChecker::checkBasicCircularInheritances() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + const QSourceLocation location = sourceLocationForType(type); + + // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 3) + + // check normal base type inheritance + QSet visitedTypes; + SchemaType::Ptr conflictingType; + + if (wxsTypeMatches(type, type->wxsSuperType(), visitedTypes, conflictingType)) { + if (conflictingType) + m_context->error(QtXmlPatterns::tr("%1 has inheritance loop in its base type %2") + .arg(formatType(m_namePool, type)) + .arg(formatType(m_namePool, conflictingType)), + XsdSchemaContext::XSDError, location); + else + m_context->error(QtXmlPatterns::tr("circular inheritance of base type %1").arg(formatType(m_namePool, type)), XsdSchemaContext::XSDError, location); + + return; + } + } +} + +void XsdSchemaChecker::checkCircularInheritances() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + const QSourceLocation location = sourceLocationForType(type); + + // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 3) + + // check normal base type inheritance + QSet visitedTypes; + if (matchesType(type, type->wxsSuperType(), visitedTypes)) { + m_context->error(QtXmlPatterns::tr("circular inheritance of base type %1").arg(formatType(m_namePool, type)), XsdSchemaContext::XSDError, location); + return; + } + + // check union member inheritance + if (type->isSimpleType() && type->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleType = type; + if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) { + const XsdSimpleType::List memberTypes = simpleType->memberTypes(); + for (int j = 0; j < memberTypes.count(); ++j) { + if (hasCircularUnionInheritance(simpleType, memberTypes.at(j), m_namePool)) { + m_context->error(QtXmlPatterns::tr("circular inheritance of union %1").arg(formatType(m_namePool, type)), XsdSchemaContext::XSDError, location); + return; + } + } + } + } + } +} + +void XsdSchemaChecker::checkInheritanceRestrictions() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + const QSourceLocation location = sourceLocationForType(type); + + // check inheritance restrictions given by final property of base class + const SchemaType::Ptr baseType = type->wxsSuperType(); + if (baseType->isDefinedBySchema()) { + if ((type->derivationMethod() == SchemaType::DerivationRestriction) && (baseType->derivationConstraints() & SchemaType::RestrictionConstraint)) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by restriction as the latter defines it as final") + .arg(formatType(m_namePool, type)) + .arg(formatType(m_namePool, baseType)), XsdSchemaContext::XSDError, location); + return; + } else if ((type->derivationMethod() == SchemaType::DerivationExtension) && (baseType->derivationConstraints() & SchemaType::ExtensionConstraint)) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by extension as the latter defines it as final") + .arg(formatType(m_namePool, type)) + .arg(formatType(m_namePool, baseType)), XsdSchemaContext::XSDError, location); + return; + } + } + } +} + +void XsdSchemaChecker::checkBasicSimpleTypeConstraints() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + + if (!type->isSimpleType()) + continue; + + const XsdSimpleType::Ptr simpleType = type; + + const QSourceLocation location = sourceLocation(simpleType); + + // check inheritance restrictions of simple type defined by schema constraints + const SchemaType::Ptr baseType = simpleType->wxsSuperType(); + + if (baseType->isComplexType() && (simpleType->name(m_namePool) != BuiltinTypes::xsAnySimpleType->name(m_namePool))) { + m_context->error(QtXmlPatterns::tr("base type of simple type %1 cannot be complex type %2") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, baseType)), + XsdSchemaContext::XSDError, location); + return; + } + + if (baseType == BuiltinTypes::xsAnyType) { + if (type->name(m_namePool) != BuiltinTypes::xsAnySimpleType->name(m_namePool)) { + m_context->error(QtXmlPatterns::tr("simple type %1 cannot have direct base type %2") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, BuiltinTypes::xsAnyType)), + XsdSchemaContext::XSDError, location); + return; + } + } + } +} + +void XsdSchemaChecker::checkSimpleTypeConstraints() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + + if (!type->isSimpleType()) + continue; + + const XsdSimpleType::Ptr simpleType = type; + + const QSourceLocation location = sourceLocation(simpleType); + + if (simpleType->category() == XsdSimpleType::None) { + // additional checks + // check that no user defined type has xs:AnySimpleType as base type (except xs:AnyAtomicType) + if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) { + if (simpleType->name(m_namePool) != BuiltinTypes::xsAnyAtomicType->name(m_namePool)) { + m_context->error(QtXmlPatterns::tr("simple type %1 is not allowed to have base type %2") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, simpleType->wxsSuperType())), + XsdSchemaContext::XSDError, location); + return; + } + } + // check that no user defined type has xs:AnyAtomicType as base type + if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnyAtomicType->name(m_namePool)) { + m_context->error(QtXmlPatterns::tr("simple type %1 is not allowed to have base type %2") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, simpleType->wxsSuperType())), + XsdSchemaContext::XSDError, location); + return; + } + } + + // @see http://www.w3.org/TR/xmlschema11-1/#d0e37310 + if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) { + // 1.1 + if ((simpleType->wxsSuperType()->category() != XsdSimpleType::SimpleTypeAtomic) && (simpleType->name(m_namePool) != BuiltinTypes::xsAnyAtomicType->name(m_namePool))) { + m_context->error(QtXmlPatterns::tr("simple type %1 can only have simple atomic type as base type") + .arg(formatType(m_namePool, simpleType)), + XsdSchemaContext::XSDError, location); + } + // 1.2 + if (simpleType->wxsSuperType()->derivationConstraints() & SchemaType::RestrictionConstraint) { + m_context->error(QtXmlPatterns::tr("simple type %1 cannot derive from %2 as the latter defines restriction as final") + .arg(formatType(m_namePool, simpleType->wxsSuperType())) + .arg(formatType(m_namePool, simpleType)), + XsdSchemaContext::XSDError, location); + } + + // 1.3 + // checked by checkConstrainingFacets already + } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) { + const AnySimpleType::Ptr itemType = simpleType->itemType(); + + // 2.1 or @see http://www.w3.org/TR/xmlschema-2/#cos-list-of-atomic + if (itemType->category() != SchemaType::SimpleTypeAtomic && itemType->category() != SchemaType::SimpleTypeUnion) { + m_context->error(QtXmlPatterns::tr("variety of item type of %1 must be either atomic or union").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location); + return; + } + + // 2.1 second part + if (itemType->category() == SchemaType::SimpleTypeUnion && itemType->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleItemType = itemType; + const AnySimpleType::List memberTypes = simpleItemType->memberTypes(); + for (int j = 0; j < memberTypes.count(); ++j) { + if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic) { + m_context->error(QtXmlPatterns::tr("variety of member types of %1 must be atomic").arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location); + return; + } + } + } + + // 2.2.1 + if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) { + if (itemType->isSimpleType() && itemType->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleItemType = itemType; + + // 2.2.1.1 + if (simpleItemType->derivationConstraints() & XsdSimpleType::ListConstraint) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by list as the latter defines it as final") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location); + return; + } + + // 2.2.1.2 + const XsdFacet::Hash facets = simpleType->facets(); + XsdFacet::HashIterator it(facets); + + bool invalidFacetFound = false; + while (it.hasNext()) { + it.next(); + if (it.key() != XsdFacet::WhiteSpace) { + invalidFacetFound = true; + break; + } + } + + if (invalidFacetFound) { + m_context->error(QtXmlPatterns::tr("simple type %1 is only allowed to have %2 facet") + .arg(formatType(m_namePool, simpleType)) + .arg(formatKeyword("whiteSpace")), + XsdSchemaContext::XSDError, location); + return; + } + } + } else { // 2.2.2 + // 2.2.2.1 + if (simpleType->wxsSuperType()->category() != XsdSimpleType::SimpleTypeList) { + m_context->error(QtXmlPatterns::tr("base type of simple type %1 must have variety of type list").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location); + return; + } + + // 2.2.2.2 + if (simpleType->wxsSuperType()->derivationConstraints() & SchemaType::RestrictionConstraint) { + m_context->error(QtXmlPatterns::tr("base type of simple type %1 has defined derivation by restriction as final").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location); + return; + } + + // 2.2.2.3 + if (!XsdSchemaHelper::isSimpleDerivationOk(itemType, XsdSimpleType::Ptr(simpleType->wxsSuperType())->itemType(), SchemaType::DerivationConstraints())) { + m_context->error(QtXmlPatterns::tr("item type of base type does not match item type of %1").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location); + return; + } + + // 2.2.2.4 + const XsdFacet::Hash facets = simpleType->facets(); + XsdFacet::HashIterator it(facets); + + bool invalidFacetFound = false; + XsdFacet::Type invalidFacetType = XsdFacet::None; + while (it.hasNext()) { + it.next(); + const XsdFacet::Type facetType = it.key(); + if (facetType != XsdFacet::Length && + facetType != XsdFacet::MinimumLength && + facetType != XsdFacet::MaximumLength && + facetType != XsdFacet::WhiteSpace && + facetType != XsdFacet::Pattern && + facetType != XsdFacet::Enumeration) { + invalidFacetType = facetType; + invalidFacetFound = true; + break; + } + } + + if (invalidFacetFound) { + m_context->error(QtXmlPatterns::tr("simple type %1 contains not allowed facet type %2") + .arg(formatType(m_namePool, simpleType)) + .arg(formatKeyword(XsdFacet::typeName(invalidFacetType))), + XsdSchemaContext::XSDError, location); + return; + } + + // 2.2.2.5 + // TODO: check value constraints + } + + + } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) { + const AnySimpleType::List memberTypes = simpleType->memberTypes(); + + if (simpleType->wxsSuperType()->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) { // 3.1.1 + // 3.3.1.1 + for (int i = 0; i < memberTypes.count(); ++i) { + const AnySimpleType::Ptr memberType = memberTypes.at(i); + + if (memberType->derivationConstraints() & XsdSimpleType::UnionConstraint) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by union as the latter defines it as final") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, memberType)), XsdSchemaContext::XSDError, location); + return; + } + } + + // 3.3.1.2 + if (!simpleType->facets().isEmpty()) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to have any facets") + .arg(formatType(m_namePool, simpleType)), + XsdSchemaContext::XSDError, location); + return; + } + } else { + // 3.1.2.1 + if (simpleType->wxsSuperType()->category() != SchemaType::SimpleTypeUnion) { + m_context->error(QtXmlPatterns::tr("base type %1 of simple type %2 must have variety of union") + .arg(formatType(m_namePool, simpleType->wxsSuperType())) + .arg(formatType(m_namePool, simpleType)), + XsdSchemaContext::XSDError, location); + return; + } + + // 3.1.2.2 + if (simpleType->wxsSuperType()->derivationConstraints() & SchemaType::DerivationRestriction) { + m_context->error(QtXmlPatterns::tr("base type %1 of simple type %2 is not allowed to have restriction in %3 attribute") + .arg(formatType(m_namePool, simpleType->wxsSuperType())) + .arg(formatType(m_namePool, simpleType)) + .arg(formatAttribute("final")), + XsdSchemaContext::XSDError, location); + return; + } + + //3.1.2.3 + if (simpleType->wxsSuperType()->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleBaseType(simpleType->wxsSuperType()); + + AnySimpleType::List baseMemberTypes = simpleBaseType->memberTypes(); + for (int i = 0; i < memberTypes.count(); ++i) { + const AnySimpleType::Ptr memberType = memberTypes.at(i); + const AnySimpleType::Ptr baseMemberType = baseMemberTypes.at(i); + + if (!XsdSchemaHelper::isSimpleDerivationOk(memberType, baseMemberType, SchemaType::DerivationConstraints())) { + m_context->error(QtXmlPatterns::tr("member type %1 cannot be derived from member type %2 of %3's base type %4") + .arg(formatType(m_namePool, memberType)) + .arg(formatType(m_namePool, baseMemberType)) + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, simpleBaseType)), + XsdSchemaContext::XSDError, location); + } + } + } + + // 3.1.2.4 + const XsdFacet::Hash facets = simpleType->facets(); + XsdFacet::HashIterator it(facets); + + bool invalidFacetFound = false; + XsdFacet::Type invalidFacetType = XsdFacet::None; + while (it.hasNext()) { + it.next(); + const XsdFacet::Type facetType = it.key(); + if (facetType != XsdFacet::Pattern && + facetType != XsdFacet::Enumeration) { + invalidFacetType = facetType; + invalidFacetFound = true; + break; + } + } + + if (invalidFacetFound) { + m_context->error(QtXmlPatterns::tr("simple type %1 contains not allowed facet type %2") + .arg(formatType(m_namePool, simpleType)) + .arg(formatKeyword(XsdFacet::typeName(invalidFacetType))), + XsdSchemaContext::XSDError, location); + return; + } + + // 3.1.2.5 + // TODO: check value constraints + } + } + } +} + +void XsdSchemaChecker::checkBasicComplexTypeConstraints() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + + if (!type->isComplexType() || !type->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = type; + + const QSourceLocation location = sourceLocation(complexType); + + // check inheritance restrictions of complex type defined by schema constraints + const SchemaType::Ptr baseType = complexType->wxsSuperType(); + + // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 2) + if (baseType->isSimpleType() && (complexType->derivationMethod() != XsdComplexType::DerivationExtension)) { + m_context->error(QtXmlPatterns::tr("derivation method of %1 must be extension because the base type %2 is a simple type") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, baseType)), + XsdSchemaContext::XSDError, location); + return; + } + } +} + +void XsdSchemaChecker::checkComplexTypeConstraints() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + + if (!type->isComplexType() || !type->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = type; + + const QSourceLocation location = sourceLocation(complexType); + + if (complexType->contentType()->particle()) { + XsdElement::Ptr duplicatedElement; + if (XsdParticleChecker::hasDuplicatedElements(complexType->contentType()->particle(), m_namePool, duplicatedElement)) { + m_context->error(QtXmlPatterns::tr("complex type %1 has duplicated element %2 in its content model") + .arg(formatType(m_namePool, complexType)) + .arg(formatKeyword(duplicatedElement->displayName(m_namePool))), + XsdSchemaContext::XSDError, location); + return; + } + + if (!XsdParticleChecker::isUPAConform(complexType->contentType()->particle(), m_namePool)) { + m_context->error(QtXmlPatterns::tr("complex type %1 has non-deterministic content") + .arg(formatType(m_namePool, complexType)), + XsdSchemaContext::XSDError, location); + return; + } + } + + // check inheritance restrictions of complex type defined by schema constraints + const SchemaType::Ptr baseType = complexType->wxsSuperType(); + + // @see http://www.w3.org/TR/xmlschema11-1/#cos-ct-extends + if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) { + if (baseType->isComplexType() && baseType->isDefinedBySchema()) { + const XsdComplexType::Ptr complexBaseType = baseType; + + // we can skip 1.1 here, as it is tested in checkInheritanceRestrictions() already + + // 1.2 and 1.3 + QString errorMsg; + if (!XsdSchemaHelper::isValidAttributeUsesExtension(complexType->attributeUses(), complexBaseType->attributeUses(), + complexType->attributeWildcard(), complexBaseType->attributeWildcard(), m_context, errorMsg)) { + m_context->error(QtXmlPatterns::tr("attributes of complex type %1 are not a valid extension of the attributes of base type %2: %3") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, baseType)) + .arg(errorMsg), + XsdSchemaContext::XSDError, location); + return; + } + + // 1.4 + bool validContentType = false; + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + if (complexType->contentType()->simpleType() == complexBaseType->contentType()->simpleType()) { + validContentType = true; // 1.4.1 + } + } else if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Empty) { + validContentType = true; // 1.4.2 + } else { // 1.4.3 + if (complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { // 1.4.3.1 + if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Empty) { + validContentType = true; // 1.4.3.2.1 + } else { // 1.4.3.2.2 + if (complexType->contentType()->particle()) { // our own check + if ((complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) || + (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) { // 1.4.3.2.2.1 + if (isValidParticleExtension(complexType->contentType()->particle(), complexBaseType->contentType()->particle())) { + validContentType = true; // 1.4.3.2.2.2 + } + } + } + // 1.4.3.2.2.3 and 1.4.3.2.2.4 handle 'open content' that we do not support yet + } + } + } + + // 1.5 WTF?!? + + if (!validContentType) { + m_context->error(QtXmlPatterns::tr("content model of complex type %1 is not a valid extension of content model of %2") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, complexBaseType)), + XsdSchemaContext::XSDError, location); + return; + } + + } else if (baseType->isSimpleType()) { + // 2.1 + if (complexType->contentType()->variety() != XsdComplexType::ContentType::Simple) { + m_context->error(QtXmlPatterns::tr("complex type %1 must have simple content") + .arg(formatType(m_namePool, complexType)), + XsdSchemaContext::XSDError, location); + return; + } + + if (complexType->contentType()->simpleType() != baseType) { + m_context->error(QtXmlPatterns::tr("complex type %1 must have the same simple type as its base class %2") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, baseType)), + XsdSchemaContext::XSDError, location); + return; + } + + // 2.2 tested in checkInheritanceRestrictions() already + } + } else if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { + // @see http://www.w3.org/TR/xmlschema11-1/#d0e21402 + const SchemaType::Ptr baseType(complexType->wxsSuperType()); + + bool derivationOk = false; + QString errorMsg; + + // we can partly skip 1 here, as it is tested in checkInheritanceRestrictions() already + if (baseType->isComplexType()) { + + // 2.1 + if (baseType->name(m_namePool) == BuiltinTypes::xsAnyType->name(m_namePool)) { + derivationOk = true; + } + + if (baseType->isDefinedBySchema()) { + const XsdComplexType::Ptr complexBaseType(baseType); + + // 2.2.1 + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + // 2.2.2.1 + if (XsdSchemaHelper::isSimpleDerivationOk(complexType->contentType()->simpleType(), complexBaseType->contentType()->simpleType(), SchemaType::DerivationConstraints())) + derivationOk = true; + + // 2.2.2.2 + if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { + if (XsdSchemaHelper::isParticleEmptiable(complexBaseType->contentType()->particle())) + derivationOk = true; + } + } + + // 2.3.1 + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty) { + // 2.3.2.1 + if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Empty) + derivationOk = true; + + // 2.3.2.2 + if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { + if (XsdSchemaHelper::isParticleEmptiable(complexBaseType->contentType()->particle())) + derivationOk = true; + } + } + + // 2.4.1.1 + if (((complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) && + (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) || + // 2.4.1.2 + (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed && complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) { + + // 2.4.2 + if (XsdParticleChecker::subsumes(complexBaseType->contentType()->particle(), complexType->contentType()->particle(), m_context, errorMsg)) + derivationOk = true; + } + } + } + + if (!derivationOk) { + m_context->error(QtXmlPatterns::tr("complex type %1 cannot be derived from base type %2%3") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, baseType)) + .arg(errorMsg.isEmpty() ? QString() : QLatin1String(": ") + errorMsg), + XsdSchemaContext::XSDError, location); + return; + } + + if (baseType->isDefinedBySchema()) { + const XsdComplexType::Ptr complexBaseType(baseType); + + QString errorMsg; + if (!XsdSchemaHelper::isValidAttributeUsesRestriction(complexType->attributeUses(), complexBaseType->attributeUses(), + complexType->attributeWildcard(), complexBaseType->attributeWildcard(), m_context, errorMsg)) { + m_context->error(QtXmlPatterns::tr("attributes of complex type %1 are not a valid restriction from the attributes of base type %2: %3") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, baseType)) + .arg(errorMsg), + XsdSchemaContext::XSDError, location); + return; + } + } + } + + // check that complex type with simple content is not allowed to inherit from + // built in complex type xs:AnyType + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + if (baseType->name(m_namePool) == BuiltinTypes::xsAnyType->name(m_namePool)) { + m_context->error(QtXmlPatterns::tr("complex type %1 with simple content cannot be derived from complex base type %2") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, baseType)), + XsdSchemaContext::XSDError, location); + return; + } + } + } +} + +void XsdSchemaChecker::checkSimpleDerivationRestrictions() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + + if (type->isComplexType()) + continue; + + if (type->category() != SchemaType::SimpleTypeList && type->category() != SchemaType::SimpleTypeUnion) + continue; + + const XsdSimpleType::Ptr simpleType = type; + const QSourceLocation location = sourceLocation(simpleType); + + // check all simple types derived by list + if (simpleType->category() == XsdSimpleType::SimpleTypeList) { + const AnySimpleType::Ptr itemType = simpleType->itemType(); + + if (itemType->isComplexType()) { + m_context->error(QtXmlPatterns::tr("item type of simple type %1 cannot be a complex type") + .arg(formatType(m_namePool, simpleType)), + XsdSchemaContext::XSDError, location); + return; + } + + + if (itemType->isSimpleType() && itemType->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleItemType = itemType; + if (simpleItemType->derivationConstraints() & XsdSimpleType::ListConstraint) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by list as the latter defines it as final") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, simpleItemType)), + XsdSchemaContext::XSDError, location); + return; + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#cos-list-of-atomic + if (itemType->category() != SchemaType::SimpleTypeAtomic && itemType->category() != SchemaType::SimpleTypeUnion) { + m_context->error(QtXmlPatterns::tr("variety of item type of %1 must be either atomic or union").arg(formatType(m_namePool, simpleType)), XsdSchemaContext::XSDError, location); + return; + } + + if (itemType->category() == SchemaType::SimpleTypeUnion && itemType->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleItemType = itemType; + const AnySimpleType::List memberTypes = simpleItemType->memberTypes(); + for (int j = 0; j < memberTypes.count(); ++j) { + if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic) { + m_context->error(QtXmlPatterns::tr("variety of member types of %1 must be atomic").arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location); + return; + } + } + } + } + + // check all simple types derived by union + if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) { + const AnySimpleType::List memberTypes = simpleType->memberTypes(); + + for (int i = 0; i < memberTypes.count(); ++i) { + const AnySimpleType::Ptr memberType = memberTypes.at(i); + + if (memberType->isComplexType()) { + m_context->error(QtXmlPatterns::tr("member type of simple type %1 cannot be a complex type") + .arg(formatType(m_namePool, simpleType)), + XsdSchemaContext::XSDError, location); + return; + } + + // @see http://www.w3.org/TR/xmlschema-2/#cos-no-circular-unions + if (simpleType->name(m_namePool) == memberType->name(m_namePool)) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to have a member type with the same name as itself") + .arg(formatType(m_namePool, simpleType)), + XsdSchemaContext::XSDError, location); + return; + } + + if (memberType->isSimpleType() && memberType->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleMemberType = memberType; + if (simpleMemberType->derivationConstraints() & XsdSimpleType::UnionConstraint) { + m_context->error(QtXmlPatterns::tr("%1 is not allowed to derive from %2 by union as the latter defines it as final") + .arg(formatType(m_namePool, simpleType)) + .arg(formatType(m_namePool, simpleMemberType)), + XsdSchemaContext::XSDError, location); + return; + } + } + } + } + } +} + +void XsdSchemaChecker::checkConstrainingFacets() +{ + // first the global simple types + const SchemaType::List types = m_schema->types(); + for (int i = 0; i < types.count(); ++i) { + if (!(types.at(i)->isSimpleType()) || !(types.at(i)->isDefinedBySchema())) + continue; + + const XsdSimpleType::Ptr simpleType = types.at(i); + checkConstrainingFacets(simpleType->facets(), simpleType); + } + + // and afterwards all anonymous simple types + const SchemaType::List anonymousTypes = m_schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + if (!(anonymousTypes.at(i)->isSimpleType()) || !(anonymousTypes.at(i)->isDefinedBySchema())) + continue; + + const XsdSimpleType::Ptr simpleType = anonymousTypes.at(i); + checkConstrainingFacets(simpleType->facets(), simpleType); + } +} + +void XsdSchemaChecker::checkConstrainingFacets(const XsdFacet::Hash &facets, const XsdSimpleType::Ptr &simpleType) +{ + if (facets.isEmpty()) + return; + + SchemaType::Ptr comparableBaseType; + if (!simpleType->wxsSuperType()->isDefinedBySchema()) + comparableBaseType = simpleType->wxsSuperType(); + else + comparableBaseType = simpleType->primitiveType(); + + const XsdSchemaSourceLocationReflection reflection(sourceLocation(simpleType)); + + // start checks + if (facets.contains(XsdFacet::Length)) { + const XsdFacet::Ptr lengthFacet = facets.value(XsdFacet::Length); + const DerivedInteger::Ptr lengthValue = lengthFacet->value(); + + // @see http://www.w3.org/TR/xmlschema-2/#length-minLength-maxLength + if (facets.contains(XsdFacet::MinimumLength)) { + const XsdFacet::Ptr minLengthFacet = facets.value(XsdFacet::MinimumLength); + const DerivedInteger::Ptr minLengthValue = minLengthFacet->value(); + + bool foundSuperMinimumLength = false; + SchemaType::Ptr baseType = simpleType->wxsSuperType(); + while (baseType) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(baseType); + if (baseFacets.contains(XsdFacet::MinimumLength) && !baseFacets.contains(XsdFacet::Length)) { + const DerivedInteger::Ptr superValue(baseFacets.value(XsdFacet::MinimumLength)->value()); + if (minLengthValue->toInteger() == superValue->toInteger()) { + foundSuperMinimumLength = true; + break; + } + } + + baseType = baseType->wxsSuperType(); + } + + if ((minLengthValue->toInteger() > lengthValue->toInteger()) || !foundSuperMinimumLength) { + m_context->error(QtXmlPatterns::tr("%1 facet collides with %2 facet") + .arg(formatKeyword("length")) + .arg(formatKeyword("minLength")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#length-minLength-maxLength + if (facets.contains(XsdFacet::MaximumLength)) { + const XsdFacet::Ptr maxLengthFacet = facets.value(XsdFacet::MaximumLength); + const DerivedInteger::Ptr maxLengthValue = maxLengthFacet->value(); + + bool foundSuperMaximumLength = false; + SchemaType::Ptr baseType = simpleType->wxsSuperType(); + while (baseType) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(baseType); + if (baseFacets.contains(XsdFacet::MaximumLength) && !baseFacets.contains(XsdFacet::Length)) { + const DerivedInteger::Ptr superValue(baseFacets.value(XsdFacet::MaximumLength)->value()); + if (maxLengthValue->toInteger() == superValue->toInteger()) { + foundSuperMaximumLength = true; + break; + } + } + + baseType = baseType->wxsSuperType(); + } + + if ((maxLengthValue->toInteger() < lengthValue->toInteger()) || !foundSuperMaximumLength) { + m_context->error(QtXmlPatterns::tr("%1 facet collides with %2 facet") + .arg(formatKeyword("length")) + .arg(formatKeyword("maxLength")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#length-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::Length)) { + const DerivedInteger::Ptr baseValue = baseFacets.value(XsdFacet::Length)->value(); + if (lengthValue->toInteger() != baseValue->toInteger()) { + m_context->error(QtXmlPatterns::tr("%1 facet must have the same value as %2 facet of base type") + .arg(formatKeyword("length")) + .arg(formatKeyword("length")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + + if (facets.contains(XsdFacet::MinimumLength)) { + const XsdFacet::Ptr minLengthFacet = facets.value(XsdFacet::MinimumLength); + const DerivedInteger::Ptr minLengthValue = minLengthFacet->value(); + + if (facets.contains(XsdFacet::MaximumLength)) { + const XsdFacet::Ptr maxLengthFacet = facets.value(XsdFacet::MaximumLength); + const DerivedInteger::Ptr maxLengthValue = maxLengthFacet->value(); + + // @see http://www.w3.org/TR/xmlschema-2/#minLength-less-than-equal-to-maxLength + if (maxLengthValue->toInteger() < minLengthValue->toInteger()) { + m_context->error(QtXmlPatterns::tr("%1 facet collides with %2 facet") + .arg(formatKeyword("minLength")) + .arg(formatKeyword("maxLength")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + + // @see http://www.w3.org/TR/xmlschema-2/#minLength-valid-restriction + //TODO: check parent facets + } + + // @see http://www.w3.org/TR/xmlschema-2/#minLength-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::MinimumLength)) { + const DerivedInteger::Ptr baseValue = baseFacets.value(XsdFacet::MinimumLength)->value(); + if (minLengthValue->toInteger() < baseValue->toInteger()) { + m_context->error(QtXmlPatterns::tr("%1 facet must be equal or greater than %2 facet of base type") + .arg(formatKeyword("minLength")) + .arg(formatKeyword("minLength")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + if (facets.contains(XsdFacet::MaximumLength)) { + const XsdFacet::Ptr maxLengthFacet = facets.value(XsdFacet::MaximumLength); + const DerivedInteger::Ptr maxLengthValue = maxLengthFacet->value(); + + // @see http://www.w3.org/TR/xmlschema-2/#maxLength-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::MaximumLength)) { + const DerivedInteger::Ptr baseValue(baseFacets.value(XsdFacet::MaximumLength)->value()); + if (maxLengthValue->toInteger() > baseValue->toInteger()) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("maxLength")) + .arg(formatKeyword("maxLength")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + if (facets.contains(XsdFacet::Pattern)) { + // we keep the patterns in separated facets + // @see http://www.w3.org/TR/xmlschema-2/#src-multiple-patterns + + // @see http://www.w3.org/TR/xmlschema-2/#cvc-pattern-valid + const XsdFacet::Ptr patternFacet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = patternFacet->multiValue(); + + for (int i = 0; i < multiValue.count(); ++i) { + const DerivedString::Ptr value = multiValue.at(i); + const QRegExp exp = PatternPlatform::parsePattern(value->stringValue(), m_context, &reflection); + if (!exp.isValid()) { + m_context->error(QtXmlPatterns::tr("%1 facet contains invalid regular expression").arg(formatKeyword("pattern")), XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (facets.contains(XsdFacet::Enumeration)) { + // @see http://www.w3.org/TR/xmlschema-2/#src-multiple-enumerations + + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + + if (BuiltinTypes::xsNOTATION->wxsTypeMatches(simpleType)) { + const AtomicValue::List notationNames = facet->multiValue(); + for (int k = 0; k < notationNames.count(); ++k) { + const QNameValue::Ptr notationName = notationNames.at(k); + if (!m_schema->notation(notationName->qName())) { + m_context->error(QtXmlPatterns::tr("unknown notation %1 used in %2 facet") + .arg(formatKeyword(m_namePool, notationName->qName())) + .arg(formatKeyword("enumeration")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + } + } + } else if (BuiltinTypes::xsQName->wxsTypeMatches(simpleType)) { + } else { + const XsdTypeChecker checker(m_context, QVector(), sourceLocation(simpleType)); + + const AnySimpleType::Ptr baseType = simpleType->wxsSuperType(); + const XsdFacet::Hash baseFacets = XsdTypeChecker::mergedFacetsForType(baseType, m_context); + + const AtomicValue::List multiValue = facet->multiValue(); + for (int k = 0; k < multiValue.count(); ++k) { + const QString stringValue = multiValue.at(k)->as >()->stringValue(); + const QString actualValue = XsdTypeChecker::normalizedValue(stringValue, baseFacets); + + QString errorMsg; + if (!checker.isValidString(actualValue, baseType, errorMsg)) { + m_context->error(QtXmlPatterns::tr("%1 facet contains invalid value %2: %3") + .arg(formatKeyword("enumeration")) + .arg(formatData(stringValue)) + .arg(errorMsg), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + if (facets.contains(XsdFacet::WhiteSpace)) { + const XsdFacet::Ptr whiteSpaceFacet = facets.value(XsdFacet::WhiteSpace); + const DerivedString::Ptr whiteSpaceValue = whiteSpaceFacet->value(); + + // @see http://www.w3.org/TR/xmlschema-2/#whiteSpace-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::WhiteSpace)) { + const QString value = whiteSpaceValue->stringValue(); + const QString baseValue = DerivedString::Ptr(baseFacets.value(XsdFacet::WhiteSpace)->value())->stringValue(); + if (value == XsdSchemaToken::toString(XsdSchemaToken::Replace) || value == XsdSchemaToken::toString(XsdSchemaToken::Preserve)) { + if (baseValue == XsdSchemaToken::toString(XsdSchemaToken::Collapse)) { + m_context->error(QtXmlPatterns::tr("%1 facet cannot be %2 or %3 if %4 facet of base type is %5") + .arg(formatKeyword("whiteSpace")) + .arg(formatData("replace")) + .arg(formatData("preserve")) + .arg(formatKeyword("whiteSpace")) + .arg(formatData("collapse")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + if (value == XsdSchemaToken::toString(XsdSchemaToken::Preserve) && baseValue == XsdSchemaToken::toString(XsdSchemaToken::Replace)) { + m_context->error(QtXmlPatterns::tr("%1 facet cannot be %2 if %3 facet of base type is %4") + .arg(formatKeyword("whiteSpace")) + .arg(formatData("preserve")) + .arg(formatKeyword("whiteSpace")) + .arg(formatData("replace")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + if (facets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumInclusive); + + // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-less-than-equal-to-maxInclusive + if (facets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumInclusive); + + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, maxFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet") + .arg(formatKeyword("minInclusive")) + .arg(formatKeyword("maxInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#maxInclusive-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("maxInclusive")) + .arg(formatKeyword("maxInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet of base type") + .arg(formatKeyword("maxInclusive")) + .arg(formatKeyword("maxExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + } + if (facets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumExclusive); + + // @see http://www.w3.org/TR/xmlschema-2/#maxInclusive-maxExclusive + if (facets.contains(XsdFacet::MaximumInclusive)) { + m_context->error(QtXmlPatterns::tr("%1 facet and %2 facet cannot appear together") + .arg(formatKeyword("maxExclusive")) + .arg(formatKeyword("maxInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + + // @see http://www.w3.org/TR/xmlschema-2/#minExclusive-less-than-equal-to-maxExclusive + if (facets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, maxFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet") + .arg(formatKeyword("minExclusive")) + .arg(formatKeyword("maxExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#maxExclusive-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("maxExclusive")) + .arg(formatKeyword("maxExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("maxExclusive")) + .arg(formatKeyword("maxInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumInclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorLessOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be greater than %2 facet of base type") + .arg(formatKeyword("maxExclusive")) + .arg(formatKeyword("minInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(maxFacet->value(), AtomicComparator::OperatorLessOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be greater than %2 facet of base type") + .arg(formatKeyword("maxExclusive")) + .arg(formatKeyword("minExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + } + if (facets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumExclusive); + + // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-minExclusive + if (facets.contains(XsdFacet::MinimumInclusive)) { + m_context->error(QtXmlPatterns::tr("%1 facet and %2 facet cannot appear together") + .arg(formatKeyword("minExclusive")) + .arg(formatKeyword("minInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + + // @see http://www.w3.org/TR/xmlschema-2/#minExclusive-less-than-maxInclusive + if (facets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumInclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, maxFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet") + .arg(formatKeyword("minExclusive")) + .arg(formatKeyword("maxInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#minExclusive-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorLessThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be greater than or equal to %2 facet of base type") + .arg(formatKeyword("minExclusive")) + .arg(formatKeyword("minExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet of base type") + .arg(formatKeyword("minExclusive")) + .arg(formatKeyword("maxExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("minExclusive")) + .arg(formatKeyword("maxInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + } + if (facets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr minFacet = facets.value(XsdFacet::MinimumInclusive); + + // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-less-than-maxExclusive + if (facets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr maxFacet = facets.value(XsdFacet::MaximumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, maxFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet") + .arg(formatKeyword("minInclusive")) + .arg(formatKeyword("maxExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#minInclusive-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumInclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorLessThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be greater than or equal to %2 facet of base type") + .arg(formatKeyword("minInclusive")) + .arg(formatKeyword("minInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MinimumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorLessOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be greater than %2 facet of base type") + .arg(formatKeyword("minInclusive")) + .arg(formatKeyword("minExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumInclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterThan, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("minInclusive")) + .arg(formatKeyword("maxInclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + if (baseFacets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::MaximumExclusive); + if (comparableBaseType) { + if (XsdSchemaHelper::constructAndCompare(minFacet->value(), AtomicComparator::OperatorGreaterOrEqual, baseFacet->value(), comparableBaseType, m_context, &reflection)) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than %2 facet of base type") + .arg(formatKeyword("minInclusive")) + .arg(formatKeyword("maxExclusive")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + } + if (facets.contains(XsdFacet::TotalDigits)) { + const XsdFacet::Ptr totalDigitsFacet = facets.value(XsdFacet::TotalDigits); + const DerivedInteger::Ptr totalDigitsValue = totalDigitsFacet->value(); + + // @see http://www.w3.org/TR/xmlschema-2/#totalDigits-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::TotalDigits)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::TotalDigits); + const DerivedInteger::Ptr baseValue = baseFacet->value(); + + if (totalDigitsValue->toInteger() > baseValue->toInteger()) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("totalDigits")) + .arg(formatKeyword("totalDigits")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + if (facets.contains(XsdFacet::FractionDigits)) { + const XsdFacet::Ptr fractionDigitsFacet = facets.value(XsdFacet::FractionDigits); + const DerivedInteger::Ptr fractionDigitsValue = fractionDigitsFacet->value(); + + // http://www.w3.org/TR/xmlschema-2/#fractionDigits-totalDigits + if (facets.contains(XsdFacet::TotalDigits)) { + const XsdFacet::Ptr totalDigitsFacet = facets.value(XsdFacet::TotalDigits); + const DerivedInteger::Ptr totalDigitsValue = totalDigitsFacet->value(); + + if (fractionDigitsValue->toInteger() > totalDigitsValue->toInteger()) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet") + .arg(formatKeyword("fractionDigits")) + .arg(formatKeyword("totalDigits")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#fractionDigits-valid-restriction + if (simpleType->derivationMethod() == XsdSimpleType::DerivationRestriction) { + const XsdFacet::Hash baseFacets = m_context->facetsForType(simpleType->wxsSuperType()); + if (baseFacets.contains(XsdFacet::FractionDigits)) { + const XsdFacet::Ptr baseFacet = baseFacets.value(XsdFacet::FractionDigits); + const DerivedInteger::Ptr baseValue = baseFacet->value(); + + if (fractionDigitsValue->toInteger() > baseValue->toInteger()) { + m_context->error(QtXmlPatterns::tr("%1 facet must be less than or equal to %2 facet of base type") + .arg(formatKeyword("fractionDigits")) + .arg(formatKeyword("fractionDigits")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + + + // check whether facets are allowed for simple types variety + if (simpleType->wxsSuperType()->category() == SchemaType::SimpleTypeAtomic) { + if (simpleType->primitiveType()) { + const QXmlName primitiveTypeName = simpleType->primitiveType()->name(m_namePool); + if (m_allowedAtomicFacets.contains(primitiveTypeName)) { + const QSet allowedFacets = m_allowedAtomicFacets.value(primitiveTypeName); + QSet availableFacets = facets.keys().toSet(); + + if (!availableFacets.subtract(allowedFacets).isEmpty()) { + m_context->error(QtXmlPatterns::tr("simple type contains not allowed facet %1") + .arg(formatKeyword(XsdFacet::typeName(availableFacets.toList().first()))), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } else if (simpleType->wxsSuperType()->category() == SchemaType::SimpleTypeList) { + if (facets.contains(XsdFacet::MaximumInclusive) || facets.contains(XsdFacet::MinimumInclusive) || + facets.contains(XsdFacet::MaximumExclusive) || facets.contains(XsdFacet::MinimumExclusive) || + facets.contains(XsdFacet::TotalDigits) || facets.contains(XsdFacet::FractionDigits)) + { + m_context->error(QtXmlPatterns::tr("%1, %2, %3, %4, %5 and %6 facets are not allowed when derived by list") + .arg(formatKeyword("maxInclusive")) + .arg(formatKeyword("maxExclusive")) + .arg(formatKeyword("minInclusive")) + .arg(formatKeyword("minExclusive")) + .arg(formatKeyword("totalDigits")) + .arg(formatKeyword("fractionDigits")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + } + } else if (simpleType->wxsSuperType()->category() == SchemaType::SimpleTypeUnion) { + if (facets.contains(XsdFacet::MaximumInclusive) || facets.contains(XsdFacet::MinimumInclusive) || + facets.contains(XsdFacet::MaximumExclusive) || facets.contains(XsdFacet::MinimumExclusive) || + facets.contains(XsdFacet::TotalDigits) || facets.contains(XsdFacet::FractionDigits) || + facets.contains(XsdFacet::MinimumLength) || facets.contains(XsdFacet::MaximumLength) || + facets.contains(XsdFacet::Length) || facets.contains(XsdFacet::WhiteSpace)) + { + m_context->error(QtXmlPatterns::tr("only %1 and %2 facets are allowed when derived by union") + .arg(formatKeyword("pattern")) + .arg(formatKeyword("enumeration")), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + } + } + + // check whether value of facet matches the value space of the simple types base type + const SchemaType::Ptr baseType = simpleType->wxsSuperType(); + if (!baseType->isDefinedBySchema()) { + const XsdSchemaSourceLocationReflection reflection(sourceLocation(simpleType)); + + XsdFacet::HashIterator it(facets); + while (it.hasNext()) { + it.next(); + const XsdFacet::Ptr facet = it.value(); + if (facet->type() == XsdFacet::MaximumInclusive || + facet->type() == XsdFacet::MaximumExclusive || + facet->type() == XsdFacet::MinimumInclusive || + facet->type() == XsdFacet::MinimumExclusive) { + const DerivedString::Ptr stringValue = facet->value(); + const AtomicValue::Ptr value = ValueFactory::fromLexical(stringValue->stringValue(), baseType, m_context, &reflection); + if (value->hasError()) { + m_context->error(QtXmlPatterns::tr("%1 contains %2 facet with invalid data: %3") + .arg(formatType(m_namePool, simpleType)) + .arg(formatKeyword(XsdFacet::typeName(facet->type()))) + .arg(formatData(stringValue->stringValue())), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + + // @see http://www.w3.org/TR/xmlschema-2/#enumeration-valid-restriction + if (facet->type() == XsdFacet::Enumeration && baseType != BuiltinTypes::xsNOTATION) { + const AtomicValue::List multiValue = facet->multiValue(); + for (int j = 0; j < multiValue.count(); ++j) { + const QString stringValue = DerivedString::Ptr(multiValue.at(j))->stringValue(); + const AtomicValue::Ptr value = ValueFactory::fromLexical(stringValue, baseType, m_context, &reflection); + if (value->hasError()) { + m_context->error(QtXmlPatterns::tr("%1 contains %2 facet with invalid data: %3") + .arg(formatType(m_namePool, simpleType)) + .arg(formatKeyword(XsdFacet::typeName(XsdFacet::Enumeration))) + .arg(formatData(stringValue)), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + } + } + } + } +} + +void XsdSchemaChecker::checkDuplicatedAttributeUses() +{ + // first all global attribute groups + const XsdAttributeGroup::List attributeGroups = m_schema->attributeGroups(); + for (int i = 0; i < attributeGroups.count(); ++i) { + const XsdAttributeGroup::Ptr attributeGroup = attributeGroups.at(i); + const XsdAttributeUse::List uses = attributeGroup->attributeUses(); + + // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 4) + XsdAttribute::Ptr conflictingAttribute; + if (hasDuplicatedAttributeUses(uses, conflictingAttribute)) { + m_context->error(QtXmlPatterns::tr("attribute group %1 contains attribute %2 twice") + .arg(formatKeyword(attributeGroup->displayName(m_namePool))) + .arg(formatKeyword(conflictingAttribute->displayName(m_namePool))), + XsdSchemaContext::XSDError, sourceLocation(attributeGroup)); + return; + } + + // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 5) + if (hasMultipleIDAttributeUses(uses)) { + m_context->error(QtXmlPatterns::tr("attribute group %1 contains two different attributes that both have types derived from %2") + .arg(formatKeyword(attributeGroup->displayName(m_namePool))) + .arg(formatType(m_namePool, BuiltinTypes::xsID)), + XsdSchemaContext::XSDError, sourceLocation(attributeGroup)); + return; + } + + if (hasConstraintIDAttributeUse(uses, conflictingAttribute)) { + m_context->error(QtXmlPatterns::tr("attribute group %1 contains attribute %2 that has value constraint but type that inherits from %3") + .arg(formatKeyword(attributeGroup->displayName(m_namePool))) + .arg(formatKeyword(conflictingAttribute->displayName(m_namePool))) + .arg(formatType(m_namePool, BuiltinTypes::xsID)), + XsdSchemaContext::XSDError, sourceLocation(attributeGroup)); + return; + } + } + + // then the global and anonymous complex types + SchemaType::List types = m_schema->types(); + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = types.at(i); + const XsdAttributeUse::List attributeUses = complexType->attributeUses(); + + // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 4) + XsdAttribute::Ptr conflictingAttribute; + if (hasDuplicatedAttributeUses(attributeUses, conflictingAttribute)) { + m_context->error(QtXmlPatterns::tr("complex type %1 contains attribute %2 twice") + .arg(formatType(m_namePool, complexType)) + .arg(formatKeyword(conflictingAttribute->displayName(m_namePool))), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + + // @see http://www.w3.org/TR/xmlschema11-1/#ct-props-correct 5) + if (hasMultipleIDAttributeUses(attributeUses)) { + m_context->error(QtXmlPatterns::tr("complex type %1 contains two different attributes that both have types derived from %2") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, BuiltinTypes::xsID)), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + + if (hasConstraintIDAttributeUse(attributeUses, conflictingAttribute)) { + m_context->error(QtXmlPatterns::tr("complex type %1 contains attribute %2 that has value constraint but type that inherits from %3") + .arg(formatType(m_namePool, complexType)) + .arg(formatKeyword(conflictingAttribute->displayName(m_namePool))) + .arg(formatType(m_namePool, BuiltinTypes::xsID)), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } +} + +void XsdSchemaChecker::checkElementConstraints() +{ + const QSet elements = collectAllElements(m_schema); + QSetIterator it(elements); + while (it.hasNext()) { + const XsdElement::Ptr element = it.next(); + + // @see http://www.w3.org/TR/xmlschema11-1/#e-props-correct + + // 2 and xs:ID check + if (element->valueConstraint()) { + const SchemaType::Ptr type = element->type(); + + AnySimpleType::Ptr targetType; + if (type->isSimpleType() && type->category() == SchemaType::SimpleTypeAtomic) { + targetType = type; + + // if it is a XsdSimpleType, use its primitive type as target type + if (type->isDefinedBySchema()) + targetType = XsdSimpleType::Ptr(type)->primitiveType(); + + } else if (type->isComplexType() && type->isDefinedBySchema()) { + const XsdComplexType::Ptr complexType(type); + + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + const AnySimpleType::Ptr simpleType = complexType->contentType()->simpleType(); + if (simpleType->category() == AnySimpleType::SimpleTypeAtomic) { + targetType = simpleType; + + if (simpleType->isDefinedBySchema()) + targetType = XsdSimpleType::Ptr(simpleType)->primitiveType(); + } + } else if (complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed) { + m_context->error(QtXmlPatterns::tr("element %1 is not allowed to have a value constraint if its base type is complex") + .arg(formatKeyword(element->displayName(m_namePool))), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + } + if ((targetType == BuiltinTypes::xsID) || BuiltinTypes::xsID->wxsTypeMatches(type)) { + m_context->error(QtXmlPatterns::tr("element %1 is not allowed to have a value constraint if its type is derived from %2") + .arg(formatKeyword(element->displayName(m_namePool))) + .arg(formatType(m_namePool, BuiltinTypes::xsID)), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + + if (type->isSimpleType()) { + QString errorMsg; + if (!isValidValue(element->valueConstraint()->value(), type, errorMsg)) { + m_context->error(QtXmlPatterns::tr("value constraint of element %1 is not of elements type: %2") + .arg(formatKeyword(element->displayName(m_namePool))) + .arg(errorMsg), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + } else if (type->isComplexType() && type->isDefinedBySchema()) { + const XsdComplexType::Ptr complexType(type); + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + QString errorMsg; + if (!isValidValue(element->valueConstraint()->value(), complexType->contentType()->simpleType(), errorMsg)) { + m_context->error(QtXmlPatterns::tr("value constraint of element %1 is not of elements type: %2") + .arg(formatKeyword(element->displayName(m_namePool))) + .arg(errorMsg), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + } + } + } + + if (!element->substitutionGroupAffiliations().isEmpty()) { + // 3 + if (!element->scope() || element->scope()->variety() != XsdElement::Scope::Global) { + m_context->error(QtXmlPatterns::tr("element %1 is not allowed to have substitution group affiliation as it is no global element").arg(formatKeyword(element->displayName(m_namePool))), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + + // 4 + const XsdElement::List affiliations = element->substitutionGroupAffiliations(); + for (int i = 0; i < affiliations.count(); ++i) { + const XsdElement::Ptr affiliation = affiliations.at(i); + + bool derivationOk = false; + if (element->type()->isComplexType() && affiliation->type()->isComplexType()) { + if (XsdSchemaHelper::isComplexDerivationOk(element->type(), affiliation->type(), affiliation->substitutionGroupExclusions())) { + derivationOk = true; + } + } + if (element->type()->isComplexType() && affiliation->type()->isSimpleType()) { + if (XsdSchemaHelper::isComplexDerivationOk(element->type(), affiliation->type(), affiliation->substitutionGroupExclusions())) { + derivationOk = true; + } + } + if (element->type()->isSimpleType()) { + if (XsdSchemaHelper::isSimpleDerivationOk(element->type(), affiliation->type(), affiliation->substitutionGroupExclusions())) { + derivationOk = true; + } + } + + if (!derivationOk) { + m_context->error(QtXmlPatterns::tr("type of element %1 cannot be derived from type of substitution group affiliation").arg(formatKeyword(element->displayName(m_namePool))), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + } + + // 5 was checked in XsdSchemaResolver::resolveSubstitutionGroupAffiliations() already + } + } +} + +void XsdSchemaChecker::checkAttributeConstraints() +{ + // all global attributes + XsdAttribute::List attributes = m_schema->attributes(); + + // and all local attributes + SchemaType::List types = m_schema->types(); + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + if (!types.at(i)->isComplexType() || !types.at(i)->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType(types.at(i)); + const XsdAttributeUse::List uses = complexType->attributeUses(); + for (int j = 0; j < uses.count(); ++j) + attributes.append(uses.at(j)->attribute()); + } + + for (int i = 0; i < attributes.count(); ++i) { + const XsdAttribute::Ptr attribute = attributes.at(i); + + if (!attribute->valueConstraint()) + continue; + + if (attribute->valueConstraint()->variety() == XsdAttribute::ValueConstraint::Default || attribute->valueConstraint()->variety() == XsdAttribute::ValueConstraint::Fixed) { + const SchemaType::Ptr type = attribute->type(); + + QString errorMsg; + if (!isValidValue(attribute->valueConstraint()->value(), attribute->type(), errorMsg)) { + m_context->error(QtXmlPatterns::tr("value constraint of attribute %1 is not of attributes type: %2") + .arg(formatKeyword(attribute->displayName(m_namePool))) + .arg(errorMsg), + XsdSchemaContext::XSDError, sourceLocation(attribute)); + return; + } + } + + if (BuiltinTypes::xsID->wxsTypeMatches(attribute->type())) { + m_context->error(QtXmlPatterns::tr("attribute %1 has value constraint but has type derived from %2") + .arg(formatKeyword(attribute->displayName(m_namePool))) + .arg(formatType(m_namePool, BuiltinTypes::xsID)), + XsdSchemaContext::XSDError, sourceLocation(attribute)); + return; + } + } +} + +bool XsdSchemaChecker::isValidValue(const QString &stringValue, const AnySimpleType::Ptr &type, QString &errorMsg) const +{ + if (BuiltinTypes::xsAnySimpleType->name(m_namePool) == type->name(m_namePool)) + return true; // no need to check xs:anyType content + + const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(type, m_context); + const QString actualValue = XsdTypeChecker::normalizedValue(stringValue, facets); + + const XsdTypeChecker checker(m_context, QVector(), QSourceLocation(QUrl(QLatin1String("http://dummy.org")), 1, 1)); + return checker.isValidString(actualValue, type, errorMsg); +} + +void XsdSchemaChecker::checkAttributeUseConstraints() +{ + XsdComplexType::List complexTypes; + + SchemaType::List types = m_schema->types(); + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + if (type->isComplexType() && type->isDefinedBySchema()) + complexTypes.append(XsdComplexType::Ptr(type)); + } + + for (int i = 0; i < complexTypes.count(); ++i) { + const XsdComplexType::Ptr complexType(complexTypes.at(i)); + const SchemaType::Ptr baseType = complexType->wxsSuperType(); + if (!baseType || !baseType->isComplexType() || !baseType->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexBaseType(baseType); + + const XsdAttributeUse::List attributeUses = complexType->attributeUses(); + QHash lookupHash; + for (int j = 0; j < attributeUses.count(); ++j) + lookupHash.insert(attributeUses.at(j)->attribute()->name(m_namePool), attributeUses.at(j)); + + const XsdAttributeUse::List baseAttributeUses = complexBaseType->attributeUses(); + for (int j = 0; j < baseAttributeUses.count(); ++j) { + const XsdAttributeUse::Ptr baseAttributeUse = baseAttributeUses.at(j); + + if (lookupHash.contains(baseAttributeUse->attribute()->name(m_namePool))) { + const XsdAttributeUse::Ptr attributeUse = lookupHash.value(baseAttributeUse->attribute()->name(m_namePool)); + + if (baseAttributeUse->useType() == XsdAttributeUse::RequiredUse) { + if (attributeUse->useType() == XsdAttributeUse::OptionalUse || attributeUse->useType() == XsdAttributeUse::ProhibitedUse) { + m_context->error(QtXmlPatterns::tr("%1 attribute in derived complex type must be %2 like in base type") + .arg(formatAttribute("use")) + .arg(formatData("required")), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } + + if (baseAttributeUse->valueConstraint()) { + if (baseAttributeUse->valueConstraint()->variety() == XsdAttributeUse::ValueConstraint::Fixed) { + if (!attributeUse->valueConstraint()) { + m_context->error(QtXmlPatterns::tr("attribute %1 in derived complex type must have %2 value constraint like in base type") + .arg(formatKeyword(attributeUse->attribute()->displayName(m_namePool))) + .arg(formatData("fixed")), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } else { + if (attributeUse->valueConstraint()->variety() == XsdAttributeUse::ValueConstraint::Fixed) { + const XsdTypeChecker checker(m_context, QVector(), sourceLocation(complexType)); + if (!checker.valuesAreEqual(attributeUse->valueConstraint()->value(), baseAttributeUse->valueConstraint()->value(), attributeUse->attribute()->type())) { + m_context->error(QtXmlPatterns::tr("attribute %1 in derived complex type must have the same %2 value constraint like in base type") + .arg(formatKeyword(attributeUse->attribute()->displayName(m_namePool))) + .arg(formatData("fixed")), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } else { + m_context->error(QtXmlPatterns::tr("attribute %1 in derived complex type must have %2 value constraint") + .arg(formatKeyword(attributeUse->attribute()->displayName(m_namePool))) + .arg(formatData("fixed")), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } + } + } + } + } + + // additional check that process content property of attribute wildcard in derived type is + // not weaker than the wildcard in base type + const XsdWildcard::Ptr baseWildcard(complexBaseType->attributeWildcard()); + const XsdWildcard::Ptr derivedWildcard(complexType->attributeWildcard()); + if (baseWildcard && derivedWildcard) { + if (!XsdSchemaHelper::checkWildcardProcessContents(baseWildcard, derivedWildcard)) { + m_context->error(QtXmlPatterns::tr("processContent of base wildcard must be weaker than derived wildcard"), XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } + } +} + +void XsdSchemaChecker::checkElementDuplicates() +{ + // check all global types... + SchemaType::List types = m_schema->types(); + + // .. and anonymous types + types << m_schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + const SchemaType::Ptr type = types.at(i); + + if (!type->isComplexType() || !type->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType(type); + + if ((complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) || (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) { + DuplicatedElementMap elementMap; + DuplicatedWildcardMap wildcardMap; + + checkElementDuplicates(complexType->contentType()->particle(), elementMap, wildcardMap); + } + } +} + +void XsdSchemaChecker::checkElementDuplicates(const XsdParticle::Ptr &particle, DuplicatedElementMap &elementMap, DuplicatedWildcardMap &wildcardMap) +{ + if (particle->term()->isElement()) { + const XsdElement::Ptr element(particle->term()); + + if (elementMap.contains(element->name(m_namePool))) { + if (element->type() != elementMap.value(element->name(m_namePool))) { + m_context->error(QtXmlPatterns::tr("element %1 exists twice with different types") + .arg(formatKeyword(element->displayName(m_namePool))), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + } else { + elementMap.insert(element->name(m_namePool), element->type()); + } + + // check substitution group affiliation + const XsdElement::List substElements = element->substitutionGroupAffiliations(); + for (int i = 0; i < substElements.count(); ++i) { + const XsdElement::Ptr substElement = substElements.at(i); + if (elementMap.contains(substElement->name(m_namePool))) { + if (substElement->type() != elementMap.value(substElement->name(m_namePool))) { + m_context->error(QtXmlPatterns::tr("element %1 exists twice with different types") + .arg(formatKeyword(substElement->displayName(m_namePool))), + XsdSchemaContext::XSDError, sourceLocation(element)); + return; + } + } else { + elementMap.insert(substElement->name(m_namePool), substElement->type()); + } + } + } else if (particle->term()->isModelGroup()) { + const XsdModelGroup::Ptr group(particle->term()); + const XsdParticle::List particles = group->particles(); + for (int i = 0; i < particles.count(); ++i) + checkElementDuplicates(particles.at(i), elementMap, wildcardMap); + } else if (particle->term()->isWildcard()) { + const XsdWildcard::Ptr wildcard(particle->term()); + + bool error = false; + if (!wildcardMap.contains(wildcard->namespaceConstraint()->variety())) { + if (!wildcardMap.isEmpty()) + error = true; + } else { + const XsdWildcard::Ptr otherWildcard = wildcardMap.value(wildcard->namespaceConstraint()->variety()); + if ((wildcard->processContents() != otherWildcard->processContents()) || (wildcard->namespaceConstraint()->namespaces() != otherWildcard->namespaceConstraint()->namespaces())) + error = true; + } + + if (error) { + m_context->error(QtXmlPatterns::tr("particle contains non-deterministic wildcards"), XsdSchemaContext::XSDError, sourceLocation(wildcard)); + return; + } else { + wildcardMap.insert(wildcard->namespaceConstraint()->variety(), wildcard); + } + } +} + +QSourceLocation XsdSchemaChecker::sourceLocation(const NamedSchemaComponent::Ptr &component) const +{ + if (m_componentLocationHash.contains(component)) { + return m_componentLocationHash.value(component); + } else { + QSourceLocation location; + location.setLine(1); + location.setColumn(1); + location.setUri(QString::fromLatin1("dummyUri")); + + return location; + } +} + +QSourceLocation XsdSchemaChecker::sourceLocationForType(const SchemaType::Ptr &type) const +{ + if (type->isSimpleType()) + return sourceLocation(XsdSimpleType::Ptr(type)); + else + return sourceLocation(XsdComplexType::Ptr(type)); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp new file mode 100644 index 0000000..98c4c63 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp @@ -0,0 +1,276 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +bool XsdSchemaChecker::hasDuplicatedAttributeUses(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const +{ + const int length = list.count(); + + for (int i = 0; i < length; ++i) { + for (int j = 0; j < length; ++j) { + if (i == j) + continue; + + if (list.at(i)->attribute()->name(m_namePool) == list.at(j)->attribute()->name(m_namePool)) { + conflictingAttribute = list.at(i)->attribute(); + return true; + } + } + } + + return false; +} + +bool XsdSchemaChecker::hasMultipleIDAttributeUses(const XsdAttributeUse::List &list) const +{ + const int length = list.count(); + + bool hasIdDerivedAttribute = false; + for (int i = 0; i < length; ++i) { + if (BuiltinTypes::xsID->wxsTypeMatches(list.at(i)->attribute()->type())) { + if (hasIdDerivedAttribute) + return true; + else + hasIdDerivedAttribute = true; + } + } + + return false; +} + +bool XsdSchemaChecker::hasConstraintIDAttributeUse(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const +{ + const int length = list.count(); + + for (int i = 0; i < length; ++i) { + const XsdAttributeUse::Ptr attributeUse(list.at(i)); + if (BuiltinTypes::xsID->wxsTypeMatches(attributeUse->attribute()->type())) { + if (attributeUse->valueConstraint()) { + conflictingAttribute = attributeUse->attribute(); + return true; + } + } + } + + return false; +} + +bool XsdSchemaChecker::particleEqualsRecursively(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &otherParticle) const +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-particle-extend + //TODO: find out what 'properties' of a particle should be checked here... + + if (particle->minimumOccurs() != otherParticle->minimumOccurs()) + return false; + + if (particle->maximumOccursUnbounded() != otherParticle->maximumOccursUnbounded()) + return false; + + if (particle->maximumOccurs() != otherParticle->maximumOccurs()) + return false; + + const XsdTerm::Ptr term = particle->term(); + const XsdTerm::Ptr otherTerm = otherParticle->term(); + + if (term->isElement() && !(otherTerm->isElement())) + return false; + + if (term->isModelGroup() && !(otherTerm->isModelGroup())) + return false; + + if (term->isWildcard() && !(otherTerm->isWildcard())) + return false; + + if (term->isElement()) { + const XsdElement::Ptr element = term; + const XsdElement::Ptr otherElement = otherTerm; + + if (element->name(m_namePool) != otherElement->name(m_namePool)) + return false; + + if (element->type()->name(m_namePool) != otherElement->type()->name(m_namePool)) + return false; + } + + if (term->isModelGroup()) { + const XsdModelGroup::Ptr group = term; + const XsdModelGroup::Ptr otherGroup = otherTerm; + + if (group->particles().count() != otherGroup->particles().count()) + return false; + + for (int i = 0; i < group->particles().count(); ++i) { + if (!particleEqualsRecursively(group->particles().at(i), otherGroup->particles().at(i))) + return false; + } + } + + if (term->isWildcard()) { + } + + return true; +} + +bool XsdSchemaChecker::isValidParticleExtension(const XsdParticle::Ptr &extension, const XsdParticle::Ptr &base) const +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-particle-extend + + // 1 + if (extension == base) + return true; + + // 2 + if (extension->minimumOccurs() == 1 && extension->maximumOccurs() == 1 && extension->maximumOccursUnbounded() == false) { + if (extension->term()->isModelGroup()) { + const XsdModelGroup::Ptr modelGroup = extension->term(); + if (modelGroup->compositor() == XsdModelGroup::SequenceCompositor) { + if (particleEqualsRecursively(modelGroup->particles().first(), base)) + return true; + } + } + } + + // 3 + if (extension->minimumOccurs() == base->minimumOccurs()) { // 3.1 + if (extension->term()->isModelGroup() && base->term()->isModelGroup()) { + const XsdModelGroup::Ptr extensionGroup(extension->term()); + const XsdModelGroup::Ptr baseGroup(base->term()); + + if (extensionGroup->compositor() == XsdModelGroup::AllCompositor && baseGroup->compositor() == XsdModelGroup::AllCompositor) { + const XsdParticle::List extensionParticles = extensionGroup->particles(); + const XsdParticle::List baseParticles = baseGroup->particles(); + for (int i = 0; i < baseParticles.count() && i < extensionParticles.count(); ++i) { + if (baseParticles.at(i) != extensionParticles.at(i)) + return false; + } + } + } + } + + return false; +} + +QSet collectAllElements(const XsdParticle::Ptr &particle) +{ + QSet elements; + + const XsdTerm::Ptr term(particle->term()); + if (term->isElement()) { + elements.insert(XsdElement::Ptr(term)); + } else if (term->isModelGroup()) { + const XsdModelGroup::Ptr group(term); + + for (int i = 0; i < group->particles().count(); ++i) + elements.unite(collectAllElements(group->particles().at(i))); + } + + return elements; +} + +QSet collectAllElements(const XsdSchema::Ptr &schema) +{ + QSet elements; + + // collect global elements + const XsdElement::List elementList = schema->elements(); + for (int i = 0; i < elementList.count(); ++i) + elements.insert(elementList.at(i)); + + // collect all elements from global groups + const XsdModelGroup::List groupList = schema->elementGroups(); + for (int i = 0; i < groupList.count(); ++i) { + const XsdModelGroup::Ptr group(groupList.at(i)); + + for (int j = 0; j < group->particles().count(); ++j) + elements.unite(collectAllElements(group->particles().at(j))); + } + + // collect all elements from complex type definitions + SchemaType::List types; + types << schema->types() << schema->anonymousTypes(); + + for (int i = 0; i < types.count(); ++i) { + if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema()) { + const XsdComplexType::Ptr complexType(types.at(i)); + if (complexType->contentType()->particle()) + elements.unite(collectAllElements(complexType->contentType()->particle())); + } + } + + return elements; +} + +bool XsdSchemaChecker::elementSequenceAccepted(const XsdModelGroup::Ptr &sequence, const XsdParticle::Ptr &particle) const +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cvc-accept + + if (particle->term()->isWildcard()) { // 1 + const XsdWildcard::Ptr wildcard(particle->term()); + + // 1.1 + if ((unsigned int)sequence->particles().count() < particle->minimumOccurs()) + return false; + + // 1.2 + if (!particle->maximumOccursUnbounded()) { + if ((unsigned int)sequence->particles().count() > particle->maximumOccurs()) + return false; + } + + // 1.3 + const XsdParticle::List particles(sequence->particles()); + for (int i = 0; i < particles.count(); ++i) { + if (particles.at(i)->term()->isElement()) { + if (!XsdSchemaHelper::wildcardAllowsExpandedName(XsdElement::Ptr(particles.at(i)->term())->name(m_namePool), wildcard, m_namePool)) + return false; + } + } + } else if (particle->term()->isElement()) { // 2 + const XsdElement::Ptr element(particle->term()); + + // 2.1 + if ((unsigned int)sequence->particles().count() < particle->minimumOccurs()) + return false; + + // 2.2 + if (!particle->maximumOccursUnbounded()) { + if ((unsigned int)sequence->particles().count() > particle->maximumOccurs()) + return false; + } + + // 2.3 + const XsdParticle::List particles(sequence->particles()); + for (int i = 0; i < particles.count(); ++i) { + bool isValid = false; + if (particles.at(i)->term()->isElement()) { + const XsdElement::Ptr seqElement(particles.at(i)->term()); + + // 2.3.1 + if (element->name(m_namePool) == seqElement->name(m_namePool)) + isValid = true; + + // 2.3.2 + if (element->scope() && element->scope()->variety() == XsdElement::Scope::Global) { + if (!(element->disallowedSubstitutions() & NamedSchemaComponent::SubstitutionConstraint)) { + //TODO: continue + } + } + } + } + } + + return true; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemachecker_p.h b/src/xmlpatterns/schema/qxsdschemachecker_p.h new file mode 100644 index 0000000..65fb87f --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemachecker_p.h @@ -0,0 +1,254 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaChecker_H +#define Patternist_XsdSchemaChecker_H + +#include "qschematype_p.h" +#include "qxsdattribute_p.h" +#include "qxsdattributegroup_p.h" +#include "qxsdelement_p.h" +#include "qxsdmodelgroup_p.h" +#include "qxsdnotation_p.h" +#include "qxsdschema_p.h" +#include "qxsdsimpletype_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + class XsdSchemaContext; + class XsdSchemaParserContext; + + /** + * @short Encapsulates the checking of schema valitity after reference resolving has finished. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchemaChecker : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Creates a new schema checker. + * + * @param context The context that is used for customization. + * @param parserContext The context that contains all the data structures. + */ + XsdSchemaChecker(const QExplicitlySharedDataPointer &context, const XsdSchemaParserContext *parserContext); + + /** + * Destroys the schema checker. + */ + ~XsdSchemaChecker(); + + /** + * Starts a basic check process. + * + * This check only validates the basic super type inheritance + * of simple and complex types. + */ + void basicCheck(); + + /** + * Starts the real check process. + */ + void check(); + + /** + * Checks the constraining facets of all global and anonymous simple types for validity. + */ + void checkConstrainingFacets(); + + /** + * Adds the component location hash, so the checker is able to report meaning full + * error messages. + */ + void addComponentLocationHash(const QHash &hash); + + private: + void checkSimpleRestrictionBaseType(); + + /** + * Checks that no simple or complex type inherits itself. + */ + void checkBasicCircularInheritances(); + + /** + * Checks the advanced circular inheritance. + */ + void checkCircularInheritances(); + + /** + * Checks for inheritance restrictions given by final or finalDefault + * attributes. + */ + void checkInheritanceRestrictions(); + + /** + * Checks for various constraints for simple types defined by schema. + */ + void checkBasicSimpleTypeConstraints(); + void checkSimpleTypeConstraints(); + + /** + * Checks for various constraints for complex types defined by schema. + */ + void checkBasicComplexTypeConstraints(); + void checkComplexTypeConstraints(); + + /** + * Checks for list and union derivation restrictions given by final or finalDefault + * attributes. + */ + void checkSimpleDerivationRestrictions(); + + /** + * Checks the set of constraining @p facets that belongs to @p simpleType for validity. + */ + void checkConstrainingFacets(const XsdFacet::Hash &facets, const XsdSimpleType::Ptr &simpleType); + + /** + * Checks for duplicated attribute uses (attributes with the same name) inside a complex type. + */ + void checkDuplicatedAttributeUses(); + + /** + * Check the element constraints. + */ + void checkElementConstraints(); + + /** + * Check the attribute constraints. + */ + void checkAttributeConstraints(); + + /** + * Check the attribute use constraints. + */ + void checkAttributeUseConstraints(); + + /** + * A map used to find duplicated elements inside a model group. + */ + typedef QHash DuplicatedElementMap; + + /** + * A map used to find duplicated wildcards inside a model group. + */ + typedef QHash DuplicatedWildcardMap; + + /** + * Check for duplicated elements and element wildcards in all complex type particles. + */ + void checkElementDuplicates(); + + /** + * Check for duplicated elements and element wildcards in the given @p particle. + * + * @param particle The particle to check. + * @param elementMap A map to find the duplicated elements. + * @param wildcardMap A map to find the duplicated element wildcards. + */ + void checkElementDuplicates(const XsdParticle::Ptr &particle, DuplicatedElementMap &elementMap, DuplicatedWildcardMap &wildcardMap); + + /** + * Setup fast lookup list for allowed facets of atomic simple types. + */ + void setupAllowedAtomicFacets(); + + /** + * Returns the source location of the given schema @p component or a dummy + * source location if the component is not found in the component location hash. + */ + QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr &component) const; + + /** + * Returns the source location of the given schema @p type or a dummy + * source location if the type is not found in the component location hash. + */ + QSourceLocation sourceLocationForType(const SchemaType::Ptr &type) const; + + /** + * Checks that the string @p value is valid according the value space of @p type + * for the given @p component. + */ + bool isValidValue(const QString &value, const AnySimpleType::Ptr &type, QString &errorMsg) const; + + /** + * Returns the list of facets for the given @p type. + */ + XsdFacet::Hash facetsForType(const SchemaType::Ptr &type) const; + + /** + * Returns whether the given @p list of attribute uses contains two (or more) attribute + * uses that point to attributes with the same name. @p conflictingAttribute + * will contain the conflicting attribute in that case. + */ + bool hasDuplicatedAttributeUses(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const; + + /** + * Returns whether the given @p list of attribute uses contains two (or more) attribute + * uses that have a type inherited by xs:ID. + */ + bool hasMultipleIDAttributeUses(const XsdAttributeUse::List &list) const; + + /** + * Returns whether the given @p list of attribute uses contains an attribute + * uses that has a type inherited by xs:ID with a value constraint. @p conflictingAttribute + * will contain the conflicting attribute in that case. + */ + bool hasConstraintIDAttributeUse(const XsdAttributeUse::List &list, XsdAttribute::Ptr &conflictingAttribute) const; + + /** + * Checks whether the @p particle equals the @p otherParticle recursively. + */ + bool particleEqualsRecursively(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &otherParticle) const; + + /** + * Checks whether the @p extension particle is a valid extension of the @p base particle. + */ + bool isValidParticleExtension(const XsdParticle::Ptr &extension, const XsdParticle::Ptr &base) const; + + /** + * Checks whether the @p sequence of elements is accepted by the given @p particle. + */ + bool elementSequenceAccepted(const XsdModelGroup::Ptr &sequence, const XsdParticle::Ptr &particle) const; + + QExplicitlySharedDataPointer m_context; + NamePool::Ptr m_namePool; + XsdSchema::Ptr m_schema; + QHash > m_allowedAtomicFacets; + QHash m_componentLocationHash; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemachecker_setup.cpp b/src/xmlpatterns/schema/qxsdschemachecker_setup.cpp new file mode 100644 index 0000000..b027129 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemachecker_setup.cpp @@ -0,0 +1,287 @@ + +#include "qxsdschemachecker_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdSchemaChecker::setupAllowedAtomicFacets() +{ + // string + { + QSet facets; + facets << XsdFacet::Length + << XsdFacet::MinimumLength + << XsdFacet::MaximumLength + << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsString->name(m_namePool), facets); + } + + // boolean + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::WhiteSpace + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsBoolean->name(m_namePool), facets); + } + + // float + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsFloat->name(m_namePool), facets); + } + + // double + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsDouble->name(m_namePool), facets); + } + + // decimal + { + QSet facets; + facets << XsdFacet::TotalDigits + << XsdFacet::FractionDigits + << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsDecimal->name(m_namePool), facets); + } + + // duration + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsDuration->name(m_namePool), facets); + } + + // dateTime + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsDateTime->name(m_namePool), facets); + } + + // time + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsTime->name(m_namePool), facets); + } + + // date + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsDate->name(m_namePool), facets); + } + + // gYearMonth + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsGYearMonth->name(m_namePool), facets); + } + + // gYear + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsGYear->name(m_namePool), facets); + } + + // gMonthDay + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsGMonthDay->name(m_namePool), facets); + } + + // gDay + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsGDay->name(m_namePool), facets); + } + + // gMonth + { + QSet facets; + facets << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::MaximumInclusive + << XsdFacet::MaximumExclusive + << XsdFacet::MinimumInclusive + << XsdFacet::MinimumExclusive + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsGMonth->name(m_namePool), facets); + } + + // hexBinary + { + QSet facets; + facets << XsdFacet::Length + << XsdFacet::MinimumLength + << XsdFacet::MaximumLength + << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsHexBinary->name(m_namePool), facets); + } + + // base64Binary + { + QSet facets; + facets << XsdFacet::Length + << XsdFacet::MinimumLength + << XsdFacet::MaximumLength + << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsBase64Binary->name(m_namePool), facets); + } + + // anyURI + { + QSet facets; + facets << XsdFacet::Length + << XsdFacet::MinimumLength + << XsdFacet::MaximumLength + << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsAnyURI->name(m_namePool), facets); + } + + // QName + { + QSet facets; + facets << XsdFacet::Length + << XsdFacet::MinimumLength + << XsdFacet::MaximumLength + << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsQName->name(m_namePool), facets); + } + + // NOTATION + { + QSet facets; + facets << XsdFacet::Length + << XsdFacet::MinimumLength + << XsdFacet::MaximumLength + << XsdFacet::Pattern + << XsdFacet::Enumeration + << XsdFacet::WhiteSpace + << XsdFacet::Assertion; + + m_allowedAtomicFacets.insert(BuiltinTypes::xsNOTATION->name(m_namePool), facets); + } +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemacontext.cpp b/src/xmlpatterns/schema/qxsdschemacontext.cpp new file mode 100644 index 0000000..57736bd --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemacontext.cpp @@ -0,0 +1,498 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschemacontext_p.h" + +#include "qderivedinteger_p.h" +#include "qderivedstring_p.h" +#include "qxsdschematypesfactory_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaContext::XsdSchemaContext(const NamePool::Ptr &namePool) + : m_namePool(namePool) + , m_networkAccessManager(0) + , m_uriResolver(0) + , m_messageHandler(0) +{ +} + +NamePool::Ptr XsdSchemaContext::namePool() const +{ + return m_namePool; +} + +QUrl XsdSchemaContext::baseURI() const +{ + return m_baseURI; +} + +void XsdSchemaContext::setBaseURI(const QUrl &uri) +{ + m_baseURI = uri; +} + +void XsdSchemaContext::setNetworkAccessManager(QNetworkAccessManager *accessManager) +{ + m_networkAccessManager = accessManager; +} + +QNetworkAccessManager* XsdSchemaContext::networkAccessManager() const +{ + return m_networkAccessManager; +} + +void XsdSchemaContext::setMessageHandler(QAbstractMessageHandler *handler) +{ + m_messageHandler = handler; +} + +QAbstractMessageHandler* XsdSchemaContext::messageHandler() const +{ + return m_messageHandler; +} + +QSourceLocation XsdSchemaContext::locationFor(const SourceLocationReflection *const) const +{ + return QSourceLocation(); +} + +void XsdSchemaContext::setUriResolver(QAbstractUriResolver *uriResolver) +{ + m_uriResolver = uriResolver; +} + +const QAbstractUriResolver* XsdSchemaContext::uriResolver() const +{ + return m_uriResolver; +} + +XsdFacet::Hash XsdSchemaContext::facetsForType(const AnySimpleType::Ptr &type) const +{ + if (type->isDefinedBySchema()) + return XsdSimpleType::Ptr(type)->facets(); + else { + if (m_builtinTypesFacetList.isEmpty()) + m_builtinTypesFacetList = setupBuiltinTypesFacetList(); + + return m_builtinTypesFacetList.value(type); + } +} + +SchemaTypeFactory::Ptr XsdSchemaContext::schemaTypeFactory() const +{ + if (!m_schemaTypeFactory) + m_schemaTypeFactory = SchemaTypeFactory::Ptr(new XsdSchemaTypesFactory(m_namePool)); + + return m_schemaTypeFactory; +} + +QHash XsdSchemaContext::setupBuiltinTypesFacetList() const +{ + QHash hash; + + const XsdFacet::Ptr fixedCollapseWhiteSpace(new XsdFacet()); + fixedCollapseWhiteSpace->setType(XsdFacet::WhiteSpace); + fixedCollapseWhiteSpace->setValue(DerivedString::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse))); + fixedCollapseWhiteSpace->setFixed(true); + + const XsdFacet::Ptr collapseWhiteSpace(new XsdFacet()); + collapseWhiteSpace->setType(XsdFacet::WhiteSpace); + collapseWhiteSpace->setValue(DerivedString::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse))); + collapseWhiteSpace->setFixed(false); + + const XsdFacet::Ptr preserveWhiteSpace(new XsdFacet()); + preserveWhiteSpace->setType(XsdFacet::WhiteSpace); + preserveWhiteSpace->setValue(DerivedString::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Preserve))); + preserveWhiteSpace->setFixed(false); + + const XsdFacet::Ptr replaceWhiteSpace(new XsdFacet()); + replaceWhiteSpace->setType(XsdFacet::WhiteSpace); + replaceWhiteSpace->setValue(DerivedString::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Replace))); + replaceWhiteSpace->setFixed(false); + + const XsdFacet::Ptr fixedZeroFractionDigits(new XsdFacet()); + fixedZeroFractionDigits->setType(XsdFacet::FractionDigits); + fixedZeroFractionDigits->setValue(DerivedInteger::fromValue(m_namePool, 0)); + fixedZeroFractionDigits->setFixed(true); + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsString]; + facets.insert(preserveWhiteSpace->type(), preserveWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsBoolean]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsDecimal]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsFloat]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsDouble]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsDuration]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsDateTime]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsTime]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsDate]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYearMonth]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsGYear]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonthDay]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsGDay]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsGMonth]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsHexBinary]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsBase64Binary]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsAnyURI]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsQName]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsNOTATION]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsNormalizedString]; + facets.insert(replaceWhiteSpace->type(), replaceWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsToken]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsLanguage]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + + const XsdFacet::Ptr pattern(new XsdFacet()); + pattern->setType(XsdFacet::Pattern); + pattern->setMultiValue(AtomicValue::List() << DerivedString::fromLexical(m_namePool, QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"))); + facets.insert(pattern->type(), pattern); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsNMTOKEN]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + + const XsdFacet::Ptr pattern(new XsdFacet()); + pattern->setType(XsdFacet::Pattern); + pattern->setMultiValue(AtomicValue::List() << DerivedString::fromLexical(m_namePool, QString::fromLatin1("\\c+"))); + facets.insert(pattern->type(), pattern); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsName]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + + const XsdFacet::Ptr pattern(new XsdFacet()); + pattern->setType(XsdFacet::Pattern); + pattern->setMultiValue(AtomicValue::List() << DerivedString::fromLexical(m_namePool, QString::fromLatin1("\\i\\c*"))); + facets.insert(pattern->type(), pattern); + } + + const XsdFacet::Ptr ncNamePattern(new XsdFacet()); + { + ncNamePattern->setType(XsdFacet::Pattern); + AtomicValue::List patterns; + patterns << DerivedString::fromLexical(m_namePool, QString::fromLatin1("\\i\\c*")); + patterns << DerivedString::fromLexical(m_namePool, QString::fromLatin1("[\\i-[:]][\\c-[:]]*")); + ncNamePattern->setMultiValue(patterns); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsNCName]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + facets.insert(ncNamePattern->type(), ncNamePattern); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsID]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + facets.insert(ncNamePattern->type(), ncNamePattern); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsIDREF]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + facets.insert(ncNamePattern->type(), ncNamePattern); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsENTITY]; + facets.insert(collapseWhiteSpace->type(), collapseWhiteSpace); + facets.insert(ncNamePattern->type(), ncNamePattern); + } + + const XsdFacet::Ptr integerPattern(new XsdFacet()); + integerPattern->setType(XsdFacet::Pattern); + integerPattern->setMultiValue(AtomicValue::List() << DerivedString::fromLexical(m_namePool, QString::fromLatin1("[\\-+]?[0-9]+"))); + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsInteger]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonPositiveInteger]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("0"))); + facets.insert(maxInclusive->type(), maxInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsNegativeInteger]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("-1"))); + facets.insert(maxInclusive->type(), maxInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsLong]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("9223372036854775807"))); + facets.insert(maxInclusive->type(), maxInclusive); + + const XsdFacet::Ptr minInclusive(new XsdFacet()); + minInclusive->setType(XsdFacet::MinimumInclusive); + minInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("-9223372036854775808"))); + facets.insert(minInclusive->type(), minInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsInt]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("2147483647"))); + facets.insert(maxInclusive->type(), maxInclusive); + + const XsdFacet::Ptr minInclusive(new XsdFacet()); + minInclusive->setType(XsdFacet::MinimumInclusive); + minInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("-2147483648"))); + facets.insert(minInclusive->type(), minInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsShort]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("32767"))); + facets.insert(maxInclusive->type(), maxInclusive); + + const XsdFacet::Ptr minInclusive(new XsdFacet()); + minInclusive->setType(XsdFacet::MinimumInclusive); + minInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("-32768"))); + facets.insert(minInclusive->type(), minInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsByte]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("127"))); + facets.insert(maxInclusive->type(), maxInclusive); + + const XsdFacet::Ptr minInclusive(new XsdFacet()); + minInclusive->setType(XsdFacet::MinimumInclusive); + minInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("-128"))); + facets.insert(minInclusive->type(), minInclusive); + } + + const XsdFacet::Ptr unsignedMinInclusive(new XsdFacet()); + unsignedMinInclusive->setType(XsdFacet::MinimumInclusive); + unsignedMinInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("0"))); + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsNonNegativeInteger]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedLong]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("18446744073709551615"))); + facets.insert(maxInclusive->type(), maxInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedInt]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("4294967295"))); + facets.insert(maxInclusive->type(), maxInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedShort]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("65535"))); + facets.insert(maxInclusive->type(), maxInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsUnsignedByte]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + facets.insert(integerPattern->type(), integerPattern); + facets.insert(unsignedMinInclusive->type(), unsignedMinInclusive); + + const XsdFacet::Ptr maxInclusive(new XsdFacet()); + maxInclusive->setType(XsdFacet::MaximumInclusive); + maxInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("255"))); + facets.insert(maxInclusive->type(), maxInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsPositiveInteger]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + facets.insert(fixedZeroFractionDigits->type(), fixedZeroFractionDigits); + + const XsdFacet::Ptr minInclusive(new XsdFacet()); + minInclusive->setType(XsdFacet::MinimumInclusive); + minInclusive->setValue(DerivedString::fromLexical(m_namePool, QString::fromLatin1("1"))); + facets.insert(minInclusive->type(), minInclusive); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsYearMonthDuration]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + + const XsdFacet::Ptr pattern(new XsdFacet()); + pattern->setType(XsdFacet::Pattern); + pattern->setMultiValue(AtomicValue::List() << DerivedString::fromLexical(m_namePool, QString::fromLatin1("[^DT]*"))); + facets.insert(pattern->type(), pattern); + } + + { + XsdFacet::Hash &facets = hash[BuiltinTypes::xsDayTimeDuration]; + facets.insert(fixedCollapseWhiteSpace->type(), fixedCollapseWhiteSpace); + + const XsdFacet::Ptr pattern(new XsdFacet()); + pattern->setType(XsdFacet::Pattern); + pattern->setMultiValue(AtomicValue::List() << DerivedString::fromLexical(m_namePool, QString::fromLatin1("[^YM]*(T.*)?"))); + facets.insert(pattern->type(), pattern); + } + + return hash; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemacontext_p.h b/src/xmlpatterns/schema/qxsdschemacontext_p.h new file mode 100644 index 0000000..cf52028 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemacontext_p.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaContext_H +#define Patternist_XsdSchemaContext_H + +#include "qnamedschemacomponent_p.h" +#include "qreportcontext_p.h" +#include "qschematypefactory_p.h" +#include "qxsdschematoken_p.h" +#include "qxsdschema_p.h" +#include "qxsdschemachecker_p.h" +#include "qxsdschemaresolver_p.h" + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A context for schema parsing and validation. + * + * This class provides the infrastructure for error reporting and + * network access. Additionally it stores objects that are used by + * both, the parser and the validator. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchemaContext : public ReportContext + { + public: + /** + * A smart pointer wrapping XsdSchemaContext instances. + */ + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Creates a new schema context object. + * + * @param namePool The name pool all names belong to. + */ + XsdSchemaContext(const NamePool::Ptr &namePool); + + /** + * Returns the name pool of the schema context. + */ + virtual NamePool::Ptr namePool() const; + + /** + * Sets the base URI for the main schema. + * + * The main schema is the one that includes resp. imports + * all the other schema files. + */ + virtual void setBaseURI(const QUrl &uri); + + /** + * Returns the base URI of the main schema. + */ + virtual QUrl baseURI() const; + + /** + * Sets the network access manager that should be used + * to access referenced schema definitions. + */ + void setNetworkAccessManager(QNetworkAccessManager *accessManager); + + /** + * Returns the network access manager that is used to + * access referenced schema definitions. + */ + virtual QNetworkAccessManager* networkAccessManager() const; + + /** + * Sets the message @p handler used by the context for error reporting. + */ + void setMessageHandler(QAbstractMessageHandler *handler); + + /** + * Returns the message handler used by the context for + * error reporting. + */ + virtual QAbstractMessageHandler* messageHandler() const; + + /** + * Always returns an empty source location. + */ + virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const; + + /** + * Sets the uri @p resolver that is used for resolving URIs in the + * schema parser. + */ + void setUriResolver(QAbstractUriResolver *resolver); + + /** + * Returns the uri resolver that is used for resolving URIs in the + * schema parser. + */ + virtual const QAbstractUriResolver* uriResolver() const; + + /** + * Returns the list of facets for the given simple @p type. + */ + XsdFacet::Hash facetsForType(const AnySimpleType::Ptr &type) const; + + /** + * Returns a schema type factory that contains some predefined schema types. + */ + SchemaTypeFactory::Ptr schemaTypeFactory() const; + + /** + * The following variables should not be accessed directly. + */ + mutable SchemaTypeFactory::Ptr m_schemaTypeFactory; + mutable QHash m_builtinTypesFacetList; + + private: + QHash setupBuiltinTypesFacetList() const; + + NamePool::Ptr m_namePool; + QNetworkAccessManager* m_networkAccessManager; + QUrl m_baseURI; + QAbstractUriResolver* m_uriResolver; + QAbstractMessageHandler* m_messageHandler; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemadebugger.cpp b/src/xmlpatterns/schema/qxsdschemadebugger.cpp new file mode 100644 index 0000000..850192c --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemadebugger.cpp @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschemadebugger_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaDebugger::XsdSchemaDebugger(const NamePool::Ptr &namePool) + : m_namePool(namePool) +{ +} + +void XsdSchemaDebugger::dumpParticle(const XsdParticle::Ptr &particle, int level) +{ + QString prefix; prefix.fill(QLatin1Char(' '), level); + + qDebug("%s min=%s max=%s", qPrintable(prefix), qPrintable(QString::number(particle->minimumOccurs())), + qPrintable(particle->maximumOccursUnbounded() ? QLatin1String("unbounded") : QString::number(particle->maximumOccurs()))); + + if (particle->term()->isElement()) { + qDebug("%selement (%s)", qPrintable(prefix), qPrintable(XsdElement::Ptr(particle->term())->displayName(m_namePool))); + } else if (particle->term()->isModelGroup()) { + const XsdModelGroup::Ptr group(particle->term()); + if (group->compositor() == XsdModelGroup::SequenceCompositor) { + qDebug("%ssequence", qPrintable(prefix)); + } else if (group->compositor() == XsdModelGroup::AllCompositor) { + qDebug("%sall", qPrintable(prefix)); + } else if (group->compositor() == XsdModelGroup::ChoiceCompositor) { + qDebug("%schoice", qPrintable(prefix)); + } + + for (int i = 0; i < group->particles().count(); ++i) + dumpParticle(group->particles().at(i), level + 5); + } else if (particle->term()->isWildcard()) { + XsdWildcard::Ptr wildcard(particle->term()); + qDebug("%swildcard (process=%d)", qPrintable(prefix), wildcard->processContents()); + } +} + +void XsdSchemaDebugger::dumpInheritance(const SchemaType::Ptr &type, int level) +{ + QString prefix; prefix.fill(QLatin1Char(' '), level); + qDebug("%s-->%s", qPrintable(prefix), qPrintable(type->displayName(m_namePool))); + if (type->wxsSuperType()) + dumpInheritance(type->wxsSuperType(), ++level); +} + +void XsdSchemaDebugger::dumpWildcard(const XsdWildcard::Ptr &wildcard) +{ + QVector varietyNames; + varietyNames.append(QLatin1String("Any")); + varietyNames.append(QLatin1String("Enumeration")); + varietyNames.append(QLatin1String("Not")); + + QVector processContentsNames; + processContentsNames.append(QLatin1String("Strict")); + processContentsNames.append(QLatin1String("Lax")); + processContentsNames.append(QLatin1String("Skip")); + + qDebug(" processContents: %s", qPrintable(processContentsNames.at((int)wildcard->processContents()))); + const XsdWildcard::NamespaceConstraint::Ptr constraint = wildcard->namespaceConstraint(); + qDebug(" variety: %s", qPrintable(varietyNames.at((int)constraint->variety()))); + if (constraint->variety() != XsdWildcard::NamespaceConstraint::Any) + qDebug() << " namespaces:" << constraint->namespaces(); +} + +void XsdSchemaDebugger::dumpType(const SchemaType::Ptr &type) +{ + if (type->isComplexType()) { + const XsdComplexType::Ptr complexType(type); + qDebug("\n+++ Complex Type +++"); + qDebug("Name: %s (abstract: %s)", qPrintable(complexType->displayName(m_namePool)), complexType->isAbstract() ? "yes" : "no"); + if (complexType->wxsSuperType()) + qDebug(" base type: %s", qPrintable(complexType->wxsSuperType()->displayName(m_namePool))); + else + qDebug(" base type: (none)"); + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty) + qDebug(" content type: empty"); + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) + qDebug(" content type: simple"); + if (complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) + qDebug(" content type: element-only"); + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed) + qDebug(" content type: mixed"); + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + if (complexType->contentType()->simpleType()) + qDebug(" simple type: %s", qPrintable(complexType->contentType()->simpleType()->displayName(m_namePool))); + else + qDebug(" simple type: (none)"); + } + + const XsdAttributeUse::List uses = complexType->attributeUses(); + qDebug(" %d attributes", uses.count()); + for (int i = 0; i < uses.count(); ++i) { + qDebug(" attr: %s", qPrintable(uses.at(i)->attribute()->displayName(m_namePool))); + } + qDebug(" has attribute wildcard: %s", complexType->attributeWildcard() ? "yes" : "no"); + if (complexType->attributeWildcard()) { + dumpWildcard(complexType->attributeWildcard()); + } + + if (complexType->contentType()->particle()) { + dumpParticle(complexType->contentType()->particle(), 5); + } + } else { + qDebug("\n+++ Simple Type +++"); + qDebug("Name: %s", qPrintable(type->displayName(m_namePool))); + if (type->isDefinedBySchema()) { + const XsdSimpleType::Ptr simpleType(type); + if (simpleType->primitiveType()) + qDebug(" primitive type: %s", qPrintable(simpleType->primitiveType()->displayName(m_namePool))); + else + qDebug(" primitive type: (none)"); + } + dumpInheritance(type, 0); + } +} + + +void XsdSchemaDebugger::dumpElement(const XsdElement::Ptr &element) +{ + QStringList disallowedSubstGroup; + if (element->disallowedSubstitutions() & XsdElement::RestrictionConstraint) + disallowedSubstGroup << QLatin1String("restriction"); + if (element->disallowedSubstitutions() & XsdElement::ExtensionConstraint) + disallowedSubstGroup << QLatin1String("extension"); + if (element->disallowedSubstitutions() & XsdElement::SubstitutionConstraint) + disallowedSubstGroup << QLatin1String("substitution"); + + + qDebug() << "Name:" << element->displayName(m_namePool); + qDebug() << "IsAbstract:" << (element->isAbstract() ? "yes" : "no"); + qDebug() << "Type:" << element->type()->displayName(m_namePool); + qDebug() << "DisallowedSubstitutionGroups:" << disallowedSubstGroup.join(QLatin1String("' ")); +} + +void XsdSchemaDebugger::dumpAttribute(const XsdAttribute::Ptr &attribute) +{ + qDebug() << "Name:" << attribute->displayName(m_namePool); + qDebug() << "Type:" << attribute->type()->displayName(m_namePool); +} + +void XsdSchemaDebugger::dumpSchema(const XsdSchema::Ptr &schema) +{ + qDebug() << "------------------------------ Schema -------------------------------"; + + // elements + { + qDebug() << "Global Elements:"; + const XsdElement::List elements = schema->elements(); + for (int i = 0; i < elements.count(); ++i) { + dumpElement(elements.at(i)); + } + } + + // attributes + { + qDebug() << "Global Attributes:"; + const XsdAttribute::List attributes = schema->attributes(); + for (int i = 0; i < attributes.count(); ++i) { + dumpAttribute(attributes.at(i)); + } + } + + // types + { + qDebug() << "Global Types:"; + const SchemaType::List types = schema->types(); + for (int i = 0; i < types.count(); ++i) { + dumpType(types.at(i)); + } + } + + // anonymous types + { + qDebug() << "Anonymous Types:"; + const SchemaType::List types = schema->anonymousTypes(); + for (int i = 0; i < types.count(); ++i) { + dumpType(types.at(i)); + } + } + + qDebug() << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemadebugger_p.h b/src/xmlpatterns/schema/qxsdschemadebugger_p.h new file mode 100644 index 0000000..8c12f0f --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemadebugger_p.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaDebugger_H +#define Patternist_XsdSchemaDebugger_H + +#include "qxsdschema_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * A helper class to print out the structure of a compiled schema. + */ + class XsdSchemaDebugger + { + public: + /** + * Creates a new schema debugger. + * + * @param namePool The name pool that the schema uses. + */ + XsdSchemaDebugger(const NamePool::Ptr &namePool); + + /** + * Dumps the structure of the given @p particle. + * + * @param particle The particle to dump. + * @param level The level of indention. + */ + void dumpParticle(const XsdParticle::Ptr &particle, int level = 0); + + /** + * Dumps the inheritance path of the given @p type. + * + * @param type The type to dump. + * @param level The level of indention. + */ + void dumpInheritance(const SchemaType::Ptr &type, int level = 0); + + /** + * Dumps the structure of the given @p wildcard. + */ + void dumpWildcard(const XsdWildcard::Ptr &wildcard); + + /** + * Dumps the structure of the given @p type. + */ + void dumpType(const SchemaType::Ptr &type); + + /** + * Dumps the structure of the given @p element. + */ + void dumpElement(const XsdElement::Ptr &element); + + /** + * Dumps the structure of the given @p attribute. + */ + void dumpAttribute(const XsdAttribute::Ptr &attribute); + + /** + * Dumps the structure of the complete @p schema. + */ + void dumpSchema(const XsdSchema::Ptr &schema); + + private: + NamePool::Ptr m_namePool; + }; + +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp new file mode 100644 index 0000000..752af89 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp @@ -0,0 +1,791 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschemahelper_p.h" + +#include "qbuiltintypes_p.h" +#include "qvaluefactory_p.h" +#include "qxsdcomplextype_p.h" +#include "qxsdmodelgroup_p.h" +#include "qxsdsimpletype_p.h" +#include "qxsdtypechecker_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +/* + * Calculates the effective total range minimum of the given @p particle as + * described by the algorithm in the schema spec. + */ +static inline unsigned int effectiveTotalRangeMinimum(const XsdParticle::Ptr &particle) +{ + const XsdModelGroup::Ptr group = particle->term(); + + if (group->compositor() == XsdModelGroup::ChoiceCompositor) { + // @see http://www.w3.org/TR/xmlschema11-1/# cos-choice-range + + int minValue = -1; + + const XsdParticle::List particles = group->particles(); + if (particles.isEmpty()) + minValue = 0; + + for (int i = 0; i < particles.count(); ++i) { + const XsdParticle::Ptr particle = particles.at(i); + + if (particle->term()->isElement() || particle->term()->isWildcard()) { + if (minValue == -1) { + minValue = particle->minimumOccurs(); + } else { + minValue = qMin((unsigned int)minValue, particle->minimumOccurs()); + } + } else if (particle->term()->isModelGroup()) { + if (minValue == -1) { + minValue = effectiveTotalRangeMinimum(particle); + } else { + minValue = qMin((unsigned int)minValue, effectiveTotalRangeMinimum(particle)); + } + } + } + + return (particle->minimumOccurs() * minValue); + + } else { + // @see http://www.w3.org/TR/xmlschema11-1/# cos-seq-range + + unsigned int sum = 0; + const XsdParticle::List particles = group->particles(); + for (int i = 0; i < particles.count(); ++i) { + const XsdParticle::Ptr particle = particles.at(i); + + if (particle->term()->isElement() || particle->term()->isWildcard()) + sum += particle->minimumOccurs(); + else if (particle->term()->isModelGroup()) + sum += effectiveTotalRangeMinimum(particle); + } + + return (particle->minimumOccurs() * sum); + } +} + +bool XsdSchemaHelper::isParticleEmptiable(const XsdParticle::Ptr &particle) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-group-emptiable + + if (particle->minimumOccurs() == 0) + return true; + + if (!(particle->term()->isModelGroup())) + return false; + + return (effectiveTotalRangeMinimum(particle) == 0); +} + +bool XsdSchemaHelper::wildcardAllowsNamespaceName(const QString &nameSpace, const XsdWildcard::NamespaceConstraint::Ptr &constraint) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cvc-wildcard-namespace + + // 1 + if (constraint->variety() == XsdWildcard::NamespaceConstraint::Any) + return true; + + // 2 + if (constraint->variety() == XsdWildcard::NamespaceConstraint::Not) { // 2.1 + if (!constraint->namespaces().contains(nameSpace)) // 2.2 + if (nameSpace != XsdWildcard::absentNamespace()) // 2.3 + return true; + } + + // 3 + if (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) { + if (constraint->namespaces().contains(nameSpace)) + return true; + } + + return false; +} + +bool XsdSchemaHelper::wildcardAllowsExpandedName(const QXmlName &name, const XsdWildcard::Ptr &wildcard, const NamePool::Ptr &namePool) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cvc-wildcard-name + + // 1 + if (!wildcardAllowsNamespaceName(namePool->stringForNamespace(name.namespaceURI()), wildcard->namespaceConstraint())) + return false; + + // 2, 3, 4 + //TODO: we have no disallowed namespace yet + + return true; +} + +// small helper function that should be available in Qt 4.6 +template +static inline bool containsSet(const QSet &super, const QSet &sub) +{ + QSetIterator it(sub); + while (it.hasNext()) { + if (!super.contains(it.next())) + return false; + } + + return true; +} + +bool XsdSchemaHelper::isWildcardSubset(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-ns-subset + // wildcard =^ sub + // otherWildcard =^ super + + const XsdWildcard::NamespaceConstraint::Ptr constraint(wildcard->namespaceConstraint()); + const XsdWildcard::NamespaceConstraint::Ptr otherConstraint(otherWildcard->namespaceConstraint()); + + // 1 + if (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Any) + return true; + + // 2 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + if (containsSet(otherConstraint->namespaces(), constraint->namespaces())) + return true; + } + + // 3 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) { + if (constraint->namespaces().intersect(otherConstraint->namespaces()).isEmpty()) + return true; + } + + // 4 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) { + if (containsSet(constraint->namespaces(), otherConstraint->namespaces())) + return true; + } + + return false; +} + +XsdWildcard::Ptr XsdSchemaHelper::wildcardUnion(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-aw-union + + XsdWildcard::Ptr unionWildcard(new XsdWildcard()); + + const XsdWildcard::NamespaceConstraint::Ptr constraint(wildcard->namespaceConstraint()); + const XsdWildcard::NamespaceConstraint::Ptr otherConstraint(otherWildcard->namespaceConstraint()); + + // 1 + if ((constraint->variety() == otherConstraint->variety()) && + (constraint->namespaces() == otherConstraint->namespaces())) { + unionWildcard->namespaceConstraint()->setVariety(constraint->variety()); + unionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces()); + return unionWildcard; + } + + // 2 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Any) || (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Any)) { + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + return unionWildcard; + } + + // 3 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration); + unionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces() + otherConstraint->namespaces()); + return unionWildcard; + } + + // 4 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) { + if (constraint->namespaces() != otherConstraint->namespaces()) { + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not); + unionWildcard->namespaceConstraint()->setNamespaces(QSet() << XsdWildcard::absentNamespace()); + return unionWildcard; + } + } + + // 5 + QSet sSet, negatedSet; + bool matches5 = false; + if (((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && !constraint->namespaces().contains(XsdWildcard::absentNamespace())) + && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + + negatedSet = constraint->namespaces(); + sSet = otherConstraint->namespaces(); + matches5 = true; + } else if (((otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not) && !otherConstraint->namespaces().contains(XsdWildcard::absentNamespace())) + && (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + + negatedSet = otherConstraint->namespaces(); + sSet = constraint->namespaces(); + matches5 = true; + } + + if (matches5) { + if (sSet.contains(negatedSet.values().first()) && sSet.contains(XsdWildcard::absentNamespace())) { // 5.1 + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + return unionWildcard; + } + if (sSet.contains(negatedSet.values().first()) && !sSet.contains(XsdWildcard::absentNamespace())) { // 5.2 + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not); + unionWildcard->namespaceConstraint()->setNamespaces(QSet() << XsdWildcard::absentNamespace()); + return unionWildcard; + } + if (!sSet.contains(negatedSet.values().first()) && sSet.contains(XsdWildcard::absentNamespace())) { // 5.3 + return XsdWildcard::Ptr(); // not expressible + } + if (!sSet.contains(negatedSet.values().first()) && !sSet.contains(XsdWildcard::absentNamespace())) { // 5.4 + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not); + unionWildcard->namespaceConstraint()->setNamespaces(negatedSet); + return unionWildcard; + } + } + + // 6 + bool matches6 = false; + if (((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && constraint->namespaces().contains(XsdWildcard::absentNamespace())) + && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + + negatedSet = constraint->namespaces(); + sSet = otherConstraint->namespaces(); + matches6 = true; + } else if (((otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not) && otherConstraint->namespaces().contains(XsdWildcard::absentNamespace())) + && (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + + negatedSet = otherConstraint->namespaces(); + sSet = constraint->namespaces(); + matches6 = true; + } + + if (matches6) { + if (sSet.contains(XsdWildcard::absentNamespace())) { // 6.1 + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + return unionWildcard; + } + if (!sSet.contains(XsdWildcard::absentNamespace())) { // 6.2 + unionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not); + unionWildcard->namespaceConstraint()->setNamespaces(QSet() += XsdWildcard::absentNamespace()); + return unionWildcard; + } + } + + return XsdWildcard::Ptr(); +} + +XsdWildcard::Ptr XsdSchemaHelper::wildcardIntersection(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-aw-intersect + + const XsdWildcard::NamespaceConstraint::Ptr constraint(wildcard->namespaceConstraint()); + const XsdWildcard::NamespaceConstraint::Ptr otherConstraint(otherWildcard->namespaceConstraint()); + + const XsdWildcard::Ptr intersectionWildcard(new XsdWildcard()); + + // 1 + if ((constraint->variety() == otherConstraint->variety()) && + (constraint->namespaces() == otherConstraint->namespaces())) { + intersectionWildcard->namespaceConstraint()->setVariety(constraint->variety()); + intersectionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces()); + return intersectionWildcard; + } + + // 2 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Any) && + (otherConstraint->variety() != XsdWildcard::NamespaceConstraint::Any)) { + intersectionWildcard->namespaceConstraint()->setVariety(otherConstraint->variety()); + intersectionWildcard->namespaceConstraint()->setNamespaces(otherConstraint->namespaces()); + return intersectionWildcard; + } + + // 2 + if ((constraint->variety() != XsdWildcard::NamespaceConstraint::Any) && + (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Any)) { + intersectionWildcard->namespaceConstraint()->setVariety(constraint->variety()); + intersectionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces()); + return intersectionWildcard; + } + + // 3 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && + (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + + QSet set = otherConstraint->namespaces(); + set.subtract(constraint->namespaces()); + set.remove(XsdWildcard::absentNamespace()); + + intersectionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration); + intersectionWildcard->namespaceConstraint()->setNamespaces(set); + + return intersectionWildcard; + } + + // 3 + if ((otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not) && + (constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + + QSet set = constraint->namespaces(); + set.subtract(otherConstraint->namespaces()); + set.remove(XsdWildcard::absentNamespace()); + + intersectionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration); + intersectionWildcard->namespaceConstraint()->setNamespaces(set); + + return intersectionWildcard; + } + + // 4 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && + (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { + + QSet set = constraint->namespaces(); + set.intersect(otherConstraint->namespaces()); + + intersectionWildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration); + intersectionWildcard->namespaceConstraint()->setNamespaces(set); + + return intersectionWildcard; + } + + // 6 + if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && + (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) { + if (!(constraint->namespaces().contains(XsdWildcard::absentNamespace())) && otherConstraint->namespaces().contains(XsdWildcard::absentNamespace())) { + return wildcard; + } + if (constraint->namespaces().contains(XsdWildcard::absentNamespace()) && !(otherConstraint->namespaces().contains(XsdWildcard::absentNamespace()))) { + return otherWildcard; + } + } + + // 5 as not expressible return empty wildcard + return XsdWildcard::Ptr(); +} + +static SchemaType::DerivationConstraints convertBlockingConstraints(const NamedSchemaComponent::BlockingConstraints &constraints) +{ + SchemaType::DerivationConstraints result = 0; + + if (constraints & NamedSchemaComponent::RestrictionConstraint) + result |= SchemaType::RestrictionConstraint; + if (constraints & NamedSchemaComponent::ExtensionConstraint) + result |= SchemaType::ExtensionConstraint; + + return result; +} + +bool XsdSchemaHelper::isValidlySubstitutable(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, const SchemaType::DerivationConstraints &constraints) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#key-val-sub-type + + // 1 + if (type->isComplexType() && otherType->isComplexType()) { + SchemaType::DerivationConstraints keywords = constraints; + if (otherType->isDefinedBySchema()) + keywords |= convertBlockingConstraints(XsdComplexType::Ptr(otherType)->prohibitedSubstitutions()); + + return isComplexDerivationOk(type, otherType, keywords); + } + + // 2 + if (type->isComplexType() && otherType->isSimpleType()) { + return isComplexDerivationOk(type, otherType, constraints); + } + + // 3 + if (type->isSimpleType() && otherType->isSimpleType()) { + return isSimpleDerivationOk(type, otherType, constraints); + } + + return false; +} + +bool XsdSchemaHelper::isSimpleDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-st-derived-ok + + // 1 + if (derivedType == baseType) + return true; + + // 2.1 + if ((constraints & SchemaType::RestrictionConstraint) || derivedType->wxsSuperType()->derivationConstraints() & SchemaType::RestrictionConstraint) { + return false; + } + + // 2.2.1 + if (derivedType->wxsSuperType() == baseType) + return true; + + // 2.2.2 + if (derivedType->wxsSuperType() != BuiltinTypes::xsAnyType) { + if (isSimpleDerivationOk(derivedType->wxsSuperType(), baseType, constraints)) + return true; + } + + // 2.2.3 + if (derivedType->category() == SchemaType::SimpleTypeList || derivedType->category() == SchemaType::SimpleTypeUnion) { + if (baseType == BuiltinTypes::xsAnySimpleType) + return true; + } + + // 2.2.4 + if (baseType->category() == SchemaType::SimpleTypeUnion && baseType->isDefinedBySchema()) { // 2.2.4.1 + const AnySimpleType::List memberTypes = XsdSimpleType::Ptr(baseType)->memberTypes(); + for (int i = 0; i < memberTypes.count(); ++i) { + if (isSimpleDerivationOk(derivedType, memberTypes.at(i), constraints)) { // 2.2.4.2 + if (XsdSimpleType::Ptr(baseType)->facets().isEmpty()) { // 2.2.4.3 + return true; + } + } + } + } + + return false; +} + +bool XsdSchemaHelper::isComplexDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints) +{ + if (!derivedType) + return false; + + // @see http://www.w3.org/TR/xmlschema11-1/#cos-ct-derived-ok + + // 1 + if (derivedType != baseType) { + if ((derivedType->derivationMethod() == SchemaType::DerivationRestriction) && (constraints & SchemaType::RestrictionConstraint)) + return false; + if ((derivedType->derivationMethod() == SchemaType::DerivationExtension) && (constraints & SchemaType::ExtensionConstraint)) + return false; + } + + // 2.1 + if (derivedType == baseType) + return true; + + // 2.2 + if (derivedType->wxsSuperType() == baseType) + return true; + + // 2.3 + bool isOk = true; + if (derivedType->wxsSuperType() == BuiltinTypes::xsAnyType) { // 2.3.1 + isOk = false; + } else { // 2.3.2 + if (!derivedType->wxsSuperType()) + return false; + + if (derivedType->wxsSuperType()->isComplexType()) { // 2.3.2.1 + isOk = isComplexDerivationOk(derivedType->wxsSuperType(), baseType, constraints); + } else { // 2.3.2.2 + isOk = isSimpleDerivationOk(derivedType->wxsSuperType(), baseType, constraints); + } + } + if (isOk) + return true; + + return false; +} + +bool XsdSchemaHelper::constructAndCompare(const DerivedString::Ptr &operand1, + const AtomicComparator::Operator op, + const DerivedString::Ptr &operand2, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection) +{ + Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO, + "We can only compare atomic values."); + + // we can not cast a xs:String to a xs:QName, so lets go the safe way + if (type->name(context->namePool()) == BuiltinTypes::xsQName->name(context->namePool())) + return false; + + const AtomicValue::Ptr value1 = ValueFactory::fromLexical(operand1->stringValue(), type, context, sourceLocationReflection); + if (value1->hasError()) + return false; + + const AtomicValue::Ptr value2 = ValueFactory::fromLexical(operand2->stringValue(), type, context, sourceLocationReflection); + if (value2->hasError()) + return false; + + return ComparisonFactory::compare(value1, op, value2, type, context, sourceLocationReflection); +} + +bool XsdSchemaHelper::checkWildcardProcessContents(const XsdWildcard::Ptr &baseWildcard, const XsdWildcard::Ptr &derivedWildcard) +{ + if (baseWildcard->processContents() == XsdWildcard::Strict) { + if (derivedWildcard->processContents() == XsdWildcard::Lax || derivedWildcard->processContents() == XsdWildcard::Skip) { + return false; + } + } else if (baseWildcard->processContents() == XsdWildcard::Lax) { + if (derivedWildcard->processContents() == XsdWildcard::Skip) + return false; + } + + return true; +} + +bool XsdSchemaHelper::foundSubstitutionGroupTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, QSet &visitedElements) +{ + if (visitedElements.contains(member)) + return false; + else + visitedElements.insert(member); + + if (member->substitutionGroupAffiliations().isEmpty()) + return false; + + if (member->substitutionGroupAffiliations().contains(head)) { + return true; + } else { + const XsdElement::List affiliations = member->substitutionGroupAffiliations(); + for (int i = 0; i < affiliations.count(); ++i) { + if (foundSubstitutionGroupTransitive(head, affiliations.at(i), visitedElements)) + return true; + } + + return false; + } +} + +void XsdSchemaHelper::foundSubstitutionGroupTypeInheritance(const SchemaType::Ptr &headType, const SchemaType::Ptr &memberType, + QSet &derivationSet, NamedSchemaComponent::BlockingConstraints &blockSet) +{ + if (!memberType) + return; + + if (memberType == headType) + return; + + derivationSet.insert(memberType->derivationMethod()); + + if (memberType->isComplexType()) { + const XsdComplexType::Ptr complexType(memberType); + blockSet |= complexType->prohibitedSubstitutions(); + } + + foundSubstitutionGroupTypeInheritance(headType, memberType->wxsSuperType(), derivationSet, blockSet); +} + +bool XsdSchemaHelper::substitutionGroupOkTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, const NamePool::Ptr &namePool) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-equiv-derived-ok-rec + + // 1 + if ((member->name(namePool) == head->name(namePool)) && (member->type() == head->type())) + return true; + + // 2.1 + if (head->disallowedSubstitutions() & NamedSchemaComponent::SubstitutionConstraint) + return false; + + // 2.2 + { + QSet visitedElements; + if (!foundSubstitutionGroupTransitive(head, member, visitedElements)) + return false; + } + + // 2.3 + { + QSet derivationSet; + NamedSchemaComponent::BlockingConstraints blockSet; + + foundSubstitutionGroupTypeInheritance(head->type(), member->type(), derivationSet, blockSet); + + NamedSchemaComponent::BlockingConstraints checkSet(blockSet); + checkSet |= head->disallowedSubstitutions(); + if (head->type()->isComplexType()) { + const XsdComplexType::Ptr complexType(head->type()); + checkSet |= complexType->prohibitedSubstitutions(); + } + + if ((checkSet & NamedSchemaComponent::RestrictionConstraint) && derivationSet.contains(SchemaType::DerivationRestriction)) + return false; + if ((checkSet & NamedSchemaComponent::ExtensionConstraint) && derivationSet.contains(SchemaType::DerivationExtension)) + return false; + if (checkSet & NamedSchemaComponent::SubstitutionConstraint) + return false; + } + + return true; +} + +bool XsdSchemaHelper::isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup, const XsdAttributeGroup::Ptr &attributeGroup, const XsdSchemaContext::Ptr &context, QString &errorMsg) +{ + // @see http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction + + const XsdAttributeUse::List derivedAttributeUses = derivedAttributeGroup->attributeUses(); + const XsdAttributeUse::List baseAttributeUses = attributeGroup->attributeUses(); + + return isValidAttributeUsesRestriction(derivedAttributeUses, baseAttributeUses, + derivedAttributeGroup->wildcard(), attributeGroup->wildcard(), context, errorMsg); +} + +bool XsdSchemaHelper::isValidAttributeUsesRestriction(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &baseAttributeUses, + const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg) +{ + const NamePool::Ptr namePool(context->namePool()); + + QHash baseAttributeUsesLookup; + for (int i = 0; i < baseAttributeUses.count(); ++i) + baseAttributeUsesLookup.insert(baseAttributeUses.at(i)->attribute()->name(namePool), baseAttributeUses.at(i)); + + QHash derivedAttributeUsesLookup; + for (int i = 0; i < derivedAttributeUses.count(); ++i) + derivedAttributeUsesLookup.insert(derivedAttributeUses.at(i)->attribute()->name(namePool), derivedAttributeUses.at(i)); + + // 2 + for (int i = 0; i < derivedAttributeUses.count(); ++i) { + const XsdAttributeUse::Ptr derivedAttributeUse = derivedAttributeUses.at(i); + + // prohibited attributes are no real attributes, so skip them in that test here + if (derivedAttributeUse->useType() == XsdAttributeUse::ProhibitedUse) + continue; + + if (baseAttributeUsesLookup.contains(derivedAttributeUse->attribute()->name(namePool))) { + const XsdAttributeUse::Ptr baseAttributeUse(baseAttributeUsesLookup.value(derivedAttributeUse->attribute()->name(namePool))); + + // 2.1.1 + if (baseAttributeUse->isRequired() == true && derivedAttributeUse->isRequired() == false) { + errorMsg = QtXmlPatterns::tr("base attribute %1 is required but derived attribute is not").arg(formatAttribute(baseAttributeUse->attribute()->displayName(namePool))); + return false; + } + + // 2.1.2 + if (!isSimpleDerivationOk(derivedAttributeUse->attribute()->type(), baseAttributeUse->attribute()->type(), SchemaType::DerivationConstraints())) { + errorMsg = QtXmlPatterns::tr("type of derived attribute %1 cannot be validly derived from type of base attribute").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); + return false; + } + + // 2.1.3 + XsdAttributeUse::ValueConstraint::Ptr derivedConstraint; + if (derivedAttributeUse->valueConstraint()) + derivedConstraint = derivedAttributeUse->valueConstraint(); + else if (derivedAttributeUse->attribute()->valueConstraint()) + derivedConstraint = XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(derivedAttributeUse->attribute()->valueConstraint()); + + XsdAttributeUse::ValueConstraint::Ptr baseConstraint; + if (baseAttributeUse->valueConstraint()) + baseConstraint = baseAttributeUse->valueConstraint(); + else if (baseAttributeUse->attribute()->valueConstraint()) + baseConstraint = XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(baseAttributeUse->attribute()->valueConstraint()); + + bool ok = false; + if (!baseConstraint || baseConstraint->variety() == XsdAttributeUse::ValueConstraint::Default) + ok = true; + + if (derivedConstraint && baseConstraint) { + const XsdTypeChecker checker(context, QVector(), QSourceLocation(QUrl(QLatin1String("http://dummy.org")), 1, 1)); + if (derivedConstraint->variety() == XsdAttributeUse::ValueConstraint::Fixed && checker.valuesAreEqual(derivedConstraint->value(), baseConstraint->value(), baseAttributeUse->attribute()->type())) + ok = true; + } + + if (!ok) { + errorMsg = QtXmlPatterns::tr("value constraint of derived attribute %1 does not match value constraint of base attribute").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); + return false; + } + } else { + if (!wildcard) { + errorMsg = QtXmlPatterns::tr("derived attribute %1 does not exists in the base definition").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); + return false; + } + + QXmlName name = derivedAttributeUse->attribute()->name(namePool); + + // wildcards using XsdWildcard::absentNamespace, so we have to fix that here + if (name.namespaceURI() == StandardNamespaces::empty) + name.setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace())); + + if (!wildcardAllowsExpandedName(name, wildcard, namePool)) { + errorMsg = QtXmlPatterns::tr("derived attribute %1 does not match the wildcard in the base definition").arg(formatAttribute(derivedAttributeUse->attribute()->displayName(namePool))); + return false; + } + } + } + + // 3 + for (int i = 0; i < baseAttributeUses.count(); ++i) { + const XsdAttributeUse::Ptr baseAttributeUse = baseAttributeUses.at(i); + + if (baseAttributeUse->isRequired()) { + if (derivedAttributeUsesLookup.contains(baseAttributeUse->attribute()->name(namePool))) { + if (!derivedAttributeUsesLookup.value(baseAttributeUse->attribute()->name(namePool))->isRequired()) { + errorMsg = QtXmlPatterns::tr("base attribute %1 is required but derived attribute is not").arg(formatAttribute(baseAttributeUse->attribute()->displayName(namePool))); + return false; + } + } else { + errorMsg = QtXmlPatterns::tr("base attribute %1 is required but missing in derived definition").arg(formatAttribute(baseAttributeUse->attribute()->displayName(namePool))); + return false; + } + } + } + + // 4 + if (derivedWildcard) { + if (!wildcard) { + errorMsg = QtXmlPatterns::tr("derived definition contains an %1 element that does not exists in the base definition").arg(formatElement("anyAttribute")); + return false; + } + + if (!isWildcardSubset(derivedWildcard, wildcard)) { + errorMsg = QtXmlPatterns::tr("derived wildcard is not a subset of the base wildcard"); + return false; + } + + if (!checkWildcardProcessContents(wildcard, derivedWildcard)) { + errorMsg = QtXmlPatterns::tr("%1 of derived wildcard is not a valid restriction of %2 of base wildcard").arg(formatKeyword("processContents")).arg(formatKeyword("processContents")); + return false; + } + } + + return true; +} + +bool XsdSchemaHelper::isValidAttributeUsesExtension(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses, + const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cos-ct-extends + + const NamePool::Ptr namePool(context->namePool()); + + // 1.2 + QHash lookupHash; + for (int i = 0; i < derivedAttributeUses.count(); ++i) + lookupHash.insert(derivedAttributeUses.at(i)->attribute()->name(namePool), derivedAttributeUses.at(i)->attribute()); + + for (int i = 0; i < attributeUses.count(); ++i) { + const QXmlName attributeName = attributeUses.at(i)->attribute()->name(namePool); + if (!lookupHash.contains(attributeName)) { + errorMsg = QtXmlPatterns::tr("attribute %1 from base type is missing in derived type").arg(formatKeyword(namePool->displayName(attributeName))); + return false; + } + + if (lookupHash.value(attributeName)->type() != attributeUses.at(i)->attribute()->type()) { + errorMsg = QtXmlPatterns::tr("type of derived attribute %1 differs from type of base attribute").arg(formatKeyword(namePool->displayName(attributeName))); + return false; + } + } + + // 1.3 + if (wildcard) { + if (!derivedWildcard) { + errorMsg = QtXmlPatterns::tr("base definition contains an %1 element that is missing in the derived definition").arg(formatElement("anyAttribute")); + return false; + } + } + + return true; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemahelper_p.h b/src/xmlpatterns/schema/qxsdschemahelper_p.h new file mode 100644 index 0000000..1722b4c --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemahelper_p.h @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaHelper_H +#define Patternist_XsdSchemaHelper_H + +#include "qcomparisonfactory_p.h" +#include "qschematype_p.h" +#include "qxsdattributegroup_p.h" +#include "qxsdelement_p.h" +#include "qxsdparticle_p.h" +#include "qxsdschemacontext_p.h" +#include "qxsdwildcard_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + + /** + * @short Contains helper methods that are used by XsdSchemaParser, XsdSchemaResolver and XsdSchemaChecker. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchemaHelper + { + public: + /** + * Checks whether the given @p particle is emptiable as defined by the + * algorithm in the schema spec. + */ + static bool isParticleEmptiable(const XsdParticle::Ptr &particle); + + /** + * Checks whether the given @p nameSpace is allowed by the given namespace @p constraint. + */ + static bool wildcardAllowsNamespaceName(const QString &nameSpace, const XsdWildcard::NamespaceConstraint::Ptr &constraint); + + /** + * Checks whether the given @p name is allowed by the namespace constraint of the given @p wildcard. + */ + static bool wildcardAllowsExpandedName(const QXmlName &name, const XsdWildcard::Ptr &wildcard, const NamePool::Ptr &namePool); + + /** + * Checks whether the @p wildcard is a subset of @p otherWildcard. + */ + static bool isWildcardSubset(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard); + + /** + * Returns the union of the given @p wildcard and @p otherWildcard. + */ + static XsdWildcard::Ptr wildcardUnion(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard); + + /** + * Returns the intersection of the given @p wildcard and @p otherWildcard. + */ + static XsdWildcard::Ptr wildcardIntersection(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard); + + /** + * Returns whether the given @p type is validly substitutable for an @p otherType + * under the given @p constraints. + */ + static bool isValidlySubstitutable(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, const SchemaType::DerivationConstraints &constraints); + + /** + * Returns whether the simple @p derivedType can be derived from the simple @p baseType + * under the given @p constraints. + */ + static bool isSimpleDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints); + + /** + * Returns whether the complex @p derivedType can be derived from the complex @p baseType + * under the given @p constraints. + */ + static bool isComplexDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints); + + /** + * This method takes the two string based operands @p operand1 and @p operand2 and converts them to instances of type @p type. + * If the conversion fails, @c false is returned, otherwise the instances are compared by the given operator @p op and the + * result of the comparison is returned. + */ + static bool constructAndCompare(const DerivedString::Ptr &operand1, + const AtomicComparator::Operator op, + const DerivedString::Ptr &operand2, + const SchemaType::Ptr &type, + const ReportContext::Ptr &context, + const SourceLocationReflection *const sourceLocationReflection); + + /** + * Returns whether the process content property of the @p derivedWildcard is valid + * according to the process content property of its @p baseWildcard. + */ + static bool checkWildcardProcessContents(const XsdWildcard::Ptr &baseWildcard, const XsdWildcard::Ptr &derivedWildcard); + + /** + * Checks whether @[ member is a member of the substitution group with the given @p head. + */ + static bool foundSubstitutionGroupTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, QSet &visitedElements); + + /** + * A helper method that iterates over the type hierarchy from @p memberType up to @p headType and collects all + * @p derivationSet and @p blockSet constraints that exists on the way there. + */ + static void foundSubstitutionGroupTypeInheritance(const SchemaType::Ptr &headType, const SchemaType::Ptr &memberType, + QSet &derivationSet, NamedSchemaComponent::BlockingConstraints &blockSet); + + /** + * Checks if the @p member is transitive to @p head. + */ + static bool substitutionGroupOkTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, const NamePool::Ptr &namePool); + + /** + * Checks if @p derivedAttributeGroup is a valid restriction for @p attributeGroup. + */ + static bool isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup, const XsdAttributeGroup::Ptr &attributeGroup, const XsdSchemaContext::Ptr &context, QString &errorMsg); + + /** + * Checks if @p derivedAttributeUses are a valid restriction for @p attributeUses. + */ + static bool isValidAttributeUsesRestriction(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses, + const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg); + + /** + * Checks if @p derivedAttributeUses are a valid extension for @p attributeUses. + */ + static bool isValidAttributeUsesExtension(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses, + const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg); + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemamerger.cpp b/src/xmlpatterns/schema/qxsdschemamerger.cpp new file mode 100644 index 0000000..a924c9c --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemamerger.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschemamerger_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaMerger::XsdSchemaMerger(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema) +{ + merge(schema, otherSchema); +} + +XsdSchema::Ptr XsdSchemaMerger::mergedSchema() const +{ + return m_mergedSchema; +} + +void XsdSchemaMerger::merge(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema) +{ + m_mergedSchema = XsdSchema::Ptr(new XsdSchema(otherSchema->namePool())); + + // first fill the merged schema with the values from schema + if (schema) { + const XsdElement::List elements = schema->elements(); + for (int i = 0; i < elements.count(); ++i) { + m_mergedSchema->addElement(elements.at(i)); + } + + const XsdAttribute::List attributes = schema->attributes(); + for (int i = 0; i < attributes.count(); ++i) { + m_mergedSchema->addAttribute(attributes.at(i)); + } + + const SchemaType::List types = schema->types(); + for (int i = 0; i < types.count(); ++i) { + m_mergedSchema->addType(types.at(i)); + } + + const SchemaType::List anonymousTypes = schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + m_mergedSchema->addAnonymousType(anonymousTypes.at(i)); + } + + const XsdModelGroup::List elementGroups = schema->elementGroups(); + for (int i = 0; i < elementGroups.count(); ++i) { + m_mergedSchema->addElementGroup(elementGroups.at(i)); + } + + const XsdAttributeGroup::List attributeGroups = schema->attributeGroups(); + for (int i = 0; i < attributeGroups.count(); ++i) { + m_mergedSchema->addAttributeGroup(attributeGroups.at(i)); + } + + const XsdNotation::List notations = schema->notations(); + for (int i = 0; i < notations.count(); ++i) { + m_mergedSchema->addNotation(notations.at(i)); + } + + const XsdIdentityConstraint::List identityConstraints = schema->identityConstraints(); + for (int i = 0; i < identityConstraints.count(); ++i) { + m_mergedSchema->addIdentityConstraint(identityConstraints.at(i)); + } + } + + // then merge in the values from the otherSchema + { + const XsdElement::List elements = otherSchema->elements(); + for (int i = 0; i < elements.count(); ++i) { + if (!m_mergedSchema->element(elements.at(i)->name(otherSchema->namePool()))) + m_mergedSchema->addElement(elements.at(i)); + } + + const XsdAttribute::List attributes = otherSchema->attributes(); + for (int i = 0; i < attributes.count(); ++i) { + if (!m_mergedSchema->attribute(attributes.at(i)->name(otherSchema->namePool()))) + m_mergedSchema->addAttribute(attributes.at(i)); + } + + const SchemaType::List types = otherSchema->types(); + for (int i = 0; i < types.count(); ++i) { + if (!m_mergedSchema->type(types.at(i)->name(otherSchema->namePool()))) + m_mergedSchema->addType(types.at(i)); + } + + const SchemaType::List anonymousTypes = otherSchema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + // add anonymous type as they are + m_mergedSchema->addAnonymousType(anonymousTypes.at(i)); + } + + const XsdModelGroup::List elementGroups = otherSchema->elementGroups(); + for (int i = 0; i < elementGroups.count(); ++i) { + if (!m_mergedSchema->elementGroup(elementGroups.at(i)->name(otherSchema->namePool()))) + m_mergedSchema->addElementGroup(elementGroups.at(i)); + } + + const XsdAttributeGroup::List attributeGroups = otherSchema->attributeGroups(); + for (int i = 0; i < attributeGroups.count(); ++i) { + if (!m_mergedSchema->attributeGroup(attributeGroups.at(i)->name(otherSchema->namePool()))) + m_mergedSchema->addAttributeGroup(attributeGroups.at(i)); + } + + const XsdNotation::List notations = otherSchema->notations(); + for (int i = 0; i < notations.count(); ++i) { + if (!m_mergedSchema->notation(notations.at(i)->name(otherSchema->namePool()))) + m_mergedSchema->addNotation(notations.at(i)); + } + + const XsdIdentityConstraint::List identityConstraints = otherSchema->identityConstraints(); + for (int i = 0; i < identityConstraints.count(); ++i) { + if (!m_mergedSchema->identityConstraint(identityConstraints.at(i)->name(otherSchema->namePool()))) + m_mergedSchema->addIdentityConstraint(identityConstraints.at(i)); + } + } +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemamerger_p.h b/src/xmlpatterns/schema/qxsdschemamerger_p.h new file mode 100644 index 0000000..54cc0f2 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemamerger_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaMerger_H +#define Patternist_XsdSchemaMerger_H + +#include "qxsdschema_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A helper class that merges two schemas into one. + * + * This class is used in XsdValidatingInstanceReader to merge the schema + * given in the constructor with a schema defined in the instance document + * via xsi:schemaLocation or xsi:noNamespaceSchema location. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchemaMerger : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Creates a new schema merger object that merges @p schema with @p otherSchema. + */ + XsdSchemaMerger(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema); + + /** + * Returns the merged schema. + */ + XsdSchema::Ptr mergedSchema() const; + + private: + void merge(const XsdSchema::Ptr &schema, const XsdSchema::Ptr &otherSchema); + + XsdSchema::Ptr m_mergedSchema; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp new file mode 100644 index 0000000..9f1e75d --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -0,0 +1,6012 @@ + +#include "qxsdschemaparser_p.h" + +#include "private/qxmlutils_p.h" +#include "qacceltreeresourceloader_p.h" +#include "qautoptr_p.h" +#include "qboolean_p.h" +#include "qderivedinteger_p.h" +#include "qderivedstring_p.h" +#include "qqnamevalue_p.h" +#include "qxmlquery_p.h" +#include "qxpathhelper_p.h" +#include "qxsdattributereference_p.h" +#include "qxsdreference_p.h" +#include "qxsdschematoken_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +/** + * @page schema_overview Overview + * @section structure_and_components Structure and Components + * + * The schema validator code consists of 4 major components + * + *
+ *
The schema parser (QPatternist::XsdSchemaParser)
+ *
This component parses a XML document that is supplied via a QIODevice. It creates + * a so called (incomplete) 'compiled schema', which is a representation of the XML Schema + * structure as C++ objects. + * As the parser is a streaming parser, it can't resolve references to types or elements/attributes + * in place, therefor it creates resolver tasks which are passed to the schema resolver component + * for resolving at a later point in time. + * The parser does furthermore the basic XML structure constraint checking, e.g. if all required + * attributes are available or the order of the elements is correct.
+ * + *
The schema resolver (QPatternist::XsdSchemaResolver)
+ *
This component is activated after the schema parser component has been finished the parsing + * of all schemas. The resolver has been supplied with resolve tasks by the schema parser that + * it will resolve in this step now. Between working on the single resolver tasks, the resolver + * calls check methods from the schema checker component to make sure that some assertions are + * valid (e.g. no circular inheritance of types), so that the resolver can work without hassle. + * During resoving references to attribute or element groups it also checks for circular references + * of these groups. + * At the end of that phase we have a compiled schema that is fully resolved (not necessarily valid though).
+ * + *
The schema checker (QPatternist::XsdSchemaChecker)
+ *
This component does all the schema constraint checking as given by the Schema specification. + * At the end of that phase we have fully resolved and valid compiled schema that can be used for validation + * of instance documents.
+ * + *
The validator (QPatternist::XsdValidatingInstanceReader)
+ *
This component is responsible for validating a XML instance document, provided via a QIODevice, against + * a valid compiled schema.
+ *
+ * + * @ingroup Patternist_schema + */ + +using namespace QPatternist; + +namespace QPatternist +{ + +/** + * @short A helper class for automatically handling namespace scopes of elements. + * + * This class should be instantiated at the beginning of each parse XYZ method. + */ +class ElementNamespaceHandler +{ + public: + /** + * Creates a new element namespace handler object. + * + * It checks whether the @p parser is on the right @p tag and it creates a new namespace + * context that contains the inherited and local namespace declarations. + */ + ElementNamespaceHandler(const XsdSchemaToken::NodeName &tag, XsdSchemaParser *parser) + : m_parser(parser) + { + Q_ASSERT(m_parser->isStartElement() && (XsdSchemaToken::toToken(m_parser->name()) == tag) && (XsdSchemaToken::toToken(m_parser->namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI)); + m_parser->m_namespaceSupport.pushContext(); + m_parser->m_namespaceSupport.setPrefixes(m_parser->namespaceDeclarations()); + } + + /** + * Destroys the element namespace handler object. + * + * It destroys the local namespace context. + */ + ~ElementNamespaceHandler() + { + m_parser->m_namespaceSupport.popContext(); + } + + private: + XsdSchemaParser *m_parser; +}; + +/** + * A helper class that checks for the right occurrence of + * xml tags with the help of a DFA. + */ +class TagValidationHandler +{ + public: + TagValidationHandler(XsdTagScope::Type tag, XsdSchemaParser *parser, const NamePool::Ptr &namePool) + : m_parser(parser), m_machine(namePool) + { + Q_ASSERT(m_parser->m_stateMachines.contains(tag)); + + m_machine = m_parser->m_stateMachines.value(tag); + m_machine.reset(); + } + + void validate(XsdSchemaToken::NodeName token) + { + if (token == XsdSchemaToken::NoKeyword) { + m_parser->error(QtXmlPatterns::tr("can not process unknown element %1").arg(formatElement(m_parser->name().toString()))); + return; + } + + if (!m_machine.proceed(token)) { + m_parser->error(QtXmlPatterns::tr("element %1 is not allowed in this scope").arg(formatElement(XsdSchemaToken::toString(token)))); + return; + } + } + + void finalize() const + { + if (!m_machine.inEndState()) { + m_parser->error(QtXmlPatterns::tr("child element is missing in that scope")); + } + } + + private: + XsdSchemaParser *m_parser; + XsdStateMachine m_machine; +}; + +} + +/** + * Returns a list of all particles with group references that appear at any level of + * the given unresolved @p group. + */ +static XsdParticle::List collectGroupRef(const XsdModelGroup::Ptr &group) +{ + XsdParticle::List refParticles; + + XsdParticle::List particles = group->particles(); + for (int i = 0; i < particles.count(); ++i) { + if (particles.at(i)->term()->isReference()) { + const XsdReference::Ptr reference(particles.at(i)->term()); + if (reference->type() == XsdReference::ModelGroup) + refParticles.append(particles.at(i)); + } + if (particles.at(i)->term()->isModelGroup()) { + refParticles << collectGroupRef(XsdModelGroup::Ptr(particles.at(i)->term())); + } + } + + return refParticles; +} + +/** + * Helper function that works around the limited facilities of + * QUrl/AnyURI::fromLexical to detect invalid URIs + */ +inline static bool isValidUri(const QString &string) +{ + // an empty URI points to the current document as defined in RFC 2396 (4.2) + if (string.isEmpty()) + return true; + + // explicit check as that is not checked by the code below + if (string.startsWith(QLatin1String("##"))) + return false; + + const AnyURI::Ptr uri = AnyURI::fromLexical(string); + return (!(uri->hasError())); +} + +XsdSchemaParser::XsdSchemaParser(const XsdSchemaContext::Ptr &context, const XsdSchemaParserContext::Ptr &parserContext, QIODevice *device) + : MaintainingReader(parserContext->elementDescriptions(), QSet(), context, device) + , m_context(context) + , m_parserContext(parserContext) + , m_namePool(m_parserContext->namePool()) + , m_namespaceSupport(m_namePool) +{ + m_schema = m_parserContext->schema(); + m_schemaResolver = m_parserContext->resolver(); + m_idCache = XsdIdCache::Ptr(new XsdIdCache()); + + setupStateMachines(); + setupBuiltinTypeNames(); +} + +void XsdSchemaParser::setIncludedSchemas(const NamespaceSet &schemas) +{ + m_includedSchemas = schemas; +} + +void XsdSchemaParser::setImportedSchemas(const NamespaceSet &schemas) +{ + m_importedSchemas = schemas; +} + +void XsdSchemaParser::setRedefinedSchemas(const NamespaceSet &schemas) +{ + m_redefinedSchemas = schemas; +} + +void XsdSchemaParser::setTargetNamespace(const QString &targetNamespace) +{ + m_targetNamespace = targetNamespace; +} + +void XsdSchemaParser::setTargetNamespaceExtended(const QString &targetNamespace) +{ + m_targetNamespace = targetNamespace; + m_namespaceSupport.setTargetNamespace(m_namePool->allocateNamespace(m_targetNamespace)); +} + +void XsdSchemaParser::setDocumentURI(const QUrl &uri) +{ + qDebug("%s", qPrintable(uri.toString())); + m_documentURI = uri; + + // prevent to get included/imported/redefined twice + m_includedSchemas.insert(uri); + m_importedSchemas.insert(uri); +} + +QUrl XsdSchemaParser::documentURI() const +{ + return m_documentURI; +} + +bool XsdSchemaParser::isAnyAttributeAllowed() const +{ + return false; +} + +bool XsdSchemaParser::parse(ParserType parserType) +{ + m_componentLocationHash.clear(); + + while (!atEnd()) { + readNext(); + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + if (isSchemaTag(XsdSchemaToken::Schema, token, namespaceToken)) { + parseSchema(parserType); + } else { + error(QtXmlPatterns::tr("document is not a XML schema")); + } + } + } + + m_schemaResolver->addComponentLocationHash(m_componentLocationHash); + m_schemaResolver->setDefaultOpenContent(m_defaultOpenContent, m_defaultOpenContentAppliesToEmpty); + + return true; +} + +void XsdSchemaParser::error(const QString &msg) +{ + MaintainingReader::error(msg, XsdSchemaContext::XSDError); +} + +void XsdSchemaParser::attributeContentError(const char *attributeName, const char *elementName, const QString &value, const SchemaType::Ptr &type) +{ + if (type) { + error(QtXmlPatterns::tr("%1 attribute of %2 element contains invalid content: {%3} is not a value of type %4") + .arg(formatAttribute(attributeName)) + .arg(formatElement(elementName)) + .arg(formatData(value)) + .arg(formatType(m_namePool, type))); + } else { + error(QtXmlPatterns::tr("%1 attribute of %2 element contains invalid content: {%3}") + .arg(formatAttribute(attributeName)) + .arg(formatElement(elementName)) + .arg(formatData(value))); + } +} + +void XsdSchemaParser::parseSchema(ParserType parserType) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Schema, this); + + validateElement(XsdTagScope::Schema); + + // parse attributes + + if (parserType == TopLevelParser) { + if (hasAttribute(QString::fromLatin1("targetNamespace"))) { + m_targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema"); + } + } else if (parserType == IncludeParser) { + // m_targetNamespace is set to the target namespace of the including schema at this point + + if (hasAttribute(QString::fromLatin1("targetNamespace"))) { + const QString targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema"); + + if (m_targetNamespace != targetNamespace) { + error(QtXmlPatterns::tr("target namespace %1 of included schema is different from the target namespace %2 as defined by the including schema") + .arg(formatURI(targetNamespace)).arg(formatURI(m_targetNamespace))); + return; + } + } + } else if (parserType == ImportParser) { + // m_targetNamespace is set to the target namespace from the namespace attribute of the tag at this point + + QString targetNamespace; + if (hasAttribute(QString::fromLatin1("targetNamespace"))) { + targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema"); + } + + if (m_targetNamespace != targetNamespace) { + error(QtXmlPatterns::tr("target namespace %1 of imported schema is different from the target namespace %2 as defined by the importing schema") + .arg(formatURI(targetNamespace)).arg(formatURI(m_targetNamespace))); + return; + } + } else if (parserType == RedefineParser) { + // m_targetNamespace is set to the target namespace of the redefining schema at this point + + if (hasAttribute(QString::fromLatin1("targetNamespace"))) { + const QString targetNamespace = readNamespaceAttribute(QString::fromLatin1("targetNamespace"), "schema"); + + if (m_targetNamespace != targetNamespace) { + error(QtXmlPatterns::tr("target namespace %1 of imported schema is different from the target namespace %2 as defined by the importing schema") + .arg(formatURI(targetNamespace)).arg(formatURI(m_targetNamespace))); + return; + } + } + } + + if (hasAttribute(QString::fromLatin1("attributeFormDefault"))) { + const QString value = readAttribute(QString::fromLatin1("attributeFormDefault")); + if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) { + attributeContentError("attributeFormDefault", "schema", value); + return; + } + + m_attributeFormDefault = value; + } else { + m_attributeFormDefault = QString::fromLatin1("unqualified"); + } + + if (hasAttribute(QString::fromLatin1("elementFormDefault"))) { + const QString value = readAttribute(QString::fromLatin1("elementFormDefault")); + if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) { + attributeContentError("elementFormDefault", "schema", value); + return; + } + + m_elementFormDefault = value; + } else { + m_elementFormDefault = QString::fromLatin1("unqualified"); + } + + if (hasAttribute(QString::fromLatin1("blockDefault"))) { + const QString blockDefault = readAttribute(QString::fromLatin1("blockDefault")); + const QStringList blockDefaultList = blockDefault.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < blockDefaultList.count(); ++i) { + const QString value = blockDefaultList.at(i); + if (value != QString::fromLatin1("#all") && + value != QString::fromLatin1("extension") && + value != QString::fromLatin1("restriction") && + value != QString::fromLatin1("substitution")) { + attributeContentError("blockDefault", "schema", value); + return; + } + } + + m_blockDefault = blockDefault; + } + + if (hasAttribute(QString::fromLatin1("finalDefault"))) { + const QString finalDefault = readAttribute(QString::fromLatin1("finalDefault")); + const QStringList finalDefaultList = finalDefault.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < finalDefaultList.count(); ++i) { + const QString value = finalDefaultList.at(i); + if (value != QString::fromLatin1("#all") && + value != QString::fromLatin1("extension") && + value != QString::fromLatin1("restriction") && + value != QString::fromLatin1("list") && + value != QString::fromLatin1("union")) { + attributeContentError("finalDefault", "schema", value); + return; + } + } + + m_finalDefault = finalDefault; + } + + if (hasAttribute(QString::fromLatin1("xpathDefaultNamespace"))) { + const QString xpathDefaultNamespace = readAttribute(QString::fromLatin1("xpathDefaultNamespace")); + if (xpathDefaultNamespace != QString::fromLatin1("##defaultNamespace") && + xpathDefaultNamespace != QString::fromLatin1("##targetNamespace") && + xpathDefaultNamespace != QString::fromLatin1("##local")) { + if (!isValidUri(xpathDefaultNamespace)) { + attributeContentError("xpathDefaultNamespace", "schema", xpathDefaultNamespace); + return; + } + } + m_xpathDefaultNamespace = xpathDefaultNamespace; + } else { + m_xpathDefaultNamespace = QString::fromLatin1("##local"); + } + + if (hasAttribute(QString::fromLatin1("defaultAttributes"))) { + const QString attrGroupName = readQNameAttribute(QString::fromLatin1("defaultAttributes"), "schema"); + convertName(attrGroupName, NamespaceSupport::ElementName, m_defaultAttributes); // translate qualified name into QXmlName + } + + if (hasAttribute(QString::fromLatin1("version"))) { + const QString version = readAttribute(QString::fromLatin1("version")); + } + + if (hasAttribute(QString::fromLatin1("http://www.w3.org/XML/1998/namespace"), QString::fromLatin1("lang"))) { + const QString value = readAttribute(QString::fromLatin1("lang"), QString::fromLatin1("http://www.w3.org/XML/1998/namespace")); + + const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); + if (!exp.exactMatch(value)) { + attributeContentError("xml:lang", "schema", value); + return; + } + } + + validateIdAttribute("schema"); + + TagValidationHandler tagValidator(XsdTagScope::Schema, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Include, token, namespaceToken)) { + parseInclude(); + } else if (isSchemaTag(XsdSchemaToken::Import, token, namespaceToken)) { + parseImport(); + } else if (isSchemaTag(XsdSchemaToken::Redefine, token, namespaceToken)) { + parseRedefine(); + } else if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + m_schema->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::DefaultOpenContent, token, namespaceToken)) { + parseDefaultOpenContent(); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + const XsdSimpleType::Ptr type = parseGlobalSimpleType(); + addType(type); + } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) { + const XsdComplexType::Ptr type = parseGlobalComplexType(); + addType(type); + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdModelGroup::Ptr group = parseNamedGroup(); + addElementGroup(group); + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + XsdAttributeGroup::Ptr attributeGroup = parseNamedAttributeGroup(); + addAttributeGroup(attributeGroup); + } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) { + const XsdElement::Ptr element = parseGlobalElement(); + addElement(element); + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttribute::Ptr attribute = parseGlobalAttribute(); + addAttribute(attribute); + } else if (isSchemaTag(XsdSchemaToken::Notation, token, namespaceToken)) { + const XsdNotation::Ptr notation = parseNotation(); + addNotation(notation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + m_schema->setTargetNamespace(m_targetNamespace); +} + +void XsdSchemaParser::parseInclude() +{ + Q_ASSERT(isStartElement() && XsdSchemaToken::toToken(name()) == XsdSchemaToken::Include && + XsdSchemaToken::toToken(namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI); + + validateElement(XsdTagScope::Include); + + // parse attributes + const QString schemaLocation = readAttribute(QString::fromLatin1("schemaLocation")); + + QUrl url(schemaLocation); + if (url.isRelative()) { + Q_ASSERT(m_documentURI.isValid()); + + url = m_documentURI.resolved(url); + } + + if (m_includedSchemas.contains(url)) { + // we have included that file already, according to the schema spec we are + // allowed to silently skip it. + } else { + m_includedSchemas.insert(url); + + const AutoPtr reply(AccelTreeResourceLoader::load(url, m_context->networkAccessManager(), + m_context, AccelTreeResourceLoader::ContinueOnError)); + if (reply) { + // parse the included schema by a different parser but with the same context + XsdSchemaParser parser(m_context, m_parserContext, reply.data()); + parser.setDocumentURI(url); + parser.setTargetNamespaceExtended(m_targetNamespace); + parser.setIncludedSchemas(m_includedSchemas); + parser.setImportedSchemas(m_importedSchemas); + parser.setRedefinedSchemas(m_redefinedSchemas); + if (!parser.parse(XsdSchemaParser::IncludeParser)) + return; + } + } + + validateIdAttribute("include"); + + TagValidationHandler tagValidator(XsdTagScope::Include, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + m_schema->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseImport() +{ + Q_ASSERT(isStartElement() && XsdSchemaToken::toToken(name()) == XsdSchemaToken::Import && + XsdSchemaToken::toToken(namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI); + + validateElement(XsdTagScope::Import); + + // parse attributes + QString importNamespace; + if (hasAttribute(QString::fromLatin1("namespace"))) { + importNamespace = readAttribute(QString::fromLatin1("namespace")); + if (importNamespace == m_targetNamespace) { + error(QtXmlPatterns::tr("%1 element is not allowed to have the same %2 attribute value as the target namespace %3") + .arg(formatElement("import")) + .arg(formatAttribute("namespace")) + .arg(formatURI(m_targetNamespace))); + return; + } + } else { + if (m_targetNamespace.isEmpty()) { + error(QtXmlPatterns::tr("%1 element without %2 attribute is not allowed inside schema without target namespace") + .arg(formatElement("import")) + .arg(formatAttribute("namespace"))); + return; + } + } + + if (hasAttribute(QString::fromLatin1("schemaLocation"))) { + const QString schemaLocation = readAttribute(QString::fromLatin1("schemaLocation")); + + QUrl url(schemaLocation); + if (url.isRelative()) { + Q_ASSERT(m_documentURI.isValid()); + + url = m_documentURI.resolved(url); + } + + if (m_importedSchemas.contains(url)) { + // we have imported that file already, according to the schema spec we are + // allowed to silently skip it. + } else { + m_importedSchemas.insert(url); + + // as it is possible that well known schemas (e.g. XSD for XML) are only referenced by + // namespace we should add it as well + m_importedSchemas.insert(importNamespace); + + AutoPtr reply(AccelTreeResourceLoader::load(url, m_context->networkAccessManager(), + m_context, AccelTreeResourceLoader::ContinueOnError)); + if (reply) { + // parse the included schema by a different parser but with the same context + XsdSchemaParser parser(m_context, m_parserContext, reply.data()); + parser.setDocumentURI(url); + parser.setTargetNamespace(importNamespace); + parser.setIncludedSchemas(m_includedSchemas); + parser.setImportedSchemas(m_importedSchemas); + parser.setRedefinedSchemas(m_redefinedSchemas); + if (!parser.parse(XsdSchemaParser::ImportParser)) + return; + } + } + } else { + // check whether it is a known namespace we have a builtin schema for + if (!importNamespace.isEmpty()) { + if (!m_importedSchemas.contains(importNamespace)) { + m_importedSchemas.insert(importNamespace); + + QFile file(QString::fromLatin1(":") + importNamespace); + if (file.open(QIODevice::ReadOnly)) { + XsdSchemaParser parser(m_context, m_parserContext, &file); + parser.setDocumentURI(importNamespace); + parser.setTargetNamespace(importNamespace); + parser.setIncludedSchemas(m_includedSchemas); + parser.setImportedSchemas(m_importedSchemas); + parser.setRedefinedSchemas(m_redefinedSchemas); + if (!parser.parse(XsdSchemaParser::ImportParser)) + return; + } + } + } else { + // we don't import anything... that is valid according to the schema + } + } + + validateIdAttribute("import"); + + TagValidationHandler tagValidator(XsdTagScope::Import, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + m_schema->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseRedefine() +{ + Q_ASSERT(isStartElement() && XsdSchemaToken::toToken(name()) == XsdSchemaToken::Redefine && + XsdSchemaToken::toToken(namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI); + + validateElement(XsdTagScope::Redefine); + + // parse attributes + validateIdAttribute("redefine"); + + const QString schemaLocation = readAttribute(QString::fromLatin1("schemaLocation")); + + TagValidationHandler tagValidator(XsdTagScope::Redefine, this, m_namePool); + + XsdSimpleType::List redefinedSimpleTypes; + XsdComplexType::List redefinedComplexTypes; + XsdModelGroup::List redefinedGroups; + XsdAttributeGroup::List redefinedAttributeGroups; + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + m_schema->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + const XsdSimpleType::Ptr type = parseGlobalSimpleType(); + redefinedSimpleTypes.append(type); + + const QXmlName baseTypeName = m_parserContext->resolver()->baseTypeNameOfType(type); + if (baseTypeName != type->name(m_namePool)) { + error(QString::fromLatin1("redefined simple type %1 must have itself as base type").arg(formatType(m_namePool, type))); + return; + } + } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) { + const XsdComplexType::Ptr type = parseGlobalComplexType(); + redefinedComplexTypes.append(type); + + // @see http://www.w3.org/TR/xmlschema11-1/#src-redefine + + // 5 + const QXmlName baseTypeName = m_parserContext->resolver()->baseTypeNameOfType(type); + if (baseTypeName != type->name(m_namePool)) { + error(QString::fromLatin1("redefined complex type %1 must have itself as base type").arg(formatType(m_namePool, type))); + return; + } + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdModelGroup::Ptr group = parseNamedGroup(); + redefinedGroups.append(group); + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeGroup::Ptr group = parseNamedAttributeGroup(); + redefinedAttributeGroups.append(group); + + } else { + parseUnknown(); + } + } + } + + bool locationMustResolve = false; + if (!redefinedSimpleTypes.isEmpty() || !redefinedComplexTypes.isEmpty() || + !redefinedGroups.isEmpty() || !redefinedAttributeGroups.isEmpty()) { + locationMustResolve = true; + } + + QUrl url(schemaLocation); + if (url.isRelative()) { + Q_ASSERT(m_documentURI.isValid()); + + url = m_documentURI.resolved(url); + } + + // we parse the schema given in the redefine tag into its own context + const XsdSchemaParserContext::Ptr redefinedContext(new XsdSchemaParserContext(m_namePool, m_context)); + + if (m_redefinedSchemas.contains(url)) { + // we have redefined that file already, according to the schema spec we are + // allowed to silently skip it. + } else { + m_redefinedSchemas.insert(url); + QNetworkReply *reply = AccelTreeResourceLoader::load(url, m_context->networkAccessManager(), + m_context, + (locationMustResolve ? AccelTreeResourceLoader::FailOnError : AccelTreeResourceLoader::ContinueOnError)); + if (reply) { + // parse the included schema by a different parser but with the same context + XsdSchemaParser parser(m_context, redefinedContext, reply); + parser.setDocumentURI(url); + parser.setTargetNamespaceExtended(m_targetNamespace); + parser.setIncludedSchemas(m_includedSchemas); + parser.setImportedSchemas(m_importedSchemas); + parser.setRedefinedSchemas(m_redefinedSchemas); + if (!parser.parse(XsdSchemaParser::RedefineParser)) + return; + + delete reply; + } + } + + XsdSimpleType::List contextSimpleTypes = redefinedContext->schema()->simpleTypes(); + XsdComplexType::List contextComplexTypes = redefinedContext->schema()->complexTypes(); + XsdModelGroup::List contextGroups = redefinedContext->schema()->elementGroups(); + XsdAttributeGroup::List contextAttributeGroups = redefinedContext->schema()->attributeGroups(); + + // now we do the actual redefinition: + + // iterate over all redefined simple types + for (int i = 0; i < redefinedSimpleTypes.count(); ++i) { + XsdSimpleType::Ptr redefinedType = redefinedSimpleTypes.at(i); + + //TODONEXT: validation + + // search the definition they override in the context types + bool found = false; + for (int j = 0; j < contextSimpleTypes.count(); ++j) { + XsdSimpleType::Ptr contextType = contextSimpleTypes.at(j); + + if (redefinedType->name(m_namePool) == contextType->name(m_namePool)) { // we found the right type + found = true; + + // 1) set name of context type to empty name + contextType->setName(m_parserContext->createAnonymousName(QString())); + + // 2) set the context type as base type for the redefined type + redefinedType->setWxsSuperType(contextType); + + // 3) remove the base type resolving job from the resolver as + // we have set the base type here explicitely + m_parserContext->resolver()->removeSimpleRestrictionBase(redefinedType); + + // 4) add the redefined type to the schema + addType(redefinedType); + + // 5) add the context type as anonymous type, so the resolver + // can resolve it further. + addAnonymousType(contextType); + + // 6) remove the context type from the list + contextSimpleTypes.removeAt(j); + + break; + } + } + + if (!found) { + error(QString::fromLatin1("no matching type found to redefine simple type %1").arg(formatType(m_namePool, redefinedType))); + return; + } + } + + // add all remaining context simple types to the schema + for (int i = 0; i < contextSimpleTypes.count(); ++i) { + addType(contextSimpleTypes.at(i)); + } + + // iterate over all redefined complex types + for (int i = 0; i < redefinedComplexTypes.count(); ++i) { + XsdComplexType::Ptr redefinedType = redefinedComplexTypes.at(i); + + //TODONEXT: validation + + // search the definition they override in the context types + bool found = false; + for (int j = 0; j < contextComplexTypes.count(); ++j) { + XsdComplexType::Ptr contextType = contextComplexTypes.at(j); + + if (redefinedType->name(m_namePool) == contextType->name(m_namePool)) { // we found the right type + found = true; + + // 1) set name of context type to empty name + contextType->setName(m_parserContext->createAnonymousName(QString())); + + // 2) set the context type as base type for the redefined type + redefinedType->setWxsSuperType(contextType); + + // 3) remove the base type resolving job from the resolver as + // we have set the base type here explicitely + m_parserContext->resolver()->removeComplexBaseType(redefinedType); + + // 4) add the redefined type to the schema + addType(redefinedType); + + // 5) add the context type as anonymous type, so the resolver + // can resolve its attribute uses etc. + addAnonymousType(contextType); + + // 6) remove the context type from the list + contextComplexTypes.removeAt(j); + + break; + } + } + + if (!found) { + error(QString::fromLatin1("no matching type found to redefine complex type %1").arg(formatType(m_namePool, redefinedType))); + return; + } + } + + // iterate over all redefined element groups + for (int i = 0; i < redefinedGroups.count(); ++i) { + const XsdModelGroup::Ptr group(redefinedGroups.at(i)); + + // @see http://www.w3.org/TR/xmlschema11-1/#src-redefine + + // 6 + const XsdParticle::List particles = collectGroupRef(group); + XsdParticle::Ptr referencedParticle; + int sameNameCounter = 0; + for (int i = 0; i < particles.count(); ++i) { + const XsdReference::Ptr ref(particles.at(i)->term()); + if (ref->referenceName() == group->name(m_namePool)) { + referencedParticle = particles.at(i); + + if (referencedParticle->minimumOccurs() != 1 || referencedParticle->maximumOccurs() != 1 || referencedParticle->maximumOccursUnbounded()) { // 6.1.2 + error(QString::fromLatin1("redefined group %1 can not contain reference to itself with minOccurs or maxOccurs != 1").arg(formatKeyword(group->displayName(m_namePool)))); + return; + } + sameNameCounter++; + } + } + + // 6.1.1 + if (sameNameCounter > 1) { + error(QString::fromLatin1("redefined group %1 can not contain multiple references to itself").arg(formatKeyword(group->displayName(m_namePool)))); + return; + } + + // search the group definition in the included schema (S2) + XsdModelGroup::Ptr contextGroup; + for (int j = 0; j < contextGroups.count(); ++j) { + if (group->name(m_namePool) == contextGroups.at(j)->name(m_namePool)) { + contextGroup = contextGroups.at(j); + break; + } + } + + if (!contextGroup) { // 6.2.1 + error(QString::fromLatin1("redefined group %1 has no occurrence in included schema").arg(formatKeyword(group->displayName(m_namePool)))); + return; + } + + if (sameNameCounter == 1) { + // there was a self reference in the redefined group, so use the + // group from the included schema + + // set a anonymous name to the group of the included schema + contextGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(contextGroup->name(m_namePool).namespaceURI()))); + + // replace the self-reference with the group from the included schema + referencedParticle->setTerm(contextGroup); + + addElementGroup(group); + + addElementGroup(contextGroup); + contextGroups.removeAll(contextGroup); + } else { + // there was no self reference in the redefined group + + // just add the redefined group... + addElementGroup(group); + + // we have to add them, otherwise it is not resolved and we can't validate it later + contextGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(contextGroup->name(m_namePool).namespaceURI()))); + addElementGroup(contextGroup); + + m_schemaResolver->addRedefinedGroups(group, contextGroup); + + // ...and forget about the group from the included schema + contextGroups.removeAll(contextGroup); + } + } + + // iterate over all redefined attribute groups + for (int i = 0; i < redefinedAttributeGroups.count(); ++i) { + const XsdAttributeGroup::Ptr group(redefinedAttributeGroups.at(i)); + + // @see http://www.w3.org/TR/xmlschema11-1/#src-redefine + + // 7 + + // 7.1 + int sameNameCounter = 0; + for (int j = 0; j < group->attributeUses().count(); ++j) { + const XsdAttributeUse::Ptr attributeUse(group->attributeUses().at(j)); + if (attributeUse->isReference()) { + const XsdAttributeReference::Ptr reference(attributeUse); + if (reference->type() == XsdAttributeReference::AttributeGroup) { + if (group->name(m_namePool) == reference->referenceName()) + sameNameCounter++; + } + } + } + if (sameNameCounter > 1) { + error(QString::fromLatin1("redefined attribute group %1 can not contain multiple references to itself").arg(formatKeyword(group->displayName(m_namePool)))); + return; + } + + // search the attribute group definition in the included schema (S2) + XsdAttributeGroup::Ptr baseGroup; + for (int j = 0; j < contextAttributeGroups.count(); ++j) { + const XsdAttributeGroup::Ptr contextGroup(contextAttributeGroups.at(j)); + if (group->name(m_namePool) == contextGroup->name(m_namePool)) { + baseGroup = contextGroup; + break; + } + } + + if (!baseGroup) { // 7.2.1 + error(QString::fromLatin1("redefined attribute group %1 has no occurrence in included schema").arg(formatKeyword(group->displayName(m_namePool)))); + return; + } + + if (sameNameCounter == 1) { + + // first set an anonymous name to the attribute group from the included + // schema + baseGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(baseGroup->name(m_namePool).namespaceURI()))); + + // iterate over the attribute uses of the redefined attribute group + // and replace the self-reference with the attribute group from the + // included schema + for (int j = 0; j < group->attributeUses().count(); ++j) { + const XsdAttributeUse::Ptr attributeUse(group->attributeUses().at(j)); + if (attributeUse->isReference()) { + const XsdAttributeReference::Ptr reference(attributeUse); + if (reference->type() == XsdAttributeReference::AttributeGroup) { + if (group->name(m_namePool) == reference->referenceName()) { + reference->setReferenceName(baseGroup->name(m_namePool)); + break; + } + } + } + } + + // add both groups to the target schema + addAttributeGroup(baseGroup); + addAttributeGroup(group); + + contextAttributeGroups.removeAll(baseGroup); + } + + if (sameNameCounter == 0) { // 7.2 + + // we have to add them, otherwise it is not resolved and we can't validate it later + baseGroup->setName(m_parserContext->createAnonymousName(m_namePool->stringForNamespace(baseGroup->name(m_namePool).namespaceURI()))); + addAttributeGroup(baseGroup); + + m_schemaResolver->addRedefinedAttributeGroups(group, baseGroup); + + // just add the redefined attribute group to the target schema... + addAttributeGroup(group); + + // ... and forget about the one from the included schema + contextAttributeGroups.removeAll(baseGroup); + } + } + + // add all remaining context complex types to the schema + for (int i = 0; i < contextComplexTypes.count(); ++i) { + addType(contextComplexTypes.at(i)); + } + + // add all remaining context element groups to the schema + for (int i = 0; i < contextGroups.count(); ++i) { + addElementGroup(contextGroups.at(i)); + } + + // add all remaining context attribute groups to the schema + for (int i = 0; i < contextAttributeGroups.count(); ++i) { + addAttributeGroup(contextAttributeGroups.at(i)); + } + + // copy all elements, attributes and notations + const XsdElement::List contextElements = redefinedContext->schema()->elements(); + for (int i = 0; i < contextElements.count(); ++i) { + addElement(contextElements.at(i)); + } + + const XsdAttribute::List contextAttributes = redefinedContext->schema()->attributes(); + for (int i = 0; i < contextAttributes.count(); ++i) { + addAttribute(contextAttributes.at(i)); + } + + const XsdNotation::List contextNotations = redefinedContext->schema()->notations(); + for (int i = 0; i < contextNotations.count(); ++i) { + addNotation(contextNotations.at(i)); + } + + // push all data to resolve from the context resolver to our resolver + redefinedContext->resolver()->copyDataTo(m_parserContext->resolver()); + + tagValidator.finalize(); +} + +XsdAnnotation::Ptr XsdSchemaParser::parseAnnotation() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Annotation, this); + + validateElement(XsdTagScope::Annotation); + + // parse attributes + validateIdAttribute("annotation"); + + TagValidationHandler tagValidator(XsdTagScope::Annotation, this, m_namePool); + + const XsdAnnotation::Ptr annotation(new XsdAnnotation()); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Appinfo, token, namespaceToken)) { + const XsdApplicationInformation::Ptr info = parseAppInfo(); + annotation->addApplicationInformation(info); + } else if (isSchemaTag(XsdSchemaToken::Documentation, token, namespaceToken)) { + const XsdDocumentation::Ptr documentation = parseDocumentation(); + annotation->addDocumentation(documentation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return annotation; +} + +XsdApplicationInformation::Ptr XsdSchemaParser::parseAppInfo() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Appinfo, this); + + validateElement(XsdTagScope::AppInfo); + + const XsdApplicationInformation::Ptr info(new XsdApplicationInformation()); + + // parse attributes + if (hasAttribute(QString::fromLatin1("source"))) { + const QString value = readAttribute(QString::fromLatin1("source")); + + if (!isValidUri(value)) { + attributeContentError("source", "appinfo", value, BuiltinTypes::xsAnyURI); + return info; + } + + if (!value.isEmpty()) { + const AnyURI::Ptr source = AnyURI::fromLexical(value); + info->setSource(source); + } + } + + while (!atEnd()) { //EVAL: can be anything... what to do? + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) + parseUnknownDocumentation(); + } + + return info; +} + +XsdDocumentation::Ptr XsdSchemaParser::parseDocumentation() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Documentation, this); + + validateElement(XsdTagScope::Documentation); + + const XsdDocumentation::Ptr documentation(new XsdDocumentation()); + + // parse attributes + if (hasAttribute(QString::fromLatin1("source"))) { + const QString value = readAttribute(QString::fromLatin1("source")); + + if (!isValidUri(value)) { + attributeContentError("source", "documentation", value, BuiltinTypes::xsAnyURI); + return documentation; + } + + if (!value.isEmpty()) { + const AnyURI::Ptr source = AnyURI::fromLexical(value); + documentation->setSource(source); + } + } + + if (hasAttribute(QString::fromLatin1("http://www.w3.org/XML/1998/namespace"), QString::fromLatin1("lang"))) { + const QString value = readAttribute(QString::fromLatin1("lang"), QString::fromLatin1("http://www.w3.org/XML/1998/namespace")); + + const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); + if (!exp.exactMatch(value)) { + attributeContentError("xml:lang", "documentation", value); + return documentation; + } + } + + while (!atEnd()) { //EVAL: can by any... what to do? + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) + parseUnknownDocumentation(); + } + + return documentation; +} + +void XsdSchemaParser::parseDefaultOpenContent() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::DefaultOpenContent, this); + + validateElement(XsdTagScope::DefaultOpenContent); + + m_defaultOpenContent = XsdComplexType::OpenContent::Ptr(new XsdComplexType::OpenContent()); + + if (hasAttribute(QString::fromLatin1("appliesToEmpty"))) { + const QString value = readAttribute(QString::fromLatin1("appliesToEmpty")); + const Boolean::Ptr appliesToEmpty = Boolean::fromLexical(value); + if (appliesToEmpty->hasError()) { + attributeContentError("appliesToEmpty", "defaultOpenContent", value, BuiltinTypes::xsBoolean); + return; + } + + m_defaultOpenContentAppliesToEmpty = appliesToEmpty->as()->value(); + } else { + m_defaultOpenContentAppliesToEmpty = false; + } + + if (hasAttribute(QString::fromLatin1("mode"))) { + const QString mode = readAttribute(QString::fromLatin1("mode")); + + if (mode == QString::fromLatin1("interleave")) { + m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Interleave); + } else if (mode == QString::fromLatin1("suffix")) { + m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Suffix); + } else { + attributeContentError("mode", "defaultOpenContent", mode); + return; + } + } else { + m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Interleave); + } + + validateIdAttribute("defaultOpenContent"); + + TagValidationHandler tagValidator(XsdTagScope::DefaultOpenContent, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + m_defaultOpenContent->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) { + const XsdParticle::Ptr particle; + const XsdWildcard::Ptr wildcard = parseAny(particle); + m_defaultOpenContent->setWildcard(wildcard); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +XsdSimpleType::Ptr XsdSchemaParser::parseGlobalSimpleType() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::SimpleType, this); + + validateElement(XsdTagScope::GlobalSimpleType); + + const XsdSimpleType::Ptr simpleType(new XsdSimpleType()); + simpleType->setCategory(XsdSimpleType::SimpleTypeAtomic); // just to make sure it's not invalid + + // parse attributes + const SchemaType::DerivationConstraints allowedConstraints(SchemaType::ExtensionConstraint | SchemaType::RestrictionConstraint | SchemaType::ListConstraint | SchemaType::UnionConstraint); + simpleType->setDerivationConstraints(readDerivationConstraintAttribute(allowedConstraints, "simpleType")); + + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("simpleType")); + simpleType->setName(objectName); + + validateIdAttribute("simpleType"); + + TagValidationHandler tagValidator(XsdTagScope::GlobalSimpleType, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + simpleType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) { + parseSimpleRestriction(simpleType); + } else if (isSchemaTag(XsdSchemaToken::List, token, namespaceToken)) { + parseList(simpleType); + } else if (isSchemaTag(XsdSchemaToken::Union, token, namespaceToken)) { + parseUnion(simpleType); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return simpleType; +} + +XsdSimpleType::Ptr XsdSchemaParser::parseLocalSimpleType() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::SimpleType, this); + + validateElement(XsdTagScope::LocalSimpleType); + + const XsdSimpleType::Ptr simpleType(new XsdSimpleType()); + simpleType->setCategory(XsdSimpleType::SimpleTypeAtomic); // just to make sure it's not invalid + simpleType->setName(m_parserContext->createAnonymousName(m_targetNamespace)); + + validateIdAttribute("simpleType"); + + TagValidationHandler tagValidator(XsdTagScope::LocalSimpleType, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + simpleType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) { + parseSimpleRestriction(simpleType); + } else if (isSchemaTag(XsdSchemaToken::List, token, namespaceToken)) { + parseList(simpleType); + } else if (isSchemaTag(XsdSchemaToken::Union, token, namespaceToken)) { + parseUnion(simpleType); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return simpleType; +} + +void XsdSchemaParser::parseSimpleRestriction(const XsdSimpleType::Ptr &ptr) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Restriction, this); + + validateElement(XsdTagScope::SimpleRestriction); + + ptr->setDerivationMethod(XsdSimpleType::DerivationRestriction); + + // The base attribute and simpleType member are mutually exclusive, + // so we keep track of that + bool hasBaseAttribute = false; + bool hasBaseTypeSpecified = false; + + QXmlName baseName; + if (hasAttribute(QString::fromLatin1("base"))) { + const QString base = readQNameAttribute(QString::fromLatin1("base"), "restriction"); + convertName(base, NamespaceSupport::ElementName, baseName); // translate qualified name into QXmlName + m_schemaResolver->addSimpleRestrictionBase(ptr, baseName, currentSourceLocation()); // add to resolver + + hasBaseAttribute = true; + hasBaseTypeSpecified = true; + } + validateIdAttribute("restriction"); + + XsdFacet::Hash facets; + QList patternFacets; + QList enumerationFacets; + QList assertionFacets; + + TagValidationHandler tagValidator(XsdTagScope::SimpleRestriction, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + ptr->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + if (hasBaseAttribute) { + error(QtXmlPatterns::tr("%1 element is not allowed inside %2 element if %3 attribute is present") + .arg(formatElement("simpleType")) + .arg(formatElement("restriction")) + .arg(formatAttribute("base"))); + return; + } + + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(ptr); + ptr->setWxsSuperType(type); + ptr->setCategory(type->category()); + hasBaseTypeSpecified = true; + + // add it to list of anonymous types as well + addAnonymousType(type); + } else if (isSchemaTag(XsdSchemaToken::MinExclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMinExclusiveFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::MinInclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMinInclusiveFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::MaxExclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMaxExclusiveFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::MaxInclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMaxInclusiveFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::TotalDigits, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseTotalDigitsFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::FractionDigits, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseFractionDigitsFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::Length, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseLengthFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::MinLength, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMinLengthFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::MaxLength, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMaxLengthFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::Enumeration, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseEnumerationFacet(); + enumerationFacets.append(facet); + } else if (isSchemaTag(XsdSchemaToken::WhiteSpace, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseWhiteSpaceFacet(); + addFacet(facet, facets, ptr); + } else if (isSchemaTag(XsdSchemaToken::Pattern, token, namespaceToken)) { + const XsdFacet::Ptr facet = parsePatternFacet(); + patternFacets.append(facet); + } else if (isSchemaTag(XsdSchemaToken::Assertion, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseAssertionFacet(); + assertionFacets.append(facet); + } else { + parseUnknown(); + } + } + } + + if (!hasBaseTypeSpecified) { + error(QtXmlPatterns::tr("%1 element has neither %2 attribute nor %3 child element") + .arg(formatElement("restriction")) + .arg(formatAttribute("base")) + .arg(formatElement("simpleType"))); + return; + } + + // merge all pattern facets into one multi value facet + if (!patternFacets.isEmpty()) { + const XsdFacet::Ptr patternFacet(new XsdFacet()); + patternFacet->setType(XsdFacet::Pattern); + + AtomicValue::List multiValue; + for (int i = 0; i < patternFacets.count(); ++i) + multiValue << patternFacets.at(i)->multiValue(); + + patternFacet->setMultiValue(multiValue); + addFacet(patternFacet, facets, ptr); + } + + // merge all enumeration facets into one multi value facet + if (!enumerationFacets.isEmpty()) { + const XsdFacet::Ptr enumerationFacet(new XsdFacet()); + enumerationFacet->setType(XsdFacet::Enumeration); + + AtomicValue::List multiValue; + for (int i = 0; i < enumerationFacets.count(); ++i) + multiValue << enumerationFacets.at(i)->multiValue(); + + enumerationFacet->setMultiValue(multiValue); + addFacet(enumerationFacet, facets, ptr); + } + + // merge all assertion facets into one facet + if (!assertionFacets.isEmpty()) { + const XsdFacet::Ptr assertionFacet(new XsdFacet()); + assertionFacet->setType(XsdFacet::Assertion); + + XsdAssertion::List assertions; + for (int i = 0; i < assertionFacets.count(); ++i) + assertions << assertionFacets.at(i)->assertions(); + + assertionFacet->setAssertions(assertions); + addFacet(assertionFacet, facets, ptr); + } + + ptr->setFacets(facets); + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseList(const XsdSimpleType::Ptr &ptr) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::List, this); + + validateElement(XsdTagScope::List); + + ptr->setCategory(XsdSimpleType::SimpleTypeList); + ptr->setDerivationMethod(XsdSimpleType::DerivationList); + ptr->setWxsSuperType(BuiltinTypes::xsAnySimpleType); + + // The itemType attribute and simpleType member are mutually exclusive, + // so we keep track of that + bool hasItemTypeAttribute = false; + bool hasItemTypeSpecified = false; + + if (hasAttribute(QString::fromLatin1("itemType"))) { + const QString itemType = readQNameAttribute(QString::fromLatin1("itemType"), "list"); + QXmlName typeName; + convertName(itemType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addSimpleListType(ptr, typeName, currentSourceLocation()); // add to resolver + + hasItemTypeAttribute = true; + hasItemTypeSpecified = true; + } + + validateIdAttribute("list"); + + TagValidationHandler tagValidator(XsdTagScope::List, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + ptr->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + if (hasItemTypeAttribute) { + error(QtXmlPatterns::tr("%1 element is not allowed inside %2 element if %3 attribute is present") + .arg(formatElement("simpleType")) + .arg(formatElement("list")) + .arg(formatAttribute("itemType"))); + return; + } + + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(ptr); + ptr->setItemType(type); + + hasItemTypeSpecified = true; + + // add it to list of anonymous types as well + addAnonymousType(type); + } else { + parseUnknown(); + } + } + } + + if (!hasItemTypeSpecified) { + error(QtXmlPatterns::tr("%1 element has neither %2 attribute nor %3 child element") + .arg(formatElement("list")) + .arg(formatAttribute("itemType")) + .arg(formatElement("simpleType"))); + return; + } + + tagValidator.finalize(); + + // add the default white space facet that every simple type with list derivation has + const XsdFacet::Ptr defaultFacet(new XsdFacet()); + defaultFacet->setType(XsdFacet::WhiteSpace); + defaultFacet->setFixed(true); + defaultFacet->setValue(DerivedString::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse))); + XsdFacet::Hash facets; + facets.insert(defaultFacet->type(), defaultFacet); + ptr->setFacets(facets); +} + +void XsdSchemaParser::parseUnion(const XsdSimpleType::Ptr &ptr) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Union, this); + + validateElement(XsdTagScope::Union); + + ptr->setCategory(XsdSimpleType::SimpleTypeUnion); + ptr->setDerivationMethod(XsdSimpleType::DerivationUnion); + ptr->setWxsSuperType(BuiltinTypes::xsAnySimpleType); + + // The memberTypes attribute is not allowed to be empty, + // so we keep track of that + bool hasMemberTypesAttribute = false; + bool hasMemberTypesSpecified = false; + + if (hasAttribute(QString::fromLatin1("memberTypes"))) { + hasMemberTypesAttribute = true; + + const QStringList memberTypes = readAttribute(QString::fromLatin1("memberTypes")).split(QLatin1Char(' '), QString::SkipEmptyParts); + QList typeNames; + + for (int i = 0; i < memberTypes.count(); ++i) { + QXmlName typeName; + convertName(memberTypes.at(i), NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + typeNames.append(typeName); + } + + if (!typeNames.isEmpty()) { + m_schemaResolver->addSimpleUnionTypes(ptr, typeNames, currentSourceLocation()); // add to resolver + hasMemberTypesSpecified = true; + } + } + + validateIdAttribute("union"); + + AnySimpleType::List memberTypes; + + TagValidationHandler tagValidator(XsdTagScope::Union, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + ptr->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(ptr); + memberTypes.append(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + } else { + parseUnknown(); + } + } + } + + if (!memberTypes.isEmpty()) { + ptr->setMemberTypes(memberTypes); + hasMemberTypesSpecified = true; + } + + if (!hasMemberTypesSpecified) { + error(QtXmlPatterns::tr("%1 element has neither %2 attribute nor %3 child element") + .arg(formatElement("union")) + .arg(formatAttribute("memberTypes")) + .arg(formatElement("simpleType"))); + return; + } + + tagValidator.finalize(); +} + +XsdFacet::Ptr XsdSchemaParser::parseMinExclusiveFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MinExclusive, this); + + validateElement(XsdTagScope::MinExclusiveFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::MinimumExclusive); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "minExclusive", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + // as minExclusive can have a value of type anySimpleType, we just read + // the string here and store it for later intepretation + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedString::Ptr string = DerivedString::fromLexical(m_namePool, value); + if (string->hasError()) { + attributeContentError("value", "minExclusive", value, BuiltinTypes::xsAnySimpleType); + return facet; + } else { + facet->setValue(string); + } + + validateIdAttribute("minExclusive"); + + TagValidationHandler tagValidator(XsdTagScope::MinExclusiveFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseMinInclusiveFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MinInclusive, this); + + validateElement(XsdTagScope::MinInclusiveFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::MinimumInclusive); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "minInclusive", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + // as minInclusive can have a value of type anySimpleType, we just read + // the string here and store it for later intepretation + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedString::Ptr string = DerivedString::fromLexical(m_namePool, value); + if (string->hasError()) { + attributeContentError("value", "minInclusive", value, BuiltinTypes::xsAnySimpleType); + return facet; + } else { + facet->setValue(string); + } + + validateIdAttribute("minInclusive"); + + TagValidationHandler tagValidator(XsdTagScope::MinInclusiveFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseMaxExclusiveFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MaxExclusive, this); + + validateElement(XsdTagScope::MaxExclusiveFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::MaximumExclusive); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "maxExclusive", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + // as maxExclusive can have a value of type anySimpleType, we just read + // the string here and store it for later intepretation + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedString::Ptr string = DerivedString::fromLexical(m_namePool, value); + if (string->hasError()) { + attributeContentError("value", "maxExclusive", value, BuiltinTypes::xsAnySimpleType); + return facet; + } else { + facet->setValue(string); + } + + validateIdAttribute("maxExclusive"); + + TagValidationHandler tagValidator(XsdTagScope::MaxExclusiveFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseMaxInclusiveFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MaxInclusive, this); + + validateElement(XsdTagScope::MaxInclusiveFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::MaximumInclusive); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "maxInclusive", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + // as maxInclusive can have a value of type anySimpleType, we just read + // the string here and store it for later intepretation + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedString::Ptr string = DerivedString::fromLexical(m_namePool, value); + if (string->hasError()) { + attributeContentError("value", "maxInclusive", value, BuiltinTypes::xsAnySimpleType); + return facet; + } else { + facet->setValue(string); + } + + validateIdAttribute("maxInclusive"); + + TagValidationHandler tagValidator(XsdTagScope::MaxInclusiveFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseTotalDigitsFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::TotalDigits, this); + + validateElement(XsdTagScope::TotalDigitsFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::TotalDigits); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "totalDigits", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedInteger::Ptr integer = DerivedInteger::fromLexical(m_namePool, value); + if (integer->hasError()) { + attributeContentError("value", "totalDigits", value, BuiltinTypes::xsPositiveInteger); + return facet; + } else { + facet->setValue(integer); + } + + validateIdAttribute("totalDigits"); + + TagValidationHandler tagValidator(XsdTagScope::TotalDigitsFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseFractionDigitsFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::FractionDigits, this); + + validateElement(XsdTagScope::FractionDigitsFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::FractionDigits); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "fractionDigits", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedInteger::Ptr integer = DerivedInteger::fromLexical(m_namePool, value); + if (integer->hasError()) { + attributeContentError("value", "fractionDigits", value, BuiltinTypes::xsNonNegativeInteger); + return facet; + } else { + facet->setValue(integer); + } + + validateIdAttribute("fractionDigits"); + + TagValidationHandler tagValidator(XsdTagScope::FractionDigitsFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseLengthFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Length, this); + + validateElement(XsdTagScope::LengthFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::Length); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "length", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedInteger::Ptr integer = DerivedInteger::fromLexical(m_namePool, value); + if (integer->hasError()) { + attributeContentError("value", "length", value, BuiltinTypes::xsNonNegativeInteger); + return facet; + } else { + facet->setValue(integer); + } + + validateIdAttribute("length"); + + TagValidationHandler tagValidator(XsdTagScope::LengthFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseMinLengthFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MinLength, this); + + validateElement(XsdTagScope::MinLengthFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::MinimumLength); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "minLength", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedInteger::Ptr integer = DerivedInteger::fromLexical(m_namePool, value); + if (integer->hasError()) { + attributeContentError("value", "minLength", value, BuiltinTypes::xsNonNegativeInteger); + return facet; + } else { + facet->setValue(integer); + } + + validateIdAttribute("minLength"); + + TagValidationHandler tagValidator(XsdTagScope::MinLengthFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseMaxLengthFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::MaxLength, this); + + validateElement(XsdTagScope::MaxLengthFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::MaximumLength); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "maxLength", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedInteger::Ptr integer = DerivedInteger::fromLexical(m_namePool, value); + if (integer->hasError()) { + attributeContentError("value", "maxLength", value, BuiltinTypes::xsNonNegativeInteger); + return facet; + } else { + facet->setValue(integer); + } + + validateIdAttribute("maxLength"); + + TagValidationHandler tagValidator(XsdTagScope::MaxLengthFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseEnumerationFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Enumeration, this); + + validateElement(XsdTagScope::EnumerationFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::Enumeration); + + // parse attributes + facet->setFixed(false); // not defined in schema, but can't hurt + + const QString value = readAttribute(QString::fromLatin1("value")); + + // as enumeration can have a value of type anySimpleType, we just read + // the string here and store it for later intepretation + DerivedString::Ptr string = DerivedString::fromLexical(m_namePool, value); + if (string->hasError()) { + attributeContentError("value", "enumeration", value); + return facet; + } else { + AtomicValue::List multiValue; + multiValue << string; + facet->setMultiValue(multiValue); + } + m_schemaResolver->addEnumerationFacetValue(string, m_namespaceSupport); + + validateIdAttribute("enumeration"); + + TagValidationHandler tagValidator(XsdTagScope::EnumerationFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseWhiteSpaceFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::WhiteSpace, this); + + validateElement(XsdTagScope::WhiteSpaceFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::WhiteSpace); + + // parse attributes + if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + const Boolean::Ptr fixed = Boolean::fromLexical(value); + if (fixed->hasError()) { + attributeContentError("fixed", "whiteSpace", value, BuiltinTypes::xsBoolean); + return facet; + } + + facet->setFixed(fixed->as()->value()); + } else { + facet->setFixed(false); // the default value + } + + const QString value = readAttribute(QString::fromLatin1("value")); + if (value != XsdSchemaToken::toString(XsdSchemaToken::Collapse) && + value != XsdSchemaToken::toString(XsdSchemaToken::Preserve) && + value != XsdSchemaToken::toString(XsdSchemaToken::Replace)) { + attributeContentError("value", "whiteSpace", value); + return facet; + } else { + DerivedString::Ptr string = DerivedString::fromLexical(m_namePool, value); + if (string->hasError()) { + attributeContentError("value", "whiteSpace", value); + return facet; + } else { + facet->setValue(string); + } + } + + validateIdAttribute("whiteSpace"); + + TagValidationHandler tagValidator(XsdTagScope::WhiteSpaceFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parsePatternFacet() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Pattern, this); + + validateElement(XsdTagScope::PatternFacet); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::Pattern); + + // parse attributes + + // as pattern can have a value of type anySimpleType, we just read + // the string here and store it for later intepretation + const QString value = readAttribute(QString::fromLatin1("value")); + DerivedString::Ptr string = DerivedString::fromLexical(m_namePool, value); + if (string->hasError()) { + attributeContentError("value", "pattern", value); + return facet; + } else { + AtomicValue::List multiValue; + multiValue << string; + facet->setMultiValue(multiValue); + } + + validateIdAttribute("pattern"); + + TagValidationHandler tagValidator(XsdTagScope::PatternFacet, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + facet->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return facet; +} + +XsdFacet::Ptr XsdSchemaParser::parseAssertionFacet() +{ + // this is just a wrapper function around the parseAssertion() method + + const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assertion, XsdTagScope::Assertion); + + const XsdFacet::Ptr facet = XsdFacet::Ptr(new XsdFacet()); + facet->setType(XsdFacet::Assertion); + facet->setAssertions(XsdAssertion::List() << assertion); + + return facet; +} + +XsdComplexType::Ptr XsdSchemaParser::parseGlobalComplexType() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::ComplexType, this); + + validateElement(XsdTagScope::GlobalComplexType); + + bool hasTypeSpecified = false; + bool hasComplexContent = false; + + const XsdComplexType::Ptr complexType(new XsdComplexType()); + + // parse attributes + if (hasAttribute(QString::fromLatin1("abstract"))) { + const QString abstract = readAttribute(QString::fromLatin1("abstract")); + + const Boolean::Ptr value = Boolean::fromLexical(abstract); + if (value->hasError()) { + attributeContentError("abstract", "complexType", abstract, BuiltinTypes::xsBoolean); + return complexType; + } + + complexType->setIsAbstract(value->as()->value()); + } else { + complexType->setIsAbstract(false); // default value + } + + complexType->setProhibitedSubstitutions(readBlockingConstraintAttribute(NamedSchemaComponent::ExtensionConstraint | NamedSchemaComponent::RestrictionConstraint, "complexType")); + complexType->setDerivationConstraints(readDerivationConstraintAttribute(SchemaType::ExtensionConstraint | SchemaType::RestrictionConstraint, "complexType")); + + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("complexType")); + complexType->setName(objectName); + + bool effectiveMixed = false; + if (hasAttribute(QString::fromLatin1("mixed"))) { + const QString mixed = readAttribute(QString::fromLatin1("mixed")); + + const Boolean::Ptr value = Boolean::fromLexical(mixed); + if (value->hasError()) { + attributeContentError("mixed", "complexType", mixed, BuiltinTypes::xsBoolean); + return complexType; + } + + effectiveMixed = value->as()->value(); + } + + validateIdAttribute("complexType"); + + TagValidationHandler tagValidator(XsdTagScope::GlobalComplexType, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleContent, token, namespaceToken)) { + if (effectiveMixed) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("complexType")) + .arg(formatElement("simpleContent")) + .arg(formatAttribute("mixed"))); + return complexType; + } + + parseSimpleContent(complexType); + hasTypeSpecified = true; + } else if (isSchemaTag(XsdSchemaToken::ComplexContent, token, namespaceToken)) { + bool mixed; + parseComplexContent(complexType, &mixed); + hasTypeSpecified = true; + + effectiveMixed = (effectiveMixed || mixed); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) { + const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent(); + complexType->contentType()->setOpenContent(openContent); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalAll(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType); + complexType->addAttributeUse(attributeUse); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup(); + complexType->addAttributeUse(attributeUse); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) { + const XsdWildcard::Ptr wildcard = parseAnyAttribute(); + complexType->setAttributeWildcard(wildcard); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) { + const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert); + complexType->addAssertion(assertion); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + if (!hasTypeSpecified) { + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } + + if (hasComplexContent == true) { + resolveComplexContentType(complexType, effectiveMixed); + } + + return complexType; +} + +XsdComplexType::Ptr XsdSchemaParser::parseLocalComplexType() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::ComplexType, this); + + validateElement(XsdTagScope::LocalComplexType); + + bool hasTypeSpecified = false; + bool hasComplexContent = true; + + const XsdComplexType::Ptr complexType(new XsdComplexType()); + complexType->setName(m_parserContext->createAnonymousName(m_targetNamespace)); + + // parse attributes + bool effectiveMixed = false; + if (hasAttribute(QString::fromLatin1("mixed"))) { + const QString mixed = readAttribute(QString::fromLatin1("mixed")); + + const Boolean::Ptr value = Boolean::fromLexical(mixed); + if (value->hasError()) { + attributeContentError("mixed", "complexType", mixed, BuiltinTypes::xsBoolean); + return complexType; + } + + effectiveMixed = value->as()->value(); + } + + validateIdAttribute("complexType"); + + TagValidationHandler tagValidator(XsdTagScope::LocalComplexType, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleContent, token, namespaceToken)) { + parseSimpleContent(complexType); + hasTypeSpecified = true; + } else if (isSchemaTag(XsdSchemaToken::ComplexContent, token, namespaceToken)) { + bool mixed; + parseComplexContent(complexType, &mixed); + hasTypeSpecified = true; + + effectiveMixed = (effectiveMixed || mixed); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) { + const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent(); + complexType->contentType()->setOpenContent(openContent); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalAll(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType); + complexType->addAttributeUse(attributeUse); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup(); + complexType->addAttributeUse(attributeUse); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) { + const XsdWildcard::Ptr wildcard = parseAnyAttribute(); + complexType->setAttributeWildcard(wildcard); + + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) { + const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert); + complexType->addAssertion(assertion); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + if (!hasTypeSpecified) { + complexType->setWxsSuperType(BuiltinTypes::xsAnyType); + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + hasComplexContent = true; + } + + if (hasComplexContent == true) { + resolveComplexContentType(complexType, effectiveMixed); + } + + return complexType; +} + +void XsdSchemaParser::resolveComplexContentType(const XsdComplexType::Ptr &complexType, bool effectiveMixed) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctcc.common + + // 1 + // the effectiveMixed contains the effective mixed value + + // 2 + bool hasEmptyContent = false; + if (!complexType->contentType()->particle()) { + hasEmptyContent = true; // 2.1.1 + } else { + if (complexType->contentType()->particle()->term()->isModelGroup()) { + const XsdModelGroup::Ptr group = complexType->contentType()->particle()->term(); + if (group->compositor() == XsdModelGroup::SequenceCompositor || group->compositor() == XsdModelGroup::AllCompositor) { + if (group->particles().isEmpty()) + hasEmptyContent = true; // 2.1.2 + } else if (group->compositor() == XsdModelGroup::ChoiceCompositor) { + if ((complexType->contentType()->particle()->minimumOccurs() == 0) && group->particles().isEmpty()) + hasEmptyContent = true; // 2.1.3 + } + + if ((complexType->contentType()->particle()->maximumOccursUnbounded() == false) && (complexType->contentType()->particle()->maximumOccurs() == 0)) + hasEmptyContent = true; // 2.1.4 + } + } + + const XsdParticle::Ptr explicitContent = (hasEmptyContent ? XsdParticle::Ptr() : complexType->contentType()->particle()); + + // do all the other work (3, 4, 5 and 6) in the resolver, as they need access to the base type object + m_schemaResolver->addComplexContentType(complexType, explicitContent, effectiveMixed); +} + +void XsdSchemaParser::parseSimpleContent(const XsdComplexType::Ptr &complexType) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::SimpleContent, this); + + validateElement(XsdTagScope::SimpleContent); + + complexType->contentType()->setVariety(XsdComplexType::ContentType::Simple); + + // parse attributes + validateIdAttribute("simpleContent"); + + TagValidationHandler tagValidator(XsdTagScope::SimpleContent, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) { + parseSimpleContentRestriction(complexType); + } else if (isSchemaTag(XsdSchemaToken::Extension, token, namespaceToken)) { + parseSimpleContentExtension(complexType); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseSimpleContentRestriction(const XsdComplexType::Ptr &complexType) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Restriction, this); + + validateElement(XsdTagScope::SimpleContentRestriction); + + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + + // parse attributes + const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "restriction"); + QXmlName typeName; + convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + + validateIdAttribute("restriction"); + + XsdFacet::Hash facets; + QList patternFacets; + QList enumerationFacets; + QList assertionFacets; + + TagValidationHandler tagValidator(XsdTagScope::SimpleContentRestriction, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(complexType); //TODO: investigate what the schema spec really wants here?!? + complexType->contentType()->setSimpleType(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + } else if (isSchemaTag(XsdSchemaToken::MinExclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMinExclusiveFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::MinInclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMinInclusiveFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::MaxExclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMaxExclusiveFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::MaxInclusive, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMaxInclusiveFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::TotalDigits, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseTotalDigitsFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::FractionDigits, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseFractionDigitsFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::Length, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseLengthFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::MinLength, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMinLengthFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::MaxLength, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseMaxLengthFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::Enumeration, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseEnumerationFacet(); + enumerationFacets.append(facet); + } else if (isSchemaTag(XsdSchemaToken::WhiteSpace, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseWhiteSpaceFacet(); + addFacet(facet, facets, complexType); + } else if (isSchemaTag(XsdSchemaToken::Pattern, token, namespaceToken)) { + const XsdFacet::Ptr facet = parsePatternFacet(); + patternFacets.append(facet); + } else if (isSchemaTag(XsdSchemaToken::Assertion, token, namespaceToken)) { + const XsdFacet::Ptr facet = parseAssertionFacet(); + assertionFacets.append(facet); + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup(); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) { + const XsdWildcard::Ptr wildcard = parseAnyAttribute(); + complexType->setAttributeWildcard(wildcard); + } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) { + const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert); + complexType->addAssertion(assertion); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + // merge all pattern facets into one multi value facet + if (!patternFacets.isEmpty()) { + const XsdFacet::Ptr patternFacet(new XsdFacet()); + patternFacet->setType(XsdFacet::Pattern); + + AtomicValue::List multiValue; + for (int i = 0; i < patternFacets.count(); ++i) + multiValue << patternFacets.at(i)->multiValue(); + + patternFacet->setMultiValue(multiValue); + addFacet(patternFacet, facets, complexType); + } + + // merge all enumeration facets into one multi value facet + if (!enumerationFacets.isEmpty()) { + const XsdFacet::Ptr enumerationFacet(new XsdFacet()); + enumerationFacet->setType(XsdFacet::Enumeration); + + AtomicValue::List multiValue; + for (int i = 0; i < enumerationFacets.count(); ++i) + multiValue << enumerationFacets.at(i)->multiValue(); + + enumerationFacet->setMultiValue(multiValue); + addFacet(enumerationFacet, facets, complexType); + } + + // merge all assertion facets into one facet + if (!assertionFacets.isEmpty()) { + const XsdFacet::Ptr assertionFacet(new XsdFacet()); + assertionFacet->setType(XsdFacet::Assertion); + + XsdAssertion::List assertions; + for (int i = 0; i < assertionFacets.count(); ++i) + assertions << assertionFacets.at(i)->assertions(); + + assertionFacet->setAssertions(assertions); + addFacet(assertionFacet, facets, complexType); + } + + m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation(), facets); // add to resolver +} + +void XsdSchemaParser::parseSimpleContentExtension(const XsdComplexType::Ptr &complexType) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Extension, this); + + validateElement(XsdTagScope::SimpleContentExtension); + + complexType->setDerivationMethod(XsdComplexType::DerivationExtension); + + // parse attributes + const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "extension"); + QXmlName typeName; + convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation()); // add to resolver + + validateIdAttribute("extension"); + + TagValidationHandler tagValidator(XsdTagScope::SimpleContentExtension, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup(); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) { + const XsdWildcard::Ptr wildcard = parseAnyAttribute(); + complexType->setAttributeWildcard(wildcard); + } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) { + const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert); + complexType->addAssertion(assertion); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseComplexContent(const XsdComplexType::Ptr &complexType, bool *mixed) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::ComplexContent, this); + + validateElement(XsdTagScope::ComplexContent); + + complexType->contentType()->setVariety(XsdComplexType::ContentType::ElementOnly); + + // parse attributes + if (hasAttribute(QString::fromLatin1("mixed"))) { + const QString mixedStr = readAttribute(QString::fromLatin1("mixed")); + + const Boolean::Ptr value = Boolean::fromLexical(mixedStr); + if (value->hasError()) { + attributeContentError("mixed", "complexType", mixedStr, BuiltinTypes::xsBoolean); + return; + } + + *mixed = value->as()->value(); + } else { + *mixed = false; + } + + validateIdAttribute("complexContent"); + + TagValidationHandler tagValidator(XsdTagScope::ComplexContent, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Restriction, token, namespaceToken)) { + parseComplexContentRestriction(complexType); + } else if (isSchemaTag(XsdSchemaToken::Extension, token, namespaceToken)) { + parseComplexContentExtension(complexType); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseComplexContentRestriction(const XsdComplexType::Ptr &complexType) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Restriction, this); + + validateElement(XsdTagScope::ComplexContentRestriction); + + complexType->setDerivationMethod(XsdComplexType::DerivationRestriction); + + // parse attributes + const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "restriction"); + QXmlName typeName; + convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation()); // add to resolver + + validateIdAttribute("restriction"); + + TagValidationHandler tagValidator(XsdTagScope::ComplexContentRestriction, this, m_namePool); + + bool hasContent = false; + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) { + const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent(); + complexType->contentType()->setOpenContent(openContent); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalAll(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup(); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) { + const XsdWildcard::Ptr wildcard = parseAnyAttribute(); + complexType->setAttributeWildcard(wildcard); + } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) { + const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert); + complexType->addAssertion(assertion); + } else { + parseUnknown(); + } + } + } + + if (!hasContent) + complexType->contentType()->setVariety(XsdComplexType::ContentType::Empty); + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseComplexContentExtension(const XsdComplexType::Ptr &complexType) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Extension, this); + + validateElement(XsdTagScope::ComplexContentExtension); + + complexType->setDerivationMethod(XsdComplexType::DerivationExtension); + + // parse attributes + const QString baseType = readQNameAttribute(QString::fromLatin1("base"), "extension"); + QXmlName typeName; + convertName(baseType, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addComplexBaseType(complexType, typeName, currentSourceLocation()); // add to resolver + + validateIdAttribute("extension"); + + TagValidationHandler tagValidator(XsdTagScope::ComplexContentExtension, this, m_namePool); + + bool hasContent = false; + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + complexType->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::OpenContent, token, namespaceToken)) { + const XsdComplexType::OpenContent::Ptr openContent = parseOpenContent(); + complexType->contentType()->setOpenContent(openContent); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalAll(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, complexType); + particle->setTerm(term); + complexType->contentType()->setParticle(particle); + hasContent = true; + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(complexType); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup(); + complexType->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) { + const XsdWildcard::Ptr wildcard = parseAnyAttribute(); + complexType->setAttributeWildcard(wildcard); + } else if (isSchemaTag(XsdSchemaToken::Assert, token, namespaceToken)) { + const XsdAssertion::Ptr assertion = parseAssertion(XsdSchemaToken::Assert, XsdTagScope::Assert); + complexType->addAssertion(assertion); + } else { + parseUnknown(); + } + } + } + + if (!hasContent) + complexType->contentType()->setVariety(XsdComplexType::ContentType::Empty); + + tagValidator.finalize(); +} + + +XsdAssertion::Ptr XsdSchemaParser::parseAssertion(const XsdSchemaToken::NodeName &nodeName, const XsdTagScope::Type &tag) +{ + const ElementNamespaceHandler namespaceHandler(nodeName, this); + + validateElement(tag); + + const XsdAssertion::Ptr assertion(new XsdAssertion()); + + // parse attributes + + const XsdXPathExpression::Ptr expression = readXPathExpression("assertion"); + assertion->setTest(expression); + + const QString test = readXPathAttribute(QString::fromLatin1("test"), XPath20, "assertion"); + expression->setExpression(test); + + validateIdAttribute("assertion"); + + TagValidationHandler tagValidator(tag, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + assertion->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return assertion; +} + +XsdComplexType::OpenContent::Ptr XsdSchemaParser::parseOpenContent() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::OpenContent, this); + + validateElement(XsdTagScope::OpenContent); + + const XsdComplexType::OpenContent::Ptr openContent(new XsdComplexType::OpenContent()); + + if (hasAttribute(QString::fromLatin1("mode"))) { + const QString mode = readAttribute(QString::fromLatin1("mode")); + + if (mode == QString::fromLatin1("none")) { + m_defaultOpenContent->setMode(XsdComplexType::OpenContent::None); + } else if (mode == QString::fromLatin1("interleave")) { + m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Interleave); + } else if (mode == QString::fromLatin1("suffix")) { + m_defaultOpenContent->setMode(XsdComplexType::OpenContent::Suffix); + } else { + attributeContentError("mode", "openContent", mode); + return openContent; + } + } else { + openContent->setMode(XsdComplexType::OpenContent::Interleave); + } + + validateIdAttribute("openContent"); + + TagValidationHandler tagValidator(XsdTagScope::OpenContent, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + openContent->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) { + const XsdParticle::Ptr particle; + const XsdWildcard::Ptr wildcard = parseAny(particle); + openContent->setWildcard(wildcard); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return openContent; +} + +XsdModelGroup::Ptr XsdSchemaParser::parseNamedGroup() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Group, this); + + validateElement(XsdTagScope::NamedGroup); + + const XsdModelGroup::Ptr modelGroup(new XsdModelGroup()); + XsdModelGroup::Ptr group; + + QXmlName objectName; + if (hasAttribute(QString::fromLatin1("name"))) { + objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("group")); + } + + validateIdAttribute("group"); + + TagValidationHandler tagValidator(XsdTagScope::NamedGroup, this, m_namePool); + + XsdAnnotation::Ptr annotation; + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + annotation = parseAnnotation(); + } else if (isSchemaTag(XsdSchemaToken::All, token, namespaceToken)) { + group = parseAll(modelGroup); + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + group = parseChoice(modelGroup); + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + group = parseSequence(modelGroup); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + group->setName(objectName); + + if (annotation) + group->addAnnotation(annotation); + + return group; +} + +XsdTerm::Ptr XsdSchemaParser::parseReferredGroup(const XsdParticle::Ptr &particle) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Group, this); + + validateElement(XsdTagScope::ReferredGroup); + + const XsdReference::Ptr reference(new XsdReference()); + reference->setType(XsdReference::ModelGroup); + reference->setSourceLocation(currentSourceLocation()); + + // parse attributes + if (!parseMinMaxConstraint(particle, "group")) { + return reference; + } + + const QString value = readQNameAttribute(QString::fromLatin1("ref"), "group"); + QXmlName referenceName; + convertName(value, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName + reference->setReferenceName(referenceName); + + validateIdAttribute("group"); + + TagValidationHandler tagValidator(XsdTagScope::ReferredGroup, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + reference->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return reference; +} + +XsdModelGroup::Ptr XsdSchemaParser::parseAll(const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::All, this); + + validateElement(XsdTagScope::All); + + const XsdModelGroup::Ptr modelGroup(new XsdModelGroup()); + modelGroup->setCompositor(XsdModelGroup::AllCompositor); + + validateIdAttribute("all"); + + TagValidationHandler tagValidator(XsdTagScope::All, this, m_namePool); + + XsdParticle::List particles; + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + modelGroup->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalElement(particle, parent); + particle->setTerm(term); + + if (particle->maximumOccursUnbounded() || particle->maximumOccurs() > 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must be %3 or %4") + .arg(formatAttribute("maxOccurs")) + .arg(formatElement("all")) + .arg(formatData("0")) + .arg(formatData("1"))); + return modelGroup; + } + + particles.append(particle); + } else { + parseUnknown(); + } + } + } + + modelGroup->setParticles(particles); + + tagValidator.finalize(); + + return modelGroup; +} + +XsdModelGroup::Ptr XsdSchemaParser::parseLocalAll(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::All, this); + + validateElement(XsdTagScope::LocalAll); + + const XsdModelGroup::Ptr modelGroup(new XsdModelGroup()); + modelGroup->setCompositor(XsdModelGroup::AllCompositor); + + // parse attributes + if (!parseMinMaxConstraint(particle, "all")) { + return modelGroup; + } + if (particle->maximumOccursUnbounded() || particle->maximumOccurs() != 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must have a value of %3") + .arg(formatAttribute("maxOccurs")) + .arg(formatElement("all")) + .arg(formatData("1"))); + return modelGroup; + } + if (particle->minimumOccurs() != 0 && particle->minimumOccurs() != 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must have a value of %3 or %4") + .arg(formatAttribute("minOccurs")) + .arg(formatElement("all")) + .arg(formatData("0")) + .arg(formatData("1"))); + return modelGroup; + } + + validateIdAttribute("all"); + + TagValidationHandler tagValidator(XsdTagScope::LocalAll, this, m_namePool); + + XsdParticle::List particles; + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + modelGroup->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalElement(particle, parent); + particle->setTerm(term); + + if (particle->maximumOccursUnbounded() || particle->maximumOccurs() > 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must have a value of %3 or %4") + .arg(formatAttribute("maxOccurs")) + .arg(formatElement("all")) + .arg(formatData("0")) + .arg(formatData("1"))); + return modelGroup; + } + + particles.append(particle); + } else { + parseUnknown(); + } + } + } + + modelGroup->setParticles(particles); + + tagValidator.finalize(); + + return modelGroup; +} + +XsdModelGroup::Ptr XsdSchemaParser::parseChoice(const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Choice, this); + + validateElement(XsdTagScope::Choice); + + const XsdModelGroup::Ptr modelGroup(new XsdModelGroup()); + modelGroup->setCompositor(XsdModelGroup::ChoiceCompositor); + + validateIdAttribute("choice"); + + XsdParticle::List particles; + + TagValidationHandler tagValidator(XsdTagScope::Choice, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + modelGroup->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalElement(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + m_schemaResolver->addAllGroupCheck(term); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseAny(particle); + particle->setTerm(term); + particles.append(particle); + } else { + parseUnknown(); + } + } + } + + modelGroup->setParticles(particles); + + tagValidator.finalize(); + + return modelGroup; +} + +XsdModelGroup::Ptr XsdSchemaParser::parseLocalChoice(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Choice, this); + + validateElement(XsdTagScope::LocalChoice); + + const XsdModelGroup::Ptr modelGroup(new XsdModelGroup()); + modelGroup->setCompositor(XsdModelGroup::ChoiceCompositor); + + // parse attributes + if (!parseMinMaxConstraint(particle, "choice")) { + return modelGroup; + } + + validateIdAttribute("choice"); + + XsdParticle::List particles; + + TagValidationHandler tagValidator(XsdTagScope::LocalChoice, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + modelGroup->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalElement(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + m_schemaResolver->addAllGroupCheck(term); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseAny(particle); + particle->setTerm(term); + particles.append(particle); + } else { + parseUnknown(); + } + } + } + + modelGroup->setParticles(particles); + + tagValidator.finalize(); + + return modelGroup; +} + +XsdModelGroup::Ptr XsdSchemaParser::parseSequence(const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Sequence, this); + + validateElement(XsdTagScope::Sequence); + + const XsdModelGroup::Ptr modelGroup(new XsdModelGroup()); + modelGroup->setCompositor(XsdModelGroup::SequenceCompositor); + + validateIdAttribute("sequence"); + + XsdParticle::List particles; + + TagValidationHandler tagValidator(XsdTagScope::Sequence, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + modelGroup->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalElement(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + m_schemaResolver->addAllGroupCheck(term); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseAny(particle); + particle->setTerm(term); + particles.append(particle); + } else { + parseUnknown(); + } + } + } + + modelGroup->setParticles(particles); + + tagValidator.finalize(); + + return modelGroup; +} + +XsdModelGroup::Ptr XsdSchemaParser::parseLocalSequence(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Sequence, this); + + validateElement(XsdTagScope::LocalSequence); + + const XsdModelGroup::Ptr modelGroup(new XsdModelGroup()); + modelGroup->setCompositor(XsdModelGroup::SequenceCompositor); + + // parse attributes + if (!parseMinMaxConstraint(particle, "sequence")) { + return modelGroup; + } + + validateIdAttribute("sequence"); + + XsdParticle::List particles; + + TagValidationHandler tagValidator(XsdTagScope::LocalSequence, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + modelGroup->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Element, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalElement(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Group, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseReferredGroup(particle); + m_schemaResolver->addAllGroupCheck(term); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Choice, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalChoice(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Sequence, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseLocalSequence(particle, parent); + particle->setTerm(term); + particles.append(particle); + } else if (isSchemaTag(XsdSchemaToken::Any, token, namespaceToken)) { + const XsdParticle::Ptr particle(new XsdParticle()); + const XsdTerm::Ptr term = parseAny(particle); + particle->setTerm(term); + particles.append(particle); + } else { + parseUnknown(); + } + } + } + + modelGroup->setParticles(particles); + + tagValidator.finalize(); + + return modelGroup; +} + +XsdAttribute::Ptr XsdSchemaParser::parseGlobalAttribute() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Attribute, this); + + validateElement(XsdTagScope::GlobalAttribute); + + const XsdAttribute::Ptr attribute(new XsdAttribute()); + attribute->setScope(XsdAttribute::Scope::Ptr(new XsdAttribute::Scope())); + attribute->scope()->setVariety(XsdAttribute::Scope::Global); + + if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("attribute")) + .arg(formatAttribute("default")) + .arg(formatAttribute("fixed"))); + return attribute; + } + + // parse attributes + if (hasAttribute(QString::fromLatin1("default"))) { + const QString value = readAttribute(QString::fromLatin1("default")); + attribute->setValueConstraint(XsdAttribute::ValueConstraint::Ptr(new XsdAttribute::ValueConstraint())); + attribute->valueConstraint()->setVariety(XsdAttribute::ValueConstraint::Default); + attribute->valueConstraint()->setValue(value); + } else if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + attribute->setValueConstraint(XsdAttribute::ValueConstraint::Ptr(new XsdAttribute::ValueConstraint())); + attribute->valueConstraint()->setVariety(XsdAttribute::ValueConstraint::Fixed); + attribute->valueConstraint()->setValue(value); + } + + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("attribute")); + if ((objectName.namespaceURI() == StandardNamespaces::xsi) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("type")) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("nil")) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("schemaLocation")) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("noNamespaceSchemaLocation"))) { + + error(QtXmlPatterns::tr("content of %1 attribute of %2 element must not be from namespace %3") + .arg(formatAttribute("name")) + .arg(formatElement("attribute")) + .arg(formatURI(QLatin1String("http://www.w3.org/2001/XMLSchema-instance")))); + return attribute; + } + if (m_namePool->stringForLocalName(objectName.localName()) == QString::fromLatin1("xmlns")) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must not be %3") + .arg(formatAttribute("name")) + .arg(formatElement("attribute")) + .arg(formatData("xmlns"))); + return attribute; + } + attribute->setName(objectName); + + bool hasTypeAttribute = false; + bool hasTypeSpecified = false; + + if (hasAttribute(QString::fromLatin1("type"))) { + hasTypeAttribute = true; + + const QString type = readQNameAttribute(QString::fromLatin1("type"), "attribute"); + QXmlName typeName; + convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addAttributeType(attribute, typeName, currentSourceLocation()); // add to resolver + hasTypeSpecified = true; + } + + validateIdAttribute("attribute"); + + TagValidationHandler tagValidator(XsdTagScope::GlobalAttribute, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + attribute->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + if (hasTypeAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("attribute")) + .arg(formatElement("simpleType")) + .arg(formatAttribute("type"))); + break; + } + + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(attribute); + attribute->setType(type); + hasTypeSpecified = true; + + // add it to list of anonymous types as well + addAnonymousType(type); + } else { + parseUnknown(); + } + } + } + + if (!hasTypeSpecified) { + attribute->setType(BuiltinTypes::xsAnySimpleType); // default value + return attribute; + } + + tagValidator.finalize(); + + return attribute; +} + +XsdAttributeUse::Ptr XsdSchemaParser::parseLocalAttribute(const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Attribute, this); + + validateElement(XsdTagScope::LocalAttribute); + + bool hasRefAttribute = false; + bool hasTypeAttribute = false; + bool hasTypeSpecified = false; + + XsdAttributeUse::Ptr attributeUse; + if (hasAttribute(QString::fromLatin1("ref"))) { + const XsdAttributeReference::Ptr reference = XsdAttributeReference::Ptr(new XsdAttributeReference()); + reference->setType(XsdAttributeReference::AttributeUse); + reference->setSourceLocation(currentSourceLocation()); + + attributeUse = reference; + hasRefAttribute = true; + } else { + attributeUse = XsdAttributeUse::Ptr(new XsdAttributeUse()); + } + + if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("attribute")) + .arg(formatAttribute("default")) + .arg(formatAttribute("fixed"))); + return attributeUse; + } + + if (hasRefAttribute) { + if (hasAttribute(QString::fromLatin1("form"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("attribute")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("form"))); + return attributeUse; + } + if (hasAttribute(QString::fromLatin1("name"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("attribute")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("name"))); + return attributeUse; + } + if (hasAttribute(QString::fromLatin1("type"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("attribute")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("type"))); + return attributeUse; + } + } + + // parse attributes + + // default, fixed and use are handled by both, attribute use and attribute reference + if (hasAttribute(QString::fromLatin1("default"))) { + const QString value = readAttribute(QString::fromLatin1("default")); + attributeUse->setValueConstraint(XsdAttributeUse::ValueConstraint::Ptr(new XsdAttributeUse::ValueConstraint())); + attributeUse->valueConstraint()->setVariety(XsdAttributeUse::ValueConstraint::Default); + attributeUse->valueConstraint()->setValue(value); + } else if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + attributeUse->setValueConstraint(XsdAttributeUse::ValueConstraint::Ptr(new XsdAttributeUse::ValueConstraint())); + attributeUse->valueConstraint()->setVariety(XsdAttributeUse::ValueConstraint::Fixed); + attributeUse->valueConstraint()->setValue(value); + } + + if (hasAttribute(QString::fromLatin1("use"))) { + const QString value = readAttribute(QString::fromLatin1("use")); + if (value != QString::fromLatin1("optional") && + value != QString::fromLatin1("prohibited") && + value != QString::fromLatin1("required")) { + attributeContentError("use", "attribute", value); + return attributeUse; + } + + if (value == QString::fromLatin1("optional")) + attributeUse->setUseType(XsdAttributeUse::OptionalUse); + else if (value == QString::fromLatin1("prohibited")) + attributeUse->setUseType(XsdAttributeUse::ProhibitedUse); + else if (value == QString::fromLatin1("required")) + attributeUse->setUseType(XsdAttributeUse::RequiredUse); + + if (attributeUse->valueConstraint() && attributeUse->valueConstraint()->variety() == XsdAttributeUse::ValueConstraint::Default && value != QString::fromLatin1("optional")) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must have the value %3 because the %4 attribute is set") + .arg(formatAttribute("use")) + .arg(formatElement("attribute")) + .arg(formatData("optional")) + .arg(formatElement("default"))); + return attributeUse; + } + } + + const XsdAttribute::Ptr attribute(new XsdAttribute()); + + attributeUse->setAttribute(attribute); + m_componentLocationHash.insert(attribute, currentSourceLocation()); + + attribute->setScope(XsdAttribute::Scope::Ptr(new XsdAttribute::Scope())); + attribute->scope()->setVariety(XsdAttribute::Scope::Local); + attribute->scope()->setParent(parent); + + // now make a difference between attribute reference and attribute use + if (hasRefAttribute) { + const QString reference = readQNameAttribute(QString::fromLatin1("ref"), "attribute"); + QXmlName referenceName; + convertName(reference, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName + + const XsdAttributeReference::Ptr attributeReference = attributeUse; + attributeReference->setReferenceName(referenceName); + } else { + if (hasAttribute(QString::fromLatin1("name"))) { + const QString attributeName = readNameAttribute("attribute"); + + QXmlName objectName; + if (hasAttribute(QString::fromLatin1("form"))) { + const QString value = readAttribute(QString::fromLatin1("form")); + if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) { + attributeContentError("form", "attribute", value); + return attributeUse; + } + + if (value == QString::fromLatin1("qualified")) { + objectName = m_namePool->allocateQName(m_targetNamespace, attributeName); + } else { + objectName = m_namePool->allocateQName(QString(), attributeName); + } + } else { + if (m_attributeFormDefault == QString::fromLatin1("qualified")) { + objectName = m_namePool->allocateQName(m_targetNamespace, attributeName); + } else { + objectName = m_namePool->allocateQName(QString(), attributeName); + } + } + + if ((objectName.namespaceURI() == StandardNamespaces::xsi) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("type")) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("nil")) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("schemaLocation")) && + (m_namePool->stringForLocalName(objectName.localName()) != QString::fromLatin1("noNamespaceSchemaLocation"))) { + + error(QtXmlPatterns::tr("content of %1 attribute of %2 element must not be from namespace %3") + .arg(formatAttribute("name")) + .arg(formatElement("attribute")) + .arg(formatURI(QLatin1String("http://www.w3.org/2001/XMLSchema-instance")))); + return attributeUse; + } + if (m_namePool->stringForLocalName(objectName.localName()) == QString::fromLatin1("xmlns")) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must not be %3") + .arg(formatAttribute("name")) + .arg(formatElement("attribute")) + .arg(formatData("xmlns"))); + return attributeUse; + } + + attribute->setName(objectName); + } + + if (hasAttribute(QString::fromLatin1("type"))) { + hasTypeAttribute = true; + + const QString type = readQNameAttribute(QString::fromLatin1("type"), "attribute"); + QXmlName typeName; + convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addAttributeType(attribute, typeName, currentSourceLocation()); // add to resolver + hasTypeSpecified = true; + } + + if (attributeUse->valueConstraint()) { + //TODO: check whether assigning the value constraint of the attribute use to the attribute is correct + if (!attribute->valueConstraint()) + attribute->setValueConstraint(XsdAttribute::ValueConstraint::Ptr(new XsdAttribute::ValueConstraint())); + + attribute->valueConstraint()->setVariety((XsdAttribute::ValueConstraint::Variety)attributeUse->valueConstraint()->variety()); + attribute->valueConstraint()->setValue(attributeUse->valueConstraint()->value()); + attribute->valueConstraint()->setLexicalForm(attributeUse->valueConstraint()->lexicalForm()); + } + } + + validateIdAttribute("attribute"); + + TagValidationHandler tagValidator(XsdTagScope::LocalAttribute, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + attribute->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + if (hasTypeAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("attribute")) + .arg(formatElement("simpleType")) + .arg(formatAttribute("type"))); + break; + } + if (hasRefAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("attribute")) + .arg(formatElement("simpleType")) + .arg(formatAttribute("ref"))); + break; + } + + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(attribute); + attribute->setType(type); + hasTypeSpecified = true; + + // add it to list of anonymous types as well + addAnonymousType(type); + } else { + parseUnknown(); + } + } + } + + if (!hasTypeSpecified) { + attribute->setType(BuiltinTypes::xsAnySimpleType); // default value + } + + tagValidator.finalize(); + + return attributeUse; +} + +XsdAttributeGroup::Ptr XsdSchemaParser::parseNamedAttributeGroup() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::AttributeGroup, this); + + validateElement(XsdTagScope::NamedAttributeGroup); + + const XsdAttributeGroup::Ptr attributeGroup(new XsdAttributeGroup()); + + // parse attributes + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("attributeGroup")); + attributeGroup->setName(objectName); + + validateIdAttribute("attributeGroup"); + + TagValidationHandler tagValidator(XsdTagScope::NamedAttributeGroup, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + attributeGroup->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Attribute, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseLocalAttribute(attributeGroup); + + if (attributeUse->useType() == XsdAttributeUse::ProhibitedUse) { + warning(QtXmlPatterns::tr("specifying use='prohibited' inside an attribute group has no effect")); + } else { + attributeGroup->addAttributeUse(attributeUse); + } + } else if (isSchemaTag(XsdSchemaToken::AttributeGroup, token, namespaceToken)) { + const XsdAttributeUse::Ptr attributeUse = parseReferredAttributeGroup(); + attributeGroup->addAttributeUse(attributeUse); + } else if (isSchemaTag(XsdSchemaToken::AnyAttribute, token, namespaceToken)) { + const XsdWildcard::Ptr wildcard = parseAnyAttribute(); + attributeGroup->setWildcard(wildcard); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return attributeGroup; +} + +XsdAttributeUse::Ptr XsdSchemaParser::parseReferredAttributeGroup() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::AttributeGroup, this); + + validateElement(XsdTagScope::ReferredAttributeGroup); + + const XsdAttributeReference::Ptr attributeReference(new XsdAttributeReference()); + attributeReference->setType(XsdAttributeReference::AttributeGroup); + attributeReference->setSourceLocation(currentSourceLocation()); + + // parse attributes + const QString reference = readQNameAttribute(QString::fromLatin1("ref"), "attributeGroup"); + QXmlName referenceName; + convertName(reference, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName + attributeReference->setReferenceName(referenceName); + + validateIdAttribute("attributeGroup"); + + TagValidationHandler tagValidator(XsdTagScope::ReferredAttributeGroup, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + attributeReference->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return attributeReference; +} + +XsdElement::Ptr XsdSchemaParser::parseGlobalElement() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Element, this); + + validateElement(XsdTagScope::GlobalElement); + + const XsdElement::Ptr element(new XsdElement()); + element->setScope(XsdElement::Scope::Ptr(new XsdElement::Scope())); + element->scope()->setVariety(XsdElement::Scope::Global); + + bool hasTypeAttribute = false; + bool hasTypeSpecified = false; + bool hasSubstitutionGroup = false; + + // parse attributes + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("element")); + element->setName(objectName); + + if (hasAttribute(QString::fromLatin1("abstract"))) { + const QString abstract = readAttribute(QString::fromLatin1("abstract")); + + const Boolean::Ptr value = Boolean::fromLexical(abstract); + if (value->hasError()) { + attributeContentError("abstract", "element", abstract, BuiltinTypes::xsBoolean); + return element; + } + + element->setIsAbstract(value->as()->value()); + } else { + element->setIsAbstract(false); // the default value + } + + if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("default")) + .arg(formatAttribute("fixed"))); + return element; + } + + if (hasAttribute(QString::fromLatin1("default"))) { + const QString value = readAttribute(QString::fromLatin1("default")); + element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint())); + element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Default); + element->valueConstraint()->setValue(value); + } else if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint())); + element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Fixed); + element->valueConstraint()->setValue(value); + } + + element->setDisallowedSubstitutions(readBlockingConstraintAttribute(NamedSchemaComponent::ExtensionConstraint | NamedSchemaComponent::RestrictionConstraint | NamedSchemaComponent::SubstitutionConstraint, "element")); + element->setSubstitutionGroupExclusions(readDerivationConstraintAttribute(SchemaType::ExtensionConstraint | SchemaType::RestrictionConstraint, "element")); + + if (hasAttribute(QString::fromLatin1("nillable"))) { + const QString nillable = readAttribute(QString::fromLatin1("nillable")); + + const Boolean::Ptr value = Boolean::fromLexical(nillable); + if (value->hasError()) { + attributeContentError("nillable", "element", nillable, BuiltinTypes::xsBoolean); + return element; + } + + element->setIsNillable(value->as()->value()); + } else { + element->setIsNillable(false); // the default value + } + + if (hasAttribute(QString::fromLatin1("type"))) { + const QString type = readQNameAttribute(QString::fromLatin1("type"), "element"); + QXmlName typeName; + convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addElementType(element, typeName, currentSourceLocation()); // add to resolver + + hasTypeAttribute = true; + hasTypeSpecified = true; + } + + if (hasAttribute(QString::fromLatin1("substitutionGroup"))) { + QList elementNames; + + const QString value = readAttribute(QString::fromLatin1("substitutionGroup")); + const QStringList substitutionGroups = value.split(QLatin1Char(' '), QString::SkipEmptyParts); + if (substitutionGroups.isEmpty()) { + attributeContentError("substitutionGroup", "element", value, BuiltinTypes::xsQName); + return element; + } + + for (int i = 0; i < substitutionGroups.count(); ++i) { + const QString value = substitutionGroups.at(i).simplified(); + if (!XPathHelper::isQName(value)) { + attributeContentError("substitutionGroup", "element", value, BuiltinTypes::xsQName); + return element; + } + + QXmlName elementName; + convertName(value, NamespaceSupport::ElementName, elementName); // translate qualified name into QXmlName + elementNames.append(elementName); + } + + m_schemaResolver->addSubstitutionGroupAffiliation(element, elementNames, currentSourceLocation()); // add to resolver + + hasSubstitutionGroup = true; + } + + validateIdAttribute("element"); + + XsdAlternative::List alternatives; + + TagValidationHandler tagValidator(XsdTagScope::GlobalElement, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + element->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + if (hasTypeAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("simpleType")) + .arg(formatAttribute("type"))); + return element; + } + + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(element); + element->setType(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + + hasTypeSpecified = true; + } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) { + if (hasTypeAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("complexType")) + .arg(formatAttribute("type"))); + return element; + } + + const XsdComplexType::Ptr type = parseLocalComplexType(); + type->setContext(element); + element->setType(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + + hasTypeSpecified = true; + } else if (isSchemaTag(XsdSchemaToken::Alternative, token, namespaceToken)) { + const XsdAlternative::Ptr alternative = parseAlternative(); + alternatives.append(alternative); + } else if (isSchemaTag(XsdSchemaToken::Unique, token, namespaceToken)) { + const XsdIdentityConstraint::Ptr constraint = parseUnique(); + element->addIdentityConstraint(constraint); + } else if (isSchemaTag(XsdSchemaToken::Key, token, namespaceToken)) { + const XsdIdentityConstraint::Ptr constraint = parseKey(); + element->addIdentityConstraint(constraint); + } else if (isSchemaTag(XsdSchemaToken::Keyref, token, namespaceToken)) { + const XsdIdentityConstraint::Ptr constraint = parseKeyRef(element); + element->addIdentityConstraint(constraint); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + if (!hasTypeSpecified) { + if (hasSubstitutionGroup) + m_schemaResolver->addSubstitutionGroupType(element); + else + element->setType(BuiltinTypes::xsAnyType); + } + + if (!alternatives.isEmpty()) { + element->setTypeTable(XsdElement::TypeTable::Ptr(new XsdElement::TypeTable())); + + for (int i = 0; i < alternatives.count(); ++i) { + if (alternatives.at(i)->test()) + element->typeTable()->addAlternative(alternatives.at(i)); + + if (i == (alternatives.count() - 1)) { // the final one + if (!alternatives.at(i)->test()) { + element->typeTable()->setDefaultTypeDefinition(alternatives.at(i)); + } else { + const XsdAlternative::Ptr alternative(new XsdAlternative()); + if (element->type()) + alternative->setType(element->type()); + else + m_schemaResolver->addAlternativeType(alternative, element); // add to resolver + + element->typeTable()->setDefaultTypeDefinition(alternative); + } + } + } + } + + return element; +} + +XsdTerm::Ptr XsdSchemaParser::parseLocalElement(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Element, this); + + validateElement(XsdTagScope::LocalElement); + + bool hasRefAttribute = false; + bool hasTypeAttribute = false; + bool hasTypeSpecified = false; + + XsdTerm::Ptr term; + XsdElement::Ptr element; + if (hasAttribute(QString::fromLatin1("ref"))) { + term = XsdReference::Ptr(new XsdReference()); + hasRefAttribute = true; + } else { + term = XsdElement::Ptr(new XsdElement()); + element = term; + } + + if (hasRefAttribute) { + if (hasAttribute(QString::fromLatin1("name"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("name"))); + return term; + } else if (hasAttribute(QString::fromLatin1("block"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("block"))); + return term; + } else if (hasAttribute(QString::fromLatin1("nillable"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("nillable"))); + return term; + } else if (hasAttribute(QString::fromLatin1("default"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("default"))); + return term; + } else if (hasAttribute(QString::fromLatin1("fixed"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("fixed"))); + return term; + } else if (hasAttribute(QString::fromLatin1("form"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("form"))); + return term; + } else if (hasAttribute(QString::fromLatin1("type"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("ref")) + .arg(formatAttribute("type"))); + return term; + } + } + + // parse attributes + if (!parseMinMaxConstraint(particle, "element")) { + return element; + } + + if (!hasAttribute(QString::fromLatin1("name")) && !hasAttribute(QString::fromLatin1("ref"))) { + error(QtXmlPatterns::tr("%1 element must have either %2 or %3 attribute") + .arg(formatElement("element")) + .arg(formatAttribute("name")) + .arg(formatAttribute("ref"))); + return element; + } + + if (hasRefAttribute) { + const QString ref = readQNameAttribute(QString::fromLatin1("ref"), "element"); + QXmlName referenceName; + convertName(ref, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName + + const XsdReference::Ptr reference = term; + reference->setReferenceName(referenceName); + reference->setType(XsdReference::Element); + reference->setSourceLocation(currentSourceLocation()); + } else { + element->setScope(XsdElement::Scope::Ptr(new XsdElement::Scope())); + element->scope()->setVariety(XsdElement::Scope::Local); + element->scope()->setParent(parent); + + if (hasAttribute(QString::fromLatin1("name"))) { + const QString elementName = readNameAttribute("element"); + + QXmlName objectName; + if (hasAttribute(QString::fromLatin1("form"))) { + const QString value = readAttribute(QString::fromLatin1("form")); + if (value != QString::fromLatin1("qualified") && value != QString::fromLatin1("unqualified")) { + attributeContentError("form", "element", value); + return element; + } + + if (value == QString::fromLatin1("qualified")) { + objectName = m_namePool->allocateQName(m_targetNamespace, elementName); + } else { + objectName = m_namePool->allocateQName(QString(), elementName); + } + } else { + if (m_elementFormDefault == QString::fromLatin1("qualified")) { + objectName = m_namePool->allocateQName(m_targetNamespace, elementName); + } else { + objectName = m_namePool->allocateQName(QString(), elementName); + } + } + + element->setName(objectName); + } + + if (hasAttribute(QString::fromLatin1("nillable"))) { + const QString nillable = readAttribute(QString::fromLatin1("nillable")); + + const Boolean::Ptr value = Boolean::fromLexical(nillable); + if (value->hasError()) { + attributeContentError("nillable", "element", nillable, BuiltinTypes::xsBoolean); + return term; + } + + element->setIsNillable(value->as()->value()); + } else { + element->setIsNillable(false); // the default value + } + + if (hasAttribute(QString::fromLatin1("default")) && hasAttribute(QString::fromLatin1("fixed"))) { + error(QtXmlPatterns::tr("%1 element must not have %2 and %3 attribute together") + .arg(formatElement("element")) + .arg(formatAttribute("default")) + .arg(formatAttribute("fixed"))); + return element; + } + + if (hasAttribute(QString::fromLatin1("default"))) { + const QString value = readAttribute(QString::fromLatin1("default")); + element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint())); + element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Default); + element->valueConstraint()->setValue(value); + } else if (hasAttribute(QString::fromLatin1("fixed"))) { + const QString value = readAttribute(QString::fromLatin1("fixed")); + element->setValueConstraint(XsdElement::ValueConstraint::Ptr(new XsdElement::ValueConstraint())); + element->valueConstraint()->setVariety(XsdElement::ValueConstraint::Fixed); + element->valueConstraint()->setValue(value); + } + + if (hasAttribute(QString::fromLatin1("type"))) { + const QString type = readQNameAttribute(QString::fromLatin1("type"), "element"); + QXmlName typeName; + convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addElementType(element, typeName, currentSourceLocation()); // add to resolver + + hasTypeAttribute = true; + hasTypeSpecified = true; + } + + element->setDisallowedSubstitutions(readBlockingConstraintAttribute(NamedSchemaComponent::ExtensionConstraint | NamedSchemaComponent::RestrictionConstraint | NamedSchemaComponent::SubstitutionConstraint, "element")); + } + + validateIdAttribute("element"); + + XsdAlternative::List alternatives; + + TagValidationHandler tagValidator(XsdTagScope::LocalElement, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + element->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + if (hasRefAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("simpleType")) + .arg(formatAttribute("ref"))); + return term; + } else if (hasTypeAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("simpleType")) + .arg(formatAttribute("type"))); + return term; + } + + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + type->setContext(element); + element->setType(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + + hasTypeSpecified = true; + } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) { + if (hasRefAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("complexType")) + .arg(formatAttribute("ref"))); + return term; + } else if (hasTypeAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("complexType")) + .arg(formatAttribute("type"))); + return term; + } + + const XsdComplexType::Ptr type = parseLocalComplexType(); + type->setContext(element); + element->setType(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + + hasTypeSpecified = true; + } else if (isSchemaTag(XsdSchemaToken::Alternative, token, namespaceToken)) { + if (hasRefAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("alternative")) + .arg(formatAttribute("ref"))); + return term; + } + + const XsdAlternative::Ptr alternative = parseAlternative(); + alternatives.append(alternative); + } else if (isSchemaTag(XsdSchemaToken::Unique, token, namespaceToken)) { + if (hasRefAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("unique")) + .arg(formatAttribute("ref"))); + return term; + } + + const XsdIdentityConstraint::Ptr constraint = parseUnique(); + element->addIdentityConstraint(constraint); + } else if (isSchemaTag(XsdSchemaToken::Key, token, namespaceToken)) { + if (hasRefAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("key")) + .arg(formatAttribute("ref"))); + return term; + } + + const XsdIdentityConstraint::Ptr constraint = parseKey(); + element->addIdentityConstraint(constraint); + } else if (isSchemaTag(XsdSchemaToken::Keyref, token, namespaceToken)) { + if (hasRefAttribute) { + error(QtXmlPatterns::tr("%1 element with %2 child element must not have a %3 attribute") + .arg(formatElement("element")) + .arg(formatElement("keyref")) + .arg(formatAttribute("ref"))); + return term; + } + + const XsdIdentityConstraint::Ptr constraint = parseKeyRef(element); + element->addIdentityConstraint(constraint); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + if (!hasTypeSpecified && !hasRefAttribute) + element->setType(BuiltinTypes::xsAnyType); + + if (!hasRefAttribute && !alternatives.isEmpty()) { + element->setTypeTable(XsdElement::TypeTable::Ptr(new XsdElement::TypeTable())); + + for (int i = 0; i < alternatives.count(); ++i) { + if (alternatives.at(i)->test()) + element->typeTable()->addAlternative(alternatives.at(i)); + + if (i == (alternatives.count() - 1)) { // the final one + if (!alternatives.at(i)->test()) { + element->typeTable()->setDefaultTypeDefinition(alternatives.at(i)); + } else { + const XsdAlternative::Ptr alternative(new XsdAlternative()); + if (element->type()) + alternative->setType(element->type()); + else + m_schemaResolver->addAlternativeType(alternative, element); // add to resolver + + element->typeTable()->setDefaultTypeDefinition(alternative); + } + } + } + } + + return term; +} + +XsdIdentityConstraint::Ptr XsdSchemaParser::parseUnique() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Unique, this); + + validateElement(XsdTagScope::Unique); + + const XsdIdentityConstraint::Ptr constraint(new XsdIdentityConstraint()); + constraint->setCategory(XsdIdentityConstraint::Unique); + + // parse attributes + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("unique")); + constraint->setName(objectName); + + validateIdAttribute("unique"); + + TagValidationHandler tagValidator(XsdTagScope::Unique, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + constraint->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Selector, token, namespaceToken)) { + parseSelector(constraint); + } else if (isSchemaTag(XsdSchemaToken::Field, token, namespaceToken)) { + parseField(constraint); + } else { + parseUnknown(); + } + } + } + + // add constraint to schema for further checking + addIdentityConstraint(constraint); + + tagValidator.finalize(); + + return constraint; +} + +XsdIdentityConstraint::Ptr XsdSchemaParser::parseKey() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Key, this); + + validateElement(XsdTagScope::Key); + + const XsdIdentityConstraint::Ptr constraint(new XsdIdentityConstraint()); + constraint->setCategory(XsdIdentityConstraint::Key); + + // parse attributes + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("key")); + constraint->setName(objectName); + + validateIdAttribute("key"); + + TagValidationHandler tagValidator(XsdTagScope::Key, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + constraint->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Selector, token, namespaceToken)) { + parseSelector(constraint); + } else if (isSchemaTag(XsdSchemaToken::Field, token, namespaceToken)) { + parseField(constraint); + } else { + parseUnknown(); + } + } + } + + // add constraint to schema for further checking + addIdentityConstraint(constraint); + + tagValidator.finalize(); + + return constraint; +} + +XsdIdentityConstraint::Ptr XsdSchemaParser::parseKeyRef(const XsdElement::Ptr &element) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Keyref, this); + + validateElement(XsdTagScope::KeyRef); + + const XsdIdentityConstraint::Ptr constraint(new XsdIdentityConstraint()); + constraint->setCategory(XsdIdentityConstraint::KeyReference); + + // parse attributes + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("keyref")); + constraint->setName(objectName); + + const QString refer = readQNameAttribute(QString::fromLatin1("refer"), "keyref"); + QXmlName referenceName; + convertName(refer, NamespaceSupport::ElementName, referenceName); // translate qualified name into QXmlName + m_schemaResolver->addKeyReference(element, constraint, referenceName, currentSourceLocation()); // add to resolver + + validateIdAttribute("keyref"); + + TagValidationHandler tagValidator(XsdTagScope::KeyRef, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + constraint->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::Selector, token, namespaceToken)) { + parseSelector(constraint); + } else if (isSchemaTag(XsdSchemaToken::Field, token, namespaceToken)) { + parseField(constraint); + } else { + parseUnknown(); + } + } + } + + // add constraint to schema for further checking + addIdentityConstraint(constraint); + + tagValidator.finalize(); + + return constraint; +} + +void XsdSchemaParser::parseSelector(const XsdIdentityConstraint::Ptr &ptr) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Selector, this); + + validateElement(XsdTagScope::Selector); + + // parse attributes + const XsdXPathExpression::Ptr expression = readXPathExpression("selector"); + + const QString xpath = readXPathAttribute(QString::fromLatin1("xpath"), XPathSelector, "selector"); + expression->setExpression(xpath); + + ptr->setSelector(expression); + + validateIdAttribute("selector"); + + TagValidationHandler tagValidator(XsdTagScope::Selector, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + expression->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +void XsdSchemaParser::parseField(const XsdIdentityConstraint::Ptr &ptr) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Field, this); + + validateElement(XsdTagScope::Field); + + // parse attributes + const XsdXPathExpression::Ptr expression = readXPathExpression("field"); + + const QString xpath = readXPathAttribute(QString::fromLatin1("xpath"), XPathField, "field"); + expression->setExpression(xpath); + + ptr->addField(expression); + + validateIdAttribute("field"); + + TagValidationHandler tagValidator(XsdTagScope::Field, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + expression->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); +} + +XsdAlternative::Ptr XsdSchemaParser::parseAlternative() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Alternative, this); + + validateElement(XsdTagScope::Alternative); + + const XsdAlternative::Ptr alternative(new XsdAlternative()); + + bool hasTypeSpecified = false; + + if (hasAttribute(QString::fromLatin1("test"))) { + const XsdXPathExpression::Ptr expression = readXPathExpression("alternative"); + + const QString test = readXPathAttribute(QString::fromLatin1("test"), XPath20, "alternative"); + expression->setExpression(test); + + alternative->setTest(expression); + } + + if (hasAttribute(QString::fromLatin1("type"))) { + const QString type = readQNameAttribute(QString::fromLatin1("type"), "alternative"); + QXmlName typeName; + convertName(type, NamespaceSupport::ElementName, typeName); // translate qualified name into QXmlName + m_schemaResolver->addAlternativeType(alternative, typeName, currentSourceLocation()); // add to resolver + + hasTypeSpecified = true; + } + + validateIdAttribute("alternative"); + + TagValidationHandler tagValidator(XsdTagScope::Alternative, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + alternative->addAnnotation(annotation); + } else if (isSchemaTag(XsdSchemaToken::SimpleType, token, namespaceToken)) { + const XsdSimpleType::Ptr type = parseLocalSimpleType(); + alternative->setType(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + + hasTypeSpecified = true; + } else if (isSchemaTag(XsdSchemaToken::ComplexType, token, namespaceToken)) { + const XsdComplexType::Ptr type = parseLocalComplexType(); + alternative->setType(type); + + // add it to list of anonymous types as well + addAnonymousType(type); + + hasTypeSpecified = true; + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + if (!hasTypeSpecified) { + error(QtXmlPatterns::tr("%1 element must have either %2 attribute or %3 or %4 as child element") + .arg(formatElement("alternative")) + .arg(formatAttribute("type")) + .arg(formatElement("simpleType")) + .arg(formatElement("complexType"))); + return alternative; + } + + return alternative; +} + +XsdNotation::Ptr XsdSchemaParser::parseNotation() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Notation, this); + + validateElement(XsdTagScope::Notation); + + const XsdNotation::Ptr notation(new XsdNotation()); + + // parse attributes + const QXmlName objectName = m_namePool->allocateQName(m_targetNamespace, readNameAttribute("notation")); + notation->setName(objectName); + + bool hasOptionalAttribute = false; + + if (hasAttribute(QString::fromLatin1("public"))) { + const QString value = readAttribute(QString::fromLatin1("public")); + if (!value.isEmpty()) { + const DerivedString::Ptr publicId = DerivedString::fromLexical(m_namePool, value); + if (publicId->hasError()) { + attributeContentError("public", "notation", value, BuiltinTypes::xsToken); + return notation; + } + notation->setPublicId(publicId); + } + + hasOptionalAttribute = true; + } + + if (hasAttribute(QString::fromLatin1("system"))) { + const QString value = readAttribute(QString::fromLatin1("system")); + if (!isValidUri(value)) { + attributeContentError("system", "notation", value, BuiltinTypes::xsAnyURI); + return notation; + } + + if (!value.isEmpty()) { + const AnyURI::Ptr systemId = AnyURI::fromLexical(value); + notation->setSystemId(systemId); + } + + hasOptionalAttribute = true; + } + + if (!hasOptionalAttribute) { + error(QtXmlPatterns::tr("%1 element requires either %2 or %3 attribute") + .arg(formatElement("notation")) + .arg(formatAttribute("public")) + .arg(formatAttribute("system"))); + return notation; + } + + validateIdAttribute("notation"); + + TagValidationHandler tagValidator(XsdTagScope::Notation, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isCharacters() || isEntityReference()) { + if (!text().toString().trimmed().isEmpty()) { + error(QtXmlPatterns::tr("text or entity references not allowed inside %1 element").arg(formatElement("notation"))); + return notation; + } + } + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + notation->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return notation; +} + +XsdWildcard::Ptr XsdSchemaParser::parseAny(const XsdParticle::Ptr &particle) +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::Any, this); + + validateElement(XsdTagScope::Any); + + const XsdWildcard::Ptr wildcard(new XsdWildcard()); + + // parse attributes + if (!parseMinMaxConstraint(particle, "any")) { + return wildcard; + } + + if (hasAttribute(QString::fromLatin1("namespace"))) { + const QSet values = readAttribute(QString::fromLatin1("namespace")).split(QLatin1Char(' '), QString::SkipEmptyParts).toSet(); + if ((values.contains(QString::fromLatin1("##any")) || values.contains(QString::fromLatin1("##other"))) && values.count() != 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must contain %3, %4 or a list of URIs") + .arg(formatAttribute("namespace")) + .arg(formatElement("any")) + .arg(formatData("##any")) + .arg(formatData("##other"))); + return wildcard; + } + + if (values.contains(QString::fromLatin1("##any"))) { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + } else if (values.contains(QString::fromLatin1("##other"))) { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not); + if (!m_targetNamespace.isEmpty()) + wildcard->namespaceConstraint()->setNamespaces(QSet() << m_targetNamespace); + else + wildcard->namespaceConstraint()->setNamespaces(QSet() << XsdWildcard::absentNamespace()); + } else { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration); + QStringList newValues = values.toList(); + + // replace the ##targetNamespace entry + for (int i = 0; i < newValues.count(); ++i) { + if (newValues.at(i) == QString::fromLatin1("##targetNamespace")) { + if (!m_targetNamespace.isEmpty()) + newValues[i] = m_targetNamespace; + else + newValues[i] = XsdWildcard::absentNamespace(); + } else if (newValues.at(i) == QString::fromLatin1("##local")) { + newValues[i] = XsdWildcard::absentNamespace(); + } + } + + // check for invalid URIs + for (int i = 0; i < newValues.count(); ++i) { + const QString stringValue = newValues.at(i); + if (stringValue == XsdWildcard::absentNamespace()) + continue; + + if (!isValidUri(stringValue)) { + attributeContentError("namespace", "any", stringValue, BuiltinTypes::xsAnyURI); + return wildcard; + } + } + + wildcard->namespaceConstraint()->setNamespaces(newValues.toSet()); + } + } else { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + } + + if (hasAttribute(QString::fromLatin1("processContents"))) { + const QString value = readAttribute(QString::fromLatin1("processContents")); + if (value != QString::fromLatin1("lax") && + value != QString::fromLatin1("skip") && + value != QString::fromLatin1("strict")) { + attributeContentError("processContents", "any", value); + return wildcard; + } + + if (value == QString::fromLatin1("lax")) { + wildcard->setProcessContents(XsdWildcard::Lax); + } else if (value == QString::fromLatin1("skip")) { + wildcard->setProcessContents(XsdWildcard::Skip); + } else if (value == QString::fromLatin1("strict")) { + wildcard->setProcessContents(XsdWildcard::Strict); + } + } else { + wildcard->setProcessContents(XsdWildcard::Strict); + } + + validateIdAttribute("any"); + + TagValidationHandler tagValidator(XsdTagScope::Any, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + wildcard->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return wildcard; +} + +XsdWildcard::Ptr XsdSchemaParser::parseAnyAttribute() +{ + const ElementNamespaceHandler namespaceHandler(XsdSchemaToken::AnyAttribute, this); + + validateElement(XsdTagScope::AnyAttribute); + + const XsdWildcard::Ptr wildcard(new XsdWildcard()); + + // parse attributes + if (hasAttribute(QString::fromLatin1("namespace"))) { + const QSet values = readAttribute(QString::fromLatin1("namespace")).split(QLatin1Char(' '), QString::SkipEmptyParts).toSet(); + if ((values.contains(QString::fromLatin1("##any")) || values.contains(QString::fromLatin1("##other"))) && values.count() != 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must contain %3, %4 or a list of URIs") + .arg(formatAttribute("namespace")) + .arg(formatElement("anyAttribute")) + .arg(formatData("##any")) + .arg(formatData("##other"))); + return wildcard; + } + + if (values.contains(QString::fromLatin1("##any"))) { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + } else if (values.contains(QString::fromLatin1("##other"))) { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Not); + if (!m_targetNamespace.isEmpty()) + wildcard->namespaceConstraint()->setNamespaces(QSet() << m_targetNamespace); + else + wildcard->namespaceConstraint()->setNamespaces(QSet() << XsdWildcard::absentNamespace()); + } else { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Enumeration); + QStringList newValues = values.toList(); + + // replace the ##targetNamespace entry + for (int i = 0; i < newValues.count(); ++i) { + if (newValues.at(i) == QString::fromLatin1("##targetNamespace")) { + if (!m_targetNamespace.isEmpty()) + newValues[i] = m_targetNamespace; + else + newValues[i] = XsdWildcard::absentNamespace(); + } else if (newValues.at(i) == QString::fromLatin1("##local")) { + newValues[i] = XsdWildcard::absentNamespace(); + } + } + + // check for invalid URIs + for (int i = 0; i < newValues.count(); ++i) { + const QString stringValue = newValues.at(i); + if (stringValue == XsdWildcard::absentNamespace()) + continue; + + if (!isValidUri(stringValue)) { + attributeContentError("namespace", "anyAttribute", stringValue, BuiltinTypes::xsAnyURI); + return wildcard; + } + } + + wildcard->namespaceConstraint()->setNamespaces(newValues.toSet()); + } + } else { + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + } + + if (hasAttribute(QString::fromLatin1("processContents"))) { + const QString value = readAttribute(QString::fromLatin1("processContents")); + if (value != QString::fromLatin1("lax") && + value != QString::fromLatin1("skip") && + value != QString::fromLatin1("strict")) { + attributeContentError("processContents", "anyAttribute", value); + return wildcard; + } + + if (value == QString::fromLatin1("lax")) { + wildcard->setProcessContents(XsdWildcard::Lax); + } else if (value == QString::fromLatin1("skip")) { + wildcard->setProcessContents(XsdWildcard::Skip); + } else if (value == QString::fromLatin1("strict")) { + wildcard->setProcessContents(XsdWildcard::Strict); + } + } else { + wildcard->setProcessContents(XsdWildcard::Strict); + } + + validateIdAttribute("anyAttribute"); + + TagValidationHandler tagValidator(XsdTagScope::AnyAttribute, this, m_namePool); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) { + const XsdSchemaToken::NodeName token = XsdSchemaToken::toToken(name()); + const XsdSchemaToken::NodeName namespaceToken = XsdSchemaToken::toToken(namespaceUri()); + + tagValidator.validate(token); + + if (isSchemaTag(XsdSchemaToken::Annotation, token, namespaceToken)) { + const XsdAnnotation::Ptr annotation = parseAnnotation(); + wildcard->addAnnotation(annotation); + } else { + parseUnknown(); + } + } + } + + tagValidator.finalize(); + + return wildcard; +} + + +void XsdSchemaParser::parseUnknownDocumentation() +{ + Q_ASSERT(isStartElement()); + m_namespaceSupport.pushContext(); + m_namespaceSupport.setPrefixes(namespaceDeclarations()); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) + parseUnknownDocumentation(); + } + + m_namespaceSupport.popContext(); +} + +void XsdSchemaParser::parseUnknown() +{ + Q_ASSERT(isStartElement()); + m_namespaceSupport.pushContext(); + m_namespaceSupport.setPrefixes(namespaceDeclarations()); + + error(QtXmlPatterns::tr("%1 element is not allowed in this context").arg(formatElement(name().toString()))); + + while (!atEnd()) { + readNext(); + + if (isEndElement()) + break; + + if (isStartElement()) + parseUnknown(); + } + + m_namespaceSupport.popContext(); +} + +bool XsdSchemaParser::parseMinMaxConstraint(const XsdParticle::Ptr &particle, const char *elementName) +{ + if (hasAttribute(QString::fromLatin1("minOccurs"))) { + const QString value = readAttribute(QString::fromLatin1("minOccurs")); + + DerivedInteger::Ptr integer = DerivedInteger::fromLexical(m_namePool, value); + if (integer->hasError()) { + attributeContentError("minOccurs", elementName, value, BuiltinTypes::xsNonNegativeInteger); + return false; + } else { + particle->setMinimumOccurs(integer->as< DerivedInteger >()->storedValue()); + } + } else { + particle->setMinimumOccurs(1); + } + + if (hasAttribute(QString::fromLatin1("maxOccurs"))) { + const QString value = readAttribute(QString::fromLatin1("maxOccurs")); + + if (value == QString::fromLatin1("unbounded")) { + particle->setMaximumOccursUnbounded(true); + } else { + particle->setMaximumOccursUnbounded(false); + DerivedInteger::Ptr integer = DerivedInteger::fromLexical(m_namePool, value); + if (integer->hasError()) { + attributeContentError("maxOccurs", elementName, value, BuiltinTypes::xsNonNegativeInteger); + return false; + } else { + particle->setMaximumOccurs(integer->as< DerivedInteger >()->storedValue()); + } + } + } else { + particle->setMaximumOccursUnbounded(false); + particle->setMaximumOccurs(1); + } + + if (!particle->maximumOccursUnbounded()) { + if (particle->maximumOccurs() < particle->minimumOccurs()) { + error(QtXmlPatterns::tr("%1 attribute of %2 element has larger value than %3 attribute") + .arg(formatAttribute("minOccurs")) + .arg(formatElement(elementName)) + .arg(formatAttribute("maxOccurs"))); + return false; + } + } + + return true; +} + +QSourceLocation XsdSchemaParser::currentSourceLocation() const +{ + QSourceLocation location; + location.setLine(lineNumber()); + location.setColumn(columnNumber()); + location.setUri(m_documentURI); + + return location; +} + +void XsdSchemaParser::convertName(const QString &qualifiedName, NamespaceSupport::NameType type, QXmlName &name) +{ + bool result = m_namespaceSupport.processName(qualifiedName, type, name); + if (!result) { + error(QtXmlPatterns::tr("prefix of qualified name %1 is not defined").arg(formatKeyword(qualifiedName))); + } +} + +QString XsdSchemaParser::readNameAttribute(const char *elementName) +{ + const QString value = readAttribute(QString::fromLatin1("name")).simplified(); + if (!QXmlUtils::isNCName(value)) { + attributeContentError("name", elementName, value, BuiltinTypes::xsNCName); + return QString(); + } else { + return value; + } +} + +QString XsdSchemaParser::readQNameAttribute(const QString &typeAttribute, const char *elementName) +{ + const QString value = readAttribute(typeAttribute).simplified(); + if (!XPathHelper::isQName(value)) { + attributeContentError(typeAttribute.toLatin1(), elementName, value, BuiltinTypes::xsQName); + return QString(); + } else { + return value; + } +} + +QString XsdSchemaParser::readNamespaceAttribute(const QString &attributeName, const char *elementName) +{ + const QString value = readAttribute(attributeName); + if (value.isEmpty()) { + attributeContentError(attributeName.toLatin1(), elementName, value, BuiltinTypes::xsAnyURI); + return QString(); + } + + return value; +} + +SchemaType::DerivationConstraints XsdSchemaParser::readDerivationConstraintAttribute(const SchemaType::DerivationConstraints &allowedConstraints, const char *elementName) +{ + // first convert the flags into strings for easier comparision + QSet allowedContent; + if (allowedConstraints & SchemaType::RestrictionConstraint) + allowedContent.insert(QString::fromLatin1("restriction")); + if (allowedConstraints & SchemaType::ExtensionConstraint) + allowedContent.insert(QString::fromLatin1("extension")); + if (allowedConstraints & SchemaType::ListConstraint) + allowedContent.insert(QString::fromLatin1("list")); + if (allowedConstraints & SchemaType::UnionConstraint) + allowedContent.insert(QString::fromLatin1("union")); + + // read content from the attribute if available, otherwise use the default definitions from the schema tag + QString content; + if (hasAttribute(QString::fromLatin1("final"))) { + content = readAttribute(QString::fromLatin1("final")); + + // split string into list to validate the content of the attribute + const QStringList values = content.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < values.count(); i++) { + const QString value = values.at(i); + if (!allowedContent.contains(value) && (value != QString::fromLatin1("#all"))) { + attributeContentError("final", elementName, value); + return SchemaType::DerivationConstraints(); + } + + if ((value == QString::fromLatin1("#all")) && values.count() != 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must either contain %3 or the other values") + .arg(formatAttribute("final")) + .arg(formatElement(elementName)) + .arg(formatData("#all"))); + return SchemaType::DerivationConstraints(); + } + } + } else { + // content of the default value has been validated in parseSchema already + content = m_finalDefault; + } + + QSet contentSet = content.split(QLatin1Char(' '), QString::SkipEmptyParts).toSet(); + + // if the '#all' tag is defined, we return all allowed values + if (contentSet.contains(QString::fromLatin1("#all"))) { + return allowedConstraints; + } else { // return the values from content set that intersects with the allowed values + contentSet.intersect(allowedContent); + + SchemaType::DerivationConstraints constraints; + + if (contentSet.contains(QString::fromLatin1("restriction"))) + constraints |= SchemaType::RestrictionConstraint; + if (contentSet.contains(QString::fromLatin1("extension"))) + constraints |= SchemaType::ExtensionConstraint; + if (contentSet.contains(QString::fromLatin1("list"))) + constraints |= SchemaType::ListConstraint; + if (contentSet.contains(QString::fromLatin1("union"))) + constraints |= SchemaType::UnionConstraint; + + return constraints; + } +} + +NamedSchemaComponent::BlockingConstraints XsdSchemaParser::readBlockingConstraintAttribute(const NamedSchemaComponent::BlockingConstraints &allowedConstraints, const char *elementName) +{ + // first convert the flags into strings for easier comparision + QSet allowedContent; + if (allowedConstraints & NamedSchemaComponent::RestrictionConstraint) + allowedContent.insert(QString::fromLatin1("restriction")); + if (allowedConstraints & NamedSchemaComponent::ExtensionConstraint) + allowedContent.insert(QString::fromLatin1("extension")); + if (allowedConstraints & NamedSchemaComponent::SubstitutionConstraint) + allowedContent.insert(QString::fromLatin1("substitution")); + + // read content from the attribute if available, otherwise use the default definitions from the schema tag + QString content; + if (hasAttribute(QString::fromLatin1("block"))) { + content = readAttribute(QString::fromLatin1("block")); + + // split string into list to validate the content of the attribute + const QStringList values = content.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < values.count(); i++) { + const QString value = values.at(i); + if (!allowedContent.contains(value) && (value != QString::fromLatin1("#all"))) { + attributeContentError("block", elementName, value); + return NamedSchemaComponent::BlockingConstraints(); + } + + if ((value == QString::fromLatin1("#all")) && values.count() != 1) { + error(QtXmlPatterns::tr("%1 attribute of %2 element must either contain %3 or the other values") + .arg(formatAttribute("block")) + .arg(formatElement(elementName)) + .arg(formatData("#all"))); + return NamedSchemaComponent::BlockingConstraints(); + } + } + } else { + // content of the default value has been validated in parseSchema already + content = m_blockDefault; + } + + QSet contentSet = content.split(QLatin1Char(' '), QString::SkipEmptyParts).toSet(); + + // if the '#all' tag is defined, we return all allowed values + if (contentSet.contains(QString::fromLatin1("#all"))) { + return allowedConstraints; + } else { // return the values from content set that intersects with the allowed values + contentSet.intersect(allowedContent); + + NamedSchemaComponent::BlockingConstraints constraints; + + if (contentSet.contains(QString::fromLatin1("restriction"))) + constraints |= NamedSchemaComponent::RestrictionConstraint; + if (contentSet.contains(QString::fromLatin1("extension"))) + constraints |= NamedSchemaComponent::ExtensionConstraint; + if (contentSet.contains(QString::fromLatin1("substitution"))) + constraints |= NamedSchemaComponent::SubstitutionConstraint; + + return constraints; + } +} + +XsdXPathExpression::Ptr XsdSchemaParser::readXPathExpression(const char *elementName) +{ + const XsdXPathExpression::Ptr expression(new XsdXPathExpression()); + + const QList namespaceBindings = m_namespaceSupport.namespaceBindings(); + QXmlName emptyName; + for (int i = 0; i < namespaceBindings.count(); ++i) { + if (namespaceBindings.at(i).prefix() == StandardPrefixes::empty) + emptyName = namespaceBindings.at(i); + } + + expression->setNamespaceBindings(namespaceBindings); + + QString xpathDefaultNamespace; + if (hasAttribute(QString::fromLatin1("xpathDefaultNamespace"))) { + xpathDefaultNamespace = readAttribute(QString::fromLatin1("xpathDefaultNamespace")); + if (xpathDefaultNamespace != QString::fromLatin1("##defaultNamespace") && + xpathDefaultNamespace != QString::fromLatin1("##targetNamespace") && + xpathDefaultNamespace != QString::fromLatin1("##local")) { + if (!isValidUri(xpathDefaultNamespace)) { + attributeContentError("xpathDefaultNamespace", elementName, xpathDefaultNamespace, BuiltinTypes::xsAnyURI); + return expression; + } + } + } else { + xpathDefaultNamespace = m_xpathDefaultNamespace; + } + + AnyURI::Ptr namespaceURI; + if (xpathDefaultNamespace == QString::fromLatin1("##defaultNamespace")) { + if (!emptyName.isNull()) + namespaceURI = AnyURI::fromLexical(m_namePool->stringForNamespace(emptyName.namespaceURI())); + } else if (xpathDefaultNamespace == QString::fromLatin1("##targetNamespace")) { + if (!m_targetNamespace.isEmpty()) + namespaceURI = AnyURI::fromLexical(m_targetNamespace); + } else if (xpathDefaultNamespace == QString::fromLatin1("##local")) { + // it is absent + } else { + namespaceURI = AnyURI::fromLexical(xpathDefaultNamespace); + } + if (namespaceURI) { + if (namespaceURI->hasError()) { + attributeContentError("xpathDefaultNamespace", elementName, xpathDefaultNamespace, BuiltinTypes::xsAnyURI); + return expression; + } + + expression->setDefaultNamespace(namespaceURI); + } + + //TODO: read the base uri if qmaintaining reader support it + + return expression; +} + +QString XsdSchemaParser::readXPathAttribute(const QString &attributeName, XPathType type, const char *elementName) +{ + const QString value = readAttribute(attributeName); + if (value.isEmpty() || value.startsWith(QLatin1Char('/'))) { + attributeContentError(attributeName.toLatin1(), elementName, value); + return QString(); + } + + QXmlNamePool namePool(m_namePool.data()); + + QXmlQuery::QueryLanguage language; + switch (type) { + case XPath20: language = QXmlQuery::XPath20; break; + case XPathSelector: language = QXmlQuery::XmlSchema11IdentityConstraintSelector; break; + case XPathField: language = QXmlQuery::XmlSchema11IdentityConstraintField; break; + }; + + QXmlQuery query(language, namePool); + QXmlQueryPrivate *queryPrivate = query.d; + + const QList namespaceBindings = m_namespaceSupport.namespaceBindings(); + for (int i = 0; i < namespaceBindings.count(); ++i) { + if (!namespaceBindings.at(i).prefix() == StandardPrefixes::empty) + queryPrivate->addAdditionalNamespaceBinding(namespaceBindings.at(i)); + } + + query.setQuery(value, m_documentURI); + if (!query.isValid()) { + attributeContentError(attributeName.toLatin1(), elementName, value); + return QString(); + } + + return value; +} + +void XsdSchemaParser::validateIdAttribute(const char *elementName) +{ + if (hasAttribute(QString::fromLatin1("id"))) { + const QString value = readAttribute(QString::fromLatin1("id")); + DerivedString::Ptr id = DerivedString::fromLexical(m_namePool, value); + if (id->hasError()) { + attributeContentError("id", elementName, value, BuiltinTypes::xsID); + } else { + if (m_idCache->hasId(value)) { + error(QtXmlPatterns::tr("component with id %1 has been defined previously").arg(formatData(value))); + } else { + m_idCache->addId(value); + } + } + } +} + +bool XsdSchemaParser::isSchemaTag(XsdSchemaToken::NodeName tag, XsdSchemaToken::NodeName token, XsdSchemaToken::NodeName namespaceToken) const +{ + return ((tag == token) && (namespaceToken == XsdSchemaToken::XML_NS_SCHEMA_URI)); +} + +void XsdSchemaParser::addElement(const XsdElement::Ptr &element) +{ + const QXmlName objectName = element->name(m_namePool); + if (m_schema->element(objectName)) { + error(QtXmlPatterns::tr("element %1 already defined").arg(formatElement(m_namePool->displayName(objectName)))); + } else { + m_schema->addElement(element); + m_componentLocationHash.insert(element, currentSourceLocation()); + } +} + +void XsdSchemaParser::addAttribute(const XsdAttribute::Ptr &attribute) +{ + const QXmlName objectName = attribute->name(m_namePool); + if (m_schema->attribute(objectName)) { + error(QtXmlPatterns::tr("attribute %1 already defined").arg(formatAttribute(m_namePool->displayName(objectName)))); + } else { + m_schema->addAttribute(attribute); + m_componentLocationHash.insert(attribute, currentSourceLocation()); + } +} + +void XsdSchemaParser::addType(const SchemaType::Ptr &type) +{ + // we don't import redefinitions of builtin types, that just causes problems + if (m_builtinTypeNames.contains(type->name(m_namePool))) + return; + + const QXmlName objectName = type->name(m_namePool); + if (m_schema->type(objectName)) { + error(QtXmlPatterns::tr("type %1 already defined").arg(formatType(m_namePool, objectName))); + } else { + m_schema->addType(type); + if (type->isSimpleType()) + m_componentLocationHash.insert(XsdSimpleType::Ptr(type), currentSourceLocation()); + else + m_componentLocationHash.insert(XsdComplexType::Ptr(type), currentSourceLocation()); + } +} + +void XsdSchemaParser::addAnonymousType(const SchemaType::Ptr &type) +{ + m_schema->addAnonymousType(type); + if (type->isSimpleType()) + m_componentLocationHash.insert(XsdSimpleType::Ptr(type), currentSourceLocation()); + else + m_componentLocationHash.insert(XsdComplexType::Ptr(type), currentSourceLocation()); +} + +void XsdSchemaParser::addAttributeGroup(const XsdAttributeGroup::Ptr &group) +{ + const QXmlName objectName = group->name(m_namePool); + if (m_schema->attributeGroup(objectName)) { + error(QtXmlPatterns::tr("attribute group %1 already defined").arg(formatKeyword(m_namePool, objectName))); + } else { + m_schema->addAttributeGroup(group); + m_componentLocationHash.insert(group, currentSourceLocation()); + } +} + +void XsdSchemaParser::addElementGroup(const XsdModelGroup::Ptr &group) +{ + const QXmlName objectName = group->name(m_namePool); + if (m_schema->elementGroup(objectName)) { + error(QtXmlPatterns::tr("element group %1 already defined").arg(formatKeyword(m_namePool, objectName))); + } else { + m_schema->addElementGroup(group); + m_componentLocationHash.insert(group, currentSourceLocation()); + } +} + +void XsdSchemaParser::addNotation(const XsdNotation::Ptr ¬ation) +{ + const QXmlName objectName = notation->name(m_namePool); + if (m_schema->notation(objectName)) { + error(QtXmlPatterns::tr("notation %1 already defined").arg(formatKeyword(m_namePool, objectName))); + } else { + m_schema->addNotation(notation); + m_componentLocationHash.insert(notation, currentSourceLocation()); + } +} + +void XsdSchemaParser::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint) +{ + const QXmlName objectName = constraint->name(m_namePool); + if (m_schema->identityConstraint(objectName)) { + error(QtXmlPatterns::tr("identity constraint %1 already defined").arg(formatKeyword(m_namePool, objectName))); + } else { + m_schema->addIdentityConstraint(constraint); + m_componentLocationHash.insert(constraint, currentSourceLocation()); + } +} + +void XsdSchemaParser::addFacet(const XsdFacet::Ptr &facet, XsdFacet::Hash &facets, const SchemaType::Ptr &type) +{ + // @see http://www.w3.org/TR/xmlschema-2/#src-single-facet-value + if (facets.contains(facet->type())) { + error(QtXmlPatterns::tr("duplicated facets in simple type %1").arg(formatType(m_namePool, type))); + return; + } + + facets.insert(facet->type(), facet); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemaparser_p.h b/src/xmlpatterns/schema/qxsdschemaparser_p.h new file mode 100644 index 0000000..960fb86 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemaparser_p.h @@ -0,0 +1,691 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaParser_H +#define Patternist_XsdSchemaParser_H + +#include "qnamespacesupport_p.h" +#include "qxsdalternative_p.h" +#include "qxsdattribute_p.h" +#include "qxsdattributegroup_p.h" +#include "qxsdattributeterm_p.h" +#include "qxsdcomplextype_p.h" +#include "qxsdelement_p.h" +#include "qxsdidcache_p.h" +#include "qxsdmodelgroup_p.h" +#include "qxsdnotation_p.h" +#include "qxsdsimpletype_p.h" +#include "qxsdschemacontext_p.h" +#include "qxsdschemaparsercontext_p.h" +#include "qxsdstatemachine_p.h" + +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Implements the parsing of XML schema file. + * + * This class parses a XML schema in XML presentation from an QIODevice + * and returns object representation as XsdSchema. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchemaParser : public MaintainingReader + { + friend class ElementNamespaceHandler; + friend class TagValidationHandler; + + public: + enum ParserType + { + TopLevelParser, + IncludeParser, + ImportParser, + RedefineParser + }; + + /** + * Creates a new schema parser object. + */ + XsdSchemaParser(const XsdSchemaContext::Ptr &context, const XsdSchemaParserContext::Ptr &parserContext, QIODevice *device); + + /** + * Parses the XML schema file. + * + * @return @c true on success, @c false if the schema is somehow invalid. + */ + bool parse(ParserType parserType = TopLevelParser); + + /** + * Describes a set of namespace URIs + */ + typedef QSet NamespaceSet; + + /** + * Sets which @p schemas have been included already, so the parser + * can detect circular includes. + */ + void setIncludedSchemas(const NamespaceSet &schemas); + + /** + * Sets which @p schemas have been imported already, so the parser + * can detect circular imports. + */ + void setImportedSchemas(const NamespaceSet &schemas); + + /** + * Sets which @p schemas have been redefined already, so the parser + * can detect circular redefines. + */ + void setRedefinedSchemas(const NamespaceSet &schemas); + + /** + * Sets the target namespace of the schema to parse. + */ + void setTargetNamespace(const QString &targetNamespace); + + /** + * Sets the document URI of the schema to parse. + */ + void setDocumentURI(const QUrl &uri); + + /** + * Returns the document URI of the schema to parse. + */ + QUrl documentURI() const; + + /** + * Reimplemented from MaintainingReader, always returns @c false. + */ + bool isAnyAttributeAllowed() const; + + private: + /** + * Used internally to report any kind of parsing error or + * schema inconsistency. + */ + virtual void error(const QString &msg); + + void attributeContentError(const char *attributeName, const char *elementName, const QString &value, const SchemaType::Ptr &type = SchemaType::Ptr()); + + /** + * Sets the target namespace of the schema to parse. + */ + void setTargetNamespaceExtended(const QString &targetNamespace); + + /** + * This method is called for parsing the top-level schema object. + */ + void parseSchema(ParserType parserType); + + /** + * This method is called for parsing any top-level include object. + */ + void parseInclude(); + + /** + * This method is called for parsing any top-level import object. + */ + void parseImport(); + + /** + * This method is called for parsing any top-level redefine object. + */ + void parseRedefine(); + + /** + * This method is called for parsing any annotation object everywhere + * in the schema. + */ + XsdAnnotation::Ptr parseAnnotation(); + + /** + * This method is called for parsing an appinfo object as child of + * an annotation object. + */ + XsdApplicationInformation::Ptr parseAppInfo(); + + /** + * This method is called for parsing a documentation object as child of + * an annotation object. + */ + XsdDocumentation::Ptr parseDocumentation(); + + /** + * This method is called for parsing a defaultOpenContent object. + */ + void parseDefaultOpenContent(); + + /** + * This method is called for parsing any top-level simpleType object. + */ + XsdSimpleType::Ptr parseGlobalSimpleType(); + + /** + * This method is called for parsing any simpleType object as descendant + * of an element or complexType object. + */ + XsdSimpleType::Ptr parseLocalSimpleType(); + + /** + * This method is called for parsing a restriction object as child + * of a simpleType object. + */ + void parseSimpleRestriction(const XsdSimpleType::Ptr &ptr); + + /** + * This method is called for parsing a list object as child + * of a simpleType object. + */ + void parseList(const XsdSimpleType::Ptr &ptr); + + /** + * This method is called for parsing a union object as child + * of a simpleType object. + */ + void parseUnion(const XsdSimpleType::Ptr &ptr); + + /** + * This method is called for parsing a minExclusive object as child + * of a restriction object. + */ + XsdFacet::Ptr parseMinExclusiveFacet(); + + /** + * This method is called for parsing a minInclusive object as child + * of a restriction object. + */ + XsdFacet::Ptr parseMinInclusiveFacet(); + + /** + * This method is called for parsing a maxExclusive object as child + * of a restriction object. + */ + XsdFacet::Ptr parseMaxExclusiveFacet(); + + /** + * This method is called for parsing a maxInclusive object as child + * of a restriction object. + */ + XsdFacet::Ptr parseMaxInclusiveFacet(); + + /** + * This method is called for parsing a totalDigits object as child + * of a restriction object. + */ + XsdFacet::Ptr parseTotalDigitsFacet(); + + /** + * This method is called for parsing a fractionDigits object as child + * of a restriction object. + */ + XsdFacet::Ptr parseFractionDigitsFacet(); + + /** + * This method is called for parsing a length object as child + * of a restriction object. + */ + XsdFacet::Ptr parseLengthFacet(); + + /** + * This method is called for parsing a minLength object as child + * of a restriction object. + */ + XsdFacet::Ptr parseMinLengthFacet(); + + /** + * This method is called for parsing a maxLength object as child + * of a restriction object. + */ + XsdFacet::Ptr parseMaxLengthFacet(); + + /** + * This method is called for parsing an enumeration object as child + * of a restriction object. + */ + XsdFacet::Ptr parseEnumerationFacet(); + + /** + * This method is called for parsing a whiteSpace object as child + * of a restriction object. + */ + XsdFacet::Ptr parseWhiteSpaceFacet(); + + /** + * This method is called for parsing a pattern object as child + * of a restriction object. + */ + XsdFacet::Ptr parsePatternFacet(); + + /** + * This method is called for parsing an assertion object as child + * of a restriction object. + */ + XsdFacet::Ptr parseAssertionFacet(); + + /** + * This method is called for parsing any top-level complexType object. + */ + XsdComplexType::Ptr parseGlobalComplexType(); + + /** + * This method is called for parsing any complexType object as descendant + * of an element object. + */ + XsdComplexType::Ptr parseLocalComplexType(); + + /** + * This method resolves the content type of the @p complexType for the given + * @p effectiveMixed value. + */ + void resolveComplexContentType(const XsdComplexType::Ptr &complexType, bool effectiveMixed); + + /** + * This method is called for parsing a simpleContent object as child + * of a complexType object. + */ + void parseSimpleContent(const XsdComplexType::Ptr &complexType); + + /** + * This method is called for parsing a restriction object as child + * of a simpleContent object. + */ + void parseSimpleContentRestriction(const XsdComplexType::Ptr &complexType); + + /** + * This method is called for parsing an extension object as child + * of a simpleContent object. + */ + void parseSimpleContentExtension(const XsdComplexType::Ptr &complexType); + + /** + * This method is called for parsing a complexContent object as child + * of a complexType object. + * + * @param complexType The complex type the complex content belongs to. + * @param mixed The output parameter for the mixed value. + */ + void parseComplexContent(const XsdComplexType::Ptr &complexType, bool *mixed); + + /** + * This method is called for parsing a restriction object as child + * of a complexContent object. + */ + void parseComplexContentRestriction(const XsdComplexType::Ptr &complexType); + + /** + * This method is called for parsing an extension object as child + * of a complexContent object. + */ + void parseComplexContentExtension(const XsdComplexType::Ptr &complexType); + + /** + * This method is called for parsing an assert object as child + * of a complexType or parsing a assertion facet object as + * child of a simpleType. + * + * @param nodeName Either XsdSchemaToken::Assert or XsdSchemaToken::Assertion. + * @param tag Either XsdTagScope::Assert or XsdTagScope::Assertion. + */ + XsdAssertion::Ptr parseAssertion(const XsdSchemaToken::NodeName &nodeName, const XsdTagScope::Type &tag); + + /** + * This method is called for parsing an openContent object. + */ + XsdComplexType::OpenContent::Ptr parseOpenContent(); + + /** + * This method is called for parsing a top-level group object. + */ + XsdModelGroup::Ptr parseNamedGroup(); + + /** + * This method is called for parsing a non-top-level group object + * that contains a ref attribute. + */ + XsdTerm::Ptr parseReferredGroup(const XsdParticle::Ptr &particle); + + /** + * This method is called for parsing an all object as child + * of a top-level group object. + * + * @param parent The schema component the all object is part of. + */ + XsdModelGroup::Ptr parseAll(const NamedSchemaComponent::Ptr &parent); + + /** + * This method is called for parsing an all object as descendant + * of a complexType object. + * + * @param particle The particle the all object belongs to. + * @param parent The schema component the all object is part of. + */ + XsdModelGroup::Ptr parseLocalAll(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent); + + /** + * This method is called for parsing a choice object as child + * of a top-level group object. + * + * @param parent The schema component the choice object is part of. + */ + XsdModelGroup::Ptr parseChoice(const NamedSchemaComponent::Ptr &parent); + + /** + * This method is called for parsing a choice object as descendant + * of a complexType object or a choice object. + * + * @param particle The particle the choice object belongs to. + * @param parent The schema component the choice object is part of. + */ + XsdModelGroup::Ptr parseLocalChoice(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent); + + /** + * This method is called for parsing a sequence object as child + * of a top-level group object. + * + * @param parent The schema component the sequence object is part of. + */ + XsdModelGroup::Ptr parseSequence(const NamedSchemaComponent::Ptr &parent); + + /** + * This method is called for parsing a sequence object as descendant + * of a complexType object or a sequence object. + * + * @param particle The particle the sequence object belongs to. + * @param parent The schema component the sequence object is part of. + */ + XsdModelGroup::Ptr parseLocalSequence(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent); + + /** + * A helper method that parses the minOccurs and maxOccurs constraints for + * the given @p particle that has the given @p tagName. + */ + bool parseMinMaxConstraint(const XsdParticle::Ptr &particle, const char* tagName); + + /** + * This method is called for parsing any top-level attribute object. + */ + XsdAttribute::Ptr parseGlobalAttribute(); + + /** + * This method is called for parsing any non-top-level attribute object as a + * descendant of a complexType object or an attributeGroup object. + * + * @param parent The parent component the attribute object is part of. + */ + XsdAttributeUse::Ptr parseLocalAttribute(const NamedSchemaComponent::Ptr &parent); + + /** + * This method is called for parsing a top-level attributeGroup object. + */ + XsdAttributeGroup::Ptr parseNamedAttributeGroup(); + + /** + * This method is called for parsing a non-top-level attributeGroup object + * that contains a ref attribute. + */ + XsdAttributeUse::Ptr parseReferredAttributeGroup(); + + /** + * This method is called for parsing any top-level element object. + */ + XsdElement::Ptr parseGlobalElement(); + + /** + * This method is called for parsing any non-top-level element object as a + * descendant of a complexType object or a group object. + * + * @param particle The particle the element object belongs to. + * @param parent The parent component the element object is part of. + */ + XsdTerm::Ptr parseLocalElement(const XsdParticle::Ptr &particle, const NamedSchemaComponent::Ptr &parent); + + /** + * This method is called for parsing a unique object as child of an element object. + */ + XsdIdentityConstraint::Ptr parseUnique(); + + /** + * This method is called for parsing a key object as child of an element object. + */ + XsdIdentityConstraint::Ptr parseKey(); + + /** + * This method is called for parsing a keyref object as child of an element object. + */ + XsdIdentityConstraint::Ptr parseKeyRef(const XsdElement::Ptr &element); + + /** + * This method is called for parsing a selector object as child of an unique object, + * key object or keyref object, + * + * @param ptr The identity constraint it belongs to. + */ + void parseSelector(const XsdIdentityConstraint::Ptr &ptr); + + /** + * This method is called for parsing a field object as child of an unique object, + * key object or keyref object, + * + * @param ptr The identity constraint it belongs to. + */ + void parseField(const XsdIdentityConstraint::Ptr &ptr); + + /** + * This method is called for parsing an alternative object inside an element object. + */ + XsdAlternative::Ptr parseAlternative(); + + /** + * This method is called for parsing a top-level notation object. + */ + XsdNotation::Ptr parseNotation(); + + /** + * This method is called for parsing an any object somewhere in + * the schema. + * + * @param particle The particle the any object belongs to. + */ + XsdWildcard::Ptr parseAny(const XsdParticle::Ptr &particle); + + /** + * This method is called for parsing an anyAttribute object somewhere in + * the schema. + */ + XsdWildcard::Ptr parseAnyAttribute(); + + /** + * This method is called for parsing unknown object as descendant of the annotation object. + */ + void parseUnknownDocumentation(); + + /** + * This method is called for parsing unknown object in the schema. + */ + void parseUnknown(); + + /** + * Returnes an source location for the current position. + */ + QSourceLocation currentSourceLocation() const; + + /** + * Converts a @p qualified name into a QXmlName @p name and does some error handling. + */ + void convertName(const QString &qualified, NamespaceSupport::NameType type, QXmlName &name); + + /** + * A helper method that reads in a 'name' attribute and checks it for syntactic errors. + */ + inline QString readNameAttribute(const char *elementName); + + /** + * A helper method that reads in an attribute that contains an QName and + * checks it for syntactic errors. + */ + inline QString readQNameAttribute(const QString &typeAttribute, const char *elementName); + + /** + * A helper method that reads in a namespace attribute and checks for syntactic errors. + */ + inline QString readNamespaceAttribute(const QString &attributeName, const char *elementName); + + /** + * A helper method that reads the final attribute and does correct handling of schema default definitions. + */ + inline SchemaType::DerivationConstraints readDerivationConstraintAttribute(const SchemaType::DerivationConstraints &allowedConstraints, const char *elementName); + + /** + * A helper method that reads the block attribute and does correct handling of schema default definitions. + */ + inline NamedSchemaComponent::BlockingConstraints readBlockingConstraintAttribute(const NamedSchemaComponent::BlockingConstraints &allowedConstraints, const char *elementName); + + /** + * A helper method that reads all components for a xpath expression for the current scope. + */ + XsdXPathExpression::Ptr readXPathExpression(const char *elementName); + + /** + * Describes the type of XPath that is allowed by the readXPathAttribute method. + */ + enum XPathType { + XPath20, + XPathSelector, + XPathField + }; + + /** + * A helper method that reads an attribute that represents a xpath query and does basic + * validation. + */ + QString readXPathAttribute(const QString &attributeName, XPathType type, const char *elementName); + + /** + * A helper method that reads in an "id" attribute, checks it for syntactic errors + * and tests whether a component with the same id has already been parsed. + */ + inline void validateIdAttribute(const char *elementName); + + /** + * Adds an @p element to the schema and checks for duplicated entries. + */ + void addElement(const XsdElement::Ptr &element); + + /** + * Adds an @p attribute to the schema and checks for duplicated entries. + */ + void addAttribute(const XsdAttribute::Ptr &attribute); + + /** + * Adds a @p type to the schema and checks for duplicated entries. + */ + void addType(const SchemaType::Ptr &type); + + /** + * Adds an anonymous @p type to the schema and checks for duplicated entries. + */ + void addAnonymousType(const SchemaType::Ptr &type); + + /** + * Adds an attribute @p group to the schema and checks for duplicated entries. + */ + void addAttributeGroup(const XsdAttributeGroup::Ptr &group); + + /** + * Adds an element @p group to the schema and checks for duplicated entries. + */ + void addElementGroup(const XsdModelGroup::Ptr &group); + + /** + * Adds a @p notation to the schema and checks for duplicated entries. + */ + void addNotation(const XsdNotation::Ptr ¬ation); + + /** + * Adds an identity @p constraint to the schema and checks for duplicated entries. + */ + void addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint); + + /** + * Adds the @p facet to the list of @p facets for @p type and checks for duplicates. + */ + void addFacet(const XsdFacet::Ptr &facet, XsdFacet::Hash &facets, const SchemaType::Ptr &type); + + /** + * Sets up the state machines for validating the right occurrence of xml elements. + */ + void setupStateMachines(); + + /** + * Sets up a list of names of known builtin types. + */ + void setupBuiltinTypeNames(); + + /** + * Checks whether the given @p tag is equal to the given @p token and + * the given @p namespaceToken is the XML Schema namespace. + */ + inline bool isSchemaTag(XsdSchemaToken::NodeName tag, XsdSchemaToken::NodeName token, XsdSchemaToken::NodeName namespaceToken) const; + + XsdSchemaContext::Ptr m_context; + XsdSchemaParserContext::Ptr m_parserContext; + NamePool::Ptr m_namePool; + NamespaceSupport m_namespaceSupport; + XsdSchemaResolver::Ptr m_schemaResolver; + XsdSchema::Ptr m_schema; + + QString m_targetNamespace; + QString m_attributeFormDefault; + QString m_elementFormDefault; + QString m_blockDefault; + QString m_finalDefault; + QString m_xpathDefaultNamespace; + QXmlName m_defaultAttributes; + XsdComplexType::OpenContent::Ptr m_defaultOpenContent; + bool m_defaultOpenContentAppliesToEmpty; + + NamespaceSet m_includedSchemas; + NamespaceSet m_importedSchemas; + NamespaceSet m_redefinedSchemas; + QUrl m_documentURI; + XsdIdCache::Ptr m_idCache; + QHash > m_stateMachines; + ComponentLocationHash m_componentLocationHash; + QSet m_builtinTypeNames; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp new file mode 100644 index 0000000..167af7a --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp @@ -0,0 +1,1070 @@ + +#include "qxsdschemaparser_p.h" + +#include "qbuiltintypes_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +/** + * @page using_dfa_for_schema Using DFA for validation of correct XML tag occurrence + * + * This page describes how to use DFAs for validating that the XML child tags of an + * XML parent tag occur in the right order. + * + * To validate the occurence of XML tags one need a regular expression that describes + * which tags can appear how often in what context. For example the regular expression + * of the global attribute tag in XML Schema is (annotation?, simpleType?). + * That means the attribute tag can contain an annotation tag followed + * by a simpleType tag, or just one simpleType tag and even no child + * tag at all. + * So the regular expression describes some kind of language and all the various occurrences + * of the child tags can be seen as words of that language. + * We can create a DFA now, that accepts all words (and only these words) of that language + * and whenever we want to check if a sequence of child tags belongs to the language, + * we test if the sequence passes the DFA successfully. + * + * The following example shows how to create the DFA for the regular expression method + * above. + * + * \dotfile GlobalAttribute_diagram.dot + * + * At first we need a start state (1), that's the state the DFA is before it + * starts running. As our regular expression allows that there are no child tags, the + * start state is an end state as well (marked by the double circle). + * Now we fetch the first token from the XML file (let's assume it is an annotation tag) + * and check if there is an edge labled with the tag name leaving the current state of the DFA. + * If there is no such edge, the input doesn't fullfill the rules of the regular expression, + * so we throw an error. Otherwise we follow that edge and the DFA is set to the new state (2) the + * edge points to. Now we fetch the next token from the XML file and do the previous steps again. + * If there is no further input from the XML file, we check whether the DFA is in an end state and + * throw an error if not. + * + * So the algorithm for checking is quite simple, the whole logic is encoded in the DFA and creating + * one for a regular expression is sometimes not easy, however the ones for XML Schema are straight + * forward. + * + *

Legend:

+ * \dotfile legend.dot + *
+ * + *

DFA for all tag

+ * \dotfile All_diagram.dot + *
+ *

DFA for alternative tag

+ * \dotfile Alternative_diagram.dot + *
+ *

DFA for annotation tag

+ * \dotfile Annotation_diagram.dot + *
+ *

DFA for anyAttribute tag

+ * \dotfile AnyAttribute_diagram.dot + *
+ *

DFA for any tag

+ * \dotfile Any_diagram.dot + *
+ *

DFA for assert tag

+ * \dotfile Assert_diagram.dot + *
+ *

DFA for choice tag

+ * \dotfile Choice_diagram.dot + *
+ *

DFA for complexContent tag

+ * \dotfile ComplexContent_diagram.dot + *
+ *

DFA for extension tag inside a complexContent tag

+ * \dotfile ComplexContentExtension_diagram.dot + *
+ *

DFA for restriction tag inside a complexContent tag

+ * \dotfile ComplexContentRestriction_diagram.dot + *
+ *

DFA for defaultOpenContent tag

+ * \dotfile DefaultOpenContent_diagram.dot + *
+ *

DFA for enumeration tag

+ * \dotfile EnumerationFacet_diagram.dot + *
+ *

DFA for field tag

+ * \dotfile Field_diagram.dot + *
+ *

DFA for fractionDigits tag

+ * \dotfile FractionDigitsFacet_diagram.dot + *
+ *

DFA for attribute tag

+ * \dotfile GlobalAttribute_diagram.dot + *
+ *

DFA for complexType tag

+ * \dotfile GlobalComplexType_diagram.dot + *
+ *

DFA for element tag

+ * \dotfile GlobalElement_diagram.dot + *
+ *

DFA for simpleType tag

+ * \dotfile GlobalSimpleType_diagram.dot + *
+ *

DFA for import tag

+ * \dotfile Import_diagram.dot + *
+ *

DFA for include tag

+ * \dotfile Include_diagram.dot + *
+ *

DFA for key tag

+ * \dotfile Key_diagram.dot + *
+ *

DFA for keyref tag

+ * \dotfile KeyRef_diagram.dot + *
+ *

DFA for length tag

+ * \dotfile LengthFacet_diagram.dot + *
+ *

DFA for list tag

+ * \dotfile List_diagram.dot + *
+ *

DFA for all tag

+ * \dotfile LocalAll_diagram.dot + *
+ *

DFA for attribute tag

+ * \dotfile LocalAttribute_diagram.dot + *
+ *

DFA for choice tag

+ * \dotfile LocalChoice_diagram.dot + *
+ *

DFA for complexType tag

+ * \dotfile LocalComplexType_diagram.dot + *
+ *

DFA for element tag

+ * \dotfile LocalElement_diagram.dot + *
+ *

DFA for sequence tag

+ * \dotfile LocalSequence_diagram.dot + *
+ *

DFA for simpleType tag that

+ * \dotfile LocalSimpleType_diagram.dot + *
+ *

DFA for maxExclusive tag

+ * \dotfile MaxExclusiveFacet_diagram.dot + *
+ *

DFA for maxInclusive tag

+ * \dotfile MaxInclusiveFacet_diagram.dot + *
+ *

DFA for maxLength tag

+ * \dotfile MaxLengthFacet_diagram.dot + *
+ *

DFA for minExclusive tag

+ * \dotfile MinExclusiveFacet_diagram.dot + *
+ *

DFA for minInclusive tag

+ * \dotfile MinInclusiveFacet_diagram.dot + *
+ *

DFA for minLength tag

+ * \dotfile MinLengthFacet_diagram.dot + *
+ *

DFA for attributeGroup tag without ref attribute

+ * \dotfile NamedAttributeGroup_diagram.dot + *
+ *

DFA for group tag without ref attribute

+ * \dotfile NamedGroup_diagram.dot + *
+ *

DFA for notation tag

+ * \dotfile Notation_diagram.dot + *
+ *

DFA for override tag

+ * \dotfile Override_diagram.dot + *
+ *

DFA for pattern tag

+ * \dotfile PatternFacet_diagram.dot + *
+ *

DFA for redefine tag

+ * \dotfile Redefine_diagram.dot + *
+ *

DFA for attributeGroup tag with ref attribute

+ * \dotfile ReferredAttributeGroup_diagram.dot + *
+ *

DFA for group tag with ref attribute

+ * \dotfile ReferredGroup_diagram.dot + *
+ *

DFA for schema tag

+ * \dotfile Schema_diagram.dot + *
+ *

DFA for selector tag

+ * \dotfile Selector_diagram.dot + *
+ *

DFA for sequence tag

+ * \dotfile Sequence_diagram.dot + *
+ *

DFA for simpleContent tag

+ * \dotfile SimpleContent_diagram.dot + *
+ *

DFA for extension tag inside a simpleContent tag

+ * \dotfile SimpleContentExtension_diagram.dot + *
+ *

DFA for restriction tag inside a simpleContent tag

+ * \dotfile SimpleContentRestriction_diagram.dot + *
+ *

DFA for restriction tag inside a simpleType tag

+ * \dotfile SimpleRestriction_diagram.dot + *
+ *

DFA for totalDigits tag

+ * \dotfile TotalDigitsFacet_diagram.dot + *
+ *

DFA for union tag

+ * \dotfile Union_diagram.dot + *
+ *

DFA for unique tag

+ * \dotfile Unique_diagram.dot + *
+ *

DFA for whiteSpace tag

+ * \dotfile WhiteSpaceFacet_diagram.dot + */ + +void XsdSchemaParser::setupStateMachines() +{ + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, simpleType?) : attribute + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + + m_stateMachines.insert(XsdTagScope::GlobalAttribute, machine); + m_stateMachines.insert(XsdTagScope::LocalAttribute, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, ((simpleType | complexType)?, alternative*, (unique | key | keyref)*)) : element + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s2); + machine.addTransition(startState, XsdSchemaToken::Alternative, s3); + machine.addTransition(startState, XsdSchemaToken::Unique, s4); + machine.addTransition(startState, XsdSchemaToken::Key, s4); + machine.addTransition(startState, XsdSchemaToken::Keyref, s4); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s2); + machine.addTransition(s1, XsdSchemaToken::Alternative, s3); + machine.addTransition(s1, XsdSchemaToken::Unique, s4); + machine.addTransition(s1, XsdSchemaToken::Key, s4); + machine.addTransition(s1, XsdSchemaToken::Keyref, s4); + + machine.addTransition(s2, XsdSchemaToken::Alternative, s3); + machine.addTransition(s2, XsdSchemaToken::Unique, s4); + machine.addTransition(s2, XsdSchemaToken::Key, s4); + machine.addTransition(s2, XsdSchemaToken::Keyref, s4); + + machine.addTransition(s3, XsdSchemaToken::Alternative, s3); + machine.addTransition(s3, XsdSchemaToken::Unique, s4); + machine.addTransition(s3, XsdSchemaToken::Key, s4); + machine.addTransition(s3, XsdSchemaToken::Keyref, s4); + + machine.addTransition(s4, XsdSchemaToken::Unique, s4); + machine.addTransition(s4, XsdSchemaToken::Key, s4); + machine.addTransition(s4, XsdSchemaToken::Keyref, s4); + + m_stateMachines.insert(XsdTagScope::GlobalElement, machine); + m_stateMachines.insert(XsdTagScope::LocalElement, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (simpleContent | complexContent | (openContent?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?), assert*))) : complexType + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s6 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s7 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleContent, s2); + machine.addTransition(startState, XsdSchemaToken::ComplexContent, s2); + machine.addTransition(startState, XsdSchemaToken::OpenContent, s3); + machine.addTransition(startState, XsdSchemaToken::Group, s4); + machine.addTransition(startState, XsdSchemaToken::All, s4); + machine.addTransition(startState, XsdSchemaToken::Choice, s4); + machine.addTransition(startState, XsdSchemaToken::Sequence, s4); + machine.addTransition(startState, XsdSchemaToken::Attribute, s5); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s5); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s6); + machine.addTransition(startState, XsdSchemaToken::Assert, s7); + + machine.addTransition(s1, XsdSchemaToken::SimpleContent, s2); + machine.addTransition(s1, XsdSchemaToken::ComplexContent, s2); + machine.addTransition(s1, XsdSchemaToken::OpenContent, s3); + machine.addTransition(s1, XsdSchemaToken::Group, s4); + machine.addTransition(s1, XsdSchemaToken::All, s4); + machine.addTransition(s1, XsdSchemaToken::Choice, s4); + machine.addTransition(s1, XsdSchemaToken::Sequence, s4); + machine.addTransition(s1, XsdSchemaToken::Attribute, s5); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s5); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s6); + machine.addTransition(s1, XsdSchemaToken::Assert, s7); + + machine.addTransition(s3, XsdSchemaToken::Group, s4); + machine.addTransition(s3, XsdSchemaToken::All, s4); + machine.addTransition(s3, XsdSchemaToken::Choice, s4); + machine.addTransition(s3, XsdSchemaToken::Sequence, s4); + machine.addTransition(s3, XsdSchemaToken::Attribute, s5); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s5); + machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s6); + machine.addTransition(s3, XsdSchemaToken::Assert, s7); + + machine.addTransition(s4, XsdSchemaToken::Attribute, s5); + machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s5); + machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s6); + machine.addTransition(s4, XsdSchemaToken::Assert, s7); + + machine.addTransition(s5, XsdSchemaToken::Attribute, s5); + machine.addTransition(s5, XsdSchemaToken::AttributeGroup, s5); + machine.addTransition(s5, XsdSchemaToken::AnyAttribute, s6); + machine.addTransition(s5, XsdSchemaToken::Assert, s7); + + machine.addTransition(s6, XsdSchemaToken::Assert, s7); + + machine.addTransition(s7, XsdSchemaToken::Assert, s7); + + m_stateMachines.insert(XsdTagScope::GlobalComplexType, machine); + m_stateMachines.insert(XsdTagScope::LocalComplexType, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (restriction | extension)) : simpleContent/complexContent + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Restriction, s2); + machine.addTransition(startState, XsdSchemaToken::Extension, s2); + + machine.addTransition(s1, XsdSchemaToken::Restriction, s2); + machine.addTransition(s1, XsdSchemaToken::Extension, s2); + + m_stateMachines.insert(XsdTagScope::SimpleContent, machine); + m_stateMachines.insert(XsdTagScope::ComplexContent, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern | assertion)*)?, ((attribute | attributeGroup)*, anyAttribute?), assert*) : simpleContent restriction + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s6 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(startState, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(startState, XsdSchemaToken::Length, s3); + machine.addTransition(startState, XsdSchemaToken::MinLength, s3); + machine.addTransition(startState, XsdSchemaToken::MaxLength, s3); + machine.addTransition(startState, XsdSchemaToken::Enumeration, s3); + machine.addTransition(startState, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(startState, XsdSchemaToken::Pattern, s3); + machine.addTransition(startState, XsdSchemaToken::Assertion, s3); + machine.addTransition(startState, XsdSchemaToken::Attribute, s4); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(startState, XsdSchemaToken::Assert, s6); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s1, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s1, XsdSchemaToken::Length, s3); + machine.addTransition(s1, XsdSchemaToken::MinLength, s3); + machine.addTransition(s1, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s1, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s1, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s1, XsdSchemaToken::Pattern, s3); + machine.addTransition(s1, XsdSchemaToken::Assertion, s3); + machine.addTransition(s1, XsdSchemaToken::Attribute, s4); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s1, XsdSchemaToken::Assert, s6); + + machine.addTransition(s2, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s2, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s2, XsdSchemaToken::Length, s3); + machine.addTransition(s2, XsdSchemaToken::MinLength, s3); + machine.addTransition(s2, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s2, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s2, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s2, XsdSchemaToken::Pattern, s3); + machine.addTransition(s2, XsdSchemaToken::Assertion, s3); + machine.addTransition(s2, XsdSchemaToken::Attribute, s4); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s2, XsdSchemaToken::Assert, s6); + + machine.addTransition(s3, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s3, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s3, XsdSchemaToken::Length, s3); + machine.addTransition(s3, XsdSchemaToken::MinLength, s3); + machine.addTransition(s3, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s3, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s3, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s3, XsdSchemaToken::Pattern, s3); + machine.addTransition(s3, XsdSchemaToken::Assertion, s3); + machine.addTransition(s3, XsdSchemaToken::Attribute, s4); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s3, XsdSchemaToken::Assert, s6); + + machine.addTransition(s4, XsdSchemaToken::Attribute, s4); + machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s4, XsdSchemaToken::Assert, s6); + + machine.addTransition(s5, XsdSchemaToken::Assert, s6); + + machine.addTransition(s6, XsdSchemaToken::Assert, s6); + + m_stateMachines.insert(XsdTagScope::SimpleContentRestriction, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, ((attribute | attributeGroup)*, anyAttribute?), assert*) : simple content extension + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Attribute, s2); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s3); + machine.addTransition(startState, XsdSchemaToken::Assert, s4); + + machine.addTransition(s1, XsdSchemaToken::Attribute, s2); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s3); + machine.addTransition(s1, XsdSchemaToken::Assert, s4); + + machine.addTransition(s2, XsdSchemaToken::Attribute, s2); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s3); + machine.addTransition(s2, XsdSchemaToken::Assert, s4); + + machine.addTransition(s3, XsdSchemaToken::Assert, s4); + + machine.addTransition(s4, XsdSchemaToken::Assert, s4); + + m_stateMachines.insert(XsdTagScope::SimpleContentExtension, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, openContent?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?), assert*)) : complex content restriction/complex content extension + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s6 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::OpenContent, s2); + machine.addTransition(startState, XsdSchemaToken::Group, s3); + machine.addTransition(startState, XsdSchemaToken::All, s3); + machine.addTransition(startState, XsdSchemaToken::Choice, s3); + machine.addTransition(startState, XsdSchemaToken::Sequence, s3); + machine.addTransition(startState, XsdSchemaToken::Attribute, s4); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(startState, XsdSchemaToken::Assert, s6); + + machine.addTransition(s1, XsdSchemaToken::OpenContent, s2); + machine.addTransition(s1, XsdSchemaToken::Group, s3); + machine.addTransition(s1, XsdSchemaToken::All, s3); + machine.addTransition(s1, XsdSchemaToken::Choice, s3); + machine.addTransition(s1, XsdSchemaToken::Sequence, s3); + machine.addTransition(s1, XsdSchemaToken::Attribute, s4); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s1, XsdSchemaToken::Assert, s6); + + machine.addTransition(s2, XsdSchemaToken::Group, s3); + machine.addTransition(s2, XsdSchemaToken::All, s3); + machine.addTransition(s2, XsdSchemaToken::Choice, s3); + machine.addTransition(s2, XsdSchemaToken::Sequence, s3); + machine.addTransition(s2, XsdSchemaToken::Attribute, s4); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s2, XsdSchemaToken::Assert, s6); + + machine.addTransition(s3, XsdSchemaToken::Attribute, s4); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s3, XsdSchemaToken::Assert, s6); + + machine.addTransition(s4, XsdSchemaToken::Attribute, s4); + machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s5); + machine.addTransition(s4, XsdSchemaToken::Assert, s6); + + machine.addTransition(s5, XsdSchemaToken::Assert, s6); + + machine.addTransition(s6, XsdSchemaToken::Assert, s6); + + m_stateMachines.insert(XsdTagScope::ComplexContentRestriction, machine); + m_stateMachines.insert(XsdTagScope::ComplexContentExtension, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, ((attribute | attributeGroup)*, anyAttribute?)) : named attribute group + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Attribute, s2); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s3); + + machine.addTransition(s1, XsdSchemaToken::Attribute, s2); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s3); + + machine.addTransition(s2, XsdSchemaToken::Attribute, s2); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s3); + + m_stateMachines.insert(XsdTagScope::NamedAttributeGroup, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (all | choice | sequence)?) : group + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::All, s2); + machine.addTransition(startState, XsdSchemaToken::Choice, s2); + machine.addTransition(startState, XsdSchemaToken::Sequence, s2); + + machine.addTransition(s1, XsdSchemaToken::All, s2); + machine.addTransition(s1, XsdSchemaToken::Choice, s2); + machine.addTransition(s1, XsdSchemaToken::Sequence, s2); + + m_stateMachines.insert(XsdTagScope::NamedGroup, machine); + m_stateMachines.insert(XsdTagScope::ReferredGroup, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (element | any)*) : all + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Element, s2); + machine.addTransition(startState, XsdSchemaToken::Any, s2); + + machine.addTransition(s1, XsdSchemaToken::Element, s2); + machine.addTransition(s1, XsdSchemaToken::Any, s2); + + machine.addTransition(s2, XsdSchemaToken::Element, s2); + machine.addTransition(s2, XsdSchemaToken::Any, s2); + + m_stateMachines.insert(XsdTagScope::All, machine); + m_stateMachines.insert(XsdTagScope::LocalAll, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (element | group | choice | sequence | any)*) : choice sequence + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Element, s2); + machine.addTransition(startState, XsdSchemaToken::Group, s2); + machine.addTransition(startState, XsdSchemaToken::Choice, s2); + machine.addTransition(startState, XsdSchemaToken::Sequence, s2); + machine.addTransition(startState, XsdSchemaToken::Any, s2); + + machine.addTransition(s1, XsdSchemaToken::Element, s2); + machine.addTransition(s1, XsdSchemaToken::Group, s2); + machine.addTransition(s1, XsdSchemaToken::Choice, s2); + machine.addTransition(s1, XsdSchemaToken::Sequence, s2); + machine.addTransition(s1, XsdSchemaToken::Any, s2); + + machine.addTransition(s2, XsdSchemaToken::Element, s2); + machine.addTransition(s2, XsdSchemaToken::Group, s2); + machine.addTransition(s2, XsdSchemaToken::Choice, s2); + machine.addTransition(s2, XsdSchemaToken::Sequence, s2); + machine.addTransition(s2, XsdSchemaToken::Any, s2); + + m_stateMachines.insert(XsdTagScope::Choice, machine); + m_stateMachines.insert(XsdTagScope::LocalChoice, machine); + m_stateMachines.insert(XsdTagScope::Sequence, machine); + m_stateMachines.insert(XsdTagScope::LocalSequence, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?) : any/selector/field/notation/include/import/referred attribute group/anyAttribute/all facets/assert + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + + m_stateMachines.insert(XsdTagScope::Any, machine); + m_stateMachines.insert(XsdTagScope::Selector, machine); + m_stateMachines.insert(XsdTagScope::Field, machine); + m_stateMachines.insert(XsdTagScope::Notation, machine); + m_stateMachines.insert(XsdTagScope::Include, machine); + m_stateMachines.insert(XsdTagScope::Import, machine); + m_stateMachines.insert(XsdTagScope::ReferredAttributeGroup, machine); + m_stateMachines.insert(XsdTagScope::AnyAttribute, machine); + m_stateMachines.insert(XsdTagScope::MinExclusiveFacet, machine); + m_stateMachines.insert(XsdTagScope::MinInclusiveFacet, machine); + m_stateMachines.insert(XsdTagScope::MaxExclusiveFacet, machine); + m_stateMachines.insert(XsdTagScope::MaxInclusiveFacet, machine); + m_stateMachines.insert(XsdTagScope::TotalDigitsFacet, machine); + m_stateMachines.insert(XsdTagScope::FractionDigitsFacet, machine); + m_stateMachines.insert(XsdTagScope::LengthFacet, machine); + m_stateMachines.insert(XsdTagScope::MinLengthFacet, machine); + m_stateMachines.insert(XsdTagScope::MaxLengthFacet, machine); + m_stateMachines.insert(XsdTagScope::EnumerationFacet, machine); + m_stateMachines.insert(XsdTagScope::WhiteSpaceFacet, machine); + m_stateMachines.insert(XsdTagScope::PatternFacet, machine); + m_stateMachines.insert(XsdTagScope::Assert, machine); + m_stateMachines.insert(XsdTagScope::Assertion, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (selector, field+)) : unique/key/keyref + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Selector, s2); + + machine.addTransition(s1, XsdSchemaToken::Selector, s2); + machine.addTransition(s2, XsdSchemaToken::Field, s3); + machine.addTransition(s3, XsdSchemaToken::Field, s3); + + m_stateMachines.insert(XsdTagScope::Unique, machine); + m_stateMachines.insert(XsdTagScope::Key, machine); + m_stateMachines.insert(XsdTagScope::KeyRef, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (simpleType | complexType)?) : alternative + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s2); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s2); + + m_stateMachines.insert(XsdTagScope::Alternative, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (appinfo | documentation)* : annotation + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Appinfo, s1); + machine.addTransition(startState, XsdSchemaToken::Documentation, s1); + + machine.addTransition(s1, XsdSchemaToken::Appinfo, s1); + machine.addTransition(s1, XsdSchemaToken::Documentation, s1); + + m_stateMachines.insert(XsdTagScope::Annotation, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (restriction | list | union)) : simpleType + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Restriction, s2); + machine.addTransition(startState, XsdSchemaToken::List, s2); + machine.addTransition(startState, XsdSchemaToken::Union, s2); + + machine.addTransition(s1, XsdSchemaToken::Restriction, s2); + machine.addTransition(s1, XsdSchemaToken::List, s2); + machine.addTransition(s1, XsdSchemaToken::Union, s2); + + m_stateMachines.insert(XsdTagScope::GlobalSimpleType, machine); + m_stateMachines.insert(XsdTagScope::LocalSimpleType, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern | assertion)*)) : simple type restriction + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(startState, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(startState, XsdSchemaToken::Length, s3); + machine.addTransition(startState, XsdSchemaToken::MinLength, s3); + machine.addTransition(startState, XsdSchemaToken::MaxLength, s3); + machine.addTransition(startState, XsdSchemaToken::Enumeration, s3); + machine.addTransition(startState, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(startState, XsdSchemaToken::Pattern, s3); + machine.addTransition(startState, XsdSchemaToken::Assertion, s3); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s1, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s1, XsdSchemaToken::Length, s3); + machine.addTransition(s1, XsdSchemaToken::MinLength, s3); + machine.addTransition(s1, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s1, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s1, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s1, XsdSchemaToken::Pattern, s3); + machine.addTransition(s1, XsdSchemaToken::Assertion, s3); + + machine.addTransition(s2, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s2, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s2, XsdSchemaToken::Length, s3); + machine.addTransition(s2, XsdSchemaToken::MinLength, s3); + machine.addTransition(s2, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s2, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s2, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s2, XsdSchemaToken::Pattern, s3); + machine.addTransition(s2, XsdSchemaToken::Assertion, s3); + + machine.addTransition(s3, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s3, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s3, XsdSchemaToken::Length, s3); + machine.addTransition(s3, XsdSchemaToken::MinLength, s3); + machine.addTransition(s3, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s3, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s3, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s3, XsdSchemaToken::Pattern, s3); + machine.addTransition(s3, XsdSchemaToken::Assertion, s3); + + m_stateMachines.insert(XsdTagScope::SimpleRestriction, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, simpleType?) : list + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + + m_stateMachines.insert(XsdTagScope::List, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, simpleType*) : union + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s2, XsdSchemaToken::SimpleType, s2); + + m_stateMachines.insert(XsdTagScope::Union, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for ((include | import | redefine |i override | annotation)*, (defaultOpenContent, annotation*)?, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*) : schema + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Include, s1); + machine.addTransition(startState, XsdSchemaToken::Import, s1); + machine.addTransition(startState, XsdSchemaToken::Redefine, s1); + machine.addTransition(startState, XsdSchemaToken::Override, s1); + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::DefaultOpenContent, s2); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s4); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s4); + machine.addTransition(startState, XsdSchemaToken::Group, s4); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(startState, XsdSchemaToken::Element, s4); + machine.addTransition(startState, XsdSchemaToken::Attribute, s4); + machine.addTransition(startState, XsdSchemaToken::Notation, s4); + + machine.addTransition(s1, XsdSchemaToken::Include, s1); + machine.addTransition(s1, XsdSchemaToken::Import, s1); + machine.addTransition(s1, XsdSchemaToken::Redefine, s1); + machine.addTransition(s1, XsdSchemaToken::Override, s1); + machine.addTransition(s1, XsdSchemaToken::Annotation, s1); + machine.addTransition(s1, XsdSchemaToken::DefaultOpenContent, s2); + machine.addTransition(s1, XsdSchemaToken::SimpleType, s4); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s4); + machine.addTransition(s1, XsdSchemaToken::Group, s4); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s1, XsdSchemaToken::Element, s4); + machine.addTransition(s1, XsdSchemaToken::Attribute, s4); + machine.addTransition(s1, XsdSchemaToken::Notation, s4); + + machine.addTransition(s2, XsdSchemaToken::Annotation, s3); + machine.addTransition(s2, XsdSchemaToken::SimpleType, s4); + machine.addTransition(s2, XsdSchemaToken::ComplexType, s4); + machine.addTransition(s2, XsdSchemaToken::Group, s4); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s2, XsdSchemaToken::Element, s4); + machine.addTransition(s2, XsdSchemaToken::Attribute, s4); + machine.addTransition(s2, XsdSchemaToken::Notation, s4); + + machine.addTransition(s3, XsdSchemaToken::SimpleType, s4); + machine.addTransition(s3, XsdSchemaToken::ComplexType, s4); + machine.addTransition(s3, XsdSchemaToken::Group, s4); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s3, XsdSchemaToken::Element, s4); + machine.addTransition(s3, XsdSchemaToken::Attribute, s4); + machine.addTransition(s3, XsdSchemaToken::Notation, s4); + + machine.addTransition(s4, XsdSchemaToken::SimpleType, s4); + machine.addTransition(s4, XsdSchemaToken::ComplexType, s4); + machine.addTransition(s4, XsdSchemaToken::Group, s4); + machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s4, XsdSchemaToken::Element, s4); + machine.addTransition(s4, XsdSchemaToken::Attribute, s4); + machine.addTransition(s4, XsdSchemaToken::Notation, s4); + machine.addTransition(s4, XsdSchemaToken::Annotation, s5); + + machine.addTransition(s5, XsdSchemaToken::SimpleType, s4); + machine.addTransition(s5, XsdSchemaToken::ComplexType, s4); + machine.addTransition(s5, XsdSchemaToken::Group, s4); + machine.addTransition(s5, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s5, XsdSchemaToken::Element, s4); + machine.addTransition(s5, XsdSchemaToken::Attribute, s4); + machine.addTransition(s5, XsdSchemaToken::Notation, s4); + machine.addTransition(s5, XsdSchemaToken::Annotation, s5); + + m_stateMachines.insert(XsdTagScope::Schema, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation?, any) : defaultOpenContent + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Any, s2); + + machine.addTransition(s1, XsdSchemaToken::Any, s2); + + m_stateMachines.insert(XsdTagScope::DefaultOpenContent, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation | (simpleType | complexType | group | attributeGroup))* : redefine + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s1); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s1); + machine.addTransition(startState, XsdSchemaToken::Group, s1); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s1); + + machine.addTransition(s1, XsdSchemaToken::Annotation, s1); + machine.addTransition(s1, XsdSchemaToken::SimpleType, s1); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s1); + machine.addTransition(s1, XsdSchemaToken::Group, s1); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s1); + + m_stateMachines.insert(XsdTagScope::Redefine, machine); + } + + { + XsdStateMachine machine(m_namePool); + + // setup state machine for (annotation | (simpleType | complexType | group | attributeGroup | element | attribute | notation))* : override + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s1); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s1); + machine.addTransition(startState, XsdSchemaToken::Group, s1); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s1); + machine.addTransition(startState, XsdSchemaToken::Element, s1); + machine.addTransition(startState, XsdSchemaToken::Attribute, s1); + machine.addTransition(startState, XsdSchemaToken::Notation, s1); + + machine.addTransition(s1, XsdSchemaToken::Annotation, s1); + machine.addTransition(s1, XsdSchemaToken::SimpleType, s1); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s1); + machine.addTransition(s1, XsdSchemaToken::Group, s1); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s1); + machine.addTransition(s1, XsdSchemaToken::Element, s1); + machine.addTransition(s1, XsdSchemaToken::Attribute, s1); + machine.addTransition(s1, XsdSchemaToken::Notation, s1); + + m_stateMachines.insert(XsdTagScope::Override, machine); + } +} + +void XsdSchemaParser::setupBuiltinTypeNames() +{ + m_builtinTypeNames.reserve(48); + + m_builtinTypeNames.insert(BuiltinTypes::xsAnyType->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsAnySimpleType->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsUntyped->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsAnyAtomicType->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsUntypedAtomic->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsDateTime->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsDate->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsTime->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsDuration->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsYearMonthDuration->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsDayTimeDuration->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsFloat->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsDouble->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsInteger->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsDecimal->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsNonPositiveInteger->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsNegativeInteger->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsLong->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsInt->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsShort->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsByte->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsNonNegativeInteger->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedLong->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedInt->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedShort->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsUnsignedByte->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsPositiveInteger->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsGYearMonth->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsGYear->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsGMonthDay->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsGDay->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsGMonth->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsBoolean->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsBase64Binary->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsHexBinary->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsAnyURI->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsQName->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsString->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsNormalizedString->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsToken->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsLanguage->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsNMTOKEN->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsName->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsNCName->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsID->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsIDREF->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsENTITY->name(m_namePool)); + m_builtinTypeNames.insert(BuiltinTypes::xsNOTATION->name(m_namePool)); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp new file mode 100644 index 0000000..896619e --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp @@ -0,0 +1,573 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschemaparsercontext_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaParserContext::XsdSchemaParserContext(const NamePool::Ptr &namePool, const XsdSchemaContext::Ptr &context) + : m_namePool(namePool) + , m_schema(new XsdSchema(m_namePool)) + , m_checker(new XsdSchemaChecker(context, this)) + , m_resolver(new XsdSchemaResolver(context, this)) + , m_elementDescriptions(setupElementDescriptions()) +{ +} + +NamePool::Ptr XsdSchemaParserContext::namePool() const +{ + return m_namePool; +} + +XsdSchemaResolver::Ptr XsdSchemaParserContext::resolver() const +{ + return m_resolver; +} + +XsdSchemaChecker::Ptr XsdSchemaParserContext::checker() const +{ + return m_checker; +} + +XsdSchema::Ptr XsdSchemaParserContext::schema() const +{ + return m_schema; +} + +ElementDescription::Hash XsdSchemaParserContext::elementDescriptions() const +{ + return m_elementDescriptions; +} + +QXmlName XsdSchemaParserContext::createAnonymousName(const QString &targetNamespace) const +{ + m_anonymousNameCounter.ref(); + + const QString name = QString::fromLatin1("__AnonymousClass_%1").arg((int)m_anonymousNameCounter); + + return m_namePool->allocateQName(targetNamespace, name); +} + +ElementDescription::Hash XsdSchemaParserContext::setupElementDescriptions() +{ + enum + { + ReservedForElements = 60 + }; + + ElementDescription::Hash elementDescriptions; + elementDescriptions.reserve(ReservedForElements); + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Schema]; + description.optionalAttributes.reserve(10); + //description.tagToken = XsdSchemaToken::Schema; + description.optionalAttributes.insert(XsdSchemaToken::AttributeFormDefault); + description.optionalAttributes.insert(XsdSchemaToken::BlockDefault); + description.optionalAttributes.insert(XsdSchemaToken::DefaultAttributes); + description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace); + description.optionalAttributes.insert(XsdSchemaToken::ElementFormDefault); + description.optionalAttributes.insert(XsdSchemaToken::FinalDefault); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::TargetNamespace); + description.optionalAttributes.insert(XsdSchemaToken::Version); + description.optionalAttributes.insert(XsdSchemaToken::XmlLanguage); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Include]; + //description.tagToken = XsdSchemaToken::Include; + description.requiredAttributes.insert(XsdSchemaToken::SchemaLocation); + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Import]; + //description.tagToken = XsdSchemaToken::Import; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Namespace); + description.optionalAttributes.insert(XsdSchemaToken::SchemaLocation); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Redefine]; + //description.tagToken = XsdSchemaToken::Redefine; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::SchemaLocation); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Override]; + //description.tagToken = XsdSchemaToken::Override; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::SchemaLocation); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Annotation]; + //description.tagToken = XsdSchemaToken::Annotation; + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::AppInfo]; + //description.tagToken = XsdSchemaToken::Appinfo; + description.optionalAttributes.insert(XsdSchemaToken::Source); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Documentation]; + //description.tagToken = XsdSchemaToken::Documentation; + description.optionalAttributes.insert(XsdSchemaToken::Source); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::GlobalSimpleType]; + //description.tagToken = XsdSchemaToken::SimpleType; + description.optionalAttributes.insert(XsdSchemaToken::Final); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LocalSimpleType]; + //description.tagToken = XsdSchemaToken::SimpleType; + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::SimpleRestriction]; + //description.tagToken = XsdSchemaToken::Restriction; + description.optionalAttributes.insert(XsdSchemaToken::Base); + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::List]; + //description.tagToken = XsdSchemaToken::List; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::ItemType); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Union]; + //description.tagToken = XsdSchemaToken::Union; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::MemberTypes); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::MinExclusiveFacet]; + //description.tagToken = XsdSchemaToken::MinExclusive; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::MinInclusiveFacet]; + //description.tagToken = XsdSchemaToken::MinInclusive; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::MaxExclusiveFacet]; + //description.tagToken = XsdSchemaToken::MaxExclusive; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::MaxInclusiveFacet]; + //description.tagToken = XsdSchemaToken::MaxInclusive; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::TotalDigitsFacet]; + //description.tagToken = XsdSchemaToken::TotalDigits; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::FractionDigitsFacet]; + //description.tagToken = XsdSchemaToken::FractionDigits; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LengthFacet]; + //description.tagToken = XsdSchemaToken::Length; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::MinLengthFacet]; + //description.tagToken = XsdSchemaToken::MinLength; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::MaxLengthFacet]; + //description.tagToken = XsdSchemaToken::MaxLength; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::EnumerationFacet]; + //description.tagToken = XsdSchemaToken::Enumeration; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::WhiteSpaceFacet]; + //description.tagToken = XsdSchemaToken::WhiteSpace; + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::PatternFacet]; + //description.tagToken = XsdSchemaToken::Pattern; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Value); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::GlobalComplexType]; + description.optionalAttributes.reserve(7); + //description.tagToken = XsdSchemaToken::ComplexType; + description.optionalAttributes.insert(XsdSchemaToken::Abstract); + description.optionalAttributes.insert(XsdSchemaToken::Block); + description.optionalAttributes.insert(XsdSchemaToken::DefaultAttributesApply); + description.optionalAttributes.insert(XsdSchemaToken::Final); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Mixed); + description.requiredAttributes.insert(XsdSchemaToken::Name); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LocalComplexType]; + //description.tagToken = XsdSchemaToken::ComplexType; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Mixed); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::SimpleContent]; + //description.tagToken = XsdSchemaToken::SimpleContent; + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::SimpleContentRestriction]; + //description.tagToken = XsdSchemaToken::Restriction; + description.requiredAttributes.insert(XsdSchemaToken::Base); + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::SimpleContentExtension]; + //description.tagToken = XsdSchemaToken::Extension; + description.requiredAttributes.insert(XsdSchemaToken::Base); + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::ComplexContent]; + //description.tagToken = XsdSchemaToken::ComplexContent; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Mixed); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::ComplexContentRestriction]; + //description.tagToken = XsdSchemaToken::Restriction; + description.requiredAttributes.insert(XsdSchemaToken::Base); + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::ComplexContentExtension]; + //description.tagToken = XsdSchemaToken::Extension; + description.requiredAttributes.insert(XsdSchemaToken::Base); + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::NamedGroup]; + //description.tagToken = XsdSchemaToken::Group; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::ReferredGroup]; + description.optionalAttributes.reserve(4); + //description.tagToken = XsdSchemaToken::Group; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs); + description.optionalAttributes.insert(XsdSchemaToken::MinOccurs); + description.requiredAttributes.insert(XsdSchemaToken::Ref); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::All]; + //description.tagToken = XsdSchemaToken::All; + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LocalAll]; + //description.tagToken = XsdSchemaToken::All; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs); + description.optionalAttributes.insert(XsdSchemaToken::MinOccurs); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Choice]; + //description.tagToken = XsdSchemaToken::Choice; + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LocalChoice]; + //description.tagToken = XsdSchemaToken::Choice; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs); + description.optionalAttributes.insert(XsdSchemaToken::MinOccurs); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Sequence]; + //description.tagToken = XsdSchemaToken::Sequence; + description.optionalAttributes.insert(XsdSchemaToken::Id); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LocalSequence]; + //description.tagToken = XsdSchemaToken::Sequence; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs); + description.optionalAttributes.insert(XsdSchemaToken::MinOccurs); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::GlobalAttribute]; + description.optionalAttributes.reserve(5); + //description.tagToken = XsdSchemaToken::Attribute; + description.optionalAttributes.insert(XsdSchemaToken::Default); + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + description.optionalAttributes.insert(XsdSchemaToken::Type); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LocalAttribute]; + description.optionalAttributes.reserve(8); + //description.tagToken = XsdSchemaToken::Attribute; + description.optionalAttributes.insert(XsdSchemaToken::Default); + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Form); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Name); + description.optionalAttributes.insert(XsdSchemaToken::Ref); + description.optionalAttributes.insert(XsdSchemaToken::Type); + description.optionalAttributes.insert(XsdSchemaToken::Use); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::NamedAttributeGroup]; + //description.tagToken = XsdSchemaToken::AttributeGroup; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::ReferredAttributeGroup]; + //description.tagToken = XsdSchemaToken::AttributeGroup; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Ref); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::LocalElement]; + description.optionalAttributes.reserve(11); + //description.tagToken = XsdSchemaToken::Element; + description.optionalAttributes.insert(XsdSchemaToken::Block); + description.optionalAttributes.insert(XsdSchemaToken::Default); + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Form); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::MinOccurs); + description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs); + description.optionalAttributes.insert(XsdSchemaToken::Name); + description.optionalAttributes.insert(XsdSchemaToken::Nillable); + description.optionalAttributes.insert(XsdSchemaToken::Ref); + description.optionalAttributes.insert(XsdSchemaToken::Type); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::GlobalElement]; + description.optionalAttributes.reserve(10); + //description.tagToken = XsdSchemaToken::Element; + description.optionalAttributes.insert(XsdSchemaToken::Abstract); + description.optionalAttributes.insert(XsdSchemaToken::Block); + description.optionalAttributes.insert(XsdSchemaToken::Default); + description.optionalAttributes.insert(XsdSchemaToken::Final); + description.optionalAttributes.insert(XsdSchemaToken::Fixed); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + description.optionalAttributes.insert(XsdSchemaToken::Nillable); + description.optionalAttributes.insert(XsdSchemaToken::SubstitutionGroup); + description.optionalAttributes.insert(XsdSchemaToken::Type); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Unique]; + //description.tagToken = XsdSchemaToken::Unique; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Key]; + //description.tagToken = XsdSchemaToken::Key; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::KeyRef]; + //description.tagToken = XsdSchemaToken::Keyref; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + description.requiredAttributes.insert(XsdSchemaToken::Refer); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Selector]; + //description.tagToken = XsdSchemaToken::Selector; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Xpath); + description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Field]; + //description.tagToken = XsdSchemaToken::Field; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Xpath); + description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Notation]; + description.optionalAttributes.reserve(4); + //description.tagToken = XsdSchemaToken::Notation; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Name); + description.optionalAttributes.insert(XsdSchemaToken::Public); + description.optionalAttributes.insert(XsdSchemaToken::System); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Any]; + description.optionalAttributes.reserve(7); + //description.tagToken = XsdSchemaToken::Any; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::MaxOccurs); + description.optionalAttributes.insert(XsdSchemaToken::MinOccurs); + description.optionalAttributes.insert(XsdSchemaToken::Namespace); + description.optionalAttributes.insert(XsdSchemaToken::NotNamespace); + description.optionalAttributes.insert(XsdSchemaToken::NotQName); + description.optionalAttributes.insert(XsdSchemaToken::ProcessContents); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::AnyAttribute]; + description.optionalAttributes.reserve(5); + //description.tagToken = XsdSchemaToken::AnyAttribute; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Namespace); + description.optionalAttributes.insert(XsdSchemaToken::NotNamespace); + description.optionalAttributes.insert(XsdSchemaToken::NotQName); + description.optionalAttributes.insert(XsdSchemaToken::ProcessContents); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Alternative]; + //description.tagToken = XsdSchemaToken::Alternative; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Test); + description.optionalAttributes.insert(XsdSchemaToken::Type); + description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::OpenContent]; + //description.tagToken = XsdSchemaToken::OpenContent; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Mode); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::DefaultOpenContent]; + //description.tagToken = XsdSchemaToken::DefaultOpenContent; + description.optionalAttributes.insert(XsdSchemaToken::AppliesToEmpty); + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.optionalAttributes.insert(XsdSchemaToken::Mode); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Assert]; + //description.tagToken = XsdSchemaToken::Assert; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Test); + description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace); + } + + { + ElementDescription &description = elementDescriptions[XsdTagScope::Assertion]; + //description.tagToken = XsdSchemaToken::Assertion; + description.optionalAttributes.insert(XsdSchemaToken::Id); + description.requiredAttributes.insert(XsdSchemaToken::Test); + description.optionalAttributes.insert(XsdSchemaToken::XPathDefaultNamespace); + } + + Q_ASSERT_X(elementDescriptions.count() == ReservedForElements, Q_FUNC_INFO, + qPrintable(QString::fromLatin1("Expected is %1, actual is %2.").arg(ReservedForElements).arg(elementDescriptions.count()))); + + return elementDescriptions; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h new file mode 100644 index 0000000..616aff3 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaParserContext_H +#define Patternist_XsdSchemaParserContext_H + +#include "qmaintainingreader_p.h" // for definition of ElementDescription +#include "qxsdschematoken_p.h" +#include "qxsdschema_p.h" +#include "qxsdschemachecker_p.h" +#include "qxsdschemacontext_p.h" +#include "qxsdschemaresolver_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A namespace class that contains identifiers for the different + * scopes a tag from the xml schema spec can appear in. + */ + class XsdTagScope + { + public: + enum Type + { + Schema, + Include, + Import, + Redefine, + Annotation, + AppInfo, + Documentation, + GlobalSimpleType, + LocalSimpleType, + SimpleRestriction, + List, + Union, + MinExclusiveFacet, + MinInclusiveFacet, + MaxExclusiveFacet, + MaxInclusiveFacet, + TotalDigitsFacet, + FractionDigitsFacet, + LengthFacet, + MinLengthFacet, + MaxLengthFacet, + EnumerationFacet, + WhiteSpaceFacet, + PatternFacet, + GlobalComplexType, + LocalComplexType, + SimpleContent, + SimpleContentRestriction, + SimpleContentExtension, + ComplexContent, + ComplexContentRestriction, + ComplexContentExtension, + NamedGroup, + ReferredGroup, + All, + LocalAll, + Choice, + LocalChoice, + Sequence, + LocalSequence, + GlobalAttribute, + LocalAttribute, + NamedAttributeGroup, + ReferredAttributeGroup, + GlobalElement, + LocalElement, + Unique, + Key, + KeyRef, + Selector, + Field, + Notation, + Any, + AnyAttribute, + Alternative, + Assert, + Assertion, + OpenContent, + DefaultOpenContent, + Override + }; + }; + + /** + * A hash that keeps the mapping between the single components that can appear + * in a schema document (e.g. elements, attributes, type definitions) and their + * source locations inside the document. + */ + typedef QHash ComponentLocationHash; + + /** + * @short A context for schema parsing. + * + * This class provides a context for all components that are + * nedded for parsing and compiling the XML schema. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchemaParserContext : public QSharedData + { + public: + /** + * A smart pointer wrapping XsdSchemaParserContext instances. + */ + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Creates a new schema parser context object. + * + * @param namePool The name pool where all names of the schema will be stored in. + * @param context The schema context to use for error reporting etc. + */ + XsdSchemaParserContext(const NamePool::Ptr &namePool, const XsdSchemaContext::Ptr &context); + + /** + * Returns the name pool of the schema parser context. + */ + NamePool::Ptr namePool() const; + + /** + * Returns the schema resolver of the schema context. + */ + XsdSchemaResolver::Ptr resolver() const; + + /** + * Returns the schema resolver of the schema context. + */ + XsdSchemaChecker::Ptr checker() const; + + /** + * Returns the schema object of the schema context. + */ + XsdSchema::Ptr schema() const; + + /** + * Returns the element descriptions for the schema parser. + * + * The element descriptions are a fast lookup table for + * verifying whether certain attributes are allowed for + * a given element type. + */ + ElementDescription::Hash elementDescriptions() const; + + /** + * Returns an unique name that is used by the schema parser + * for anonymous types. + * + * @param targetNamespace The namespace of the name. + */ + QXmlName createAnonymousName(const QString &targetNamespace) const; + + private: + /** + * Fills the element description hash with the required and prohibited + * attributes. + */ + static ElementDescription::Hash setupElementDescriptions(); + + NamePool::Ptr m_namePool; + XsdSchema::Ptr m_schema; + XsdSchemaChecker::Ptr m_checker; + XsdSchemaResolver::Ptr m_resolver; + const ElementDescription::Hash m_elementDescriptions; + mutable QAtomicInt m_anonymousNameCounter; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschemaresolver.cpp b/src/xmlpatterns/schema/qxsdschemaresolver.cpp new file mode 100644 index 0000000..4c6910f --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemaresolver.cpp @@ -0,0 +1,1706 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschemaresolver_p.h" + +#include "qderivedinteger_p.h" +#include "qderivedstring_p.h" +#include "qqnamevalue_p.h" +#include "qxsdattributereference_p.h" +#include "qxsdparticlechecker_p.h" +#include "qxsdreference_p.h" +#include "qxsdschemacontext_p.h" +#include "qxsdschemahelper_p.h" +#include "qxsdschemaparsercontext_p.h" +#include "qxsdschematypesfactory_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaResolver::XsdSchemaResolver(const QExplicitlySharedDataPointer &context, const XsdSchemaParserContext *parserContext) + : m_context(context) + , m_checker(parserContext->checker()) + , m_namePool(parserContext->namePool()) + , m_schema(parserContext->schema()) +{ + m_keyReferences.reserve(20); + m_simpleRestrictionBases.reserve(20); + m_simpleListTypes.reserve(20); + m_simpleUnionTypes.reserve(20); + m_elementTypes.reserve(20); + m_complexBaseTypes.reserve(20); + m_attributeTypes.reserve(20); + m_alternativeTypes.reserve(20); + m_alternativeTypeElements.reserve(20); + m_substitutionGroupAffiliations.reserve(20); + + m_predefinedSchemaTypes = m_context->schemaTypeFactory()->types().values(); +} + +XsdSchemaResolver::~XsdSchemaResolver() +{ +} + +void XsdSchemaResolver::resolve() +{ + m_checker->addComponentLocationHash(m_componentLocationHash); + + // resolve the base types for all types + resolveSimpleRestrictionBaseTypes(); + resolveComplexBaseTypes(); + + // do the basic checks which depend on having a base type available + m_checker->basicCheck(); + + // resolve further types that only map a type name to a type object + resolveSimpleListType(); + resolveSimpleUnionTypes(); + resolveElementTypes(); + resolveAttributeTypes(); + resolveAlternativeTypes(); + + // resolve objects that do not need information about inheritance + resolveKeyReferences(); + resolveSubstitutionGroupAffiliations(); + + // resolve objects that do need information about inheritance + resolveSimpleRestrictions(); + resolveSimpleContentComplexTypes(); + + // resolve objects which replace place holders + resolveTermReferences(); + resolveAttributeTermReferences(); + + // resolve additional objects that do need information about inheritance + resolveAttributeInheritance(); + resolveComplexContentComplexTypes(); + resolveSubstitutionGroups(); + + resolveEnumerationFacetValues(); + + checkRedefinedGroups(); + checkRedefinedAttributeGroups(); + + // check the constraining facets before we resolve them + m_checker->checkConstrainingFacets(); + + // add it again, as we may have added new components in the meantime + m_checker->addComponentLocationHash(m_componentLocationHash); + + m_checker->check(); +} + +void XsdSchemaResolver::addKeyReference(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &keyRef, const QXmlName &reference, const QSourceLocation &location) +{ + KeyReference item; + item.element = element; + item.keyRef = keyRef; + item.reference = reference; + item.location = location; + + m_keyReferences.append(item); +} + +void XsdSchemaResolver::addSimpleRestrictionBase(const XsdSimpleType::Ptr &simpleType, const QXmlName &baseName, const QSourceLocation &location) +{ + SimpleRestrictionBase item; + item.simpleType = simpleType; + item.baseName = baseName; + item.location = location; + + m_simpleRestrictionBases.append(item); +} + +void XsdSchemaResolver::removeSimpleRestrictionBase(const XsdSimpleType::Ptr &type) +{ + for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) { + if (m_simpleRestrictionBases.at(i).simpleType == type) { + m_simpleRestrictionBases.remove(i); + break; + } + } +} + +void XsdSchemaResolver::addSimpleListType(const XsdSimpleType::Ptr &simpleType, const QXmlName &typeName, const QSourceLocation &location) +{ + SimpleListType item; + item.simpleType = simpleType; + item.typeName = typeName; + item.location = location; + + m_simpleListTypes.append(item); +} + +void XsdSchemaResolver::addSimpleUnionTypes(const XsdSimpleType::Ptr &simpleType, const QList &typeNames, const QSourceLocation &location) +{ + SimpleUnionType item; + item.simpleType = simpleType; + item.typeNames = typeNames; + item.location = location; + + m_simpleUnionTypes.append(item); +} + +void XsdSchemaResolver::addElementType(const XsdElement::Ptr &element, const QXmlName &typeName, const QSourceLocation &location) +{ + ElementType item; + item.element = element; + item.typeName = typeName; + item.location = location; + + m_elementTypes.append(item); +} + +void XsdSchemaResolver::addComplexBaseType(const XsdComplexType::Ptr &complexType, const QXmlName &baseName, const QSourceLocation &location, const XsdFacet::Hash &facets) +{ + ComplexBaseType item; + item.complexType = complexType; + item.baseName = baseName; + item.location = location; + item.facets = facets; + + m_complexBaseTypes.append(item); +} + +void XsdSchemaResolver::removeComplexBaseType(const XsdComplexType::Ptr &type) +{ + for (int i = 0; i < m_complexBaseTypes.count(); ++i) { + if (m_complexBaseTypes.at(i).complexType == type) { + m_complexBaseTypes.remove(i); + break; + } + } +} + +void XsdSchemaResolver::addComplexContentType(const XsdComplexType::Ptr &complexType, const XsdParticle::Ptr &content, bool mixed) +{ + ComplexContentType item; + item.complexType = complexType; + item.explicitContent = content; + item.effectiveMixed = mixed; + m_complexContentTypes.append(item); +} + +void XsdSchemaResolver::addAttributeType(const XsdAttribute::Ptr &attribute, const QXmlName &typeName, const QSourceLocation &location) +{ + AttributeType item; + item.attribute = attribute; + item.typeName = typeName; + item.location = location; + + m_attributeTypes.append(item); +} + +void XsdSchemaResolver::addAlternativeType(const XsdAlternative::Ptr &alternative, const QXmlName &typeName, const QSourceLocation &location) +{ + AlternativeType item; + item.alternative = alternative; + item.typeName = typeName; + item.location = location; + + m_alternativeTypes.append(item); +} + +void XsdSchemaResolver::addAlternativeType(const XsdAlternative::Ptr &alternative, const XsdElement::Ptr &element) +{ + AlternativeTypeElement item; + item.alternative = alternative; + item.element = element; + + m_alternativeTypeElements.append(item); +} + +void XsdSchemaResolver::addSubstitutionGroupAffiliation(const XsdElement::Ptr &element, const QList &elementNames, const QSourceLocation &location) +{ + SubstitutionGroupAffiliation item; + item.element = element; + item.elementNames = elementNames; + item.location = location; + + m_substitutionGroupAffiliations.append(item); +} + +void XsdSchemaResolver::addSubstitutionGroupType(const XsdElement::Ptr &element) +{ + m_substitutionGroupTypes.append(element); +} + +void XsdSchemaResolver::addComponentLocationHash(const ComponentLocationHash &hash) +{ + m_componentLocationHash.unite(hash); +} + +void XsdSchemaResolver::addEnumerationFacetValue(const AtomicValue::Ptr &facetValue, const NamespaceSupport &namespaceSupport) +{ + m_enumerationFacetValues.insert(facetValue, namespaceSupport); +} + +void XsdSchemaResolver::addRedefinedGroups(const XsdModelGroup::Ptr &redefinedGroup, const XsdModelGroup::Ptr &group) +{ + RedefinedGroups item; + item.redefinedGroup = redefinedGroup; + item.group = group; + + m_redefinedGroups.append(item); +} + +void XsdSchemaResolver::addRedefinedAttributeGroups(const XsdAttributeGroup::Ptr &redefinedGroup, const XsdAttributeGroup::Ptr &group) +{ + RedefinedAttributeGroups item; + item.redefinedGroup = redefinedGroup; + item.group = group; + + m_redefinedAttributeGroups.append(item); +} + +void XsdSchemaResolver::addAllGroupCheck(const XsdReference::Ptr &reference) +{ + m_allGroups.insert(reference); +} + +void XsdSchemaResolver::copyDataTo(const XsdSchemaResolver::Ptr &other) const +{ + other->m_keyReferences << m_keyReferences; + other->m_simpleRestrictionBases << m_simpleRestrictionBases; + other->m_simpleListTypes << m_simpleListTypes; + other->m_simpleUnionTypes << m_simpleUnionTypes; + other->m_elementTypes << m_elementTypes; + other->m_complexBaseTypes << m_complexBaseTypes; + other->m_complexContentTypes << m_complexContentTypes; + other->m_attributeTypes << m_attributeTypes; + other->m_alternativeTypes << m_alternativeTypes; + other->m_alternativeTypeElements << m_alternativeTypeElements; + other->m_substitutionGroupAffiliations << m_substitutionGroupAffiliations; + other->m_substitutionGroupTypes << m_substitutionGroupTypes; +} + +QXmlName XsdSchemaResolver::baseTypeNameOfType(const SchemaType::Ptr &type) const +{ + for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) { + if (m_simpleRestrictionBases.at(i).simpleType == type) + return m_simpleRestrictionBases.at(i).baseName; + } + + for (int i = 0; i < m_complexBaseTypes.count(); ++i) { + if (m_complexBaseTypes.at(i).complexType == type) + return m_complexBaseTypes.at(i).baseName; + } + + return QXmlName(); +} + +QXmlName XsdSchemaResolver::typeNameOfAttribute(const XsdAttribute::Ptr &attribute) const +{ + for (int i = 0; i < m_attributeTypes.count(); ++i) { + if (m_attributeTypes.at(i).attribute == attribute) + return m_attributeTypes.at(i).typeName; + } + + return QXmlName(); +} + +void XsdSchemaResolver::setDefaultOpenContent(const XsdComplexType::OpenContent::Ptr &openContent, bool appliesToEmpty) +{ + m_defaultOpenContent = openContent; + m_defaultOpenContentAppliesToEmpty = appliesToEmpty; +} + +void XsdSchemaResolver::resolveKeyReferences() +{ + for (int i = 0; i < m_keyReferences.count(); ++i) { + const KeyReference ref = m_keyReferences.at(i); + + const XsdIdentityConstraint::Ptr constraint = m_schema->identityConstraint(ref.reference); + if (!constraint) { + m_context->error(QtXmlPatterns::tr("%1 references unknown %2 or %3 element %4") + .arg(formatKeyword(ref.keyRef->displayName(m_namePool))) + .arg(formatElement("key")) + .arg(formatElement("unique")) + .arg(formatKeyword(m_namePool, ref.reference)), + XsdSchemaContext::XSDError, ref.location); + return; + } + + if (constraint->category() != XsdIdentityConstraint::Key && constraint->category() != XsdIdentityConstraint::Unique) { // only key and unique can be referenced + m_context->error(QtXmlPatterns::tr("%1 references identity constraint %2 that is no %3 or %4 element") + .arg(formatKeyword(ref.keyRef->displayName(m_namePool))) + .arg(formatKeyword(m_namePool, ref.reference)) + .arg(formatElement("key")) + .arg(formatElement("unique")), + XsdSchemaContext::XSDError, ref.location); + return; + } + + if (constraint->fields().count() != ref.keyRef->fields().count()) { + m_context->error(QtXmlPatterns::tr("%1 has a different number of fields from the identity constraint %2 that it references") + .arg(formatKeyword(ref.keyRef->displayName(m_namePool))) + .arg(formatKeyword(m_namePool, ref.reference)), + XsdSchemaContext::XSDError, ref.location); + return; + } + + ref.keyRef->setReferencedKey(constraint); + } +} + +void XsdSchemaResolver::resolveSimpleRestrictionBaseTypes() +{ + // iterate over all simple types that are derived by restriction + for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) { + const SimpleRestrictionBase item = m_simpleRestrictionBases.at(i); + + // find the base type + SchemaType::Ptr type = m_schema->type(item.baseName); + if (!type) { + // maybe it's a basic type... + type = m_context->schemaTypeFactory()->createSchemaType(item.baseName); + if (!type) { + m_context->error(QtXmlPatterns::tr("base type %1 of %2 element cannot be resolved") + .arg(formatType(m_namePool, item.baseName)) + .arg(formatElement("restriction")), + XsdSchemaContext::XSDError, item.location); + return; + } + } + + item.simpleType->setWxsSuperType(type); + } +} + +void XsdSchemaResolver::resolveSimpleRestrictions() +{ + XsdSimpleType::List simpleTypes; + + // first collect the global simple types + const SchemaType::List types = m_schema->types(); + for (int i = 0; i < types.count(); ++i) { + if (types.at(i)->isSimpleType() && (types.at(i)->derivationMethod() == SchemaType::DerivationRestriction)) + simpleTypes.append(types.at(i)); + } + + // then collect all anonymous simple types + const SchemaType::List anonymousTypes = m_schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + if (anonymousTypes.at(i)->isSimpleType() && (anonymousTypes.at(i)->derivationMethod() == SchemaType::DerivationRestriction)) + simpleTypes.append(anonymousTypes.at(i)); + } + + QSet visitedTypes; + for (int i = 0; i < simpleTypes.count(); ++i) { + resolveSimpleRestrictions(simpleTypes.at(i), visitedTypes); + } +} + +void XsdSchemaResolver::resolveSimpleRestrictions(const XsdSimpleType::Ptr &simpleType, QSet &visitedTypes) +{ + if (visitedTypes.contains(simpleType)) + return; + else + visitedTypes.insert(simpleType); + + if (simpleType->derivationMethod() != XsdSimpleType::DerivationRestriction) + return; + + // as xs:NMTOKENS, xs:ENTITIES and xs:IDREFS are provided by our XsdSchemaTypesFactory, they are + // setup correctly already and shouldn't be handled here + if (m_predefinedSchemaTypes.contains(simpleType)) + return; + + const SchemaType::Ptr baseType = simpleType->wxsSuperType(); + Q_ASSERT(baseType); + + if (baseType->isDefinedBySchema()) + resolveSimpleRestrictions(XsdSimpleType::Ptr(baseType), visitedTypes); + + simpleType->setCategory(baseType->category()); + + if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) { + QSet visitedPrimitiveTypes; + const AnySimpleType::Ptr primitiveType = findPrimitiveType(baseType, visitedPrimitiveTypes); + simpleType->setPrimitiveType(primitiveType); + } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) { + const XsdSimpleType::Ptr simpleBaseType = baseType; + simpleType->setItemType(simpleBaseType->itemType()); + } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) { + const XsdSimpleType::Ptr simpleBaseType = baseType; + simpleType->setMemberTypes(simpleBaseType->memberTypes()); + } +} + +void XsdSchemaResolver::resolveSimpleListType() +{ + // iterate over all simple types where the item type shall be resolved + for (int i = 0; i < m_simpleListTypes.count(); ++i) { + const SimpleListType item = m_simpleListTypes.at(i); + + // try to resolve the name + SchemaType::Ptr type = m_schema->type(item.typeName); + if (!type) { + // maybe it's a basic type... + type = m_context->schemaTypeFactory()->createSchemaType(item.typeName); + if (!type) { + m_context->error(QtXmlPatterns::tr("item type %1 of %2 element cannot be resolved") + .arg(formatType(m_namePool, item.typeName)) + .arg(formatElement("list")), + XsdSchemaContext::XSDError, item.location); + return; + } + } + + item.simpleType->setItemType(type); + } +} + +void XsdSchemaResolver::resolveSimpleUnionTypes() +{ + // iterate over all simple types where the union member types shall be resolved + for (int i = 0; i < m_simpleUnionTypes.count(); ++i) { + const SimpleUnionType item = m_simpleUnionTypes.at(i); + + AnySimpleType::List memberTypes; + + // iterate over all union member type names + const QList typeNames = item.typeNames; + for (int j = 0; j < typeNames.count(); ++j) { + const QXmlName typeName = typeNames.at(j); + + // try to resolve the name + SchemaType::Ptr type = m_schema->type(typeName); + if (!type) { + // maybe it's a basic type... + type = m_context->schemaTypeFactory()->createSchemaType(typeName); + if (!type) { + m_context->error(QtXmlPatterns::tr("member type %1 of %2 element cannot be resolved") + .arg(formatType(m_namePool, typeName)) + .arg(formatElement("union")), + XsdSchemaContext::XSDError, item.location); + return; + } + } + + memberTypes.append(type); + } + + // append the types that have been defined as children + memberTypes << item.simpleType->memberTypes(); + + item.simpleType->setMemberTypes(memberTypes); + } +} + +void XsdSchemaResolver::resolveElementTypes() +{ + for (int i = 0; i < m_elementTypes.count(); ++i) { + const ElementType item = m_elementTypes.at(i); + + SchemaType::Ptr type = m_schema->type(item.typeName); + if (!type) { + // maybe it's a basic type... + type = m_context->schemaTypeFactory()->createSchemaType(item.typeName); + if (!type) { + m_context->error(QtXmlPatterns::tr("type %1 of %2 element cannot be resolved") + .arg(formatType(m_namePool, item.typeName)) + .arg(formatElement("element")), + XsdSchemaContext::XSDError, item.location); + return; + } + } + + item.element->setType(type); + } +} + +void XsdSchemaResolver::resolveComplexBaseTypes() +{ + for (int i = 0; i < m_complexBaseTypes.count(); ++i) { + const ComplexBaseType item = m_complexBaseTypes.at(i); + + SchemaType::Ptr type = m_schema->type(item.baseName); + if (!type) { + // maybe it's a basic type... + type = m_context->schemaTypeFactory()->createSchemaType(item.baseName); + if (!type) { + m_context->error(QtXmlPatterns::tr("base type %1 of complex type cannot be resolved").arg(formatType(m_namePool, item.baseName)), XsdSchemaContext::XSDError, item.location); + return; + } + } + + if (item.complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + if (type->isComplexType() && type->isDefinedBySchema()) { + const XsdComplexType::Ptr baseType = type; + if (baseType->contentType()->variety() != XsdComplexType::ContentType::Simple) { + m_context->error(QtXmlPatterns::tr("%1 cannot have complex base type that has a %2") + .arg(formatElement("simpleContent")) + .arg(formatElement("complexContent")), + XsdSchemaContext::XSDError, item.location); + return; + } + } + } + + item.complexType->setWxsSuperType(type); + } +} + +void XsdSchemaResolver::resolveSimpleContentComplexTypes() +{ + XsdComplexType::List complexTypes; + + // first collect the global complex types + const SchemaType::List types = m_schema->types(); + for (int i = 0; i < types.count(); ++i) { + if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema()) + complexTypes.append(types.at(i)); + } + + // then collect all anonymous simple types + const SchemaType::List anonymousTypes = m_schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + if (anonymousTypes.at(i)->isComplexType() && anonymousTypes.at(i)->isDefinedBySchema()) + complexTypes.append(anonymousTypes.at(i)); + } + + QSet visitedTypes; + for (int i = 0; i < complexTypes.count(); ++i) { + if (XsdComplexType::Ptr(complexTypes.at(i))->contentType()->variety() == XsdComplexType::ContentType::Simple) + resolveSimpleContentComplexTypes(complexTypes.at(i), visitedTypes); + } +} + +void XsdSchemaResolver::resolveSimpleContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet &visitedTypes) +{ + if (visitedTypes.contains(complexType)) + return; + else + visitedTypes.insert(complexType); + + const SchemaType::Ptr baseType = complexType->wxsSuperType(); + + // at this point simple types have been resolved already, so we care about + // complex types here only + + // http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctsc + // 1 + if (baseType->isComplexType() && baseType->isDefinedBySchema()) { + const XsdComplexType::Ptr complexBaseType = baseType; + + resolveSimpleContentComplexTypes(complexBaseType, visitedTypes); + + if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { + if (complexType->contentType()->simpleType()) { + // 1.1 contains the content of the already + } else { + // 1.2 + const XsdSimpleType::Ptr anonType(new XsdSimpleType()); + anonType->setCategory(complexBaseType->contentType()->simpleType()->category()); + anonType->setDerivationMethod(XsdSimpleType::DerivationRestriction); + anonType->setWxsSuperType(complexBaseType->contentType()->simpleType()); + anonType->setFacets(complexTypeFacets(complexType)); + + QSet visitedPrimitiveTypes; + const AnySimpleType::Ptr primitiveType = findPrimitiveType(anonType->wxsSuperType(), visitedPrimitiveTypes); + anonType->setPrimitiveType(primitiveType); + + complexType->contentType()->setSimpleType(anonType); + + m_schema->addAnonymousType(anonType); + m_componentLocationHash.insert(anonType, m_componentLocationHash.value(complexType)); + } + } else if (complexBaseType->derivationMethod() == XsdComplexType::DerivationExtension) { // 3 + complexType->contentType()->setSimpleType(complexBaseType->contentType()->simpleType()); + } + } else if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed && + complexType->derivationMethod() == XsdComplexType::DerivationRestriction && + XsdSchemaHelper::isParticleEmptiable(complexBaseType->contentType()->particle())) { // 2 + // simple type was already set in parser + + const XsdSimpleType::Ptr anonType(new XsdSimpleType()); + anonType->setCategory(complexType->contentType()->simpleType()->category()); + anonType->setDerivationMethod(XsdSimpleType::DerivationRestriction); + anonType->setWxsSuperType(complexType->contentType()->simpleType()); + anonType->setFacets(complexTypeFacets(complexType)); + + QSet visitedPrimitiveTypes; + const AnySimpleType::Ptr primitiveType = findPrimitiveType(anonType->wxsSuperType(), visitedPrimitiveTypes); + anonType->setPrimitiveType(primitiveType); + + complexType->contentType()->setSimpleType(anonType); + + m_schema->addAnonymousType(anonType); + m_componentLocationHash.insert(anonType, m_componentLocationHash.value(complexType)); + } else { + complexType->contentType()->setSimpleType(BuiltinTypes::xsAnySimpleType); + } + } else if (baseType->isSimpleType()) { // 4 + complexType->contentType()->setSimpleType(baseType); + } else { // 5 + complexType->contentType()->setSimpleType(BuiltinTypes::xsAnySimpleType); + } +} + +void XsdSchemaResolver::resolveComplexContentComplexTypes() +{ + XsdComplexType::List complexTypes; + + // first collect the global complex types + const SchemaType::List types = m_schema->types(); + for (int i = 0; i < types.count(); ++i) { + if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema()) + complexTypes.append(types.at(i)); + } + + // then collect all anonymous simple types + const SchemaType::List anonymousTypes = m_schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + if (anonymousTypes.at(i)->isComplexType() && anonymousTypes.at(i)->isDefinedBySchema()) + complexTypes.append(anonymousTypes.at(i)); + } + + QSet visitedTypes; + for (int i = 0; i < complexTypes.count(); ++i) { + if (XsdComplexType::Ptr(complexTypes.at(i))->contentType()->variety() != XsdComplexType::ContentType::Simple) + resolveComplexContentComplexTypes(complexTypes.at(i), visitedTypes); + } +} + +void XsdSchemaResolver::resolveComplexContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet &visitedTypes) +{ + if (visitedTypes.contains(complexType)) + return; + else + visitedTypes.insert(complexType); + + ComplexContentType item; + bool foundCorrespondingItem = false; + for (int i = 0; i < m_complexContentTypes.count(); ++i) { + if (m_complexContentTypes.at(i).complexType == complexType) { + item = m_complexContentTypes.at(i); + foundCorrespondingItem = true; + break; + } + } + + if (!foundCorrespondingItem) + return; + + const SchemaType::Ptr baseType = complexType->wxsSuperType(); + + // at this point simple types have been resolved already, so we care about + // complex types here only + if (baseType->isComplexType() && baseType->isDefinedBySchema()) + resolveComplexContentComplexTypes(XsdComplexType::Ptr(baseType), visitedTypes); + + + // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctcc.common + + // 3 + XsdParticle::Ptr effectiveContent; + if (!item.explicitContent) { // 3.1 + if (item.effectiveMixed == true) { // 3.1.1 + const XsdParticle::Ptr particle(new XsdParticle()); + particle->setMinimumOccurs(1); + particle->setMaximumOccurs(1); + particle->setMaximumOccursUnbounded(false); + + const XsdModelGroup::Ptr sequence(new XsdModelGroup()); + sequence->setCompositor(XsdModelGroup::SequenceCompositor); + particle->setTerm(sequence); + + effectiveContent = particle; + } else { // 3.1.2 + effectiveContent = XsdParticle::Ptr(); + } + } else { // 3.2 + effectiveContent = item.explicitContent; + } + + // 4 + XsdComplexType::ContentType::Ptr explicitContentType(new XsdComplexType::ContentType()); + if (item.complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { // 4.1 + if (!effectiveContent) { // 4.1.1 + explicitContentType->setVariety(XsdComplexType::ContentType::Empty); + } else { // 4.1.2 + if (item.effectiveMixed == true) + explicitContentType->setVariety(XsdComplexType::ContentType::Mixed); + else + explicitContentType->setVariety(XsdComplexType::ContentType::ElementOnly); + + explicitContentType->setParticle(effectiveContent); + } + } else if (item.complexType->derivationMethod() == XsdComplexType::DerivationExtension) { // 4.2 + const SchemaType::Ptr baseType = item.complexType->wxsSuperType(); + if (baseType->isSimpleType() || (baseType->isComplexType() && baseType->isDefinedBySchema() && (XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Empty || + XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Simple))) { // 4.2.1 + if (!effectiveContent) { + explicitContentType->setVariety(XsdComplexType::ContentType::Empty); + } else { + if (item.effectiveMixed == true) + explicitContentType->setVariety(XsdComplexType::ContentType::Mixed); + else + explicitContentType->setVariety(XsdComplexType::ContentType::ElementOnly); + + explicitContentType->setParticle(effectiveContent); + } + } else if (baseType->isComplexType() && baseType->isDefinedBySchema() && (XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || + XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Mixed) && !effectiveContent) { // 4.2.2 + const XsdComplexType::Ptr complexBaseType(baseType); + + explicitContentType = complexBaseType->contentType(); + } else { // 4.2.3 + explicitContentType->setVariety(item.effectiveMixed ? XsdComplexType::ContentType::Mixed : XsdComplexType::ContentType::ElementOnly); + + XsdParticle::Ptr baseParticle; + if (baseType == BuiltinTypes::xsAnyType) { + // we need a workaround here, since the xsAnyType is no real (aka XsdComplexType) complex type... + + baseParticle = XsdParticle::Ptr(new XsdParticle()); + baseParticle->setMinimumOccurs(1); + baseParticle->setMaximumOccurs(1); + baseParticle->setMaximumOccursUnbounded(false); + + const XsdModelGroup::Ptr group(new XsdModelGroup()); + group->setCompositor(XsdModelGroup::SequenceCompositor); + + const XsdParticle::Ptr particle(new XsdParticle()); + particle->setMinimumOccurs(0); + particle->setMaximumOccursUnbounded(true); + + const XsdWildcard::Ptr wildcard(new XsdWildcard()); + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + wildcard->setProcessContents(XsdWildcard::Lax); + + particle->setTerm(wildcard); + XsdParticle::List particles; + particles.append(particle); + group->setParticles(particles); + baseParticle->setTerm(group); + } else { + const XsdComplexType::Ptr complexBaseType(baseType); + baseParticle = complexBaseType->contentType()->particle(); + } + if (baseParticle && baseParticle->term()->isModelGroup() && (XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) && + (!item.explicitContent)) { // 4.2.3.1 + + explicitContentType->setParticle(baseParticle); + } else if (baseParticle && baseParticle->term()->isModelGroup() && (XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) && + (effectiveContent->term()->isModelGroup() && (XsdModelGroup::Ptr(effectiveContent->term())->compositor() == XsdModelGroup::AllCompositor))) { // 4.2.3.2 + const XsdParticle::Ptr particle(new XsdParticle()); + particle->setMinimumOccurs(effectiveContent->minimumOccurs()); + particle->setMaximumOccurs(1); + particle->setMaximumOccursUnbounded(false); + + const XsdModelGroup::Ptr group(new XsdModelGroup()); + group->setCompositor(XsdModelGroup::AllCompositor); + XsdParticle::List particles = XsdModelGroup::Ptr(baseParticle->term())->particles(); + particles << XsdModelGroup::Ptr(effectiveContent->term())->particles(); + group->setParticles(particles); + particle->setTerm(group); + + explicitContentType->setParticle(particle); + } else { // 4.2.3.3 + const XsdParticle::Ptr particle(new XsdParticle()); + particle->setMinimumOccurs(1); + particle->setMaximumOccurs(1); + particle->setMaximumOccursUnbounded(false); + + const XsdModelGroup::Ptr group(new XsdModelGroup()); + group->setCompositor(XsdModelGroup::SequenceCompositor); + + if (effectiveContent && effectiveContent->term()->isModelGroup() && XsdModelGroup::Ptr(effectiveContent->term())->compositor() == XsdModelGroup::AllCompositor) { + m_context->error(QtXmlPatterns::tr("content model of complex type %1 contains %2 element so it cannot be derived by extension from a non-empty type") + .arg(formatType(m_namePool, complexType)).arg(formatKeyword("all")), XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + + if (baseParticle && baseParticle->term()->isModelGroup() && XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) { + m_context->error(QtXmlPatterns::tr("complex type %1 cannot be derived by extension from %2 as the latter contains %3 element in its content model") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, baseType)) + .arg(formatKeyword("all")), XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + + XsdParticle::List particles; + if (baseParticle) + particles << baseParticle; + if (effectiveContent) + particles << effectiveContent; + group->setParticles(particles); + particle->setTerm(group); + + explicitContentType->setParticle(particle); + } + + if (baseType->isDefinedBySchema()) { // xs:anyType has no open content + const XsdComplexType::Ptr complexBaseType(baseType); + explicitContentType->setOpenContent(complexBaseType->contentType()->openContent()); + } + } + } + + // 5 + XsdComplexType::OpenContent::Ptr wildcardElement; + if (item.complexType->contentType()->openContent()) { // 5.1 + wildcardElement = item.complexType->contentType()->openContent(); + } else { + if (m_defaultOpenContent) { // 5.2 + if ((explicitContentType->variety() != XsdComplexType::ContentType::Empty) || // 5.2.1 + (explicitContentType->variety() == XsdComplexType::ContentType::Empty && m_defaultOpenContentAppliesToEmpty)) { // 5.2.2 + wildcardElement = m_defaultOpenContent; + } + } + } + + // 6 + if (!wildcardElement) { // 6.1 + item.complexType->setContentType(explicitContentType); + } else { + if (wildcardElement->mode() == XsdComplexType::OpenContent::None) { // 6.2 + const XsdComplexType::ContentType::Ptr contentType(new XsdComplexType::ContentType()); + contentType->setVariety(explicitContentType->variety()); + contentType->setParticle(explicitContentType->particle()); + + item.complexType->setContentType(contentType); + } else { // 6.3 + const XsdComplexType::ContentType::Ptr contentType(new XsdComplexType::ContentType()); + + if (explicitContentType->variety() == XsdComplexType::ContentType::Empty) + contentType->setVariety(XsdComplexType::ContentType::ElementOnly); + else + contentType->setVariety(explicitContentType->variety()); + + if (explicitContentType->variety() == XsdComplexType::ContentType::Empty) { + const XsdParticle::Ptr particle(new XsdParticle()); + particle->setMinimumOccurs(1); + particle->setMaximumOccurs(1); + const XsdModelGroup::Ptr sequence(new XsdModelGroup()); + sequence->setCompositor(XsdModelGroup::SequenceCompositor); + particle->setTerm(sequence); + contentType->setParticle(particle); + } else { + contentType->setParticle(explicitContentType->particle()); + } + + const XsdComplexType::OpenContent::Ptr openContent(new XsdComplexType::OpenContent()); + if (wildcardElement) + openContent->setMode(wildcardElement->mode()); + else + openContent->setMode(XsdComplexType::OpenContent::Interleave); + + if (wildcardElement) + openContent->setWildcard(wildcardElement->wildcard()); + + item.complexType->setContentType(contentType); + } + } +} + +void XsdSchemaResolver::resolveAttributeTypes() +{ + for (int i = 0; i < m_attributeTypes.count(); ++i) { + const AttributeType item = m_attributeTypes.at(i); + + SchemaType::Ptr type = m_schema->type(item.typeName); + if (!type) { + // maybe it's a basic type... + type = m_context->schemaTypeFactory()->createSchemaType(item.typeName); + if (!type) { + m_context->error(QtXmlPatterns::tr("type %1 of %2 element cannot be resolved") + .arg(formatType(m_namePool, item.typeName)) + .arg(formatElement("attribute")), + XsdSchemaContext::XSDError, item.location); + return; + } + } + + if (!type->isSimpleType() && type->category() != SchemaType::None) { + m_context->error(QtXmlPatterns::tr("type of %1 element must be a simple type, %2 is not") + .arg(formatElement("attribute")) + .arg(formatType(m_namePool, item.typeName)), + XsdSchemaContext::XSDError, item.location); + return; + } + + item.attribute->setType(type); + } +} + +void XsdSchemaResolver::resolveAlternativeTypes() +{ + for (int i = 0; i < m_alternativeTypes.count(); ++i) { + const AlternativeType item = m_alternativeTypes.at(i); + + SchemaType::Ptr type = m_schema->type(item.typeName); + if (!type) { + // maybe it's a basic type... + type = m_context->schemaTypeFactory()->createSchemaType(item.typeName); + if (!type) { + m_context->error(QtXmlPatterns::tr("type %1 of %2 element cannot be resolved") + .arg(formatType(m_namePool, item.typeName)) + .arg(formatElement("alternative")), + XsdSchemaContext::XSDError, item.location); + return; + } + } + + item.alternative->setType(type); + } + + for (int i = 0; i < m_alternativeTypeElements.count(); ++i) { + const AlternativeTypeElement item = m_alternativeTypeElements.at(i); + item.alternative->setType(item.element->type()); + } +} + +bool hasCircularSubstitutionGroup(const XsdElement::Ptr ¤t, const XsdElement::Ptr &head, const NamePool::Ptr &namePool) +{ + if (current == head) + return true; + else { + const XsdElement::List elements = current->substitutionGroupAffiliations(); + for (int i = 0; i < elements.count(); ++i) { + if (hasCircularSubstitutionGroup(elements.at(i), head, namePool)) + return true; + } + } + + return false; +} + +void XsdSchemaResolver::resolveSubstitutionGroupAffiliations() +{ + for (int i = 0; i < m_substitutionGroupAffiliations.count(); ++i) { + const SubstitutionGroupAffiliation item = m_substitutionGroupAffiliations.at(i); + + XsdElement::List affiliations; + for (int j = 0; j < item.elementNames.count(); ++j) { + const XsdElement::Ptr element = m_schema->element(item.elementNames.at(j)); + if (!element) { + m_context->error(QtXmlPatterns::tr("substitution group %1 of %2 element cannot be resolved") + .arg(formatKeyword(m_namePool, item.elementNames.at(j))) + .arg(formatElement("element")), + XsdSchemaContext::XSDError, item.location); + return; + } + + // @see http://www.w3.org/TR/xmlschema11-1/#e-props-correct 5) + if (hasCircularSubstitutionGroup(element, item.element, m_namePool)) { + m_context->error(QtXmlPatterns::tr("substitution group %1 has circular definition").arg(formatKeyword(m_namePool, item.elementNames.at(j))), XsdSchemaContext::XSDError, item.location); + return; + } + + affiliations.append(element); + } + + item.element->setSubstitutionGroupAffiliations(affiliations); + } + + for (int i = 0; i < m_substitutionGroupTypes.count(); ++i) { + const XsdElement::Ptr element = m_substitutionGroupTypes.at(i); + element->setType(element->substitutionGroupAffiliations().first()->type()); + } +} + +bool isSubstGroupHeadOf(const XsdElement::Ptr &head, const XsdElement::Ptr &element, const NamePool::Ptr &namePool) +{ + if (head->name(namePool) == element->name(namePool)) + return true; + + const XsdElement::List affiliations = element->substitutionGroupAffiliations(); + for (int i = 0; i < affiliations.count(); ++i) { + if (isSubstGroupHeadOf(head, affiliations.at(i), namePool)) + return true; + } + + return false; +} + +void XsdSchemaResolver::resolveSubstitutionGroups() +{ + const XsdElement::List elements = m_schema->elements(); + for (int i = 0; i < elements.count(); ++i) { + const XsdElement::Ptr element = elements.at(i); + + // the element is always itself in the substitution group + element->addSubstitutionGroup(element); + + for (int j = 0; j < elements.count(); ++j) { + if (i == j) + continue; + + if (isSubstGroupHeadOf(element, elements.at(j), m_namePool)) + element->addSubstitutionGroup(elements.at(j)); + } + } +} + +void XsdSchemaResolver::resolveTermReferences() +{ + // first the global complex types + const SchemaType::List types = m_schema->types(); + for (int i = 0; i < types.count(); ++i) { + if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = types.at(i); + if (complexType->contentType()->variety() != XsdComplexType::ContentType::ElementOnly && complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed) + continue; + + resolveTermReference(complexType->contentType()->particle(), QSet()); + } + + // then all anonymous complex types + const SchemaType::List anonymousTypes = m_schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + if (!(anonymousTypes.at(i)->isComplexType()) || !anonymousTypes.at(i)->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = anonymousTypes.at(i); + if (complexType->contentType()->variety() != XsdComplexType::ContentType::ElementOnly && complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed) + continue; + + resolveTermReference(complexType->contentType()->particle(), QSet()); + } + + const XsdModelGroup::List groups = m_schema->elementGroups(); + for (int i = 0; i < groups.count(); ++i) { + const XsdParticle::Ptr particle(new XsdParticle()); + particle->setTerm(groups.at(i)); + resolveTermReference(particle, QSet()); + } +} + +void XsdSchemaResolver::resolveTermReference(const XsdParticle::Ptr &particle, QSet visitedGroups) +{ + if (!particle) + return; + + const XsdTerm::Ptr term = particle->term(); + + // if it is a model group, we iterate over it recursive... + if (term->isModelGroup()) { + const XsdModelGroup::Ptr modelGroup = term; + const XsdParticle::List particles = modelGroup->particles(); + + for (int i = 0; i < particles.count(); ++i) { + resolveTermReference(particles.at(i), visitedGroups); + } + + // check for unique names of elements inside all compositor + if (modelGroup->compositor() != XsdModelGroup::ChoiceCompositor) { + for (int i = 0; i < particles.count(); ++i) { + const XsdParticle::Ptr particle = particles.at(i); + const XsdTerm::Ptr term = particle->term(); + + if (!(term->isElement())) + continue; + + for (int j = 0; j < particles.count(); ++j) { + const XsdParticle::Ptr otherParticle = particles.at(j); + const XsdTerm::Ptr otherTerm = otherParticle->term(); + + if (otherTerm->isElement() && i != j) { + const XsdElement::Ptr element = term; + const XsdElement::Ptr otherElement = otherTerm; + + if (element->name(m_namePool) == otherElement->name(m_namePool)) { + if (modelGroup->compositor() == XsdModelGroup::AllCompositor) { + m_context->error(QtXmlPatterns::tr("duplicated element names %1 in %2 element") + .arg(formatKeyword(element->displayName(m_namePool))) + .arg(formatElement("all")), + XsdSchemaContext::XSDError, sourceLocation(modelGroup)); + return; + } else if (modelGroup->compositor() == XsdModelGroup::SequenceCompositor) { + if (element->type() != otherElement->type()) { // not same variety + m_context->error(QtXmlPatterns::tr("duplicated element names %1 in %2 element") + .arg(formatKeyword(element->displayName(m_namePool))) + .arg(formatElement("sequence")), + XsdSchemaContext::XSDError, sourceLocation(modelGroup)); + return; + } + } + } + } + } + } + } + + return; + } + + // ...otherwise we have reached the end of recursion... + if (!term->isReference()) + return; + + // ...or we have reached a reference term that must be resolved + const XsdReference::Ptr reference = term; + switch (reference->type()) { + case XsdReference::Element: + { + const XsdElement::Ptr element = m_schema->element(reference->referenceName()); + if (element) { + particle->setTerm(element); + } else { + m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved") + .arg(formatKeyword(m_namePool, reference->referenceName())) + .arg(formatElement("element")), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return; + } + } + break; + case XsdReference::ModelGroup: + { + const XsdModelGroup::Ptr modelGroup = m_schema->elementGroup(reference->referenceName()); + if (modelGroup) { + if (visitedGroups.contains(modelGroup->name(m_namePool))) { + m_context->error(QtXmlPatterns::tr("circular group reference for %1").arg(formatKeyword(modelGroup->displayName(m_namePool))), + XsdSchemaContext::XSDError, reference->sourceLocation()); + } else { + visitedGroups.insert(modelGroup->name(m_namePool)); + } + + particle->setTerm(modelGroup); + + // start recursive iteration here as well to get all references resolved + const XsdParticle::List particles = modelGroup->particles(); + for (int i = 0; i < particles.count(); ++i) { + resolveTermReference(particles.at(i), visitedGroups); + } + + if (modelGroup->compositor() == XsdModelGroup::AllCompositor) { + if (m_allGroups.contains(reference)) { + m_context->error(QtXmlPatterns::tr("%1 element is not allowed in this scope").arg(formatElement("all")), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return; + } + if (particle->maximumOccursUnbounded() || particle->maximumOccurs() != 1) { + m_context->error(QtXmlPatterns::tr("%1 element cannot have %2 attribute with value other than %3") + .arg(formatElement("all")) + .arg(formatAttribute("maxOccurs")) + .arg(formatData("1")), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return; + } + if (particle->minimumOccurs() != 0 && particle->minimumOccurs() != 1) { + m_context->error(QtXmlPatterns::tr("%1 element cannot have %2 attribute with value other than %3 or %4") + .arg(formatElement("all")) + .arg(formatAttribute("minOccurs")) + .arg(formatData("0")) + .arg(formatData("1")), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return; + } + } + } else { + m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved") + .arg(formatKeyword(m_namePool, reference->referenceName())) + .arg(formatElement("group")), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return; + } + } + break; + } +} + +void XsdSchemaResolver::resolveAttributeTermReferences() +{ + // first all global attribute groups + const XsdAttributeGroup::List attributeGroups = m_schema->attributeGroups(); + for (int i = 0; i < attributeGroups.count(); ++i) { + XsdWildcard::Ptr wildcard = attributeGroups.at(i)->wildcard(); + const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeGroups.at(i)->attributeUses(), wildcard, QSet()); + attributeGroups.at(i)->setAttributeUses(uses); + attributeGroups.at(i)->setWildcard(wildcard); + } + + // then the global complex types + const SchemaType::List types = m_schema->types(); + for (int i = 0; i < types.count(); ++i) { + if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = types.at(i); + const XsdAttributeUse::List attributeUses = complexType->attributeUses(); + + XsdWildcard::Ptr wildcard = complexType->attributeWildcard(); + const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeUses, wildcard, QSet()); + complexType->setAttributeUses(uses); + complexType->setAttributeWildcard(wildcard); + } + + // and afterwards all anonymous complex types + const SchemaType::List anonymousTypes = m_schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + if (!(anonymousTypes.at(i)->isComplexType()) || !anonymousTypes.at(i)->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = anonymousTypes.at(i); + const XsdAttributeUse::List attributeUses = complexType->attributeUses(); + + XsdWildcard::Ptr wildcard = complexType->attributeWildcard(); + const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeUses, wildcard, QSet()); + complexType->setAttributeUses(uses); + complexType->setAttributeWildcard(wildcard); + } +} + +XsdAttributeUse::List XsdSchemaResolver::resolveAttributeTermReferences(const XsdAttributeUse::List &attributeUses, XsdWildcard::Ptr &wildcard, QSet visitedAttributeGroups) +{ + XsdAttributeUse::List resolvedAttributeUses; + + for (int i = 0; i < attributeUses.count(); ++i) { + const XsdAttributeUse::Ptr attributeUse = attributeUses.at(i); + if (attributeUse->isAttributeUse()) { + // it is a real attribute use, so no need to resolve it + resolvedAttributeUses.append(attributeUse); + } else if (attributeUse->isReference()) { + // it is just a reference, so resolve it to the real attribute use + + const XsdAttributeReference::Ptr reference = attributeUse; + if (reference->type() == XsdAttributeReference::AttributeUse) { + + // lookup the real attribute + const XsdAttribute::Ptr attribute = m_schema->attribute(reference->referenceName()); + if (!attribute) { + m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved") + .arg(formatKeyword(m_namePool, reference->referenceName())) + .arg(formatElement("attribute")), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return XsdAttributeUse::List(); + } + + // if both, reference and definition have a fixed or default value set, then they must be equal + if (attribute->valueConstraint() && attributeUse->valueConstraint()) { + if (attribute->valueConstraint()->value() != attributeUse->valueConstraint()->value()) { + m_context->error(QtXmlPatterns::tr("%1 or %2 attribute of reference %3 does not match with the attribute declaration %4") + .arg(formatAttribute("fixed")) + .arg(formatAttribute("default")) + .arg(formatKeyword(m_namePool, reference->referenceName())) + .arg(formatKeyword(attribute->displayName(m_namePool))), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return XsdAttributeUse::List(); + } + } + + attributeUse->setAttribute(attribute); + if (!attributeUse->valueConstraint() && attribute->valueConstraint()) + attributeUse->setValueConstraint(XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(attribute->valueConstraint())); + + resolvedAttributeUses.append(attributeUse); + } else if (reference->type() == XsdAttributeReference::AttributeGroup) { + const XsdAttributeGroup::Ptr attributeGroup = m_schema->attributeGroup(reference->referenceName()); + if (!attributeGroup) { + m_context->error(QtXmlPatterns::tr("reference %1 of %2 element cannot be resolved") + .arg(formatKeyword(m_namePool, reference->referenceName())) + .arg(formatElement("attributeGroup")), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return XsdAttributeUse::List(); + } + if (visitedAttributeGroups.contains(attributeGroup->name(m_namePool))) { + m_context->error(QtXmlPatterns::tr("attribute group %1 has circular reference").arg(formatKeyword(m_namePool, reference->referenceName())), + XsdSchemaContext::XSDError, reference->sourceLocation()); + return XsdAttributeUse::List(); + } else { + visitedAttributeGroups.insert(attributeGroup->name(m_namePool)); + } + + // resolve attribute wildcards as defined in http://www.w3.org/TR/xmlschema11-1/#declare-attributeGroup-wildcard + XsdWildcard::Ptr childWildcard; + resolvedAttributeUses << resolveAttributeTermReferences(attributeGroup->attributeUses(), childWildcard, visitedAttributeGroups); + if (!childWildcard) { + if (attributeGroup->wildcard()) { + if (wildcard) { + const XsdWildcard::ProcessContents contents = wildcard->processContents(); + wildcard = XsdSchemaHelper::wildcardIntersection(wildcard, attributeGroup->wildcard()); + wildcard->setProcessContents(contents); + } else { + wildcard = attributeGroup->wildcard(); + } + } + } else { + XsdWildcard::Ptr newWildcard; + if (attributeGroup->wildcard()) { + const XsdWildcard::ProcessContents contents = attributeGroup->wildcard()->processContents(); + newWildcard = XsdSchemaHelper::wildcardIntersection(attributeGroup->wildcard(), childWildcard); + newWildcard->setProcessContents(contents); + } else { + newWildcard = childWildcard; + } + + if (wildcard) { + const XsdWildcard::ProcessContents contents = wildcard->processContents(); + wildcard = XsdSchemaHelper::wildcardIntersection(wildcard, newWildcard); + wildcard->setProcessContents(contents); + } else { + wildcard = newWildcard; + } + } + } + } + } + + return resolvedAttributeUses; +} + +void XsdSchemaResolver::resolveAttributeInheritance() +{ + // collect the global and anonymous complex types + SchemaType::List types = m_schema->types(); + types << m_schema->anonymousTypes(); + + QSet visitedTypes; + for (int i = 0; i < types.count(); ++i) { + if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema()) + continue; + + const XsdComplexType::Ptr complexType = types.at(i); + + resolveAttributeInheritance(complexType, visitedTypes); + } +} + +bool isValidWildcardRestriction(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &baseWildcard) +{ + if (wildcard->namespaceConstraint()->variety() == baseWildcard->namespaceConstraint()->variety()) { + if (!XsdSchemaHelper::checkWildcardProcessContents(baseWildcard, wildcard)) + return false; + } + + if (wildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Any && + baseWildcard->namespaceConstraint()->variety() != XsdWildcard::NamespaceConstraint::Any ) { + return false; + } + if (baseWildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Not && + wildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration) { + if (!baseWildcard->namespaceConstraint()->namespaces().intersect(wildcard->namespaceConstraint()->namespaces()).isEmpty()) + return false; + } + if (baseWildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration && + wildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration) { + if (!wildcard->namespaceConstraint()->namespaces().subtract(baseWildcard->namespaceConstraint()->namespaces()).isEmpty()) + return false; + } + + return true; +} + +/* + * Since we inherit the attributes from our base class we have to walk up in the + * inheritance hierarchy first and resolve the attribute inheritance top-down. + */ +void XsdSchemaResolver::resolveAttributeInheritance(const XsdComplexType::Ptr &complexType, QSet &visitedTypes) +{ + if (visitedTypes.contains(complexType)) + return; + else + visitedTypes.insert(complexType); + + const SchemaType::Ptr baseType = complexType->wxsSuperType(); + Q_ASSERT(baseType); + + if (!(baseType->isComplexType()) || !baseType->isDefinedBySchema()) + return; + + const XsdComplexType::Ptr complexBaseType = baseType; + + resolveAttributeInheritance(complexBaseType, visitedTypes); + + // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.attuses + + // 1 and 2 (the attribute groups have been resolved here already) + const XsdAttributeUse::List uses = complexBaseType->attributeUses(); + + if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { // 3.2 + const XsdAttributeUse::List currentUses = complexType->attributeUses(); + + // 3.2.1 and 3.2.2 As we also keep the prohibited attributes as objects, the algorithm below + // handles both the same way + + // add only these attribute uses of the base type that match one of the following criteria: + // 1: there is no attribute use with the same name in type + // 2: there is no attribute with the same name marked as prohibited in type + for (int j = 0; j < uses.count(); ++j) { + const XsdAttributeUse::Ptr use = uses.at(j); + bool found = false; + for (int k = 0; k < currentUses.count(); ++k) { + if (use->attribute()->name(m_namePool) == currentUses.at(k)->attribute()->name(m_namePool)) { + found = true; + + // check if prohibited usage is violated + if ((use->useType() == XsdAttributeUse::ProhibitedUse) && (currentUses.at(k)->useType() != XsdAttributeUse::ProhibitedUse)) { + m_context->error(QtXmlPatterns::tr("%1 attribute in %2 must have %3 use like in base type %4") + .arg(formatAttribute(use->attribute()->displayName(m_namePool))) + .arg(formatType(m_namePool, complexType)) + .arg(formatData("prohibited")) + .arg(formatType(m_namePool, complexBaseType)), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + + break; + } + } + + if (!found && uses.at(j)->useType() != XsdAttributeUse::ProhibitedUse) { + complexType->addAttributeUse(uses.at(j)); + } + } + } else if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) { // 3.1 + QHash availableUses; + + // fill hash with attribute uses of current type for faster lookup + { + const XsdAttributeUse::List attributeUses = complexType->attributeUses(); + + for (int i = 0; i < attributeUses.count(); ++i) { + availableUses.insert(attributeUses.at(i)->attribute()->name(m_namePool), attributeUses.at(i)); + } + } + + // just add the attribute uses of the base type + for (int i = 0; i < uses.count(); ++i) { + const XsdAttributeUse::Ptr currentAttributeUse = uses.at(i); + + // if the base type defines the attribute as prohibited but we override it in current type, then don't copy the prohibited attribute use + if ((currentAttributeUse->useType() == XsdAttributeUse::ProhibitedUse) && availableUses.contains(currentAttributeUse->attribute()->name(m_namePool))) + continue; + + complexType->addAttributeUse(uses.at(i)); + } + } + + // handle attribute wildcards: @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.anyatt + + // 1 + const XsdWildcard::Ptr completeWildcard(complexType->attributeWildcard()); + + if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { + if (complexType->wxsSuperType()->isComplexType() && complexType->wxsSuperType()->isDefinedBySchema()) { + const XsdComplexType::Ptr complexBaseType(complexType->wxsSuperType()); + if (complexType->attributeWildcard()) { + if (complexBaseType->attributeWildcard()) { + if (!isValidWildcardRestriction(complexType->attributeWildcard(), complexBaseType->attributeWildcard())) { + m_context->error(QtXmlPatterns::tr("attribute wildcard of %1 is not a valid restriction of attribute wildcard of base type %2") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, complexBaseType)), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } else { + m_context->error(QtXmlPatterns::tr("%1 has attribute wildcard but its base type %2 has not") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, complexBaseType)), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } + } + complexType->setAttributeWildcard(completeWildcard); // 2.1 + } else if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) { + XsdWildcard::Ptr baseWildcard; // 2.2.1 + if (complexType->wxsSuperType()->isComplexType() && complexType->wxsSuperType()->isDefinedBySchema()) + baseWildcard = XsdComplexType::Ptr(complexType->wxsSuperType())->attributeWildcard(); // 2.2.1.1 + else + baseWildcard = XsdWildcard::Ptr(); // 2.2.1.2 + + if (!baseWildcard) { + complexType->setAttributeWildcard(completeWildcard); // 2.2.2.1 + } else if (!completeWildcard) { + complexType->setAttributeWildcard(baseWildcard); // 2.2.2.2 + } else { + XsdWildcard::Ptr unionWildcard = XsdSchemaHelper::wildcardUnion(completeWildcard, baseWildcard); + if (unionWildcard) { + unionWildcard->setProcessContents(completeWildcard->processContents()); + complexType->setAttributeWildcard(unionWildcard); // 2.2.2.3 + } else { + m_context->error(QtXmlPatterns::tr("union of attribute wildcard of type %1 and attribute wildcard of its base type %2 is not expressible") + .arg(formatType(m_namePool, complexType)) + .arg(formatType(m_namePool, complexBaseType)), + XsdSchemaContext::XSDError, sourceLocation(complexType)); + return; + } + } + } +} + +void XsdSchemaResolver::resolveEnumerationFacetValues() +{ + XsdSimpleType::List simpleTypes; + + // first collect the global simple types + const SchemaType::List types = m_schema->types(); + for (int i = 0; i < types.count(); ++i) { + if (types.at(i)->isSimpleType()) + simpleTypes.append(types.at(i)); + } + + // then collect all anonymous simple types + const SchemaType::List anonymousTypes = m_schema->anonymousTypes(); + for (int i = 0; i < anonymousTypes.count(); ++i) { + if (anonymousTypes.at(i)->isSimpleType()) + simpleTypes.append(anonymousTypes.at(i)); + } + // process all simple types + for (int i = 0; i < simpleTypes.count(); ++i) { + const XsdSimpleType::Ptr simpleType = simpleTypes.at(i); + + // we resolve the enumeration values only for xs:QName and xs:NOTATION based types + if (BuiltinTypes::xsQName->wxsTypeMatches(simpleType) || + BuiltinTypes::xsNOTATION->wxsTypeMatches(simpleType)) { + const XsdFacet::Hash facets = simpleType->facets(); + if (facets.contains(XsdFacet::Enumeration)) { + AtomicValue::List newValues; + + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const AtomicValue::List values = facet->multiValue(); + for (int j = 0; j < values.count(); ++j) { + const AtomicValue::Ptr value = values.at(j); + + Q_ASSERT(m_enumerationFacetValues.contains(value)); + const NamespaceSupport support( m_enumerationFacetValues.value(value) ); + + const QString qualifiedName = value->as >()->stringValue(); + if (!XPathHelper::isQName(qualifiedName)) { + m_context->error(QtXmlPatterns::tr("enumeration facet contains invalid content: {%1} is not a value of type %2") + .arg(formatData(qualifiedName)) + .arg(formatType(m_namePool, BuiltinTypes::xsQName)), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + + QXmlName qNameValue; + bool result = support.processName(qualifiedName, NamespaceSupport::ElementName, qNameValue); + if (!result) { + m_context->error(QtXmlPatterns::tr("namespace prefix of qualified name %1 is not defined").arg(formatData(qualifiedName)), + XsdSchemaContext::XSDError, sourceLocation(simpleType)); + return; + } + + newValues.append(QNameValue::fromValue(m_namePool, qNameValue)); + } + facet->setMultiValue(newValues); + } + } + } +} + +QSourceLocation XsdSchemaResolver::sourceLocation(const NamedSchemaComponent::Ptr component) const +{ + if (m_componentLocationHash.contains(component)) { + return m_componentLocationHash.value(component); + } else { + QSourceLocation location; + location.setLine(1); + location.setColumn(1); + location.setUri(QString::fromLatin1("dummyUri")); + + return location; + } +} + +XsdFacet::Hash XsdSchemaResolver::complexTypeFacets(const XsdComplexType::Ptr &complexType) const +{ + for (int i = 0; i < m_complexBaseTypes.count(); ++i) { + if (m_complexBaseTypes.at(i).complexType == complexType) + return m_complexBaseTypes.at(i).facets; + } + + return XsdFacet::Hash(); +} + +void XsdSchemaResolver::checkRedefinedGroups() +{ + for (int i = 0; i < m_redefinedGroups.count(); ++i) { + const RedefinedGroups item = m_redefinedGroups.at(i); + + // create dummy particles... + const XsdParticle::Ptr redefinedParticle(new XsdParticle()); + redefinedParticle->setTerm(item.redefinedGroup); + const XsdParticle::Ptr particle(new XsdParticle()); + particle->setTerm(item.group); + + // so that we can pass them to XsdParticleChecker::subsumes() + QString errorMsg; + if (!XsdParticleChecker::subsumes(particle, redefinedParticle, m_context, errorMsg)) { + m_context->error(QtXmlPatterns::tr("%1 element %2 is not a valid restriction of the %3 element it redefines: %4") + .arg(formatElement("group")) + .arg(formatData(item.redefinedGroup->displayName(m_namePool))) + .arg(formatElement("group")) + .arg(errorMsg), + XsdSchemaContext::XSDError, sourceLocation(item.redefinedGroup)); + return; + } + } +} + +void XsdSchemaResolver::checkRedefinedAttributeGroups() +{ + for (int i = 0; i < m_redefinedAttributeGroups.count(); ++i) { + const RedefinedAttributeGroups item = m_redefinedAttributeGroups.at(i); + + QString errorMsg; + if (!XsdSchemaHelper::isValidAttributeGroupRestriction(item.redefinedGroup, item.group, m_context, errorMsg)) { + m_context->error(QtXmlPatterns::tr("%1 element %2 is not a valid restriction of the %3 element it redefines: %4") + .arg(formatElement("attributeGroup")) + .arg(formatData(item.redefinedGroup->displayName(m_namePool))) + .arg(formatElement("attributeGroup")) + .arg(errorMsg), + XsdSchemaContext::XSDError, sourceLocation(item.redefinedGroup)); + return; + } + } +} + +AnySimpleType::Ptr XsdSchemaResolver::findPrimitiveType(const AnySimpleType::Ptr &type, QSet &visitedTypes) +{ + if (visitedTypes.contains(type)) { + // found invalid circular reference... + return AnySimpleType::Ptr(); + } else { + visitedTypes.insert(type); + } + + const QXmlName typeName = type->name(m_namePool); + if (typeName == BuiltinTypes::xsString->name(m_namePool) || + typeName == BuiltinTypes::xsBoolean->name(m_namePool) || + typeName == BuiltinTypes::xsFloat->name(m_namePool) || + typeName == BuiltinTypes::xsDouble->name(m_namePool) || + typeName == BuiltinTypes::xsDecimal->name(m_namePool) || + typeName == BuiltinTypes::xsDuration->name(m_namePool) || + typeName == BuiltinTypes::xsDateTime->name(m_namePool) || + typeName == BuiltinTypes::xsTime->name(m_namePool) || + typeName == BuiltinTypes::xsDate->name(m_namePool) || + typeName == BuiltinTypes::xsGYearMonth->name(m_namePool) || + typeName == BuiltinTypes::xsGYear->name(m_namePool) || + typeName == BuiltinTypes::xsGMonthDay->name(m_namePool) || + typeName == BuiltinTypes::xsGDay->name(m_namePool) || + typeName == BuiltinTypes::xsGMonth->name(m_namePool) || + typeName == BuiltinTypes::xsHexBinary->name(m_namePool) || + typeName == BuiltinTypes::xsBase64Binary->name(m_namePool) || + typeName == BuiltinTypes::xsAnyURI->name(m_namePool) || + typeName == BuiltinTypes::xsQName->name(m_namePool) || + typeName == BuiltinTypes::xsNOTATION->name(m_namePool) || + typeName == BuiltinTypes::xsAnySimpleType->name(m_namePool)) + return type; + else { + if (type->wxsSuperType()) + return findPrimitiveType(type->wxsSuperType(), visitedTypes); + else { + return AnySimpleType::Ptr(); + } + } +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschemaresolver_p.h b/src/xmlpatterns/schema/qxsdschemaresolver_p.h new file mode 100644 index 0000000..1222619 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschemaresolver_p.h @@ -0,0 +1,548 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaResolver_H +#define Patternist_XsdSchemaResolver_H + +#include "qnamespacesupport_p.h" +#include "qschematype_p.h" +#include "qschematypefactory_p.h" +#include "qxsdalternative_p.h" +#include "qxsdattribute_p.h" +#include "qxsdattributegroup_p.h" +#include "qxsdelement_p.h" +#include "qxsdmodelgroup_p.h" +#include "qxsdnotation_p.h" +#include "qxsdreference_p.h" +#include "qxsdschema_p.h" +#include "qxsdschemachecker_p.h" +#include "qxsdsimpletype_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + class XsdSchemaContext; + class XsdSchemaParserContext; + + /** + * @short Encapsulates the resolving of type/element references in a schema after parsing has finished. + * + * This class collects task for resolving types or element references. After the parsing has finished, + * one can start the resolve process by calling resolve(). + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSchemaResolver : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Creates a new schema resolver. + * + * @param context The schema context used for error reporting etc.. + * @param parserContext The schema parser context where all objects to resolve belong to. + */ + XsdSchemaResolver(const QExplicitlySharedDataPointer &context, const XsdSchemaParserContext *parserContext); + + /** + * Destroys the schema resolver. + */ + ~XsdSchemaResolver(); + + /** + * Starts the resolve process. + */ + void resolve(); + + /** + * Adds a resolve task for key references. + * + * The resolver will try to set the referencedKey property of @p keyRef to the key or unique object + * of @p element that has the given @p name. + */ + void addKeyReference(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &keyRef, const QXmlName &name, const QSourceLocation &location); + + /** + * Adds a resolve task for the base type of restriction of a simple type. + * + * The resolver will set the base type of @p simpleType to the type named by @p baseName. + */ + void addSimpleRestrictionBase(const XsdSimpleType::Ptr &simpleType, const QXmlName &baseName, const QSourceLocation &location); + + /** + * Removes the resolve task for the base type of restriction of the simple @p type. + */ + void removeSimpleRestrictionBase(const XsdSimpleType::Ptr &type); + + /** + * Adds a resolve task for the list type of a simple type. + * + * The resolver will set the itemType property of @p simpleType to the type named by @p typeName. + */ + void addSimpleListType(const XsdSimpleType::Ptr &simpleType, const QXmlName &typeName, const QSourceLocation &location); + + /** + * Adds a resolve task for the member types of a simple type. + * + * The resolver will set the memberTypes property of @p simpleType to the types named by @p typeNames. + */ + void addSimpleUnionTypes(const XsdSimpleType::Ptr &simpleType, const QList &typeNames, const QSourceLocation &location); + + /** + * Adds a resolve task for the type of an element. + * + * The resolver will set the type of the @p element to the type named by @p typeName. + */ + void addElementType(const XsdElement::Ptr &element, const QXmlName &typeName, const QSourceLocation &location); + + /** + * Adds a resolve task for the base type of a complex type. + * + * The resolver will set the base type of @p complexType to the type named by @p baseName. + */ + void addComplexBaseType(const XsdComplexType::Ptr &complexType, const QXmlName &baseName, const QSourceLocation &location, const XsdFacet::Hash &facets = XsdFacet::Hash()); + + /** + * Removes the resolve task for the base type of the complex @p type. + */ + void removeComplexBaseType(const XsdComplexType::Ptr &type); + + /** + * Adds a resolve task for the content type of a complex type. + * + * The resolver will set the content type properties for @p complexType based on the + * given explicit @p content and effective @p mixed value. + */ + void addComplexContentType(const XsdComplexType::Ptr &complexType, const XsdParticle::Ptr &content, bool mixed); + + /** + * Adds a resolve task for the type of an attribute. + * + * The resolver will set the type of the @p attribute to the type named by @p typeName. + */ + void addAttributeType(const XsdAttribute::Ptr &attribute, const QXmlName &typeName, const QSourceLocation &location); + + /** + * Adds a resolve task for the type of an alternative. + * + * The resolver will set the type of the @p alternative to the type named by @p typeName. + */ + void addAlternativeType(const XsdAlternative::Ptr &alternative, const QXmlName &typeName, const QSourceLocation &location); + + /** + * Adds a resolve task for the type of an alternative. + * + * The resolver will set the type of the @p alternative to the type of the @p element after + * the type of the @p element has been resolved. + */ + void addAlternativeType(const XsdAlternative::Ptr &alternative, const XsdElement::Ptr &element); + + /** + * Adds a resolve task for the substituion group affiliations of an element. + * + * The resolver will set the substitution group affiliations of the @p element to the + * top-level element named by @p elementNames. + */ + void addSubstitutionGroupAffiliation(const XsdElement::Ptr &element, const QList &elementName, const QSourceLocation &location); + + /** + * Adds a resolve task for an element that has no type specified, only a substitution group + * affiliation. + * + * The resolver will set the type of the substitution group affiliation as type for the element. + */ + void addSubstitutionGroupType(const XsdElement::Ptr &element); + + /** + * Adds the component location hash, so the resolver is able to report meaning full + * error messages. + */ + void addComponentLocationHash(const QHash &hash); + + /** + * Add a resolve task for enumeration facet values. + * + * In case the enumeration is of type QName or NOTATION, we have to resolve the QName later, + * so we store the namespace bindings together with the facet value here and resolve it as soon as + * we have all type information available. + */ + void addEnumerationFacetValue(const AtomicValue::Ptr &facetValue, const NamespaceSupport &namespaceSupport); + + /** + * Add a check job for redefined groups. + * + * When an element group is redefined, we have to check whether the redefined group is a valid + * restriction of the group it redefines. As we need all type information for that, we keep them + * here for later checking. + */ + void addRedefinedGroups(const XsdModelGroup::Ptr &redefinedGroup, const XsdModelGroup::Ptr &group); + + /** + * Add a check job for redefined attribute groups. + * + * When an attribute group is redefined, we have to check whether the redefined group is a valid + * restriction of the group it redefines. As we need all type information for that, we keep them + * here for later checking. + */ + void addRedefinedAttributeGroups(const XsdAttributeGroup::Ptr &redefinedGroup, const XsdAttributeGroup::Ptr &group); + + /** + * Adds a check for nested all groups. + */ + void addAllGroupCheck(const XsdReference::Ptr &reference); + + /** + * Copies the data to resolve to an @p other resolver. + * + * @note That functionality is only used by the redefine algorithm in the XsdSchemaParser. + */ + void copyDataTo(const XsdSchemaResolver::Ptr &other) const; + + /** + * Returns the to resolve base type name for the given @p type. + * + * @note That functionality is only used by the redefine algorithm in the XsdSchemaParser. + */ + QXmlName baseTypeNameOfType(const SchemaType::Ptr &type) const; + + /** + * Returns the to resolve type name for the given @p attribute. + * + * @note That functionality is only used by the redefine algorithm in the XsdSchemaParser. + */ + QXmlName typeNameOfAttribute(const XsdAttribute::Ptr &attribute) const; + + /** + * Sets the defaultOpenContent object from the schema parser. + */ + void setDefaultOpenContent(const XsdComplexType::OpenContent::Ptr &openContent, bool appliesToEmpty); + + private: + /** + * Resolves key references. + */ + void resolveKeyReferences(); + + /** + * Resolves the base types of simple types derived by restriction. + */ + void resolveSimpleRestrictionBaseTypes(); + + /** + * Resolves the other properties except the base type + * of all simple restrictions. + */ + void resolveSimpleRestrictions(); + + /** + * Resolves the other properties except the base type + * of the given simple restriction. + * + * @param simpleType The restricted type to resolve. + * @param visitedTypes A set of already resolved types, used for termination of recursion. + */ + void resolveSimpleRestrictions(const XsdSimpleType::Ptr &simpleType, QSet &visitedTypes); + + /** + * Resolves the item type property of simple types derived by list. + */ + void resolveSimpleListType(); + + /** + * Resolves the member types property of simple types derived by union. + */ + void resolveSimpleUnionTypes(); + + /** + * Resolves element types. + */ + void resolveElementTypes(); + + /** + * Resolves base type of complex types. + */ + void resolveComplexBaseTypes(); + + /** + * Resolves the simple content model of a complex type + * depending on its base type. + */ + void resolveSimpleContentComplexTypes(); + + /** + * Resolves the complex content model of a complex type + * depending on its base type. + */ + void resolveComplexContentComplexTypes(); + + /** + * Resolves the simple content model of a complex type + * depending on its base type. + * + * @param complexType The complex type to resolve. + * @param visitedTypes A set of already resolved types, used for termination of recursion. + */ + void resolveSimpleContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet &visitedTypes); + + /** + * Resolves the complex content model of a complex type + * depending on its base type. + * + * @param complexType The complex type to resolve. + * @param visitedTypes A set of already resolved types, used for termination of recursion. + */ + void resolveComplexContentComplexTypes(const XsdComplexType::Ptr &complexType, QSet &visitedTypes); + + /** + * Resolves attribute types. + */ + void resolveAttributeTypes(); + + /** + * Resolves alternative types. + */ + void resolveAlternativeTypes(); + + /** + * Resolves substitution group affiliations. + */ + void resolveSubstitutionGroupAffiliations(); + + /** + * Resolves substitution groups. + */ + void resolveSubstitutionGroups(); + + /** + * Resolves all XsdReferences in the schema by their corresponding XsdElement or XsdModelGroup terms. + */ + void resolveTermReferences(); + + /** + * Resolves all XsdReferences in the @p particle recursive by their corresponding XsdElement or XsdModelGroup terms. + */ + void resolveTermReference(const XsdParticle::Ptr &particle, QSet visitedGroups); + + /** + * Resolves all XsdAttributeReferences in the schema by their corresponding XsdAttributeUse objects. + */ + void resolveAttributeTermReferences(); + + /** + * Resolves all XsdAttributeReferences in the list of @p attributeUses by their corresponding XsdAttributeUse objects. + */ + XsdAttributeUse::List resolveAttributeTermReferences(const XsdAttributeUse::List &attributeUses, XsdWildcard::Ptr &wildcard, QSet visitedAttributeGroups); + + /** + * Resolves the attribute inheritance of complex types. + * + * @note This method must be called after all base types have been resolved. + */ + void resolveAttributeInheritance(); + + /** + * Resolves the attribute inheritance of the given complex types. + * + * @param complexType The complex type to resolve. + * @param visitedTypes A set of already resolved types, used for termination of recursion. + * + * @note This method must be called after all base types have been resolved. + */ + void resolveAttributeInheritance(const XsdComplexType::Ptr &complexType, QSet &visitedTypes); + + /** + * Resolves the enumeration facet values for QName and NOTATION based facets. + */ + void resolveEnumerationFacetValues(); + + /** + * Returns the source location of the given schema @p component or a dummy + * source location if the component is not found in the component location hash. + */ + QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const; + + /** + * Returns the facets that are marked for the given complex @p type with a simple + * type restriction. + */ + XsdFacet::Hash complexTypeFacets(const XsdComplexType::Ptr &complexType) const; + + /** + * Finds the primitive type for the given simple @p type. + * + * The type is found by walking up the inheritance tree, until one of the builtin + * primitive type definitions is reached. + */ + AnySimpleType::Ptr findPrimitiveType(const AnySimpleType::Ptr &type, QSet &visitedTypes); + + /** + * Checks the redefined groups. + */ + void checkRedefinedGroups(); + + /** + * Checks the redefined attribute groups. + */ + void checkRedefinedAttributeGroups(); + + class KeyReference + { + public: + XsdElement::Ptr element; + XsdIdentityConstraint::Ptr keyRef; + QXmlName reference; + QSourceLocation location; + }; + + class SimpleRestrictionBase + { + public: + XsdSimpleType::Ptr simpleType; + QXmlName baseName; + QSourceLocation location; + }; + + class SimpleListType + { + public: + XsdSimpleType::Ptr simpleType; + QXmlName typeName; + QSourceLocation location; + }; + + class SimpleUnionType + { + public: + XsdSimpleType::Ptr simpleType; + QList typeNames; + QSourceLocation location; + }; + + class ElementType + { + public: + XsdElement::Ptr element; + QXmlName typeName; + QSourceLocation location; + }; + + class ComplexBaseType + { + public: + XsdComplexType::Ptr complexType; + QXmlName baseName; + QSourceLocation location; + XsdFacet::Hash facets; + }; + + class ComplexContentType + { + public: + XsdComplexType::Ptr complexType; + XsdParticle::Ptr explicitContent; + bool effectiveMixed; + }; + + class AttributeType + { + public: + XsdAttribute::Ptr attribute; + QXmlName typeName; + QSourceLocation location; + }; + + class AlternativeType + { + public: + XsdAlternative::Ptr alternative; + QXmlName typeName; + QSourceLocation location; + }; + + class AlternativeTypeElement + { + public: + XsdAlternative::Ptr alternative; + XsdElement::Ptr element; + }; + + class SubstitutionGroupAffiliation + { + public: + XsdElement::Ptr element; + QList elementNames; + QSourceLocation location; + }; + + class RedefinedGroups + { + public: + XsdModelGroup::Ptr redefinedGroup; + XsdModelGroup::Ptr group; + }; + + class RedefinedAttributeGroups + { + public: + XsdAttributeGroup::Ptr redefinedGroup; + XsdAttributeGroup::Ptr group; + }; + + QVector m_keyReferences; + QVector m_simpleRestrictionBases; + QVector m_simpleListTypes; + QVector m_simpleUnionTypes; + QVector m_elementTypes; + QVector m_complexBaseTypes; + QVector m_complexContentTypes; + QVector m_attributeTypes; + QVector m_alternativeTypes; + QVector m_alternativeTypeElements; + QVector m_substitutionGroupAffiliations; + QVector m_substitutionGroupTypes; + QVector m_redefinedGroups; + QVector m_redefinedAttributeGroups; + QHash m_enumerationFacetValues; + QSet m_allGroups; + + QExplicitlySharedDataPointer m_context; + QExplicitlySharedDataPointer m_checker; + NamePool::Ptr m_namePool; + XsdSchema::Ptr m_schema; + QHash m_componentLocationHash; + XsdComplexType::OpenContent::Ptr m_defaultOpenContent; + bool m_defaultOpenContentAppliesToEmpty; + SchemaType::List m_predefinedSchemaTypes; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdschematoken.cpp b/src/xmlpatterns/schema/qxsdschematoken.cpp new file mode 100644 index 0000000..b527de6 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschematoken.cpp @@ -0,0 +1,2951 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +/* NOTE: This file is AUTO GENERATED by qautomaton2cpp.xsl. */ + +#include "qxsdschematoken_p.h" + +QT_BEGIN_NAMESPACE + +XsdSchemaToken::NodeName XsdSchemaToken::classifier2(const QChar *data) + + { + + static const unsigned short string[] = + { + 105, 100 + }; + if(memcmp(&data[0], &string, sizeof(QChar) * 2) == 0) + + + return Id; + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier3(const QChar *data) + + { + if (data[0] == 97) + + + { + if (data[1] == 108) + + + { + + if(data[2] == 108) + + + return All; + + } + + else if (data[1] == 110) + + + { + + if(data[2] == 121) + + + return Any; + + } + + + } + + else if (data[0] == 107) + + + { + + static const unsigned short string[] = + { + 101, 121 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) + + + return Key; + + } + + else if (data[0] == 114) + + + { + + static const unsigned short string[] = + { + 101, 102 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) + + + return Ref; + + } + + else if (data[0] == 117) + + + { + + static const unsigned short string[] = + { + 115, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0) + + + return Use; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier4(const QChar *data) + + { + if (data[0] == 98) + + + { + + static const unsigned short string[] = + { + 97, 115, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0) + + + return Base; + + } + + else if (data[0] == 102) + + + { + + static const unsigned short string[] = + { + 111, 114, 109 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0) + + + return Form; + + } + + else if (data[0] == 108) + + + { + + static const unsigned short string[] = + { + 105, 115, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0) + + + return List; + + } + + else if (data[0] == 109) + + + { + + static const unsigned short string[] = + { + 111, 100, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0) + + + return Mode; + + } + + else if (data[0] == 110) + + + { + + static const unsigned short string[] = + { + 97, 109, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 3) == 0) + + + return Name; + + } + + else if (data[0] == 116) + + + { + if (data[1] == 101) + + + { + + static const unsigned short string[] = + { + 115, 116 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 2) == 0) + + + return Test; + + } + + else if (data[1] == 121) + + + { + + static const unsigned short string[] = + { + 112, 101 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 2) == 0) + + + return Type; + + } + + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier5(const QChar *data) + + { + if (data[0] == 98) + + + { + + static const unsigned short string[] = + { + 108, 111, 99, 107 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0) + + + return Block; + + } + + else if (data[0] == 102) + + + { + if (data[1] == 105) + + + { + if (data[2] == 101) + + + { + + static const unsigned short string[] = + { + 108, 100 + }; + if(memcmp(&data[3], &string, sizeof(QChar) * 2) == 0) + + + return Field; + + } + + else if (data[2] == 110) + + + { + + static const unsigned short string[] = + { + 97, 108 + }; + if(memcmp(&data[3], &string, sizeof(QChar) * 2) == 0) + + + return Final; + + } + + else if (data[2] == 120) + + + { + + static const unsigned short string[] = + { + 101, 100 + }; + if(memcmp(&data[3], &string, sizeof(QChar) * 2) == 0) + + + return Fixed; + + } + + + } + + + } + + else if (data[0] == 103) + + + { + + static const unsigned short string[] = + { + 114, 111, 117, 112 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0) + + + return Group; + + } + + else if (data[0] == 109) + + + { + + static const unsigned short string[] = + { + 105, 120, 101, 100 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0) + + + return Mixed; + + } + + else if (data[0] == 114) + + + { + + static const unsigned short string[] = + { + 101, 102, 101, 114 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0) + + + return Refer; + + } + + else if (data[0] == 117) + + + { + + static const unsigned short string[] = + { + 110, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0) + + + return Union; + + } + + else if (data[0] == 118) + + + { + + static const unsigned short string[] = + { + 97, 108, 117, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0) + + + return Value; + + } + + else if (data[0] == 120) + + + { + + static const unsigned short string[] = + { + 112, 97, 116, 104 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 4) == 0) + + + return Xpath; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier6(const QChar *data) + + { + if (data[0] == 97) + + + { + + static const unsigned short string[] = + { + 115, 115, 101, 114, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0) + + + return Assert; + + } + + else if (data[0] == 99) + + + { + + static const unsigned short string[] = + { + 104, 111, 105, 99, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0) + + + return Choice; + + } + + else if (data[0] == 105) + + + { + + static const unsigned short string[] = + { + 109, 112, 111, 114, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0) + + + return Import; + + } + + else if (data[0] == 107) + + + { + + static const unsigned short string[] = + { + 101, 121, 114, 101, 102 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0) + + + return Keyref; + + } + + else if (data[0] == 108) + + + { + + static const unsigned short string[] = + { + 101, 110, 103, 116, 104 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0) + + + return Length; + + } + + else if (data[0] == 112) + + + { + + static const unsigned short string[] = + { + 117, 98, 108, 105, 99 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0) + + + return Public; + + } + + else if (data[0] == 115) + + + { + if (data[1] == 99) + + + { + + static const unsigned short string[] = + { + 104, 101, 109, 97 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 4) == 0) + + + return Schema; + + } + + else if (data[1] == 111) + + + { + + static const unsigned short string[] = + { + 117, 114, 99, 101 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 4) == 0) + + + return Source; + + } + + else if (data[1] == 121) + + + { + + static const unsigned short string[] = + { + 115, 116, 101, 109 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 4) == 0) + + + return System; + + } + + + } + + else if (data[0] == 117) + + + { + + static const unsigned short string[] = + { + 110, 105, 113, 117, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 5) == 0) + + + return Unique; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier7(const QChar *data) + + { + if (data[0] == 97) + + + { + + static const unsigned short string[] = + { + 112, 112, 105, 110, 102, 111 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0) + + + return Appinfo; + + } + + else if (data[0] == 100) + + + { + + static const unsigned short string[] = + { + 101, 102, 97, 117, 108, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0) + + + return Default; + + } + + else if (data[0] == 101) + + + { + + static const unsigned short string[] = + { + 108, 101, 109, 101, 110, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0) + + + return Element; + + } + + else if (data[0] == 105) + + + { + + static const unsigned short string[] = + { + 110, 99, 108, 117, 100, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0) + + + return Include; + + } + + else if (data[0] == 112) + + + { + + static const unsigned short string[] = + { + 97, 116, 116, 101, 114, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0) + + + return Pattern; + + } + + else if (data[0] == 114) + + + { + + static const unsigned short string[] = + { + 101, 112, 108, 97, 99, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0) + + + return Replace; + + } + + else if (data[0] == 118) + + + { + + static const unsigned short string[] = + { + 101, 114, 115, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 6) == 0) + + + return Version; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier8(const QChar *data) + + { + if (data[0] == 97) + + + { + + static const unsigned short string[] = + { + 98, 115, 116, 114, 97, 99, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0) + + + return Abstract; + + } + + else if (data[0] == 99) + + + { + + static const unsigned short string[] = + { + 111, 108, 108, 97, 112, 115, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0) + + + return Collapse; + + } + + else if (data[0] == 105) + + + { + + static const unsigned short string[] = + { + 116, 101, 109, 84, 121, 112, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0) + + + return ItemType; + + } + + else if (data[0] == 110) + + + { + if (data[1] == 105) + + + { + + static const unsigned short string[] = + { + 108, 108, 97, 98, 108, 101 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 6) == 0) + + + return Nillable; + + } + + else if (data[1] == 111) + + + { + if (data[2] == 116) + + + { + if (data[3] == 97) + + + { + + static const unsigned short string[] = + { + 116, 105, 111, 110 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 4) == 0) + + + return Notation; + + } + + else if (data[3] == 81) + + + { + + static const unsigned short string[] = + { + 78, 97, 109, 101 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 4) == 0) + + + return NotQName; + + } + + + } + + + } + + + } + + else if (data[0] == 111) + + + { + + static const unsigned short string[] = + { + 118, 101, 114, 114, 105, 100, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0) + + + return Override; + + } + + else if (data[0] == 112) + + + { + + static const unsigned short string[] = + { + 114, 101, 115, 101, 114, 118, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0) + + + return Preserve; + + } + + else if (data[0] == 114) + + + { + + static const unsigned short string[] = + { + 101, 100, 101, 102, 105, 110, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0) + + + return Redefine; + + } + + else if (data[0] == 115) + + + { + if (data[1] == 101) + + + { + if (data[2] == 108) + + + { + + static const unsigned short string[] = + { + 101, 99, 116, 111, 114 + }; + if(memcmp(&data[3], &string, sizeof(QChar) * 5) == 0) + + + return Selector; + + } + + else if (data[2] == 113) + + + { + + static const unsigned short string[] = + { + 117, 101, 110, 99, 101 + }; + if(memcmp(&data[3], &string, sizeof(QChar) * 5) == 0) + + + return Sequence; + + } + + + } + + + } + + else if (data[0] == 120) + + + { + + static const unsigned short string[] = + { + 109, 108, 58, 108, 97, 110, 103 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 7) == 0) + + + return XmlLanguage; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier9(const QChar *data) + + { + if (data[0] == 97) + + + { + if (data[1] == 115) + + + { + + static const unsigned short string[] = + { + 115, 101, 114, 116, 105, 111, 110 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 7) == 0) + + + return Assertion; + + } + + else if (data[1] == 116) + + + { + + static const unsigned short string[] = + { + 116, 114, 105, 98, 117, 116, 101 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 7) == 0) + + + return Attribute; + + } + + + } + + else if (data[0] == 101) + + + { + + static const unsigned short string[] = + { + 120, 116, 101, 110, 115, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 8) == 0) + + + return Extension; + + } + + else if (data[0] == 109) + + + { + if (data[1] == 97) + + + { + if (data[2] == 120) + + + { + if (data[3] == 76) + + + { + + static const unsigned short string[] = + { + 101, 110, 103, 116, 104 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0) + + + return MaxLength; + + } + + else if (data[3] == 79) + + + { + + static const unsigned short string[] = + { + 99, 99, 117, 114, 115 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0) + + + return MaxOccurs; + + } + + + } + + + } + + else if (data[1] == 105) + + + { + if (data[2] == 110) + + + { + if (data[3] == 76) + + + { + + static const unsigned short string[] = + { + 101, 110, 103, 116, 104 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0) + + + return MinLength; + + } + + else if (data[3] == 79) + + + { + + static const unsigned short string[] = + { + 99, 99, 117, 114, 115 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 5) == 0) + + + return MinOccurs; + + } + + + } + + + } + + + } + + else if (data[0] == 110) + + + { + + static const unsigned short string[] = + { + 97, 109, 101, 115, 112, 97, 99, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 8) == 0) + + + return Namespace; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier10(const QChar *data) + + { + if (data[0] == 97) + + + { + + static const unsigned short string[] = + { + 110, 110, 111, 116, 97, 116, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 9) == 0) + + + return Annotation; + + } + + else if (data[0] == 115) + + + { + + static const unsigned short string[] = + { + 105, 109, 112, 108, 101, 84, 121, 112, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 9) == 0) + + + return SimpleType; + + } + + else if (data[0] == 119) + + + { + + static const unsigned short string[] = + { + 104, 105, 116, 101, 83, 112, 97, 99, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 9) == 0) + + + return WhiteSpace; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier11(const QChar *data) + + { + if (data[0] == 97) + + + { + + static const unsigned short string[] = + { + 108, 116, 101, 114, 110, 97, 116, 105, 118, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0) + + + return Alternative; + + } + + else if (data[0] == 99) + + + { + + static const unsigned short string[] = + { + 111, 109, 112, 108, 101, 120, 84, 121, 112, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0) + + + return ComplexType; + + } + + else if (data[0] == 101) + + + { + + static const unsigned short string[] = + { + 110, 117, 109, 101, 114, 97, 116, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0) + + + return Enumeration; + + } + + else if (data[0] == 109) + + + { + + static const unsigned short string[] = + { + 101, 109, 98, 101, 114, 84, 121, 112, 101, 115 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0) + + + return MemberTypes; + + } + + else if (data[0] == 111) + + + { + + static const unsigned short string[] = + { + 112, 101, 110, 67, 111, 110, 116, 101, 110, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0) + + + return OpenContent; + + } + + else if (data[0] == 114) + + + { + + static const unsigned short string[] = + { + 101, 115, 116, 114, 105, 99, 116, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0) + + + return Restriction; + + } + + else if (data[0] == 116) + + + { + + static const unsigned short string[] = + { + 111, 116, 97, 108, 68, 105, 103, 105, 116, 115 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 10) == 0) + + + return TotalDigits; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier12(const QChar *data) + + { + if (data[0] == 97) + + + { + + static const unsigned short string[] = + { + 110, 121, 65, 116, 116, 114, 105, 98, 117, 116, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0) + + + return AnyAttribute; + + } + + else if (data[0] == 98) + + + { + + static const unsigned short string[] = + { + 108, 111, 99, 107, 68, 101, 102, 97, 117, 108, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0) + + + return BlockDefault; + + } + + else if (data[0] == 102) + + + { + + static const unsigned short string[] = + { + 105, 110, 97, 108, 68, 101, 102, 97, 117, 108, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0) + + + return FinalDefault; + + } + + else if (data[0] == 109) + + + { + if (data[1] == 97) + + + { + if (data[2] == 120) + + + { + if (data[3] == 69) + + + { + + static const unsigned short string[] = + { + 120, 99, 108, 117, 115, 105, 118, 101 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0) + + + return MaxExclusive; + + } + + else if (data[3] == 73) + + + { + + static const unsigned short string[] = + { + 110, 99, 108, 117, 115, 105, 118, 101 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0) + + + return MaxInclusive; + + } + + + } + + + } + + else if (data[1] == 105) + + + { + if (data[2] == 110) + + + { + if (data[3] == 69) + + + { + + static const unsigned short string[] = + { + 120, 99, 108, 117, 115, 105, 118, 101 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0) + + + return MinExclusive; + + } + + else if (data[3] == 73) + + + { + + static const unsigned short string[] = + { + 110, 99, 108, 117, 115, 105, 118, 101 + }; + if(memcmp(&data[4], &string, sizeof(QChar) * 8) == 0) + + + return MinInclusive; + + } + + + } + + + } + + + } + + else if (data[0] == 110) + + + { + + static const unsigned short string[] = + { + 111, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 11) == 0) + + + return NotNamespace; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier13(const QChar *data) + + { + if (data[0] == 100) + + + { + + static const unsigned short string[] = + { + 111, 99, 117, 109, 101, 110, 116, 97, 116, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 12) == 0) + + + return Documentation; + + } + + else if (data[0] == 115) + + + { + + static const unsigned short string[] = + { + 105, 109, 112, 108, 101, 67, 111, 110, 116, 101, 110, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 12) == 0) + + + return SimpleContent; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier14(const QChar *data) + + { + if (data[0] == 97) + + + { + if (data[1] == 112) + + + { + + static const unsigned short string[] = + { + 112, 108, 105, 101, 115, 84, 111, 69, 109, 112, 116, 121 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 12) == 0) + + + return AppliesToEmpty; + + } + + else if (data[1] == 116) + + + { + + static const unsigned short string[] = + { + 116, 114, 105, 98, 117, 116, 101, 71, 114, 111, 117, 112 + }; + if(memcmp(&data[2], &string, sizeof(QChar) * 12) == 0) + + + return AttributeGroup; + + } + + + } + + else if (data[0] == 99) + + + { + + static const unsigned short string[] = + { + 111, 109, 112, 108, 101, 120, 67, 111, 110, 116, 101, 110, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0) + + + return ComplexContent; + + } + + else if (data[0] == 102) + + + { + + static const unsigned short string[] = + { + 114, 97, 99, 116, 105, 111, 110, 68, 105, 103, 105, 116, 115 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0) + + + return FractionDigits; + + } + + else if (data[0] == 115) + + + { + + static const unsigned short string[] = + { + 99, 104, 101, 109, 97, 76, 111, 99, 97, 116, 105, 111, 110 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0) + + + return SchemaLocation; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier15(const QChar *data) + + { + if (data[0] == 112) + + + { + + static const unsigned short string[] = + { + 114, 111, 99, 101, 115, 115, 67, 111, 110, 116, 101, 110, 116, 115 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 14) == 0) + + + return ProcessContents; + + } + + else if (data[0] == 116) + + + { + + static const unsigned short string[] = + { + 97, 114, 103, 101, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 14) == 0) + + + return TargetNamespace; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier17(const QChar *data) + + { + if (data[0] == 100) + + + { + + static const unsigned short string[] = + { + 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 16) == 0) + + + return DefaultAttributes; + + } + + else if (data[0] == 115) + + + { + + static const unsigned short string[] = + { + 117, 98, 115, 116, 105, 116, 117, 116, 105, 111, 110, 71, 114, 111, 117, 112 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 16) == 0) + + + return SubstitutionGroup; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier18(const QChar *data) + + { + if (data[0] == 100) + + + { + + static const unsigned short string[] = + { + 101, 102, 97, 117, 108, 116, 79, 112, 101, 110, 67, 111, 110, 116, 101, 110, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 17) == 0) + + + return DefaultOpenContent; + + } + + else if (data[0] == 101) + + + { + + static const unsigned short string[] = + { + 108, 101, 109, 101, 110, 116, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116 + }; + if(memcmp(&data[1], &string, sizeof(QChar) * 17) == 0) + + + return ElementFormDefault; + + } + + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier20(const QChar *data) + + { + + static const unsigned short string[] = + { + 97, 116, 116, 114, 105, 98, 117, 116, 101, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116 + }; + if(memcmp(&data[0], &string, sizeof(QChar) * 20) == 0) + + + return AttributeFormDefault; + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier21(const QChar *data) + + { + + static const unsigned short string[] = + { + 120, 112, 97, 116, 104, 68, 101, 102, 97, 117, 108, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101 + }; + if(memcmp(&data[0], &string, sizeof(QChar) * 21) == 0) + + + return XPathDefaultNamespace; + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier22(const QChar *data) + + { + + static const unsigned short string[] = + { + 100, 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115, 65, 112, 112, 108, 121 + }; + if(memcmp(&data[0], &string, sizeof(QChar) * 22) == 0) + + + return DefaultAttributesApply; + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::classifier32(const QChar *data) + + { + + static const unsigned short string[] = + { + 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 49, 47, 88, 77, 76, 83, 99, 104, 101, 109, 97 + }; + if(memcmp(&data[0], &string, sizeof(QChar) * 32) == 0) + + + return XML_NS_SCHEMA_URI; + + + return NoKeyword; + } + XsdSchemaToken::NodeName XsdSchemaToken::toToken(const QChar *data, int length) + { + switch(length) + { + + case 2: + return classifier2(data); + + + case 3: + return classifier3(data); + + + case 4: + return classifier4(data); + + + case 5: + return classifier5(data); + + + case 6: + return classifier6(data); + + + case 7: + return classifier7(data); + + + case 8: + return classifier8(data); + + + case 9: + return classifier9(data); + + + case 10: + return classifier10(data); + + + case 11: + return classifier11(data); + + + case 12: + return classifier12(data); + + + case 13: + return classifier13(data); + + + case 14: + return classifier14(data); + + + case 15: + return classifier15(data); + + + case 17: + return classifier17(data); + + + case 18: + return classifier18(data); + + + case 20: + return classifier20(data); + + + case 21: + return classifier21(data); + + + case 22: + return classifier22(data); + + + case 32: + return classifier32(data); + + + default: + return NoKeyword; + } + } + + + QString XsdSchemaToken::toString(NodeName token) + { + const unsigned short *data = 0; + int length = 0; + + switch(token) + { + + case Abstract: + { + static const unsigned short staticallyStoredAbstract[] = + { + 97, 98, 115, 116, 114, 97, 99, 116, 0 + }; + data = staticallyStoredAbstract; + length = 8; + break; + } + + case All: + { + static const unsigned short staticallyStoredAll[] = + { + 97, 108, 108, 0 + }; + data = staticallyStoredAll; + length = 3; + break; + } + + case Alternative: + { + static const unsigned short staticallyStoredAlternative[] = + { + 97, 108, 116, 101, 114, 110, 97, 116, 105, 118, 101, 0 + }; + data = staticallyStoredAlternative; + length = 11; + break; + } + + case Annotation: + { + static const unsigned short staticallyStoredAnnotation[] = + { + 97, 110, 110, 111, 116, 97, 116, 105, 111, 110, 0 + }; + data = staticallyStoredAnnotation; + length = 10; + break; + } + + case Any: + { + static const unsigned short staticallyStoredAny[] = + { + 97, 110, 121, 0 + }; + data = staticallyStoredAny; + length = 3; + break; + } + + case AnyAttribute: + { + static const unsigned short staticallyStoredAnyAttribute[] = + { + 97, 110, 121, 65, 116, 116, 114, 105, 98, 117, 116, 101, 0 + }; + data = staticallyStoredAnyAttribute; + length = 12; + break; + } + + case Appinfo: + { + static const unsigned short staticallyStoredAppinfo[] = + { + 97, 112, 112, 105, 110, 102, 111, 0 + }; + data = staticallyStoredAppinfo; + length = 7; + break; + } + + case AppliesToEmpty: + { + static const unsigned short staticallyStoredAppliesToEmpty[] = + { + 97, 112, 112, 108, 105, 101, 115, 84, 111, 69, 109, 112, 116, 121, 0 + }; + data = staticallyStoredAppliesToEmpty; + length = 14; + break; + } + + case Assert: + { + static const unsigned short staticallyStoredAssert[] = + { + 97, 115, 115, 101, 114, 116, 0 + }; + data = staticallyStoredAssert; + length = 6; + break; + } + + case Assertion: + { + static const unsigned short staticallyStoredAssertion[] = + { + 97, 115, 115, 101, 114, 116, 105, 111, 110, 0 + }; + data = staticallyStoredAssertion; + length = 9; + break; + } + + case Attribute: + { + static const unsigned short staticallyStoredAttribute[] = + { + 97, 116, 116, 114, 105, 98, 117, 116, 101, 0 + }; + data = staticallyStoredAttribute; + length = 9; + break; + } + + case AttributeFormDefault: + { + static const unsigned short staticallyStoredAttributeFormDefault[] = + { + 97, 116, 116, 114, 105, 98, 117, 116, 101, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116, 0 + }; + data = staticallyStoredAttributeFormDefault; + length = 20; + break; + } + + case AttributeGroup: + { + static const unsigned short staticallyStoredAttributeGroup[] = + { + 97, 116, 116, 114, 105, 98, 117, 116, 101, 71, 114, 111, 117, 112, 0 + }; + data = staticallyStoredAttributeGroup; + length = 14; + break; + } + + case Base: + { + static const unsigned short staticallyStoredBase[] = + { + 98, 97, 115, 101, 0 + }; + data = staticallyStoredBase; + length = 4; + break; + } + + case Block: + { + static const unsigned short staticallyStoredBlock[] = + { + 98, 108, 111, 99, 107, 0 + }; + data = staticallyStoredBlock; + length = 5; + break; + } + + case BlockDefault: + { + static const unsigned short staticallyStoredBlockDefault[] = + { + 98, 108, 111, 99, 107, 68, 101, 102, 97, 117, 108, 116, 0 + }; + data = staticallyStoredBlockDefault; + length = 12; + break; + } + + case Choice: + { + static const unsigned short staticallyStoredChoice[] = + { + 99, 104, 111, 105, 99, 101, 0 + }; + data = staticallyStoredChoice; + length = 6; + break; + } + + case Collapse: + { + static const unsigned short staticallyStoredCollapse[] = + { + 99, 111, 108, 108, 97, 112, 115, 101, 0 + }; + data = staticallyStoredCollapse; + length = 8; + break; + } + + case ComplexContent: + { + static const unsigned short staticallyStoredComplexContent[] = + { + 99, 111, 109, 112, 108, 101, 120, 67, 111, 110, 116, 101, 110, 116, 0 + }; + data = staticallyStoredComplexContent; + length = 14; + break; + } + + case ComplexType: + { + static const unsigned short staticallyStoredComplexType[] = + { + 99, 111, 109, 112, 108, 101, 120, 84, 121, 112, 101, 0 + }; + data = staticallyStoredComplexType; + length = 11; + break; + } + + case Default: + { + static const unsigned short staticallyStoredDefault[] = + { + 100, 101, 102, 97, 117, 108, 116, 0 + }; + data = staticallyStoredDefault; + length = 7; + break; + } + + case DefaultAttributes: + { + static const unsigned short staticallyStoredDefaultAttributes[] = + { + 100, 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115, 0 + }; + data = staticallyStoredDefaultAttributes; + length = 17; + break; + } + + case DefaultAttributesApply: + { + static const unsigned short staticallyStoredDefaultAttributesApply[] = + { + 100, 101, 102, 97, 117, 108, 116, 65, 116, 116, 114, 105, 98, 117, 116, 101, 115, 65, 112, 112, 108, 121, 0 + }; + data = staticallyStoredDefaultAttributesApply; + length = 22; + break; + } + + case DefaultOpenContent: + { + static const unsigned short staticallyStoredDefaultOpenContent[] = + { + 100, 101, 102, 97, 117, 108, 116, 79, 112, 101, 110, 67, 111, 110, 116, 101, 110, 116, 0 + }; + data = staticallyStoredDefaultOpenContent; + length = 18; + break; + } + + case Documentation: + { + static const unsigned short staticallyStoredDocumentation[] = + { + 100, 111, 99, 117, 109, 101, 110, 116, 97, 116, 105, 111, 110, 0 + }; + data = staticallyStoredDocumentation; + length = 13; + break; + } + + case Element: + { + static const unsigned short staticallyStoredElement[] = + { + 101, 108, 101, 109, 101, 110, 116, 0 + }; + data = staticallyStoredElement; + length = 7; + break; + } + + case ElementFormDefault: + { + static const unsigned short staticallyStoredElementFormDefault[] = + { + 101, 108, 101, 109, 101, 110, 116, 70, 111, 114, 109, 68, 101, 102, 97, 117, 108, 116, 0 + }; + data = staticallyStoredElementFormDefault; + length = 18; + break; + } + + case Enumeration: + { + static const unsigned short staticallyStoredEnumeration[] = + { + 101, 110, 117, 109, 101, 114, 97, 116, 105, 111, 110, 0 + }; + data = staticallyStoredEnumeration; + length = 11; + break; + } + + case Extension: + { + static const unsigned short staticallyStoredExtension[] = + { + 101, 120, 116, 101, 110, 115, 105, 111, 110, 0 + }; + data = staticallyStoredExtension; + length = 9; + break; + } + + case Field: + { + static const unsigned short staticallyStoredField[] = + { + 102, 105, 101, 108, 100, 0 + }; + data = staticallyStoredField; + length = 5; + break; + } + + case Final: + { + static const unsigned short staticallyStoredFinal[] = + { + 102, 105, 110, 97, 108, 0 + }; + data = staticallyStoredFinal; + length = 5; + break; + } + + case FinalDefault: + { + static const unsigned short staticallyStoredFinalDefault[] = + { + 102, 105, 110, 97, 108, 68, 101, 102, 97, 117, 108, 116, 0 + }; + data = staticallyStoredFinalDefault; + length = 12; + break; + } + + case Fixed: + { + static const unsigned short staticallyStoredFixed[] = + { + 102, 105, 120, 101, 100, 0 + }; + data = staticallyStoredFixed; + length = 5; + break; + } + + case Form: + { + static const unsigned short staticallyStoredForm[] = + { + 102, 111, 114, 109, 0 + }; + data = staticallyStoredForm; + length = 4; + break; + } + + case FractionDigits: + { + static const unsigned short staticallyStoredFractionDigits[] = + { + 102, 114, 97, 99, 116, 105, 111, 110, 68, 105, 103, 105, 116, 115, 0 + }; + data = staticallyStoredFractionDigits; + length = 14; + break; + } + + case Group: + { + static const unsigned short staticallyStoredGroup[] = + { + 103, 114, 111, 117, 112, 0 + }; + data = staticallyStoredGroup; + length = 5; + break; + } + + case Id: + { + static const unsigned short staticallyStoredId[] = + { + 105, 100, 0 + }; + data = staticallyStoredId; + length = 2; + break; + } + + case Import: + { + static const unsigned short staticallyStoredImport[] = + { + 105, 109, 112, 111, 114, 116, 0 + }; + data = staticallyStoredImport; + length = 6; + break; + } + + case Include: + { + static const unsigned short staticallyStoredInclude[] = + { + 105, 110, 99, 108, 117, 100, 101, 0 + }; + data = staticallyStoredInclude; + length = 7; + break; + } + + case ItemType: + { + static const unsigned short staticallyStoredItemType[] = + { + 105, 116, 101, 109, 84, 121, 112, 101, 0 + }; + data = staticallyStoredItemType; + length = 8; + break; + } + + case Key: + { + static const unsigned short staticallyStoredKey[] = + { + 107, 101, 121, 0 + }; + data = staticallyStoredKey; + length = 3; + break; + } + + case Keyref: + { + static const unsigned short staticallyStoredKeyref[] = + { + 107, 101, 121, 114, 101, 102, 0 + }; + data = staticallyStoredKeyref; + length = 6; + break; + } + + case Length: + { + static const unsigned short staticallyStoredLength[] = + { + 108, 101, 110, 103, 116, 104, 0 + }; + data = staticallyStoredLength; + length = 6; + break; + } + + case List: + { + static const unsigned short staticallyStoredList[] = + { + 108, 105, 115, 116, 0 + }; + data = staticallyStoredList; + length = 4; + break; + } + + case MaxExclusive: + { + static const unsigned short staticallyStoredMaxExclusive[] = + { + 109, 97, 120, 69, 120, 99, 108, 117, 115, 105, 118, 101, 0 + }; + data = staticallyStoredMaxExclusive; + length = 12; + break; + } + + case MaxInclusive: + { + static const unsigned short staticallyStoredMaxInclusive[] = + { + 109, 97, 120, 73, 110, 99, 108, 117, 115, 105, 118, 101, 0 + }; + data = staticallyStoredMaxInclusive; + length = 12; + break; + } + + case MaxLength: + { + static const unsigned short staticallyStoredMaxLength[] = + { + 109, 97, 120, 76, 101, 110, 103, 116, 104, 0 + }; + data = staticallyStoredMaxLength; + length = 9; + break; + } + + case MaxOccurs: + { + static const unsigned short staticallyStoredMaxOccurs[] = + { + 109, 97, 120, 79, 99, 99, 117, 114, 115, 0 + }; + data = staticallyStoredMaxOccurs; + length = 9; + break; + } + + case MemberTypes: + { + static const unsigned short staticallyStoredMemberTypes[] = + { + 109, 101, 109, 98, 101, 114, 84, 121, 112, 101, 115, 0 + }; + data = staticallyStoredMemberTypes; + length = 11; + break; + } + + case MinExclusive: + { + static const unsigned short staticallyStoredMinExclusive[] = + { + 109, 105, 110, 69, 120, 99, 108, 117, 115, 105, 118, 101, 0 + }; + data = staticallyStoredMinExclusive; + length = 12; + break; + } + + case MinInclusive: + { + static const unsigned short staticallyStoredMinInclusive[] = + { + 109, 105, 110, 73, 110, 99, 108, 117, 115, 105, 118, 101, 0 + }; + data = staticallyStoredMinInclusive; + length = 12; + break; + } + + case MinLength: + { + static const unsigned short staticallyStoredMinLength[] = + { + 109, 105, 110, 76, 101, 110, 103, 116, 104, 0 + }; + data = staticallyStoredMinLength; + length = 9; + break; + } + + case MinOccurs: + { + static const unsigned short staticallyStoredMinOccurs[] = + { + 109, 105, 110, 79, 99, 99, 117, 114, 115, 0 + }; + data = staticallyStoredMinOccurs; + length = 9; + break; + } + + case Mixed: + { + static const unsigned short staticallyStoredMixed[] = + { + 109, 105, 120, 101, 100, 0 + }; + data = staticallyStoredMixed; + length = 5; + break; + } + + case Mode: + { + static const unsigned short staticallyStoredMode[] = + { + 109, 111, 100, 101, 0 + }; + data = staticallyStoredMode; + length = 4; + break; + } + + case Name: + { + static const unsigned short staticallyStoredName[] = + { + 110, 97, 109, 101, 0 + }; + data = staticallyStoredName; + length = 4; + break; + } + + case Namespace: + { + static const unsigned short staticallyStoredNamespace[] = + { + 110, 97, 109, 101, 115, 112, 97, 99, 101, 0 + }; + data = staticallyStoredNamespace; + length = 9; + break; + } + + case Nillable: + { + static const unsigned short staticallyStoredNillable[] = + { + 110, 105, 108, 108, 97, 98, 108, 101, 0 + }; + data = staticallyStoredNillable; + length = 8; + break; + } + + case NotNamespace: + { + static const unsigned short staticallyStoredNotNamespace[] = + { + 110, 111, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101, 0 + }; + data = staticallyStoredNotNamespace; + length = 12; + break; + } + + case NotQName: + { + static const unsigned short staticallyStoredNotQName[] = + { + 110, 111, 116, 81, 78, 97, 109, 101, 0 + }; + data = staticallyStoredNotQName; + length = 8; + break; + } + + case Notation: + { + static const unsigned short staticallyStoredNotation[] = + { + 110, 111, 116, 97, 116, 105, 111, 110, 0 + }; + data = staticallyStoredNotation; + length = 8; + break; + } + + case OpenContent: + { + static const unsigned short staticallyStoredOpenContent[] = + { + 111, 112, 101, 110, 67, 111, 110, 116, 101, 110, 116, 0 + }; + data = staticallyStoredOpenContent; + length = 11; + break; + } + + case Override: + { + static const unsigned short staticallyStoredOverride[] = + { + 111, 118, 101, 114, 114, 105, 100, 101, 0 + }; + data = staticallyStoredOverride; + length = 8; + break; + } + + case Pattern: + { + static const unsigned short staticallyStoredPattern[] = + { + 112, 97, 116, 116, 101, 114, 110, 0 + }; + data = staticallyStoredPattern; + length = 7; + break; + } + + case Preserve: + { + static const unsigned short staticallyStoredPreserve[] = + { + 112, 114, 101, 115, 101, 114, 118, 101, 0 + }; + data = staticallyStoredPreserve; + length = 8; + break; + } + + case ProcessContents: + { + static const unsigned short staticallyStoredProcessContents[] = + { + 112, 114, 111, 99, 101, 115, 115, 67, 111, 110, 116, 101, 110, 116, 115, 0 + }; + data = staticallyStoredProcessContents; + length = 15; + break; + } + + case Public: + { + static const unsigned short staticallyStoredPublic[] = + { + 112, 117, 98, 108, 105, 99, 0 + }; + data = staticallyStoredPublic; + length = 6; + break; + } + + case Redefine: + { + static const unsigned short staticallyStoredRedefine[] = + { + 114, 101, 100, 101, 102, 105, 110, 101, 0 + }; + data = staticallyStoredRedefine; + length = 8; + break; + } + + case Ref: + { + static const unsigned short staticallyStoredRef[] = + { + 114, 101, 102, 0 + }; + data = staticallyStoredRef; + length = 3; + break; + } + + case Refer: + { + static const unsigned short staticallyStoredRefer[] = + { + 114, 101, 102, 101, 114, 0 + }; + data = staticallyStoredRefer; + length = 5; + break; + } + + case Replace: + { + static const unsigned short staticallyStoredReplace[] = + { + 114, 101, 112, 108, 97, 99, 101, 0 + }; + data = staticallyStoredReplace; + length = 7; + break; + } + + case Restriction: + { + static const unsigned short staticallyStoredRestriction[] = + { + 114, 101, 115, 116, 114, 105, 99, 116, 105, 111, 110, 0 + }; + data = staticallyStoredRestriction; + length = 11; + break; + } + + case Schema: + { + static const unsigned short staticallyStoredSchema[] = + { + 115, 99, 104, 101, 109, 97, 0 + }; + data = staticallyStoredSchema; + length = 6; + break; + } + + case SchemaLocation: + { + static const unsigned short staticallyStoredSchemaLocation[] = + { + 115, 99, 104, 101, 109, 97, 76, 111, 99, 97, 116, 105, 111, 110, 0 + }; + data = staticallyStoredSchemaLocation; + length = 14; + break; + } + + case Selector: + { + static const unsigned short staticallyStoredSelector[] = + { + 115, 101, 108, 101, 99, 116, 111, 114, 0 + }; + data = staticallyStoredSelector; + length = 8; + break; + } + + case Sequence: + { + static const unsigned short staticallyStoredSequence[] = + { + 115, 101, 113, 117, 101, 110, 99, 101, 0 + }; + data = staticallyStoredSequence; + length = 8; + break; + } + + case SimpleContent: + { + static const unsigned short staticallyStoredSimpleContent[] = + { + 115, 105, 109, 112, 108, 101, 67, 111, 110, 116, 101, 110, 116, 0 + }; + data = staticallyStoredSimpleContent; + length = 13; + break; + } + + case SimpleType: + { + static const unsigned short staticallyStoredSimpleType[] = + { + 115, 105, 109, 112, 108, 101, 84, 121, 112, 101, 0 + }; + data = staticallyStoredSimpleType; + length = 10; + break; + } + + case Source: + { + static const unsigned short staticallyStoredSource[] = + { + 115, 111, 117, 114, 99, 101, 0 + }; + data = staticallyStoredSource; + length = 6; + break; + } + + case SubstitutionGroup: + { + static const unsigned short staticallyStoredSubstitutionGroup[] = + { + 115, 117, 98, 115, 116, 105, 116, 117, 116, 105, 111, 110, 71, 114, 111, 117, 112, 0 + }; + data = staticallyStoredSubstitutionGroup; + length = 17; + break; + } + + case System: + { + static const unsigned short staticallyStoredSystem[] = + { + 115, 121, 115, 116, 101, 109, 0 + }; + data = staticallyStoredSystem; + length = 6; + break; + } + + case TargetNamespace: + { + static const unsigned short staticallyStoredTargetNamespace[] = + { + 116, 97, 114, 103, 101, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101, 0 + }; + data = staticallyStoredTargetNamespace; + length = 15; + break; + } + + case Test: + { + static const unsigned short staticallyStoredTest[] = + { + 116, 101, 115, 116, 0 + }; + data = staticallyStoredTest; + length = 4; + break; + } + + case TotalDigits: + { + static const unsigned short staticallyStoredTotalDigits[] = + { + 116, 111, 116, 97, 108, 68, 105, 103, 105, 116, 115, 0 + }; + data = staticallyStoredTotalDigits; + length = 11; + break; + } + + case Type: + { + static const unsigned short staticallyStoredType[] = + { + 116, 121, 112, 101, 0 + }; + data = staticallyStoredType; + length = 4; + break; + } + + case Union: + { + static const unsigned short staticallyStoredUnion[] = + { + 117, 110, 105, 111, 110, 0 + }; + data = staticallyStoredUnion; + length = 5; + break; + } + + case Unique: + { + static const unsigned short staticallyStoredUnique[] = + { + 117, 110, 105, 113, 117, 101, 0 + }; + data = staticallyStoredUnique; + length = 6; + break; + } + + case Use: + { + static const unsigned short staticallyStoredUse[] = + { + 117, 115, 101, 0 + }; + data = staticallyStoredUse; + length = 3; + break; + } + + case Value: + { + static const unsigned short staticallyStoredValue[] = + { + 118, 97, 108, 117, 101, 0 + }; + data = staticallyStoredValue; + length = 5; + break; + } + + case Version: + { + static const unsigned short staticallyStoredVersion[] = + { + 118, 101, 114, 115, 105, 111, 110, 0 + }; + data = staticallyStoredVersion; + length = 7; + break; + } + + case WhiteSpace: + { + static const unsigned short staticallyStoredWhiteSpace[] = + { + 119, 104, 105, 116, 101, 83, 112, 97, 99, 101, 0 + }; + data = staticallyStoredWhiteSpace; + length = 10; + break; + } + + case XML_NS_SCHEMA_URI: + { + static const unsigned short staticallyStoredXML_NS_SCHEMA_URI[] = + { + 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 50, 48, 48, 49, 47, 88, 77, 76, 83, 99, 104, 101, 109, 97, 0 + }; + data = staticallyStoredXML_NS_SCHEMA_URI; + length = 32; + break; + } + + case XPathDefaultNamespace: + { + static const unsigned short staticallyStoredXPathDefaultNamespace[] = + { + 120, 112, 97, 116, 104, 68, 101, 102, 97, 117, 108, 116, 78, 97, 109, 101, 115, 112, 97, 99, 101, 0 + }; + data = staticallyStoredXPathDefaultNamespace; + length = 21; + break; + } + + case XmlLanguage: + { + static const unsigned short staticallyStoredXmlLanguage[] = + { + 120, 109, 108, 58, 108, 97, 110, 103, 0 + }; + data = staticallyStoredXmlLanguage; + length = 8; + break; + } + + case Xpath: + { + static const unsigned short staticallyStoredXpath[] = + { + 120, 112, 97, 116, 104, 0 + }; + data = staticallyStoredXpath; + length = 5; + break; + } + + default: + /* It's either the default token, or an undefined enum + * value. We silence a compiler warning, and return the + * empty string. */ + ; + } + + union + { + const unsigned short *data; + const QChar *asQChar; + } converter; + converter.data = data; + + return QString::fromRawData(converter.asQChar, length); + } + +QT_END_NAMESPACE + diff --git a/src/xmlpatterns/schema/qxsdschematoken_p.h b/src/xmlpatterns/schema/qxsdschematoken_p.h new file mode 100644 index 0000000..8cb1e76 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschematoken_p.h @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +/* NOTE: This file is AUTO GENERATED by qautomaton2cpp.xsl. */ + +#ifndef QPatternist_XsdSchemaToken_h +#define QPatternist_XsdSchemaToken_h + +#include + +QT_BEGIN_NAMESPACE + +class XsdSchemaToken + { + public: + enum NodeName + + { + NoKeyword, +Abstract, +All, +Alternative, +Annotation, +Any, +AnyAttribute, +Appinfo, +AppliesToEmpty, +Assert, +Assertion, +Attribute, +AttributeFormDefault, +AttributeGroup, +Base, +Block, +BlockDefault, +Choice, +Collapse, +ComplexContent, +ComplexType, +Default, +DefaultAttributes, +DefaultAttributesApply, +DefaultOpenContent, +Documentation, +Element, +ElementFormDefault, +Enumeration, +Extension, +Field, +Final, +FinalDefault, +Fixed, +Form, +FractionDigits, +Group, +Id, +Import, +Include, +ItemType, +Key, +Keyref, +Length, +List, +MaxExclusive, +MaxInclusive, +MaxLength, +MaxOccurs, +MemberTypes, +MinExclusive, +MinInclusive, +MinLength, +MinOccurs, +Mixed, +Mode, +Name, +Namespace, +Nillable, +NotNamespace, +NotQName, +Notation, +OpenContent, +Override, +Pattern, +Preserve, +ProcessContents, +Public, +Redefine, +Ref, +Refer, +Replace, +Restriction, +Schema, +SchemaLocation, +Selector, +Sequence, +SimpleContent, +SimpleType, +Source, +SubstitutionGroup, +System, +TargetNamespace, +Test, +TotalDigits, +Type, +Union, +Unique, +Use, +Value, +Version, +WhiteSpace, +XML_NS_SCHEMA_URI, +XPathDefaultNamespace, +XmlLanguage, +Xpath + }; + + static inline NodeName toToken(const QString &value); +static inline NodeName toToken(const QStringRef &value); +static NodeName toToken(const QChar *data, int length); +static QString toString(NodeName token); + + + private: + static inline NodeName classifier2(const QChar *data); +static inline NodeName classifier3(const QChar *data); +static inline NodeName classifier4(const QChar *data); +static inline NodeName classifier5(const QChar *data); +static inline NodeName classifier6(const QChar *data); +static inline NodeName classifier7(const QChar *data); +static inline NodeName classifier8(const QChar *data); +static inline NodeName classifier9(const QChar *data); +static inline NodeName classifier10(const QChar *data); +static inline NodeName classifier11(const QChar *data); +static inline NodeName classifier12(const QChar *data); +static inline NodeName classifier13(const QChar *data); +static inline NodeName classifier14(const QChar *data); +static inline NodeName classifier15(const QChar *data); +static inline NodeName classifier17(const QChar *data); +static inline NodeName classifier18(const QChar *data); +static inline NodeName classifier20(const QChar *data); +static inline NodeName classifier21(const QChar *data); +static inline NodeName classifier22(const QChar *data); +static inline NodeName classifier32(const QChar *data); + + }; + + inline XsdSchemaToken::NodeName XsdSchemaToken::toToken(const QString &value) + { + return toToken(value.constData(), value.length()); + } + + inline XsdSchemaToken::NodeName XsdSchemaToken::toToken(const QStringRef &value) + { + return toToken(value.constData(), value.length()); + } + + +QT_END_NAMESPACE + +#endif diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory.cpp b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp new file mode 100644 index 0000000..6cac0ff --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdschematypesfactory_p.h" + +#include "qbasictypesfactory_p.h" +#include "qbuiltintypes_p.h" +#include "qderivedinteger_p.h" +#include "qderivedstring_p.h" +#include "qcommonnamespaces_p.h" +#include "qxsdschematoken_p.h" +#include "qxsdsimpletype_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaTypesFactory::XsdSchemaTypesFactory(const NamePool::Ptr &namePool) + : m_namePool(namePool) +{ + m_types.reserve(3); + + const XsdFacet::Ptr whiteSpaceFacet(new XsdFacet()); + whiteSpaceFacet->setType(XsdFacet::WhiteSpace); + whiteSpaceFacet->setFixed(true); + whiteSpaceFacet->setValue(DerivedString::fromLexical(m_namePool, XsdSchemaToken::toString(XsdSchemaToken::Collapse))); + + const XsdFacet::Ptr minLengthFacet(new XsdFacet()); + minLengthFacet->setType(XsdFacet::MinimumLength); + minLengthFacet->setValue(DerivedInteger::fromLexical(namePool, QLatin1String("1"))); + + XsdFacet::Hash facets; + facets.insert(whiteSpaceFacet->type(), whiteSpaceFacet); + facets.insert(minLengthFacet->type(), minLengthFacet); + + { + const QXmlName typeName = m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("NMTOKENS")); + const XsdSimpleType::Ptr type(new XsdSimpleType()); + type->setName(typeName); + type->setWxsSuperType(BuiltinTypes::xsAnySimpleType); + type->setCategory(XsdSimpleType::SimpleTypeList); + type->setItemType(BuiltinTypes::xsNMTOKEN); + type->setDerivationMethod(XsdSimpleType::DerivationRestriction); + type->setFacets(facets); + m_types.insert(typeName, type); + } + { + const QXmlName typeName = m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("IDREFS")); + const XsdSimpleType::Ptr type(new XsdSimpleType()); + type->setName(typeName); + type->setWxsSuperType(BuiltinTypes::xsAnySimpleType); + type->setCategory(XsdSimpleType::SimpleTypeList); + type->setItemType(BuiltinTypes::xsIDREF); + type->setDerivationMethod(XsdSimpleType::DerivationRestriction); + type->setFacets(facets); + m_types.insert(typeName, type); + } + { + const QXmlName typeName = m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("ENTITIES")); + const XsdSimpleType::Ptr type(new XsdSimpleType()); + type->setName(typeName); + type->setWxsSuperType(BuiltinTypes::xsAnySimpleType); + type->setCategory(XsdSimpleType::SimpleTypeList); + type->setItemType(BuiltinTypes::xsENTITY); + type->setDerivationMethod(XsdSimpleType::DerivationRestriction); + type->setFacets(facets); + m_types.insert(typeName, type); + } +} + +SchemaType::Ptr XsdSchemaTypesFactory::createSchemaType(const QXmlName name) const +{ + if (m_types.contains(name)) { + return m_types.value(name); + } else { + if (!m_basicTypesFactory) + m_basicTypesFactory = BasicTypesFactory::self(m_namePool); + + return m_basicTypesFactory->createSchemaType(name); + } +} + +SchemaType::Hash XsdSchemaTypesFactory::types() const +{ + return m_types; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory_p.h b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h new file mode 100644 index 0000000..4fcd5fb --- /dev/null +++ b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSchemaTypesFactory_H +#define Patternist_XsdSchemaTypesFactory_H + +#include +#include "qschematypefactory_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + + /** + * @short Factory for creating schema types for the types defined in XSD. + * + * @ingroup Patternist_types + * @author Tobias Koenig + */ + class XsdSchemaTypesFactory : public SchemaTypeFactory + { + public: + /** + * Creates a new schema type factory. + * + * @param namePool The name pool all type names belong to. + */ + XsdSchemaTypesFactory(const NamePool::Ptr &namePool); + + /** + * Creates a primitive type for @p name. If @p name is not supported, + * @c null is returned. + * + * @note This does not handle user defined types, only builtin types. + */ + virtual SchemaType::Ptr createSchemaType(const QXmlName) const; + + /** + * Returns a hash of all available types. + */ + virtual SchemaType::Hash types() const; + + private: + /** + * A dictonary of all predefined schema types. + */ + SchemaType::Hash m_types; + + NamePool::Ptr m_namePool; + mutable SchemaTypeFactory::Ptr m_basicTypesFactory; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdsimpletype.cpp b/src/xmlpatterns/schema/qxsdsimpletype.cpp new file mode 100644 index 0000000..2e5b7f5 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdsimpletype.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#include "qxsdsimpletype_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +QString XsdSimpleType::displayName(const NamePool::Ptr &np) const +{ + return np->displayName(name(np)); +} + +void XsdSimpleType::setWxsSuperType(const SchemaType::Ptr &type) +{ + m_superType = type; +} + +SchemaType::Ptr XsdSimpleType::wxsSuperType() const +{ + return m_superType; +} + +void XsdSimpleType::setContext(const NamedSchemaComponent::Ptr &component) +{ + m_context = component; +} + +NamedSchemaComponent::Ptr XsdSimpleType::context() const +{ + return m_context; +} + +void XsdSimpleType::setPrimitiveType(const AnySimpleType::Ptr &type) +{ + m_primitiveType = type; +} + +AnySimpleType::Ptr XsdSimpleType::primitiveType() const +{ + return m_primitiveType; +} + +void XsdSimpleType::setItemType(const AnySimpleType::Ptr &type) +{ + m_itemType = type; +} + +AnySimpleType::Ptr XsdSimpleType::itemType() const +{ + return m_itemType; +} + +void XsdSimpleType::setMemberTypes(const AnySimpleType::List &types) +{ + m_memberTypes = types; +} + +AnySimpleType::List XsdSimpleType::memberTypes() const +{ + return m_memberTypes; +} + +void XsdSimpleType::setFacets(const XsdFacet::Hash &facets) +{ + m_facets = facets; +} + +XsdFacet::Hash XsdSimpleType::facets() const +{ + return m_facets; +} + +void XsdSimpleType::setCategory(TypeCategory category) +{ + m_typeCategory = category; +} + +XsdSimpleType::TypeCategory XsdSimpleType::category() const +{ + return m_typeCategory; +} + +void XsdSimpleType::setDerivationMethod(DerivationMethod method) +{ + m_derivationMethod = method; +} + +XsdSimpleType::DerivationMethod XsdSimpleType::derivationMethod() const +{ + return m_derivationMethod; +} + +bool XsdSimpleType::isDefinedBySchema() const +{ + return true; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdsimpletype_p.h b/src/xmlpatterns/schema/qxsdsimpletype_p.h new file mode 100644 index 0000000..9ba34b6 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdsimpletype_p.h @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdSimpleType_H +#define Patternist_XsdSimpleType_H + +#include "qanysimpletype_p.h" +#include "qxsdfacet_p.h" +#include "qxsduserschematype_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD simpleType object. + * + * This class represents the simpleType object of a XML schema as described + * here. + * + * It contains information from either a top-level simple type declaration (as child of a schema object) + * or a local simple type declaration (as descendant of an element or complexType object). + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdSimpleType : public XsdUserSchemaType + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Returns the display name of the simple type. + * + * @param namePool The name pool the type name is stored in. + */ + virtual QString displayName(const NamePool::Ptr &namePool) const; + + /** + * Sets the base @p type of the simple type. + * + * @see Base Type Definition + */ + void setWxsSuperType(const SchemaType::Ptr &type); + + /** + * Returns the base type of the simple type or an empty pointer if no base type is + * set. + */ + virtual SchemaType::Ptr wxsSuperType() const; + + /** + * Sets the context @p component of the simple type. + * + * @see Context Definition + */ + void setContext(const NamedSchemaComponent::Ptr &component); + + /** + * Returns the context component of the simple type. + */ + NamedSchemaComponent::Ptr context() const; + + /** + * Sets the primitive @p type of the simple type. + * + * The primitive type is only specified if the category is SimpleTypeAtomic. + * + * @see Primitive Type Definition + */ + void setPrimitiveType(const AnySimpleType::Ptr &type); + + /** + * Returns the primitive type of the simple type or an empty pointer if the category is + * not SimpleTypeAtomic. + */ + AnySimpleType::Ptr primitiveType() const; + + /** + * Sets the list item @p type of the simple type. + * + * The list item type is only specified if the category is SimpleTypeList. + * + * @see Item Type Definition + */ + void setItemType(const AnySimpleType::Ptr &type); + + /** + * Returns the list item type of the simple type or an empty pointer if the category is + * not SimpleTypeList. + */ + AnySimpleType::Ptr itemType() const; + + /** + * Sets the member @p types of the simple type. + * + * The member types are only specified if the category is SimpleTypeUnion. + * + * @see Member Types Definition + */ + void setMemberTypes(const AnySimpleType::List &types); + + /** + * Returns the list member types of the simple type or an empty list if the category is + * not SimpleTypeUnion. + */ + AnySimpleType::List memberTypes() const; + + /** + * Sets the @p facets of the simple type. + * + * @see Facets Definition + */ + void setFacets(const XsdFacet::Hash &facets); + + /** + * Returns the facets of the simple type. + */ + XsdFacet::Hash facets() const; + + /** + * Sets the @p category (variety) of the simple type. + * + * @see Variety Definition + */ + void setCategory(TypeCategory category); + + /** + * Returns the category (variety) of the simple type. + */ + virtual TypeCategory category() const; + + /** + * Sets the derivation @p method of the simple type. + * + * @see DerivationMethod + */ + void setDerivationMethod(DerivationMethod method); + + /** + * Returns the derivation method of the simple type. + */ + virtual DerivationMethod derivationMethod() const; + + /** + * Always returns @c true. + */ + virtual bool isDefinedBySchema() const; + + private: + SchemaType::Ptr m_superType; + NamedSchemaComponent::Ptr m_context; + AnySimpleType::Ptr m_primitiveType; + AnySimpleType::Ptr m_itemType; + AnySimpleType::List m_memberTypes; + XsdFacet::Hash m_facets; + TypeCategory m_typeCategory; + DerivationMethod m_derivationMethod; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdstatemachine.cpp b/src/xmlpatterns/schema/qxsdstatemachine.cpp new file mode 100644 index 0000000..e40e55b --- /dev/null +++ b/src/xmlpatterns/schema/qxsdstatemachine.cpp @@ -0,0 +1,433 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +/* + * NOTE: This file is included by qxsdstatemachine_p.h + * if you need some includes, put them in qxsdstatemachine_p.h (outside of the namespace) + */ + +template +XsdStateMachine::XsdStateMachine() + : m_counter(50) +{ +} + +template +XsdStateMachine::XsdStateMachine(const NamePool::Ptr &namePool) + : m_namePool(namePool) + , m_counter(50) +{ +} + +template +typename XsdStateMachine::StateId XsdStateMachine::addState(StateType type) +{ +#ifndef QT_NO_DEBUG + // make sure we don't have two start states + if (type == StartState) { + QHashIterator it(m_states); + while (it.hasNext()) { + it.next(); + Q_ASSERT(it.value() != StartState && it.value() != StartEndState); + } + } +#endif // QT_NO_DEBUG + + // reserve new state id + const StateId id = ++m_counter; + m_states.insert(id, type); + + // if it is a start state, we make it to our current state + if (type == StartState || type == StartEndState) + m_currentState = id; + + return id; +} + +template +void XsdStateMachine::addTransition(StateId start, TransitionType transition, StateId end) +{ + QHash > &hash = m_transitions[start]; + QVector &states = hash[transition]; + if (!states.contains(end)) + states.append(end); +} + +template +void XsdStateMachine::addEpsilonTransition(StateId start, StateId end) +{ + QVector &states = m_epsilonTransitions[start]; + states.append(end); +} + +template +void XsdStateMachine::reset() +{ + // reset the machine to the start state + QHashIterator it(m_states); + while (it.hasNext()) { + it.next(); + if (it.value() == StartState || it.value() == StartEndState) { + m_currentState = it.key(); + return; + } + } + + Q_ASSERT(false); +} + +template +void XsdStateMachine::clear() +{ + m_states.clear(); + m_transitions.clear(); + m_epsilonTransitions.clear(); + m_currentState = -1; + m_counter = 50; +} + +template +bool XsdStateMachine::proceed(TransitionType transition) +{ + // check that we are not in an invalid state + if (!m_transitions.contains(m_currentState)) { + return false; + } + + // fetch the transition entry for the current state + const QHash > &entry = m_transitions[m_currentState]; + if (entry.contains(transition)) { // is there an transition for the given input? + m_currentState = entry.value(transition).first(); + m_lastTransition = transition; + return true; + } else { + return false; + } +} + +template +template +bool XsdStateMachine::proceed(InputType input) +{ + // check that we are not in an invalid state + if (!m_transitions.contains(m_currentState)) { + return false; + } + + // fetch the transition entry for the current state + const QHash > &entry = m_transitions[m_currentState]; + QHashIterator > it(entry); + while (it.hasNext()) { + it.next(); + if (inputEqualsTransition(input, it.key())) { + m_currentState = it.value().first(); + m_lastTransition = it.key(); + return true; + } + } + + return false; +} + +template +template +bool XsdStateMachine::inputEqualsTransition(InputType input, TransitionType transition) const +{ + return false; +} + +template +bool XsdStateMachine::inEndState() const +{ + // check if current state is an end state + return (m_states.value(m_currentState) == StartEndState || m_states.value(m_currentState) == EndState); +} + +template +TransitionType XsdStateMachine::lastTransition() const +{ + return m_lastTransition; +} + +template +typename XsdStateMachine::StateId XsdStateMachine::startState() const +{ + QHashIterator it(m_states); + while (it.hasNext()) { + it.next(); + if (it.value() == StartState || it.value() == StartEndState) + return it.key(); + } + + Q_ASSERT(false); // should never be reached + return -1; +} + +template +QString XsdStateMachine::transitionTypeToString(TransitionType type) const +{ + Q_UNUSED(type) + + return QString(); +} + +template +bool XsdStateMachine::outputGraph(QIODevice *device, const QString &graphName) const +{ + if (!device->isOpen()) { + qWarning("device must be open for writing"); + return false; + } + + QByteArray graph; + QTextStream s(&graph); + + QHashIterator > > it(m_transitions); + QHashIterator it3(m_states); + + s << "digraph " << graphName << " {\n"; + s << " mindist = 2.0\n"; + + // draw edges + while (it.hasNext()) { + it.next(); + + QHashIterator > it2(it.value()); + while (it2.hasNext()) { + it2.next(); + for (int i = 0; i < it2.value().count(); ++i) + s << " " << it.key() << " -> " << it2.value().at(i) << " [label=\"" << transitionTypeToString(it2.key()) << "\"]\n"; + } + } + + QHashIterator > it4(m_epsilonTransitions); + while (it4.hasNext()) { + it4.next(); + + const QVector states = it4.value(); + for (int i = 0; i < states.count(); ++i) + s << " " << it4.key() << " -> " << states.at(i) << " [label=\"ε\"]\n"; + } + + // draw node infos + while (it3.hasNext()) { + it3.next(); + + QString style; + if (it3.value() == StartState) { + style = QLatin1String("shape=circle, style=filled, color=blue"); + } else if (it3.value() == StartEndState) { + style = QLatin1String("shape=doublecircle, style=filled, color=blue"); + } else if (it3.value() == InternalState) { + style = QLatin1String("shape=circle, style=filled, color=red"); + } else if (it3.value() == EndState) { + style = QLatin1String("shape=doublecircle, style=filled, color=green"); + } + + s << " " << it3.key() << " [" << style << "]\n"; + } + + s << "}\n"; + + s.flush(); + + if (device->write(graph) == -1) + return false; + + return true; +} + + +template +typename XsdStateMachine::StateId XsdStateMachine::dfaStateForNfaState(QSet nfaState, + QList< QPair, StateId> > &stateTable, + XsdStateMachine &dfa) const +{ + // check whether we have the given state in our lookup table + // already, in that case simply return it + for (int i = 0; i < stateTable.count(); ++i) { + if (stateTable.at(i).first == nfaState) + return stateTable.at(i).second; + } + + // check if the NFA state set contains a Start or End + // state, in that case our new DFA state will be a + // Start or End state as well + StateType type = InternalState; + QSetIterator it(nfaState); + bool hasStartState = false; + bool hasEndState = false; + while (it.hasNext()) { + const StateId state = it.next(); + if (m_states.value(state) == EndState) { + hasEndState = true; + } else if (m_states.value(state) == StartState) { + hasStartState = true; + } + } + if (hasStartState) { + if (hasEndState) + type = StartEndState; + else + type = StartState; + } else if (hasEndState) { + type = EndState; + } + + // create the new DFA state + const StateId dfaState = dfa.addState(type); + + // add the new DFA state to the lookup table + stateTable.append(qMakePair, StateId>(nfaState, dfaState)); + + return dfaState; +} + + +template +QSet::StateId> XsdStateMachine::epsilonClosure(const QSet &input) const +{ + // every state can reach itself by epsilon transition, so include the input states + // in the result as well + QSet result = input; + + // add the input states to the list of to be processed states + QList workStates = input.toList(); + while (!workStates.isEmpty()) { // while there are states to be processed left... + + // dequeue one state from list + const StateId state = workStates.takeFirst(); + + // get the list of states that can be reached by the epsilon transition + // from the current 'state' + const QVector targetStates = m_epsilonTransitions.value(state); + for (int i = 0; i < targetStates.count(); ++i) { + // if we have this target state not in our result set yet... + if (!result.contains(targetStates.at(i))) { + // ... add it to the result set + result.insert(targetStates.at(i)); + + // add the target state to the list of to be processed states as well, + // as we want to have the epsilon transitions not only for the first + // level of following states + workStates.append(targetStates.at(i)); + } + } + } + + return result; +} + +template +QSet::StateId> XsdStateMachine::move(const QSet &states, TransitionType input) const +{ + QSet result; + + QSetIterator it(states); + while (it.hasNext()) { // iterate over all given states + const StateId state = it.next(); + + // get the transition table for the current state + const QHash > transitions = m_transitions.value(state); + + // get the target states for the given input + const QVector targetStates = transitions.value(input); + + // add all target states to the result + for (int i = 0; i < targetStates.size(); ++i) + result.insert(targetStates.at(i)); + } + + return result; +} + +template +XsdStateMachine XsdStateMachine::toDFA() const +{ + XsdStateMachine dfa(m_namePool); + dfa.m_counter = 100; + QList< QPair< QSet, StateId> > table; + QList< QSet > isMarked; + + // search the start state as the algorithm starts with it... + StateId startState = -1; + QHashIterator stateTypeIt(m_states); + while (stateTypeIt.hasNext()) { + stateTypeIt.next(); + if (stateTypeIt.value() == StartState) { + startState = stateTypeIt.key(); + break; + } + } + Q_ASSERT(startState != -1); + + // our list of state set that still have to be processed + QList< QSet > workStates; + + // add the start state to the list of to processed state sets + workStates.append(epsilonClosure(QSet() << startState)); + + while (!workStates.isEmpty()) { // as long as there are state sets to process left + + // enqueue set of states + const QSet states = workStates.takeFirst(); + + if (isMarked.contains(states)) // we processed this state set already + continue; + + // mark as processed + isMarked.append(states); + + // select a list of all inputs that are possible for + // the 'states' set + QList input; + + { + QSetIterator it(states); + while (it.hasNext()) { + input << m_transitions.value(it.next()).keys(); + } + } + + // get the state in DFA that corresponds to the 'states' set in the NFA + const StateId dfaBegin = dfaStateForNfaState(states, table, dfa); + + for (int i = 0; i < input.count(); ++i) { // for each possible input + // retrieve the states that can be reached from the 'states' set by the + // given input or by epsilon transition + const QSet followStates = epsilonClosure(move(states, input.at(i))); + + // get the state in DFA that corresponds to the 'followStates' set in the NFA + const StateId dfaEnd = dfaStateForNfaState(followStates, table, dfa); + + // adds a new transition to the DFA that corresponds to the transitions between + // 'states' and 'followStates' in the NFA + dfa.addTransition(dfaBegin, input.at(i), dfaEnd); + + // add the 'followStates' to the list of to be processed state sets + workStates.append(followStates); + } + } + + return dfa; +} + +template +QHash::StateId, typename XsdStateMachine::StateType> XsdStateMachine::states() const +{ + return m_states; +} + +template +QHash::StateId, QHash::StateId> > > XsdStateMachine::transitions() const +{ + return m_transitions; +} diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h new file mode 100644 index 0000000..7988335 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdStateMachine_H +#define Patternist_XsdStateMachine_H + +#include "qnamepool_p.h" + +#include +#include +#include + +class QIODevice; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A state machine used for evaluation. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + template + class XsdStateMachine + { + public: + typedef qint32 StateId; + + /** + * Describes the type of state. + */ + enum StateType + { + StartState, ///< The state the machine will start with. + StartEndState, ///< The state the machine will start with, can be end state as well. + InternalState, ///< Any state that is not start or end state. + EndState ///< Any state where the machine is allowed to stop. + }; + + /** + * Creates a new state machine object. + */ + XsdStateMachine(); + + /** + * Creates a new state machine object. + * + * The name pool to use for accessing object names. + */ + XsdStateMachine(const NamePool::Ptr &namePool); + + /** + * Adds a new state of the given @p type to the state machine. + * + * @return The id of the new state. + */ + StateId addState(StateType type); + + /** + * Adds a new @p transition to the state machine. + * + * @param start The start state. + * @param transition The transition to come from the start to the end state. + * @param end The end state. + */ + void addTransition(StateId start, TransitionType transition, StateId end); + + /** + * Adds a new epsilon @p transition to the state machine. + * + * @param start The start state. + * @param end The end state. + */ + void addEpsilonTransition(StateId start, StateId end); + + /** + * Resets the machine to the start state. + */ + void reset(); + + /** + * Removes all states and transitions from the state machine. + */ + void clear(); + + /** + * Continues execution of the machine with the given input @p transition. + * + * @return @c true if the transition was successfull, @c false otherwise. + */ + bool proceed(TransitionType transition); + + /** + * Continues execution of the machine with the given @p input. + * + * @note To use this method, inputEqualsTransition must be implemented + * to find the right transition to use. + * + * @return @c true if the transition was successfull, @c false otherwise. + */ + template + bool proceed(InputType input); + + /** + * Returns whether the given @p input matches the given @p transition. + */ + template + bool inputEqualsTransition(InputType input, TransitionType transition) const; + + /** + * Returns whether the machine is in an allowed end state. + */ + bool inEndState() const; + + /** + * Returns the last transition that was taken. + */ + TransitionType lastTransition() const; + + /** + * Returns the start state of the machine. + */ + StateId startState() const; + + /** + * This method should be redefined by template specialization for every + * concret TransitionType. + */ + QString transitionTypeToString(TransitionType type) const; + + /** + * Outputs the state machine in DOT format to the given + * output @p device. + */ + bool outputGraph(QIODevice *device, const QString &graphName) const; + + /** + * Returns a DFA that is equal to the NFA of the state machine. + */ + XsdStateMachine toDFA() const; + + /** + * Returns the information of all states of the state machine. + */ + QHash states() const; + + /** + * Returns the information of all transitions of the state machine. + */ + QHash > > transitions() const; + + private: + /** + * Returns the DFA state for the given @p nfaStat from the given @p stateTable. + * If there is no corresponding DFA state yet, a new one is created. + */ + StateId dfaStateForNfaState(QSet nfaState, QList< QPair< QSet, StateId> > &stateTable, XsdStateMachine &dfa) const; + + /** + * Returns the set of all states that can be reached from the set of @p input states + * by the epsilon transition. + */ + QSet epsilonClosure(const QSet &input) const; + + /** + * Returns the set of all states that can be reached from the set of given @p states + * by the given @p input. + */ + QSet move(const QSet &states, TransitionType input) const; + + NamePool::Ptr m_namePool; + QHash m_states; + QHash > > m_transitions; + QHash > m_epsilonTransitions; + StateId m_currentState; + qint32 m_counter; + TransitionType m_lastTransition; + }; + + #include "qxsdstatemachine.cpp" +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp new file mode 100644 index 0000000..866e010 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp @@ -0,0 +1,230 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdstatemachinebuilder_p.h" + +#include "qxsdelement_p.h" +#include "qxsdmodelgroup_p.h" +#include "qxsdschemahelper_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +/* + * This methods takes a list of objects and returns a list of list + * of all combinations the objects can be ordered. + * + * e.g. input = [ 1, 2, 3 ] + * output = [ + * [ 1, 2, 3 ], + * [ 1, 3, 2 ], + * [ 2, 1, 3 ], + * [ 2, 3, 1 ], + * [ 3, 1, 2 ], + * [ 3, 2, 1 ] + * ] + * + * The method is used to create all possible combinations for the particles + * in an model group. + */ +template +QList< QList > allCombinations(const QList &input) +{ + if (input.count() == 1) + return (QList< QList >() << input); + + QList< QList > result; + for (int i = 0; i < input.count(); ++i) { + QList subList = input; + T value = subList.takeAt(i); + + QList< QList > subLists = allCombinations(subList); + for (int j = 0; j < subLists.count(); ++j) { + subLists[j].prepend(value); + } + result << subLists; + } + + return result; +} + +XsdStateMachineBuilder::XsdStateMachineBuilder(XsdStateMachine *machine, const NamePool::Ptr &namePool, Mode mode) + : m_stateMachine(machine), m_namePool(namePool), m_mode(mode) +{ +} + +XsdStateMachine::StateId XsdStateMachineBuilder::reset() +{ + Q_ASSERT(m_stateMachine); + + m_stateMachine->clear(); + + return m_stateMachine->addState(XsdStateMachine::EndState); +} + +XsdStateMachine::StateId XsdStateMachineBuilder::addStartState(XsdStateMachine::StateId state) +{ + const XsdStateMachine::StateId startState = m_stateMachine->addState(XsdStateMachine::StartState); + m_stateMachine->addEpsilonTransition(startState, state); + + return startState; +} + +/* + * Create the FSA according to Algorithm Tp(S) from http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html + */ +XsdStateMachine::StateId XsdStateMachineBuilder::buildParticle(const XsdParticle::Ptr &particle, XsdStateMachine::StateId endState) +{ + XsdStateMachine::StateId currentStartState = endState; + XsdStateMachine::StateId currentEndState = endState; + + // 2 + if (particle->maximumOccursUnbounded()) { + const XsdStateMachine::StateId t = m_stateMachine->addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId n = buildTerm(particle->term(), t); + + m_stateMachine->addEpsilonTransition(t, n); + m_stateMachine->addEpsilonTransition(n, endState); + + currentEndState = t; + currentStartState = t; + } else { // 3 + int count = (particle->maximumOccurs() - particle->minimumOccurs()); + if (count > 100) + count = 100; + + for (int i = 0; i < count; ++i) { + currentStartState = buildTerm(particle->term(), currentEndState); + m_stateMachine->addEpsilonTransition(currentStartState, endState); + currentEndState = currentStartState; + } + } + + int minOccurs = particle->minimumOccurs(); + if (minOccurs > 100) + minOccurs = 100; + + for (int i = 0; i < minOccurs; ++i) { + currentStartState = buildTerm(particle->term(), currentEndState); + currentEndState = currentStartState; + } + + return currentStartState; +} + +/* + * Create the FSA according to Algorithm Tt(S) from http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html + */ +XsdStateMachine::StateId XsdStateMachineBuilder::buildTerm(const XsdTerm::Ptr &term, XsdStateMachine::StateId endState) +{ + if (term->isWildcard()) { // 1 + const XsdStateMachine::StateId b = m_stateMachine->addState(XsdStateMachine::InternalState); + m_stateMachine->addTransition(b, term, endState); + return b; + } else if (term->isElement()) { // 2 + const XsdStateMachine::StateId b = m_stateMachine->addState(XsdStateMachine::InternalState); + m_stateMachine->addTransition(b, term, endState); + + const XsdElement::Ptr element(term); + if (m_mode == CheckingMode) { + const XsdElement::List substGroups = element->substitutionGroups(); + for (int i = 0; i < substGroups.count(); ++i) + m_stateMachine->addTransition(b, substGroups.at(i), endState); + } else if (m_mode == ValidatingMode) { + const XsdElement::List substGroups = element->substitutionGroups(); + for (int i = 0; i < substGroups.count(); ++i) { + if (XsdSchemaHelper::substitutionGroupOkTransitive(element, substGroups.at(i), m_namePool)) + m_stateMachine->addTransition(b, substGroups.at(i), endState); + } + } + + return b; + } else if (term->isModelGroup()) { + const XsdModelGroup::Ptr group(term); + + if (group->compositor() == XsdModelGroup::ChoiceCompositor) { // 3 + const XsdStateMachine::StateId b = m_stateMachine->addState(XsdStateMachine::InternalState); + + for (int i = 0; i < group->particles().count(); ++i) { + const XsdParticle::Ptr particle(group->particles().at(i)); + if (particle->maximumOccurs() != 0) { + const XsdStateMachine::StateId state = buildParticle(particle, endState); + m_stateMachine->addEpsilonTransition(b, state); + } + } + + return b; + } else if (group->compositor() == XsdModelGroup::SequenceCompositor) { // 4 + XsdStateMachine::StateId currentStartState = endState; + XsdStateMachine::StateId currentEndState = endState; + + for (int i = (group->particles().count() - 1); i >= 0; --i) { // iterate reverse + const XsdParticle::Ptr particle(group->particles().at(i)); + if (particle->maximumOccurs() != 0) { + currentStartState = buildParticle(particle, currentEndState); + currentEndState = currentStartState; + } + } + + return currentStartState; + } else if (group->compositor() == XsdModelGroup::AllCompositor) { + const XsdStateMachine::StateId newStartState = m_stateMachine->addState(XsdStateMachine::InternalState); + + const QList list = allCombinations(group->particles()); + + for (int i = 0; i < list.count(); ++i) { + XsdStateMachine::StateId currentStartState = endState; + XsdStateMachine::StateId currentEndState = endState; + + const XsdParticle::List particles = list.at(i); + for (int j = (particles.count() - 1); j >= 0; --j) { // iterate reverse + const XsdParticle::Ptr particle(particles.at(j)); + if (particle->maximumOccurs() != 0) { + currentStartState = buildParticle(particle, currentEndState); + currentEndState = currentStartState; + } + } + m_stateMachine->addEpsilonTransition(newStartState, currentStartState); + } + + if (list.isEmpty()) + return endState; + else + return newStartState; + } + } + + Q_ASSERT(false); + return 0; +} + +static void internalParticleLookupMap(const XsdParticle::Ptr &particle, QHash &hash) +{ + hash.insert(particle->term(), particle); + + if (particle->term()->isModelGroup()) { + const XsdModelGroup::Ptr group(particle->term()); + const XsdParticle::List particles = group->particles(); + for (int i = 0; i < particles.count(); ++i) + internalParticleLookupMap(particles.at(i), hash); + } +} + +QHash XsdStateMachineBuilder::particleLookupMap(const XsdParticle::Ptr &particle) +{ + QHash result; + internalParticleLookupMap(particle, result); + + return result; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h b/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h new file mode 100644 index 0000000..011153a --- /dev/null +++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdStateMachineBuilder_H +#define Patternist_XsdStateMachineBuilder_H + +#include "qxsdparticle_p.h" +#include "qxsdstatemachine_p.h" +#include "qxsdterm_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A helper class to build up validation state machines. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdStateMachineBuilder : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + enum Mode + { + CheckingMode, + ValidatingMode + }; + + /** + * Creates a new state machine builder. + * + * @param machine The state machine it should work on. + * @param namePool The name pool used by all schema components. + * @param mode The mode the machine shall be build for. + */ + XsdStateMachineBuilder(XsdStateMachine *machine, const NamePool::Ptr &namePool, Mode mode = CheckingMode); + + /** + * Resets the state machine. + * + * @returns The initial end state. + */ + XsdStateMachine::StateId reset(); + + /** + * Prepends a start state to the given @p state. + * That is needed to allow the conversion of the state machine from a FSA to a DFA. + */ + XsdStateMachine::StateId addStartState(XsdStateMachine::StateId state); + + /** + * Creates the state machine for the given @p particle that should have the + * given @p endState. + * + * @returns The new start state. + */ + XsdStateMachine::StateId buildParticle(const XsdParticle::Ptr &particle, XsdStateMachine::StateId endState); + + /** + * Creates the state machine for the given @p term that should have the + * given @p endState. + * + * @returns The new start state. + */ + XsdStateMachine::StateId buildTerm(const XsdTerm::Ptr &term, XsdStateMachine::StateId endState); + + /** + * Returns a hash that maps each term that appears inside @p particle, to the particle it belongs. + * + * @note These information are used by XsdParticleChecker to check particle inheritance. + */ + static QHash particleLookupMap(const XsdParticle::Ptr &particle); + + private: + XsdStateMachine *m_stateMachine; + NamePool::Ptr m_namePool; + Mode m_mode; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdterm.cpp b/src/xmlpatterns/schema/qxsdterm.cpp new file mode 100644 index 0000000..1dbe34b --- /dev/null +++ b/src/xmlpatterns/schema/qxsdterm.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdterm_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +bool XsdTerm::isElement() const +{ + return false; +} + +bool XsdTerm::isModelGroup() const +{ + return false; +} + +bool XsdTerm::isWildcard() const +{ + return false; +} + +bool XsdTerm::isReference() const +{ + return false; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdterm_p.h b/src/xmlpatterns/schema/qxsdterm_p.h new file mode 100644 index 0000000..f45d791 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdterm_p.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdTerm_H +#define Patternist_XsdTerm_H + +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A base class for all particles of a model group. + * + * This class is the base class for all particles of a model group + * as the element, group or any tag, it is not supposed to + * be instantiated directly. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdTerm : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Returns @c true if the term is an element, @c false otherwise. + */ + virtual bool isElement() const; + + /** + * Returns @c true if the term is a model group (group tag), @c false otherwise. + */ + virtual bool isModelGroup() const; + + /** + * Returns @c true if the term is a wildcard (any tag), @c false otherwise. + */ + virtual bool isWildcard() const; + + /** + * Returns @c true if the term is a reference, @c false otherwise. + * + * @note The reference term is only used internally as helper during type resolving. + */ + virtual bool isReference() const; + + protected: + /** + * This constructor only exists to ensure this class is subclassed. + */ + inline XsdTerm() {}; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp new file mode 100644 index 0000000..ab971a9 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp @@ -0,0 +1,1308 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdtypechecker_p.h" + +#include "qabstractdatetime_p.h" +#include "qbase64binary_p.h" +#include "qboolean_p.h" +#include "qdecimal_p.h" +#include "qderivedinteger_p.h" +#include "qduration_p.h" +#include "qgenericstaticcontext_p.h" +#include "qhexbinary_p.h" +#include "qnamespaceresolver_p.h" +#include "qpatternplatform_p.h" +#include "qqnamevalue_p.h" +#include "qvaluefactory_p.h" +#include "qxmlnamepool.h" +#include "qxsdschemahelper_p.h" +#include "qxsdschemamerger_p.h" +#include "qxsdstatemachine_p.h" + +#include "qxsdschemadebugger_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdSchemaSourceLocationReflection::XsdSchemaSourceLocationReflection(const QSourceLocation &location) + : m_sourceLocation(location) +{ +} + +const SourceLocationReflection* XsdSchemaSourceLocationReflection::actualReflection() const +{ + return this; +} + +QSourceLocation XsdSchemaSourceLocationReflection::sourceLocation() const +{ + return m_sourceLocation; +} + + +static AnySimpleType::Ptr comparableType(const AnySimpleType::Ptr &type) +{ + if (!type->isDefinedBySchema()) { + return type; + } else { + const XsdSimpleType::Ptr simpleType(type); + if (type->category() == SchemaType::SimpleTypeAtomic) { + return simpleType->primitiveType(); + } else if (type->category() == SchemaType::SimpleTypeList) { + return simpleType->itemType(); + } else if (type->category() == SchemaType::SimpleTypeUnion) { + return simpleType->memberTypes().first(); + } + } + + Q_ASSERT(false); + return AnySimpleType::Ptr(); +} + +static int totalDigitsForSignedLongLong(long long value) +{ + QString number = QString::number(value); + if (number.startsWith(QLatin1Char('-'))) + number = number.mid(1); + + return number.length(); +} + +static int totalDigitsForUnsignedLongLong(unsigned long long value) +{ + const QString number = QString::number(value); + return number.length(); +} + +static int totalDigitsForDecimal(const QString &lexicalValue) +{ + const QLatin1Char zeroChar('0'); + const int length = lexicalValue.length() - 1; + + // strip leading zeros + int pos = 0; + while (lexicalValue.at(pos) == zeroChar && (pos != length)) + pos++; + + QString value = lexicalValue.mid(pos); + + // if contains '.' strip trailing zeros + if (value.contains(QLatin1Char('.'))) { + pos = value.length() - 1; + while (value.at(pos) == zeroChar) { + pos--; + } + + value = value.left(pos + 1); + } + + // check number of digits of remaining string + int totalDigits = 0; + for (int i = 0; i < value.count(); ++i) + if (value.at(i).isDigit()) + ++totalDigits; + + if (totalDigits == 0) + totalDigits = 1; + + return totalDigits; +} + +static int fractionDigitsForDecimal(const QString &lexicalValue) +{ + // we use the lexical value here, as the conversion to double might strip + // away decimal positions + + QString trimmedValue(lexicalValue.trimmed()); + const int pos = trimmedValue.indexOf(QLatin1Char('.')); + if (pos == -1) // no '.' -> 0 fraction digits + return 0; + else + return (trimmedValue.length() - pos - 1); +} + +XsdTypeChecker::XsdTypeChecker(const XsdSchemaContext::Ptr &context, const QVector &namespaceBindings, const QSourceLocation &location) + : m_context(context) + , m_namePool(m_context->namePool()) + , m_namespaceBindings(namespaceBindings) + , m_reflection(new XsdSchemaSourceLocationReflection(location)) +{ +} + +XsdTypeChecker::~XsdTypeChecker() +{ +} + +QString XsdTypeChecker::normalizedValue(const QString &value, const XsdFacet::Hash &facets) +{ + if (!facets.contains(XsdFacet::WhiteSpace)) + return value; + + const XsdFacet::Ptr whiteSpaceFacet = facets.value(XsdFacet::WhiteSpace); + + const DerivedString::Ptr facetValue = whiteSpaceFacet->value(); + const QString stringValue = facetValue->stringValue(); + if (stringValue == XsdSchemaToken::toString(XsdSchemaToken::Preserve)) + return value; + else if (stringValue == XsdSchemaToken::toString(XsdSchemaToken::Replace)) { + QString newValue(value); + newValue.replace(QLatin1Char('\t'), QLatin1Char(' ')); + newValue.replace(QLatin1Char('\n'), QLatin1Char(' ')); + newValue.replace(QLatin1Char('\r'), QLatin1Char(' ')); + + return newValue; + } else if (stringValue == XsdSchemaToken::toString(XsdSchemaToken::Collapse)) { + return value.simplified(); + } + + return value; +} + +XsdFacet::Hash XsdTypeChecker::mergedFacetsForType(const SchemaType::Ptr &type, const XsdSchemaContext::Ptr &context) +{ + if (!type) + return XsdFacet::Hash(); + + const XsdFacet::Hash baseFacets = mergedFacetsForType(type->wxsSuperType(), context); + const XsdFacet::Hash facets = context->facetsForType(type); + + XsdFacet::Hash result = baseFacets; + XsdFacet::HashIterator it(facets); + while (it.hasNext()) { + it.next(); + + result.insert(it.key(), it.value()); + } + + return result; +} + +bool XsdTypeChecker::isValidString(const QString &normalizedString, const AnySimpleType::Ptr &type, QString &errorMsg, AnySimpleType::Ptr *boundType) const +{ + if (type->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) { + if (boundType) + *boundType = type; + + return true; + } + + if (!type->isDefinedBySchema()) { + // special QName check + if (BuiltinTypes::xsQName->wxsTypeMatches(type)) { + if (!XPathHelper::isQName(normalizedString)) { + errorMsg = QtXmlPatterns::tr("%1 is not valid according to %2").arg(formatData(normalizedString)).arg(formatType(m_namePool, type)); + return false; + } + } + + const AtomicValue::Ptr value = fromLexical(normalizedString, type, m_context, m_reflection); + if (value->hasError()) { + errorMsg = QtXmlPatterns::tr("%1 is not valid according to %2").arg(formatData(normalizedString)).arg(formatType(m_namePool, type)); + return false; + } + + if (!checkConstrainingFacets(value, normalizedString, type, errorMsg)) { + return false; + } + + if (boundType) + *boundType = type; + + } else { + const XsdSimpleType::Ptr simpleType(type); + + if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) { + AnySimpleType::Ptr targetType = simpleType->primitiveType(); + if (!simpleType->wxsSuperType()->isDefinedBySchema()) + targetType = simpleType->wxsSuperType(); + + const AtomicValue::Ptr value = fromLexical(normalizedString, targetType, m_context, m_reflection); + if (value->hasError()) { + errorMsg = QtXmlPatterns::tr("%1 is not valid according to %2").arg(formatData(normalizedString)).arg(formatType(m_namePool, targetType)); + return false; + } + + if (!checkConstrainingFacets(value, normalizedString, type, errorMsg)) { + return false; + } + + if (boundType) + *boundType = type; + + } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) { + QStringList entries = normalizedString.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < entries.count(); ++i) { + entries[i] = normalizedValue(entries.at(i), mergedFacetsForType(simpleType->itemType(), m_context)); + } + + if (!checkConstrainingFacetsList(entries, normalizedString, simpleType->itemType(), mergedFacetsForType(simpleType, m_context), errorMsg)) { + return false; + } + + for (int i = 0; i < entries.count(); ++i) { + if (!isValidString(entries.at(i), simpleType->itemType(), errorMsg)) { + return false; + } + } + + if (boundType) + *boundType = simpleType->itemType(); + + } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) { + if (!checkConstrainingFacetsUnion(normalizedString, normalizedString, simpleType, mergedFacetsForType(simpleType, m_context), errorMsg)) { + return false; + } + + const AnySimpleType::List memberTypes = simpleType->memberTypes(); + + bool foundValidType = false; + for (int i = 0; i < memberTypes.count(); ++i) { + const XsdFacet::Hash mergedFacets = mergedFacetsForType(memberTypes.at(i), m_context); + if (isValidString(normalizedValue(normalizedString, mergedFacets), memberTypes.at(i), errorMsg)) { + foundValidType = true; + + if (boundType) + *boundType = memberTypes.at(i); + + break; + } + } + + if (!foundValidType) { + return false; + } + } + } + + return true; +} + +bool XsdTypeChecker::valuesAreEqual(const QString &value, const QString &otherValue, const AnySimpleType::Ptr &type) const +{ + const AnySimpleType::Ptr targetType = comparableType(type); + + // if the type is xs:anySimpleType we just do string comparison... + if (targetType->name(m_namePool) == BuiltinTypes::xsAnySimpleType->name(m_namePool)) + return (value == otherValue); + + if (BuiltinTypes::xsQName->wxsTypeMatches(type)) { + const QXmlName valueName = convertToQName(value); + const QXmlName otherValueName = convertToQName(otherValue); + + if (valueName == otherValueName) + return true; + } + + if (type->category() == SchemaType::SimpleTypeAtomic) { + // ... otherwise we use the casting platform for value comparison + const DerivedString::Ptr valueStr = DerivedString::fromLexical(m_namePool, value); + const DerivedString::Ptr otherValueStr = DerivedString::fromLexical(m_namePool, otherValue); + + return XsdSchemaHelper::constructAndCompare(valueStr, AtomicComparator::OperatorEqual, otherValueStr, targetType, m_context, m_reflection); + } else if (type->category() == SchemaType::SimpleTypeList) { + const QStringList values = value.split(QLatin1Char(' '), QString::SkipEmptyParts); + const QStringList otherValues = otherValue.split(QLatin1Char(' '), QString::SkipEmptyParts); + if (values.count() != otherValues.count()) + return false; + + for (int i = 0; i < values.count(); ++i) { + if (!valuesAreEqual(values.at(i), otherValues.at(i), XsdSimpleType::Ptr(type)->itemType())) + return false; + } + + return true; + } else if (type->category() == SchemaType::SimpleTypeUnion) { + const AnySimpleType::List memberTypes = XsdSimpleType::Ptr(type)->memberTypes(); + for (int i = 0; i < memberTypes.count(); ++i) { + if (valuesAreEqual(value, otherValue, memberTypes.at(i))) { + return true; + } + } + + return false; + } + + return false; +} + +bool XsdTypeChecker::checkConstrainingFacets(const AtomicValue::Ptr &value, const QString &lexicalValue, const AnySimpleType::Ptr &type, QString &errorMsg) const +{ + const XsdFacet::Hash facets = mergedFacetsForType(type, m_context); + + if (BuiltinTypes::xsString->wxsTypeMatches(type) || + BuiltinTypes::xsUntypedAtomic->wxsTypeMatches(type)) { + return checkConstrainingFacetsString(value->stringValue(), facets, BuiltinTypes::xsString, errorMsg); + } else if (BuiltinTypes::xsAnyURI->wxsTypeMatches(type)) { + return checkConstrainingFacetsString(value->stringValue(), facets, BuiltinTypes::xsAnyURI, errorMsg); + } else if (BuiltinTypes::xsNOTATION->wxsTypeMatches(type)) { + return checkConstrainingFacetsNotation(value->as()->qName(), facets, errorMsg); + } else if (BuiltinTypes::xsUnsignedByte->wxsTypeMatches(type) || + BuiltinTypes::xsUnsignedInt->wxsTypeMatches(type) || + BuiltinTypes::xsUnsignedLong->wxsTypeMatches(type) || + BuiltinTypes::xsUnsignedShort->wxsTypeMatches(type)) { + return checkConstrainingFacetsUnsignedInteger(value->as()->toUnsignedInteger(), lexicalValue, facets, errorMsg); + } else if (BuiltinTypes::xsInteger->wxsTypeMatches(type)) { + return checkConstrainingFacetsSignedInteger(value->as()->toInteger(), lexicalValue, facets, errorMsg); + } else if (BuiltinTypes::xsFloat->wxsTypeMatches(type) || + BuiltinTypes::xsDouble->wxsTypeMatches(type)) { + return checkConstrainingFacetsDouble(value->as()->toDouble(), lexicalValue, facets, errorMsg); + } else if (BuiltinTypes::xsDecimal->wxsTypeMatches(type)) { + return checkConstrainingFacetsDecimal(value, lexicalValue, facets, errorMsg); + } else if (BuiltinTypes::xsDateTime->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsDateTime, errorMsg); + } else if (BuiltinTypes::xsDate->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsDate, errorMsg); + } else if (BuiltinTypes::xsGYear->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsGYear, errorMsg); + } else if (BuiltinTypes::xsGYearMonth->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsGYearMonth, errorMsg); + } else if (BuiltinTypes::xsGMonth->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsGMonth, errorMsg); + } else if (BuiltinTypes::xsGMonthDay->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsGMonthDay, errorMsg); + } else if (BuiltinTypes::xsGDay->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsGDay, errorMsg); + } else if (BuiltinTypes::xsTime->wxsTypeMatches(type)) { + return checkConstrainingFacetsDateTime(value->as()->toDateTime(), lexicalValue, facets, BuiltinTypes::xsTime, errorMsg); + } else if (BuiltinTypes::xsDuration->wxsTypeMatches(type)) { + return checkConstrainingFacetsDuration(value, lexicalValue, facets, errorMsg); + } else if (BuiltinTypes::xsBoolean->wxsTypeMatches(type)) { + return checkConstrainingFacetsBoolean(value->as()->value(), lexicalValue, facets, errorMsg); + } else if (BuiltinTypes::xsHexBinary->wxsTypeMatches(type)) { + return checkConstrainingFacetsBinary(value->as()->asByteArray(), facets, BuiltinTypes::xsHexBinary, errorMsg); + } else if (BuiltinTypes::xsBase64Binary->wxsTypeMatches(type)) { + return checkConstrainingFacetsBinary(value->as()->asByteArray(), facets, BuiltinTypes::xsBase64Binary, errorMsg); + } else if (BuiltinTypes::xsQName->wxsTypeMatches(type)) { + return checkConstrainingFacetsQName(value->as()->qName(), lexicalValue, facets, errorMsg); + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsString(const QString &value, const XsdFacet::Hash &facets, const AnySimpleType::Ptr &type, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::Length)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Length); + const DerivedInteger::Ptr length = facet->value(); + if (length->toInteger() != value.length()) { + errorMsg = QtXmlPatterns::tr("string content does not match the length facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumLength)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumLength); + const DerivedInteger::Ptr length = facet->value(); + if (length->toInteger() > value.length()) { + errorMsg = QtXmlPatterns::tr("string content does not match the minLength facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumLength)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumLength); + const DerivedInteger::Ptr length = facet->value(); + if (length->toInteger() < value.length()) { + errorMsg = QtXmlPatterns::tr("string content does not match the maxLength facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(value)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("string content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const DerivedString::Ptr valueStr = DerivedString::fromLexical(m_namePool, value); + + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + if (XsdSchemaHelper::constructAndCompare(valueStr, AtomicComparator::OperatorEqual, multiValue.at(j), type, m_context, m_reflection)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("string content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsSignedInteger(long long value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumInclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsLong, m_context, m_reflection); + if (facetValue->toInteger() < value) { + errorMsg = QtXmlPatterns::tr("signed integer content does not match the maxInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumExclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsLong, m_context, m_reflection); + if (facetValue->toInteger() <= value) { + errorMsg = QtXmlPatterns::tr("signed integer content does not match the maxExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumInclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsLong, m_context, m_reflection); + if (facetValue->toInteger() > value) { + errorMsg = QtXmlPatterns::tr("signed integer content does not match the minInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumExclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsLong, m_context, m_reflection); + if (facetValue->toInteger() >= value) { + errorMsg = QtXmlPatterns::tr("signed integer content does not match the minExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const DerivedString::Ptr valueStr = DerivedString::fromLexical(m_namePool, QString::number(value)); + + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + if (XsdSchemaHelper::constructAndCompare(valueStr, AtomicComparator::OperatorEqual, multiValue.at(j), BuiltinTypes::xsLong, m_context, m_reflection)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("signed integer content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("signed integer content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::TotalDigits)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::TotalDigits); + const DerivedInteger::Ptr facetValue = facet->value(); + + if (totalDigitsForSignedLongLong(value) > facetValue->toInteger()) { + errorMsg = QtXmlPatterns::tr("signed integer content does not match in the totalDigits facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsUnsignedInteger(unsigned long long value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumInclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsUnsignedLong, m_context, m_reflection); + if (facetValue->toUnsignedInteger() < value) { + errorMsg = QtXmlPatterns::tr("unsigned integer content does not match the maxInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumExclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsUnsignedLong, m_context, m_reflection); + if (facetValue->toUnsignedInteger() <= value) { + errorMsg = QtXmlPatterns::tr("unsigned integer content does not match the maxExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumInclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsUnsignedLong, m_context, m_reflection); + if (facetValue->toUnsignedInteger() > value) { + errorMsg = QtXmlPatterns::tr("unsigned integer content does not match the minInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumExclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsUnsignedLong, m_context, m_reflection); + if (facetValue->toUnsignedInteger() >= value) { + errorMsg = QtXmlPatterns::tr("unsigned integer content does not match the minExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const DerivedString::Ptr valueStr = DerivedString::fromLexical(m_namePool, QString::number(value)); + + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + if (XsdSchemaHelper::constructAndCompare(valueStr, AtomicComparator::OperatorEqual, multiValue.at(j), BuiltinTypes::xsUnsignedLong, m_context, m_reflection)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("unsigned integer content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("unsigned integer content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::TotalDigits)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::TotalDigits); + const DerivedInteger::Ptr facetValue = facet->value(); + + if (totalDigitsForUnsignedLongLong(value) > facetValue->toInteger()) { + errorMsg = QtXmlPatterns::tr("unsigned integer content does not match in the totalDigits facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsDouble(double value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumInclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsDouble, m_context, m_reflection); + if (facetValue->toDouble() < value) { + errorMsg = QtXmlPatterns::tr("double content does not match the maxInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumExclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsDouble, m_context, m_reflection); + if (facetValue->toDouble() <= value) { + errorMsg = QtXmlPatterns::tr("double content does not match the maxExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumInclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsDouble, m_context, m_reflection); + if (facetValue->toDouble() > value) { + errorMsg = QtXmlPatterns::tr("double content does not match the minInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumExclusive); + const Numeric::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), BuiltinTypes::xsDouble, m_context, m_reflection); + if (facetValue->toDouble() >= value) { + errorMsg = QtXmlPatterns::tr("double content does not match the minExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const DerivedString::Ptr valueStr = DerivedString::fromLexical(m_namePool, QString::number(value)); + + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + if (XsdSchemaHelper::constructAndCompare(valueStr, AtomicComparator::OperatorEqual, multiValue.at(j), BuiltinTypes::xsDouble, m_context, m_reflection)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("double content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("double content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsDecimal(const AtomicValue::Ptr &value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::FractionDigits)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::FractionDigits); + const DerivedInteger::Ptr facetValue = facet->value(); + + if (fractionDigitsForDecimal(lexicalValue) > facetValue->toInteger()) { + errorMsg = QtXmlPatterns::tr("decimal content does not match in the fractionDigits facet"); + return false; + } + } + if (facets.contains(XsdFacet::TotalDigits)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::TotalDigits); + const DerivedInteger::Ptr facetValue = facet->value(); + + if (totalDigitsForDecimal(lexicalValue) > facetValue->toInteger()) { + errorMsg = QtXmlPatterns::tr("decimal content does not match in the totalDigits facet"); + return false; + } + } + + return checkConstrainingFacetsDouble(value->as()->toDouble(), lexicalValue, facets, errorMsg); +} + +bool XsdTypeChecker::checkConstrainingFacetsDateTime(const QDateTime &value, const QString &lexicalValue, const XsdFacet::Hash &facets, const AnySimpleType::Ptr &type, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumInclusive); + const AbstractDateTime::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), type, m_context, m_reflection); + if (facetValue->toDateTime() < value) { + errorMsg = QtXmlPatterns::tr("date time content does not match the maxInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumExclusive); + const AbstractDateTime::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), type, m_context, m_reflection); + if (facetValue->toDateTime() <= value) { + errorMsg = QtXmlPatterns::tr("date time content does not match the maxExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumInclusive); + const AbstractDateTime::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), type, m_context, m_reflection); + if (facetValue->toDateTime() > value) { + errorMsg = QtXmlPatterns::tr("date time content does not match the minInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumExclusive); + const AbstractDateTime::Ptr facetValue = ValueFactory::fromLexical(facet->value()->as >()->stringValue(), type, m_context, m_reflection); + if (facetValue->toDateTime() >= value) { + errorMsg = QtXmlPatterns::tr("date time content does not match the minExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const AbstractDateTime::Ptr facetValue = ValueFactory::fromLexical(multiValue.at(j)->as >()->stringValue(), type, m_context, m_reflection); + if (facetValue->toDateTime() == value) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("date time content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("date time content does not match pattern facet"); + return false; + } + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsDuration(const AtomicValue::Ptr&, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::MaximumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumInclusive); + const DerivedString::Ptr value = DerivedString::fromLexical(m_namePool, lexicalValue); + + if (XsdSchemaHelper::constructAndCompare(facets.value(XsdFacet::MaximumInclusive)->value(), AtomicComparator::OperatorLessThan, value, BuiltinTypes::xsDuration, m_context, m_reflection)) { + errorMsg = QtXmlPatterns::tr("duration content does not match the maxInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumExclusive); + const DerivedString::Ptr value = DerivedString::fromLexical(m_namePool, lexicalValue); + + if (XsdSchemaHelper::constructAndCompare(facets.value(XsdFacet::MaximumExclusive)->value(), AtomicComparator::OperatorLessOrEqual, value, BuiltinTypes::xsDuration, m_context, m_reflection)) { + errorMsg = QtXmlPatterns::tr("duration content does not match the maxExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumInclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumInclusive); + const DerivedString::Ptr value = DerivedString::fromLexical(m_namePool, lexicalValue); + + if (XsdSchemaHelper::constructAndCompare(facets.value(XsdFacet::MinimumInclusive)->value(), AtomicComparator::OperatorGreaterThan, value, BuiltinTypes::xsDuration, m_context, m_reflection)) { + errorMsg = QtXmlPatterns::tr("duration content does not match the minInclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumExclusive)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumExclusive); + const DerivedString::Ptr value = DerivedString::fromLexical(m_namePool, lexicalValue); + + if (XsdSchemaHelper::constructAndCompare(facets.value(XsdFacet::MinimumExclusive)->value(), AtomicComparator::OperatorGreaterOrEqual, value, BuiltinTypes::xsDuration, m_context, m_reflection)) { + errorMsg = QtXmlPatterns::tr("duration content does not match the minExclusive facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const DerivedString::Ptr value = DerivedString::fromLexical(m_namePool, lexicalValue); + + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + if (XsdSchemaHelper::constructAndCompare(multiValue.at(j), AtomicComparator::OperatorEqual, value, BuiltinTypes::xsDuration, m_context, m_reflection)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("duration content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("duration content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsBoolean(bool, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("boolean content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsBinary(const QByteArray &value, const XsdFacet::Hash &facets, const AnySimpleType::Ptr &type, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::Length)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Length); + const DerivedInteger::Ptr length = facet->value(); + if (length->toInteger() != value.length()) { + errorMsg = QtXmlPatterns::tr("binary content does not match the length facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumLength)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MinimumLength); + const DerivedInteger::Ptr length = facet->value(); + if (length->toInteger() > value.length()) { + errorMsg = QtXmlPatterns::tr("binary content does not match the minLength facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumLength)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::MaximumLength); + const DerivedInteger::Ptr length = facet->value(); + if (length->toInteger() < value.length()) { + errorMsg = QtXmlPatterns::tr("binary content does not match the maxLength facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const Base64Binary::Ptr binary = ValueFactory::fromLexical(multiValue.at(j)->as >()->stringValue(), type, m_context, m_reflection); + const QByteArray facetValue = binary->as()->asByteArray(); + if (value == facetValue) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("binary content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + //TODO: implement + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsQName(const QXmlName &value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::Length)) { + // always true + } + if (facets.contains(XsdFacet::MinimumLength)) { + // always true + } + if (facets.contains(XsdFacet::MaximumLength)) { + // always true + } + if (facets.contains(XsdFacet::Enumeration)) { + if (!XPathHelper::isQName(lexicalValue)) { + errorMsg = QtXmlPatterns::tr("invalid QName content: %1").arg(formatData(lexicalValue)); + return false; + } + + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QXmlName facetValue = multiValue.at(j)->as()->qName(); + + if (value == facetValue) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("QName content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("QName content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsNotation(const QXmlName &value, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::Length)) { + // deprecated by spec + } + if (facets.contains(XsdFacet::MinimumLength)) { + // deprecated by spec + } + if (facets.contains(XsdFacet::MaximumLength)) { + // deprecated by spec + } + if (facets.contains(XsdFacet::Enumeration)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QXmlName facetValue = multiValue.at(j)->as()->qName(); + + if (value == facetValue) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("notation content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + //TODO: implement + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsList(const QStringList &values, const QString &lexicalValue, const AnySimpleType::Ptr &itemType, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::Length)) { + const DerivedInteger::Ptr value = facets.value(XsdFacet::Length)->value(); + if (value->toInteger() != values.count()) { + errorMsg = QtXmlPatterns::tr("list content does not match length facet"); + return false; + } + } + if (facets.contains(XsdFacet::MinimumLength)) { + const DerivedInteger::Ptr value = facets.value(XsdFacet::MinimumLength)->value(); + if (value->toInteger() > values.count()) { + errorMsg = QtXmlPatterns::tr("list content does not match minLength facet"); + return false; + } + } + if (facets.contains(XsdFacet::MaximumLength)) { + const DerivedInteger::Ptr value = facets.value(XsdFacet::MaximumLength)->value(); + if (value->toInteger() < values.count()) { + errorMsg = QtXmlPatterns::tr("list content does not match maxLength facet"); + return false; + } + } + if (facets.contains(XsdFacet::Enumeration)) { + + bool found = false; + + // we have to handle lists with QName derived items differently + if (BuiltinTypes::xsQName->wxsTypeMatches(itemType) || BuiltinTypes::xsNOTATION->wxsTypeMatches(itemType)) { + // first convert the string values from the instance document to a list of QXmlName + QList instanceValues; + for (int i = 0; i < values.count(); ++i) { + instanceValues.append(convertToQName(values.at(i))); + } + + // fetch the values from the facet and create a list of QXmlNames for each of them + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + + const AtomicValue::List multiValue = facet->multiValue(); + for (int i = 0; i < multiValue.count(); ++i) { + const QStringList facetValueList = multiValue.at(i)->as >()->stringValue().split(QLatin1Char(' '), QString::SkipEmptyParts); + + // create the list of atomic string values + QList facetValues; + for (int j = 0; j < facetValueList.count(); ++j) { + facetValues.append(convertToQName(facetValueList.at(j))); + } + + // check if both lists have the same length + if (instanceValues.count() != facetValues.count()) + continue; + + // check if both lists are equal, that means the contain equal items in the same order + bool matchesAll = true; + for (int j = 0; j < instanceValues.count(); ++j) { + if (instanceValues.at(j) != facetValues.at(j)) { + matchesAll = false; + break; + } + } + + if (matchesAll) { + found = true; + break; + } + } + } else { + // first convert the string values from the instance document to atomic values of type string + AtomicValue::List instanceValues; + for (int i = 0; i < values.count(); ++i) { + instanceValues.append(DerivedString::fromLexical(m_namePool, values.at(i))); + } + + // fetch the values from the facet and create a list of atomic string values for each of them + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + + const AnySimpleType::Ptr targetType = comparableType(itemType); + + const AtomicValue::List multiValue = facet->multiValue(); + for (int i = 0; i < multiValue.count(); ++i) { + const QStringList facetValueList = multiValue.at(i)->as >()->stringValue().split(QLatin1Char(' '), QString::SkipEmptyParts); + + // create the list of atomic string values + AtomicValue::List facetValues; + for (int j = 0; j < facetValueList.count(); ++j) { + facetValues.append(DerivedString::fromLexical(m_namePool, facetValueList.at(j))); + } + + // check if both lists have the same length + if (instanceValues.count() != facetValues.count()) + continue; + + // check if both lists are equal, that means the contain equal items in the same order + bool matchesAll = true; + for (int j = 0; j < instanceValues.count(); ++j) { + if (!XsdSchemaHelper::constructAndCompare(instanceValues.at(j), AtomicComparator::OperatorEqual, facetValues.at(j), targetType, m_context, m_reflection)) { + matchesAll = false; + break; + } + } + + if (matchesAll) { + found = true; + break; + } + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("list content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("list content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +bool XsdTypeChecker::checkConstrainingFacetsUnion(const QString &value, const QString &lexicalValue, const XsdSimpleType::Ptr &simpleType, const XsdFacet::Hash &facets, QString &errorMsg) const +{ + if (facets.contains(XsdFacet::Enumeration)) { + const AnySimpleType::List memberTypes = simpleType->memberTypes(); + + const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); + + // convert the instance value into an atomic string value + const DerivedString::Ptr valueString = DerivedString::fromLexical(m_namePool, value); + + // collect the facet values into a list of atomic string values + const AtomicValue::List facetValues = facet->multiValue(); + + // compare the instance value against the facetValues for each member type and + // search for a match + + bool found = false; + for (int i = 0; i < memberTypes.count(); ++i) { + const AnySimpleType::Ptr targetType = comparableType(memberTypes.at(i)); + for (int j = 0; j < facetValues.count(); ++j) { + if (XsdSchemaHelper::constructAndCompare(valueString, AtomicComparator::OperatorEqual, facetValues.at(j), targetType, m_context, m_reflection)) { + found = true; + break; + } + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("union content is not listed in the enumeration facet"); + return false; + } + } + if (facets.contains(XsdFacet::Pattern)) { + const XsdFacet::Ptr facet = facets.value(XsdFacet::Pattern); + const AtomicValue::List multiValue = facet->multiValue(); + bool found = false; + for (int j = 0; j < multiValue.count(); ++j) { + const QString pattern = multiValue.at(j)->as >()->stringValue(); + const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection); + if (exp.exactMatch(lexicalValue)) { + found = true; + break; + } + } + + if (!found) { + errorMsg = QtXmlPatterns::tr("union content does not match pattern facet"); + return false; + } + } + if (facets.contains(XsdFacet::Assertion)) { + //TODO: implement + } + + return true; +} + +AtomicValue::Ptr XsdTypeChecker::fromLexical(const QString &value, const SchemaType::Ptr &type, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const +{ + if (type->name(m_namePool) == BuiltinTypes::xsNOTATION->name(m_namePool) || type->name(m_namePool) == BuiltinTypes::xsQName->name(m_namePool)) { + if (value.simplified().isEmpty()) + return ValidationError::createError(QtXmlPatterns::tr("data of type %1 are not allowed to be empty").arg(formatType(m_namePool, BuiltinTypes::xsNOTATION))); + + const QXmlName valueName = convertToQName(value); + return QNameValue::fromValue(m_namePool, valueName); + } else { + return ValueFactory::fromLexical(value, type, context, reflection); + } +} + +QXmlName XsdTypeChecker::convertToQName(const QString &name) const +{ + const int pos = name.indexOf(QLatin1Char(':')); + + QXmlName::PrefixCode prefixCode = 0; + QXmlName::NamespaceCode namespaceCode; + QXmlName::LocalNameCode localNameCode; + if (pos != -1) { + prefixCode = m_context->namePool()->allocatePrefix(name.left(pos)); + namespaceCode = StandardNamespaces::empty; + for (int i = 0; i < m_namespaceBindings.count(); ++i) { + if (m_namespaceBindings.at(i).prefix() == prefixCode) { + namespaceCode = m_namespaceBindings.at(i).namespaceURI(); + break; + } + } + localNameCode = m_context->namePool()->allocateLocalName(name.mid(pos + 1)); + } else { + prefixCode = StandardPrefixes::empty; + namespaceCode = StandardNamespaces::empty; + for (int i = 0; i < m_namespaceBindings.count(); ++i) { + if (m_namespaceBindings.at(i).prefix() == prefixCode) { + namespaceCode = m_namespaceBindings.at(i).namespaceURI(); + break; + } + } + localNameCode = m_context->namePool()->allocateLocalName(name); + } + + return QXmlName(namespaceCode, localNameCode, prefixCode); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdtypechecker_p.h b/src/xmlpatterns/schema/qxsdtypechecker_p.h new file mode 100644 index 0000000..2af20db --- /dev/null +++ b/src/xmlpatterns/schema/qxsdtypechecker_p.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdTypeChecker_H +#define Patternist_XsdTypeChecker_H + +#include + +#include "qschematype_p.h" +#include "qsourcelocationreflection_p.h" +#include "qxsdschemacontext_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QXmlQuery; + +namespace QPatternist +{ + /** + * @short An implementation of SourceLocationReflection that takes a QSourceLocation. + * + * This is a convenience class which provides a QSourceLocation with a SourceLocationReflection + * interface. + */ + class XsdSchemaSourceLocationReflection : public SourceLocationReflection + { + public: + XsdSchemaSourceLocationReflection(const QSourceLocation &location); + + virtual const SourceLocationReflection *actualReflection() const; + virtual QSourceLocation sourceLocation() const; + + private: + const QSourceLocation m_sourceLocation; + }; + + /** + * @short The class that provides methods for checking a string against a type. + * + * The class provides functionality for type-aware string handling. + */ + class XsdTypeChecker + { + public: + /** + * Creates a new type checker. + * + * @param context The schema context that is used for error reporting. + * @param namespaceBindings The namespace bindings that shall be used to check against xs:QName based types. + * @param location The source location that is used for error reporting. + */ + XsdTypeChecker(const XsdSchemaContext::Ptr &context, const QVector &namespaceBindings, const QSourceLocation &location); + + /** + * Destroys the type checker. + */ + ~XsdTypeChecker(); + + /** + * Returns all facets for the given @p type. + * + * The list of facets is created by following the type hierarchy from xs:anyType down to the given type + * and merging the facets in each step. + */ + static XsdFacet::Hash mergedFacetsForType(const SchemaType::Ptr &type, const XsdSchemaContext::Ptr &context); + + /** + * Returns the normalized value for the given @p value. + * + * The normalized value is the original value with all the white space facets + * applied on it. + * + * @param value The original value. + * @param facets The hash of all facets of the values type. + */ + static QString normalizedValue(const QString &value, const XsdFacet::Hash &facets); + + /** + * Checks whether the @p normalizedString is valid according the given @p type. + * + * @param normalizedString The string in normalized form (whitespace facets applied). + * @param type The type the string shall be tested against. + * @param errorMsg Contains the error message if the normalizedString does not match the type. + * @param boundType The type the data was bound to during validation. + * + * @note The @p boundType only differs from @p type if the type is derived from an based union value. + */ + bool isValidString(const QString &normalizedString, const AnySimpleType::Ptr &type, QString &errorMsg, AnySimpleType::Ptr *boundType = 0) const; + + /** + * Returns whether the given @p value and @p otherValue are of @p type and are equal. + */ + bool valuesAreEqual(const QString &value, const QString &otherValue, const AnySimpleType::Ptr &type) const; + + private: + Q_DISABLE_COPY(XsdTypeChecker) + + /** + * Checks the given value against the facets of @p type. + */ + bool checkConstrainingFacets(const AtomicValue::Ptr &value, const QString &lexicalValue, const AnySimpleType::Ptr &type, QString &errorMsg) const; + bool checkConstrainingFacetsString(const QString &value, const XsdFacet::Hash &facets, const AnySimpleType::Ptr &type, QString &errorMsg) const; + bool checkConstrainingFacetsSignedInteger(long long value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsUnsignedInteger(unsigned long long value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsDouble(double value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsDecimal(const AtomicValue::Ptr &value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsDateTime(const QDateTime &value, const QString &lexicalValue, const XsdFacet::Hash &facets, const AnySimpleType::Ptr &type, QString &errorMsg) const; + bool checkConstrainingFacetsDuration(const AtomicValue::Ptr &value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsBoolean(bool value, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsBinary(const QByteArray &value, const XsdFacet::Hash &facets, const AnySimpleType::Ptr &type, QString &errorMsg) const; + bool checkConstrainingFacetsQName(const QXmlName&, const QString &lexicalValue, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsNotation(const QXmlName &value, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsList(const QStringList &values, const QString &lexicalValue, const AnySimpleType::Ptr &itemType, const XsdFacet::Hash &facets, QString &errorMsg) const; + bool checkConstrainingFacetsUnion(const QString &value, const QString &lexicalValue, const XsdSimpleType::Ptr &simpleType, const XsdFacet::Hash &facets, QString &errorMsg) const; + + /** + * Creates an atomic value of @p type from the given string @p value. + */ + AtomicValue::Ptr fromLexical(const QString &value, const SchemaType::Ptr &type, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const; + + /** + * Converts a qualified name into a QXmlName according to the namespace + * mappings of the current node. + */ + QXmlName convertToQName(const QString &name) const; + + XsdSchemaContext::Ptr m_context; + XsdSchema::Ptr m_schema; + const NamePool::Ptr m_namePool; + QVector m_namespaceBindings; + SourceLocationReflection* m_reflection; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsduserschematype.cpp b/src/xmlpatterns/schema/qxsduserschematype.cpp new file mode 100644 index 0000000..b8bf7e7 --- /dev/null +++ b/src/xmlpatterns/schema/qxsduserschematype.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +/* + * NOTE: This file is included by qxsduserschematype_p.h + * if you need some includes, put them in qxsduserschematype_p.h (outside of the namespace) + */ + +template +void XsdUserSchemaType::setName(const QXmlName &name) +{ + m_name = name; +} + +template +QXmlName XsdUserSchemaType::name(const NamePool::Ptr&) const +{ + return m_name; +} + +template +QString XsdUserSchemaType::displayName(const NamePool::Ptr &np) const +{ + return np->displayName(m_name); +} + +template +void XsdUserSchemaType::setDerivationConstraints(const SchemaType::DerivationConstraints &constraints) +{ + m_derivationConstraints = constraints; +} + +template +SchemaType::DerivationConstraints XsdUserSchemaType::derivationConstraints() const +{ + return m_derivationConstraints; +} diff --git a/src/xmlpatterns/schema/qxsduserschematype_p.h b/src/xmlpatterns/schema/qxsduserschematype_p.h new file mode 100644 index 0000000..ab70f91 --- /dev/null +++ b/src/xmlpatterns/schema/qxsduserschematype_p.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdUserSchemaType_H +#define Patternist_XsdUserSchemaType_H + +#include "qnamedschemacomponent_p.h" +#include "qschematype_p.h" +#include "qxsdannotated_p.h" + +template class QHash; +template class QList; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A base class for all user defined simple and complex types. + * + * This class was introduced to combine the SchemaType class and the + * NamedSchemaComponent class without explicit inheritance. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + template + class XsdUserSchemaType : public TSuperClass, public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Sets the @p name of the type. + */ + void setName(const QXmlName &name); + + /** + * Returns the name of the type. + * + * @param namePool The pool the name belongs to. + */ + virtual QXmlName name(const NamePool::Ptr &namePool) const; + + /** + * Returns the display name of the type. + * + * @param namePool The pool the name belongs to. + */ + virtual QString displayName(const NamePool::Ptr &namePool) const; + + /** + * Sets the derivation @p constraints of the type. + */ + void setDerivationConstraints(const SchemaType::DerivationConstraints &constraints); + + /** + * Returns the derivation constraints of the type. + */ + SchemaType::DerivationConstraints derivationConstraints() const; + + private: + QXmlName m_name; + SchemaType::DerivationConstraints m_derivationConstraints; + }; + + #include "qxsduserschematype.cpp" +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp new file mode 100644 index 0000000..8e1645a --- /dev/null +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdvalidatedxmlnodemodel_p.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +XsdValidatedXmlNodeModel::XsdValidatedXmlNodeModel(const QAbstractXmlNodeModel *model) + : m_internalModel(const_cast(model)) +{ +} + +XsdValidatedXmlNodeModel::~XsdValidatedXmlNodeModel() +{ +} + +QUrl XsdValidatedXmlNodeModel::baseUri(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->baseUri(index); +} + +QUrl XsdValidatedXmlNodeModel::documentUri(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->documentUri(index); +} + +QXmlNodeModelIndex::NodeKind XsdValidatedXmlNodeModel::kind(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->kind(index); +} + +QXmlNodeModelIndex::DocumentOrder XsdValidatedXmlNodeModel::compareOrder(const QXmlNodeModelIndex &index, const QXmlNodeModelIndex &otherIndex) const +{ + return m_internalModel->compareOrder(index, otherIndex); +} + +QXmlNodeModelIndex XsdValidatedXmlNodeModel::root(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->root(index); +} + +QXmlName XsdValidatedXmlNodeModel::name(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->name(index); +} + +QString XsdValidatedXmlNodeModel::stringValue(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->stringValue(index); +} + +QVariant XsdValidatedXmlNodeModel::typedValue(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->typedValue(index); +} + +QExplicitlySharedDataPointer > XsdValidatedXmlNodeModel::iterate(const QXmlNodeModelIndex &index, QXmlNodeModelIndex::Axis axis) const +{ + return m_internalModel->iterate(index, axis); +} + +QPatternist::ItemIteratorPtr XsdValidatedXmlNodeModel::sequencedTypedValue(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->sequencedTypedValue(index); +} + +QPatternist::ItemTypePtr XsdValidatedXmlNodeModel::type(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->type(index); +} + +QXmlName::NamespaceCode XsdValidatedXmlNodeModel::namespaceForPrefix(const QXmlNodeModelIndex &index, const QXmlName::PrefixCode prefix) const +{ + return m_internalModel->namespaceForPrefix(index, prefix); +} + +bool XsdValidatedXmlNodeModel::isDeepEqual(const QXmlNodeModelIndex &index, const QXmlNodeModelIndex &otherIndex) const +{ + return m_internalModel->isDeepEqual(index, otherIndex); +} + +void XsdValidatedXmlNodeModel::sendNamespaces(const QXmlNodeModelIndex &index, QAbstractXmlReceiver *const receiver) const +{ + m_internalModel->sendNamespaces(index, receiver); +} + +QVector XsdValidatedXmlNodeModel::namespaceBindings(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->namespaceBindings(index); +} + +QXmlNodeModelIndex XsdValidatedXmlNodeModel::elementById(const QXmlName &name) const +{ + return m_internalModel->elementById(name); +} + +QVector XsdValidatedXmlNodeModel::nodesByIdref(const QXmlName &name) const +{ + return m_internalModel->nodesByIdref(name); +} + +void XsdValidatedXmlNodeModel::copyNodeTo(const QXmlNodeModelIndex &index, QAbstractXmlReceiver *const receiver, const NodeCopySettings &settings) const +{ + return m_internalModel->copyNodeTo(index, receiver, settings); +} + +QXmlNodeModelIndex XsdValidatedXmlNodeModel::nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const +{ + return m_internalModel->nextFromSimpleAxis(axis, origin); +} + +QVector XsdValidatedXmlNodeModel::attributes(const QXmlNodeModelIndex &index) const +{ + return m_internalModel->attributes(index); +} + +void XsdValidatedXmlNodeModel::setAssignedElement(const QXmlNodeModelIndex &index, const XsdElement::Ptr &element) +{ + m_assignedElements.insert(index, element); +} + +XsdElement::Ptr XsdValidatedXmlNodeModel::assignedElement(const QXmlNodeModelIndex &index) const +{ + if (m_assignedElements.contains(index)) + return m_assignedElements.value(index); + else + return XsdElement::Ptr(); +} + +void XsdValidatedXmlNodeModel::setAssignedAttribute(const QXmlNodeModelIndex &index, const XsdAttribute::Ptr &attribute) +{ + m_assignedAttributes.insert(index, attribute); +} + +XsdAttribute::Ptr XsdValidatedXmlNodeModel::assignedAttribute(const QXmlNodeModelIndex &index) const +{ + if (m_assignedAttributes.contains(index)) + return m_assignedAttributes.value(index); + else + return XsdAttribute::Ptr(); +} + +void XsdValidatedXmlNodeModel::setAssignedType(const QXmlNodeModelIndex &index, const SchemaType::Ptr &type) +{ + m_assignedTypes.insert(index, type); +} + +SchemaType::Ptr XsdValidatedXmlNodeModel::assignedType(const QXmlNodeModelIndex &index) const +{ + if (m_assignedTypes.contains(index)) + return m_assignedTypes.value(index); + else + return SchemaType::Ptr(); +} + +void XsdValidatedXmlNodeModel::addIdIdRefBinding(const QString &id, const NamedSchemaComponent::Ptr &binding) +{ + m_idIdRefBindings[id].insert(binding); +} + +QStringList XsdValidatedXmlNodeModel::idIdRefBindingIds() const +{ + return m_idIdRefBindings.keys(); +} + +QSet XsdValidatedXmlNodeModel::idIdRefBindings(const QString &id) const +{ + return m_idIdRefBindings.value(id); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h new file mode 100644 index 0000000..579f41a --- /dev/null +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdValidatedXmlNodeModel_H +#define Patternist_XsdValidatedXmlNodeModel_H + +#include "qabstractxmlnodemodel.h" + +#include "qabstractxmlforwarditerator_p.h" +#include "qitem_p.h" +#include "qschematype_p.h" +#include "qxsdelement_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short A delegate class that wraps around a QAbstractXmlNodeModel and provides + * additional validation specific information. + * + * This class represents the input XML document enriched with additional type + * information that has been assigned during validation. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdValidatedXmlNodeModel : public QAbstractXmlNodeModel + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Creates a new validated xml node model. + */ + XsdValidatedXmlNodeModel(const QAbstractXmlNodeModel *model); + + /** + * Destroys the validated xml node model. + */ + virtual ~XsdValidatedXmlNodeModel(); + + virtual QUrl baseUri(const QXmlNodeModelIndex &ni) const; + virtual QUrl documentUri(const QXmlNodeModelIndex &ni) const; + virtual QXmlNodeModelIndex::NodeKind kind(const QXmlNodeModelIndex &ni) const; + virtual QXmlNodeModelIndex::DocumentOrder compareOrder(const QXmlNodeModelIndex &ni1, const QXmlNodeModelIndex &ni2) const; + virtual QXmlNodeModelIndex root(const QXmlNodeModelIndex &n) const; + virtual QXmlName name(const QXmlNodeModelIndex &ni) const; + virtual QString stringValue(const QXmlNodeModelIndex &n) const; + virtual QVariant typedValue(const QXmlNodeModelIndex &n) const; + virtual QExplicitlySharedDataPointer > iterate(const QXmlNodeModelIndex &ni, QXmlNodeModelIndex::Axis axis) const; + virtual QPatternist::ItemIteratorPtr sequencedTypedValue(const QXmlNodeModelIndex &ni) const; + virtual QPatternist::ItemTypePtr type(const QXmlNodeModelIndex &ni) const; + virtual QXmlName::NamespaceCode namespaceForPrefix(const QXmlNodeModelIndex &ni, const QXmlName::PrefixCode prefix) const; + virtual bool isDeepEqual(const QXmlNodeModelIndex &ni1, const QXmlNodeModelIndex &ni2) const; + virtual void sendNamespaces(const QXmlNodeModelIndex &n, QAbstractXmlReceiver *const receiver) const; + virtual QVector namespaceBindings(const QXmlNodeModelIndex &n) const; + virtual QXmlNodeModelIndex elementById(const QXmlName &NCName) const; + virtual QVector nodesByIdref(const QXmlName &NCName) const; + virtual void copyNodeTo(const QXmlNodeModelIndex &node, QAbstractXmlReceiver *const receiver, const NodeCopySettings &) const; + + /** + * Sets the @p element that is assigned to the xml node at @p index. + */ + void setAssignedElement(const QXmlNodeModelIndex &index, const XsdElement::Ptr &element); + + /** + * Returns the element that is assigned to the xml node at @p index. + */ + XsdElement::Ptr assignedElement(const QXmlNodeModelIndex &index) const; + + /** + * Sets the @p attribute that is assigned to the xml node at @p index. + */ + void setAssignedAttribute(const QXmlNodeModelIndex &index, const XsdAttribute::Ptr &attribute); + + /** + * Returns the attribute that is assigned to the xml node at @p index. + */ + XsdAttribute::Ptr assignedAttribute(const QXmlNodeModelIndex &index) const; + + /** + * Sets the @p type that is assigned to the xml node at @p index. + * + * @note The type can be a different than the type of the element or + * attribute that is assigned to the index, since the instance + * document can overwrite it by xsi:type. + */ + void setAssignedType(const QXmlNodeModelIndex &index, const SchemaType::Ptr &type); + + /** + * Returns the type that is assigned to the xml node at @p index. + */ + SchemaType::Ptr assignedType(const QXmlNodeModelIndex &index) const; + + /** + * Adds the attribute or element @p binding with the given @p id. + */ + void addIdIdRefBinding(const QString &id, const NamedSchemaComponent::Ptr &binding); + + /** + * Returns a list of all binding ids. + */ + QStringList idIdRefBindingIds() const; + + /** + * Returns the set of bindings with the given @p id. + */ + QSet idIdRefBindings(const QString &id) const; + + protected: + virtual QXmlNodeModelIndex nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const; + virtual QVector attributes(const QXmlNodeModelIndex &element) const; + + private: + QAbstractXmlNodeModel::Ptr m_internalModel; + QHash m_assignedElements; + QHash m_assignedAttributes; + QHash m_assignedTypes; + QHash > m_idIdRefBindings; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp new file mode 100644 index 0000000..12fc477 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp @@ -0,0 +1,1245 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdvalidatinginstancereader_p.h" + +#include "qabstractdatetime_p.h" +#include "qacceltreeresourceloader_p.h" +#include "qbase64binary_p.h" +#include "qboolean_p.h" +#include "qderivedinteger_p.h" +#include "qduration_p.h" +#include "qgenericstaticcontext_p.h" +#include "qhexbinary_p.h" +#include "qnamespaceresolver_p.h" +#include "qpatternplatform_p.h" +#include "qqnamevalue_p.h" +#include "qsourcelocationreflection_p.h" +#include "qvaluefactory_p.h" +#include "qxmlnamepool.h" +#include "qxmlquery_p.h" +#include "qxmlschema_p.h" +#include "qxsdschemahelper_p.h" +#include "qxsdschemamerger_p.h" +#include "qxsdstatemachine_p.h" +#include "qxsdstatemachinebuilder_p.h" +#include "qxsdtypechecker_p.h" + +#include "qxsdschemadebugger_p.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +namespace QPatternist +{ + template <> + template <> + bool XsdStateMachine::inputEqualsTransition(QXmlName name, XsdTerm::Ptr term) const + { + if (term->isElement()) { + return (XsdElement::Ptr(term)->name(m_namePool) == name); + } else if (term->isWildcard()) { + // wildcards using XsdWildcard::absentNamespace, so we have to fix that here + if (name.namespaceURI() == StandardNamespaces::empty) { + name.setNamespaceURI(m_namePool->allocateNamespace(XsdWildcard::absentNamespace())); + } + + return XsdSchemaHelper::wildcardAllowsExpandedName(name, XsdWildcard::Ptr(term), m_namePool); + } + + return false; + } +} + +XsdValidatingInstanceReader::XsdValidatingInstanceReader(const XsdValidatedXmlNodeModel *model, const QUrl &documentUri, const XsdSchemaContext::Ptr &context) + : XsdInstanceReader(model, context) + , m_model(const_cast(model)) + , m_namePool(m_context->namePool()) + , m_xsiNilName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("nil"))) + , m_xsiTypeName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("type"))) + , m_xsiSchemaLocationName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("schemaLocation"))) + , m_xsiNoNamespaceSchemaLocationName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("noNamespaceSchemaLocation"))) + , m_documentUri(documentUri) +{ + m_idRefsType = m_context->schemaTypeFactory()->createSchemaType(m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("IDREFS"))); +} + +void XsdValidatingInstanceReader::addSchema(const XsdSchema::Ptr &schema, const QUrl &locationUrl) +{ + if (!m_mergedSchemas.contains(locationUrl)) { + m_mergedSchemas.insert(locationUrl, QStringList() << schema->targetNamespace()); + } else { + QStringList &targetNamespaces = m_mergedSchemas[locationUrl]; + if (targetNamespaces.contains(schema->targetNamespace())) + return; + + targetNamespaces.append(schema->targetNamespace()); + } + + const XsdSchemaMerger merger(m_schema, schema); + m_schema = merger.mergedSchema(); +/* + XsdSchemaDebugger dbg(m_namePool); + dbg.dumpSchema(m_schema); +*/ +} + +bool XsdValidatingInstanceReader::read() +{ + while (!atEnd()) { + readNext(); + + if (isEndElement()) + return true; + + if (isStartElement()) { + const QXmlName elementName = name(); + const QXmlItem currentItem = item(); + bool hasStateMachine = false; + XsdElement::Ptr processedElement; + + if (!validate(hasStateMachine, processedElement)) + return false; + + read(); + + if (processedElement) { // for wildcard with 'skip' we have no element + m_model->setAssignedElement(currentItem.toNodeModelIndex(), processedElement); + + // check identity constraints after all child nodes have been + // validated, so that we know there assigned types + validateIdentityConstraint(processedElement, currentItem); + } + + if (!m_stateMachines.isEmpty() && hasStateMachine) { + if (!m_stateMachines.top().inEndState()) { + error(QtXmlPatterns::tr("element %1 is missing child element").arg(formatKeyword(m_namePool->displayName(elementName)))); + return false; + } + m_stateMachines.pop(); + } + } + } + + // final validations + + // check IDREF occurrences + const QStringList ids = m_model->idIdRefBindingIds(); + QSetIterator it(m_idRefs); + while (it.hasNext()) { + const QString id = it.next(); + if (!ids.contains(id)) { + error(QtXmlPatterns::tr("there is one IDREF value with no corresponding ID: %1").arg(formatKeyword(id))); + return false; + } + } + + return true; +} + +void XsdValidatingInstanceReader::error(const QString &msg) const +{ + const_cast(m_context.data())->error(msg, XsdSchemaContext::XSDError, sourceLocation()); +} + +bool XsdValidatingInstanceReader::loadSchema(const QString &targetNamespace, const QUrl &location) +{ + const AutoPtr reply(AccelTreeResourceLoader::load(location, m_context->networkAccessManager(), + m_context, AccelTreeResourceLoader::ContinueOnError)); + if (!reply) + return true; + + // we have to create a separated schema context here, that however shares the type factory + XsdSchemaContext::Ptr context(new XsdSchemaContext(m_namePool)); + context->m_schemaTypeFactory = m_context->m_schemaTypeFactory; + + QXmlSchemaPrivate schema(context); + schema.load(reply.data(), location, targetNamespace); + if (!schema.isValid()) { + error(QtXmlPatterns::tr("loaded schema file is invalid")); + return false; + } + + addSchema(schema.m_schemaParserContext->schema(), location); + + return true; +} + +bool XsdValidatingInstanceReader::validate(bool &hasStateMachine, XsdElement::Ptr &processedElement) +{ + // first check if a custom schema is defined + if (hasAttribute(m_xsiSchemaLocationName)) { + const QString schemaLocation = attribute(m_xsiSchemaLocationName); + const QStringList parts = schemaLocation.split(QLatin1Char(' '), QString::SkipEmptyParts); + if ((parts.count()%2) == 1) { + error(QtXmlPatterns::tr("%1 contains invalid data").arg(formatKeyword(m_namePool, m_xsiSchemaLocationName))); + return false; + } + + for (int i = 0; i < parts.count(); i += 2) { + const QString identifier = QString::fromLatin1("%1 %2").arg(parts.at(i)).arg(parts.at(i + 1)); + if (m_processedSchemaLocations.contains(identifier)) + continue; + else + m_processedSchemaLocations.insert(identifier); + + // check constraint 4) from http://www.w3.org/TR/xmlschema-1/#schema-loc (only valid for XML Schema 1.0?) + if (m_processedNamespaces.contains(parts.at(i))) { + error(QtXmlPatterns::tr("xsi:schemaLocation namespace %1 has already appeared earlier in the instance document").arg(formatKeyword(parts.at(i)))); + return false; + } + + QUrl url(parts.at(i + 1)); + if (url.isRelative()) { + Q_ASSERT(m_documentUri.isValid()); + + url = m_documentUri.resolved(url); + } + + loadSchema(parts.at(i), url); + } + } + + if (hasAttribute(m_xsiNoNamespaceSchemaLocationName)) { + const QString schemaLocation = attribute(m_xsiNoNamespaceSchemaLocationName); + + if (!m_processedSchemaLocations.contains(schemaLocation)) { + m_processedSchemaLocations.insert(schemaLocation); + + if (m_processedNamespaces.contains(QString())) { + error(QtXmlPatterns::tr("xsi:noNamespaceSchemaLocation cannot appear after the first no-namespace element or attribute")); + return false; + } + + QUrl url(schemaLocation); + if (url.isRelative()) { + Q_ASSERT(m_documentUri.isValid()); + + url = m_documentUri.resolved(url); + } + + loadSchema(QString(), url); + } + } + + m_processedNamespaces.insert(m_namePool->stringForNamespace(name().namespaceURI())); + + if (!m_schema) { + error(QtXmlPatterns::tr("no schema defined for validation")); + return false; + } + + // check if we are 'inside' a type definition + if (m_stateMachines.isEmpty()) { + // find out the type of the top-level element + XsdElement::Ptr element = elementByName(name()); + if (!element) { + if (!hasAttribute(m_xsiTypeName)) { + error(QtXmlPatterns::tr("no definition for element %1 available").arg(formatKeyword(m_namePool, name()))); + return false; + } + + // This instance document has an element with no definition in the schema + // but an explicitly given type, that is fine according to the spec. + // We will create an element definition manually here and continue the + // normal validation process + element = XsdElement::Ptr(new XsdElement()); + element->setName(name()); + element->setIsAbstract(false); + element->setIsNillable(hasAttribute(m_xsiNilName)); + + const QString type = qNameAttribute(m_xsiTypeName); + const QXmlName typeName = convertToQName(type); + + const SchemaType::Ptr elementType = typeByName(typeName); + if (!elementType) { + error(QtXmlPatterns::tr("specified type %1 is not known to the schema").arg(formatType(m_namePool, typeName))); + return false; + } + element->setType(elementType); + } + + // rememeber the element we process + processedElement = element; + + if (!validateElement(element, hasStateMachine)) { + return false; + } + + } else { + if (!m_stateMachines.top().proceed(name())) { + error(QtXmlPatterns::tr("element %1 is not defined in this scope").arg(formatKeyword(m_namePool, name()))); + return false; + } + + const XsdTerm::Ptr term = m_stateMachines.top().lastTransition(); + if (term->isElement()) { + const XsdElement::Ptr element(term); + + // rememeber the element we process + processedElement = element; + + if (!validateElement(element, hasStateMachine)) + return false; + + } else { + const XsdWildcard::Ptr wildcard(term); + if (wildcard->processContents() != XsdWildcard::Skip) { + XsdElement::Ptr elementDeclaration = elementByName(name()); + if (!elementDeclaration) { + if (hasAttribute(m_xsiTypeName)) { + // This instance document has an element with no definition in the schema + // but an explicitly given type, that is fine according to the spec. + // We will create an element definition manually here and continue the + // normal validation process + elementDeclaration = XsdElement::Ptr(new XsdElement()); + elementDeclaration->setName(name()); + elementDeclaration->setIsAbstract(false); + elementDeclaration->setIsNillable(hasAttribute(m_xsiNilName)); + + const QString type = qNameAttribute(m_xsiTypeName); + const QXmlName typeName = convertToQName(type); + + const SchemaType::Ptr elementType = typeByName(typeName); + if (!elementType) { + error(QtXmlPatterns::tr("specified type %1 is not known to the schema").arg(formatType(m_namePool, typeName))); + return false; + } + elementDeclaration->setType(elementType); + } + } + + if (!elementDeclaration) { + if (wildcard->processContents() == XsdWildcard::Strict) { + error(QtXmlPatterns::tr("declaration for element %1 does not exist").arg(formatKeyword(m_namePool->displayName(name())))); + return false; + } else { + // in this case we put a state machine for the xs:anyType on the statemachine stack, + // so we accept every content of this element + + createAndPushStateMachine(anyType()->contentType()->particle()); + hasStateMachine = true; + } + } else { + if (!validateElement(elementDeclaration, hasStateMachine)) { + if (wildcard->processContents() == XsdWildcard::Strict) { + error(QtXmlPatterns::tr("element %1 contains invalid content").arg(formatKeyword(m_namePool->displayName(name())))); + return false; + } + } + + // rememeber the type of that element node + m_model->setAssignedType(item().toNodeModelIndex(), elementDeclaration->type()); + } + } else { // wildcard process contents type is Skip + // in this case we put a state machine for the xs:anyType on the statemachine stack, + // so we accept every content of this element + + const XsdWildcard::Ptr wildcard(new XsdWildcard()); + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + wildcard->setProcessContents(XsdWildcard::Skip); + + const XsdParticle::Ptr outerParticle(new XsdParticle()); + outerParticle->setMinimumOccurs(1); + outerParticle->setMaximumOccurs(1); + + const XsdParticle::Ptr innerParticle(new XsdParticle()); + innerParticle->setMinimumOccurs(0); + innerParticle->setMaximumOccursUnbounded(true); + innerParticle->setTerm(wildcard); + + const XsdModelGroup::Ptr outerModelGroup(new XsdModelGroup()); + outerModelGroup->setCompositor(XsdModelGroup::SequenceCompositor); + outerModelGroup->setParticles(XsdParticle::List() << innerParticle); + outerParticle->setTerm(outerModelGroup); + + createAndPushStateMachine(outerParticle); + hasStateMachine = true; + } + } + } + + return true; +} + +void XsdValidatingInstanceReader::createAndPushStateMachine(const XsdParticle::Ptr &particle) +{ + XsdStateMachine stateMachine(m_namePool); + + XsdStateMachineBuilder builder(&stateMachine, m_namePool, XsdStateMachineBuilder::ValidatingMode); + const XsdStateMachine::StateId endState = builder.reset(); + const XsdStateMachine::StateId startState = builder.buildParticle(particle, endState); + builder.addStartState(startState); + +/* + QString fileName = QString("/tmp/foo_%1.dot").arg(m_namePool->displayName(complexType->name(m_namePool))); + QString pngFileName = QString("/tmp/foo_%1.png").arg(m_namePool->displayName(complexType->name(m_namePool))); + QFile file(fileName); + file.open(QIODevice::WriteOnly); + stateMachine.outputGraph(&file, "Hello"); + file.close(); + ::system(QString("dot -Tpng %1 -o%2").arg(fileName).arg(pngFileName).toLatin1().data()); +*/ + + stateMachine = stateMachine.toDFA(); + + m_stateMachines.push(stateMachine); +} + +bool XsdValidatingInstanceReader::validateElement(const XsdElement::Ptr &declaration, bool &hasStateMachine) +{ + // http://www.w3.org/TR/xmlschema11-1/#d0e10998 + + bool isNilled = false; + + // 1 tested already, 'declaration' corresponds D + + // 2 + if (declaration->isAbstract()) { + error(QtXmlPatterns::tr("element %1 is declared as abstract").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + + // 3 + if (!declaration->isNillable()) { + if (hasAttribute(m_xsiNilName)) { + error(QtXmlPatterns::tr("element %1 is not nillable").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; // 3.1 + } + } else { + if (hasAttribute(m_xsiNilName)) { + const QString value = attribute(m_xsiNilName); + const Boolean::Ptr nil = Boolean::fromLexical(value); + if (nil->hasError()) { + error(QtXmlPatterns::tr("attribute %1 contains invalid data: %1").arg(formatKeyword(QLatin1String("nil"))).arg(formatData(value))); + return false; + } + + // 3.2.3 + if (nil->as()->value() == true) { + // 3.2.3.1 + if (hasChildElement() || hasChildText()) { + error(QtXmlPatterns::tr("element contains content although it is nillable")); + return false; + } + + // 3.2.3.2 + if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { + error(QtXmlPatterns::tr("fixed value constrained not allowed if element is nillable")); + return false; + } + } + + isNilled = nil->as()->value(); + } + } + + SchemaType::Ptr finalElementType = declaration->type(); + + // 4 + if (hasAttribute(m_xsiTypeName)) { + const QString type = qNameAttribute(m_xsiTypeName); + const QXmlName typeName = convertToQName(type); + + const SchemaType::Ptr elementType = typeByName(typeName); + // 4.1 + if (!elementType) { + error(QtXmlPatterns::tr("specified type %1 is not known to the schema").arg(formatType(m_namePool, typeName))); + return false; + } + + // 4.2 + SchemaType::DerivationConstraints constraints = 0; + if (declaration->disallowedSubstitutions() & NamedSchemaComponent::ExtensionConstraint) + constraints |= SchemaType::ExtensionConstraint; + if (declaration->disallowedSubstitutions() & NamedSchemaComponent::RestrictionConstraint) + constraints |= SchemaType::RestrictionConstraint; + + if (!XsdSchemaHelper::isValidlySubstitutable(elementType, declaration->type(), constraints)) { + if (declaration->type()->name(m_namePool) != BuiltinTypes::xsAnyType->name(m_namePool)) { // xs:anyType is a valid substitutable type here + error(QtXmlPatterns::tr("specified type %1 is not validly substitutable with element type %2").arg(formatType(m_namePool, elementType)).arg(formatType(m_namePool, declaration->type()))); + return false; + } + } + + finalElementType = elementType; + } + + if (!validateElementType(declaration, finalElementType, isNilled, hasStateMachine)) + return false; + + return true; +} + +bool XsdValidatingInstanceReader::validateElementType(const XsdElement::Ptr &declaration, const SchemaType::Ptr &type, bool isNilled, bool &hasStateMachine) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#d0e11749 + + // 1 checked already + + // 2 + if (type->isComplexType() && type->isDefinedBySchema()) { + if (XsdComplexType::Ptr(type)->isAbstract()) { + error(QtXmlPatterns::tr("complex type %1 is not allowed to be abstract").arg(formatType(m_namePool, type))); + return false; + } + } + + // 3 + if (type->isSimpleType()) + return validateElementSimpleType(declaration, type, isNilled); // 3.1 + else + return validateElementComplexType(declaration, type, isNilled, hasStateMachine); // 3.2 +} + +bool XsdValidatingInstanceReader::validateElementSimpleType(const XsdElement::Ptr &declaration, const SchemaType::Ptr &type, bool isNilled) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#d0e11749 + + // 3.1.1 + const QSet allowedAttributes(QSet() << m_xsiNilName << m_xsiTypeName << m_xsiSchemaLocationName << m_xsiNoNamespaceSchemaLocationName); + QSet elementAttributes = attributeNames(); + elementAttributes.subtract(allowedAttributes); + if (!elementAttributes.isEmpty()) { + error(QtXmlPatterns::tr("element %1 contains not allowed attributes").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + + // 3.1.2 + if (hasChildElement()) { + error(QtXmlPatterns::tr("element %1 contains not allowed child element").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + + // 3.1.3 + if (!isNilled) { + const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(type, m_context); + + QString actualValue; + if (hasChildText()) { + actualValue = XsdTypeChecker::normalizedValue(text(), facets); + } else { + if (declaration->valueConstraint()) + actualValue = XsdTypeChecker::normalizedValue(declaration->valueConstraint()->value(), facets); + } + + QString errorMsg; + AnySimpleType::Ptr boundType; + + const XsdTypeChecker checker(m_context, namespaceBindings(item().toNodeModelIndex()), sourceLocation()); + if (!checker.isValidString(actualValue, type, errorMsg, &boundType)) { + error(QtXmlPatterns::tr("content of element %1 does not match its type definition: %2").arg(formatKeyword(declaration->displayName(m_namePool))).arg(errorMsg)); + return false; + } + + // additional check + if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { + const QString actualConstraintValue = XsdTypeChecker::normalizedValue(declaration->valueConstraint()->value(), facets); + if (!text().isEmpty() && !checker.valuesAreEqual(actualValue, actualConstraintValue, type)) { + error(QtXmlPatterns::tr("content of element %1 does not match defined value constraint").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + } + } + + // 4 checked in validateElement already + + // rememeber the type of that element node + m_model->setAssignedType(item().toNodeModelIndex(), type); + + const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(type, m_context); + const QString actualValue = XsdTypeChecker::normalizedValue(text(), facets); + + if (BuiltinTypes::xsID->wxsTypeMatches(type)) { + addIdIdRefBinding(actualValue, declaration); + } + + if (m_idRefsType->wxsTypeMatches(type)) { + const QStringList idRefs = actualValue.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < idRefs.count(); ++i) { + m_idRefs.insert(idRefs.at(i)); + } + } else if (BuiltinTypes::xsIDREF->wxsTypeMatches(type)) { + m_idRefs.insert(actualValue); + } + + return true; +} + +static bool hasIDAttributeUse(const XsdAttributeUse::List &uses) +{ + const int count = uses.count(); + for (int i = 0; i < count; ++i) { + if (BuiltinTypes::xsID->wxsTypeMatches(uses.at(i)->attribute()->type())) + return true; + } + + return false; +} + +bool XsdValidatingInstanceReader::validateElementComplexType(const XsdElement::Ptr &declaration, const SchemaType::Ptr &type, bool isNilled, bool &hasStateMachine) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type + + // 1 + if (!isNilled) { + XsdComplexType::Ptr complexType; + + if (type->isDefinedBySchema()) { + complexType = XsdComplexType::Ptr(type); + } else { + if (type->name(m_namePool) == BuiltinTypes::xsAnyType->name(m_namePool)) + complexType = anyType(); + } + + if (complexType) { + // 1.1 + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty) { + if (hasChildText() || hasChildElement()) { + error(QtXmlPatterns::tr("element %1 contains not allowed child content").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + } + + // 1.2 + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) { + if (hasChildElement()) { + error(QtXmlPatterns::tr("element %1 contains not allowed child element").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + + const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(complexType->contentType()->simpleType(), m_context); + QString actualValue; + if (hasChildText()) { + actualValue = XsdTypeChecker::normalizedValue(text(), facets); + } else { + if (declaration->valueConstraint()) + actualValue = XsdTypeChecker::normalizedValue(declaration->valueConstraint()->value(), facets); + } + + QString errorMsg; + AnySimpleType::Ptr boundType; + const XsdTypeChecker checker(m_context, namespaceBindings(item().toNodeModelIndex()), sourceLocation()); + if (!checker.isValidString(actualValue, complexType->contentType()->simpleType(), errorMsg, &boundType)) { + error(QtXmlPatterns::tr("content of element %1 does not match its type definition: %2").arg(formatKeyword(declaration->displayName(m_namePool))).arg(errorMsg)); + return false; + } + + // additional check + if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { + if (!checker.valuesAreEqual(actualValue, declaration->valueConstraint()->value(), boundType)) { + error(QtXmlPatterns::tr("content of element %1 does not match defined value constraint").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + } + } + + // 1.3 + if (complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly) { + if (!text().simplified().isEmpty()) { + error(QtXmlPatterns::tr("element %1 contains not allowed text content").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + } + + // 1.4 + if (complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly || + complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { + + if (complexType->contentType()->particle()) { + createAndPushStateMachine(complexType->contentType()->particle()); + hasStateMachine = true; + } + + // additional check + if (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed) { + if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) { + if (hasChildElement()) { + error(QtXmlPatterns::tr("element %1 can not contain other elements, as it has a fixed content").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + + const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(complexType->contentType()->simpleType(), m_context); + QString actualValue; + if (hasChildText()) { + actualValue = XsdTypeChecker::normalizedValue(text(), facets); + } else { + if (declaration->valueConstraint()) + actualValue = XsdTypeChecker::normalizedValue(declaration->valueConstraint()->value(), facets); + } + + if (actualValue != declaration->valueConstraint()->value()) { + error(QtXmlPatterns::tr("content of element %1 does not match defined value constraint").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + } + } + } + } + } + + if (type->isDefinedBySchema()) { + const XsdComplexType::Ptr complexType(type); + + // create a lookup hash for faster access + QHash attributeUseHash; + { + const XsdAttributeUse::List attributeUses = complexType->attributeUses(); + for (int i = 0; i < attributeUses.count(); ++i) + attributeUseHash.insert(attributeUses.at(i)->attribute()->name(m_namePool), attributeUses.at(i)); + } + + const QSet attributes(attributeNames()); + + // 3 + QHashIterator usesIt(attributeUseHash); + while (usesIt.hasNext()) { + usesIt.next(); + + if (usesIt.value()->isRequired()) { + if (!attributes.contains(usesIt.key())) { + error(QtXmlPatterns::tr("element %1 is missing required attribute %2").arg(formatKeyword(declaration->displayName(m_namePool))) + .arg(formatKeyword(m_namePool->displayName(usesIt.key())))); + return false; + } + } + } + + bool hasIDAttribute = hasIDAttributeUse(complexType->attributeUses()); + + // 2 + QSetIterator it(attributes); + while (it.hasNext()) { + const QXmlName attributeName = it.next(); + + // skip builtin attributes + if (attributeName == m_xsiNilName || + attributeName == m_xsiTypeName || + attributeName == m_xsiSchemaLocationName || + attributeName == m_xsiNoNamespaceSchemaLocationName) + continue; + + // 2.1 + if (attributeUseHash.contains(attributeName) && (attributeUseHash.value(attributeName)->useType() != XsdAttributeUse::ProhibitedUse)) { + if (!validateAttribute(attributeUseHash.value(attributeName), attribute(attributeName))) + return false; + } else { // 2.2 + if (complexType->attributeWildcard()) { + const XsdWildcard::Ptr wildcard(complexType->attributeWildcard()); + if (!validateAttributeWildcard(attributeName, wildcard)) { + error(QtXmlPatterns::tr("attribute %1 does not match the attribute wildcard").arg(formatKeyword(m_namePool->displayName(attributeName)))); + return false; + } + + if (wildcard->processContents() != XsdWildcard::Skip) { + const XsdAttribute::Ptr attributeDeclaration = attributeByName(attributeName); + + if (!attributeDeclaration) { + if (wildcard->processContents() == XsdWildcard::Strict) { + error(QtXmlPatterns::tr("declaration for attribute %1 does not exist").arg(formatKeyword(m_namePool->displayName(attributeName)))); + return false; + } + } else { + if (BuiltinTypes::xsID->wxsTypeMatches(attributeDeclaration->type())) { + if (hasIDAttribute) { + error(QtXmlPatterns::tr("element %1 contains two attributes of type %2") + .arg(formatKeyword(declaration->displayName(m_namePool))) + .arg(formatKeyword("ID"))); + return false; + } + + hasIDAttribute = true; + } + + if (!validateAttribute(attributeDeclaration, attribute(attributeName))) { + if (wildcard->processContents() == XsdWildcard::Strict) { + error(QtXmlPatterns::tr("attribute %1 contains invalid content").arg(formatKeyword(m_namePool->displayName(attributeName)))); + return false; + } + } + } + } + } else { + error(QtXmlPatterns::tr("element %1 contains unknown attribute %2").arg(formatKeyword(declaration->displayName(m_namePool))) + .arg(formatKeyword(m_namePool->displayName(attributeName)))); + return false; + } + } + } + } + + // 4 + // so what?... + + // 5 + // hmm... + + // 6 + // TODO: check assertions + + // 7 + // TODO: check type table restrictions + + // rememeber the type of that element node + m_model->setAssignedType(item().toNodeModelIndex(), type); + + return true; +} + +bool XsdValidatingInstanceReader::validateAttribute(const XsdAttributeUse::Ptr &declaration, const QString &value) +{ + const AnySimpleType::Ptr attributeType = declaration->attribute()->type(); + const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(attributeType, m_context); + + const QString actualValue = XsdTypeChecker::normalizedValue(value, facets); + + QString errorMsg; + AnySimpleType::Ptr boundType; + + const QXmlNodeModelIndex index = attributeItem(declaration->attribute()->name(m_namePool)).toNodeModelIndex(); + + const XsdTypeChecker checker(m_context, namespaceBindings(index), sourceLocation()); + if (!checker.isValidString(actualValue, attributeType, errorMsg, &boundType)) { + error(QtXmlPatterns::tr("content of attribute %1 does not match its type definition: %2").arg(formatKeyword(declaration->attribute()->displayName(m_namePool))).arg(errorMsg)); + return false; + } + + // @see http://www.w3.org/TR/xmlschema11-1/#cvc-au + if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdAttributeUse::ValueConstraint::Fixed) { + const QString actualConstraintValue = XsdTypeChecker::normalizedValue(declaration->valueConstraint()->value(), facets); + if (!checker.valuesAreEqual(actualValue, actualConstraintValue, attributeType)) { + error(QtXmlPatterns::tr("content of attribute %1 does not match defined value constraint").arg(formatKeyword(declaration->attribute()->displayName(m_namePool)))); + return false; + } + } + + if (BuiltinTypes::xsID->wxsTypeMatches(declaration->attribute()->type())) { + addIdIdRefBinding(actualValue, declaration->attribute()); + } + + if (m_idRefsType->wxsTypeMatches(declaration->attribute()->type())) { + const QStringList idRefs = actualValue.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < idRefs.count(); ++i) + m_idRefs.insert(idRefs.at(i)); + } else if (BuiltinTypes::xsIDREF->wxsTypeMatches(declaration->attribute()->type())) { + m_idRefs.insert(actualValue); + } + + m_model->setAssignedType(index, declaration->attribute()->type()); + m_model->setAssignedAttribute(index, declaration->attribute()); + + return true; +} + +//TODO: merge that with the method above +bool XsdValidatingInstanceReader::validateAttribute(const XsdAttribute::Ptr &declaration, const QString &value) +{ + const AnySimpleType::Ptr attributeType = declaration->type(); + const XsdFacet::Hash facets = XsdTypeChecker::mergedFacetsForType(attributeType, m_context); + + const QString actualValue = XsdTypeChecker::normalizedValue(value, facets); + + QString errorMsg; + AnySimpleType::Ptr boundType; + + const QXmlNodeModelIndex index = attributeItem(declaration->name(m_namePool)).toNodeModelIndex(); + + const XsdTypeChecker checker(m_context, namespaceBindings(index), sourceLocation()); + if (!checker.isValidString(actualValue, attributeType, errorMsg, &boundType)) { + error(QtXmlPatterns::tr("content of attribute %1 does not match its type definition: %2").arg(formatKeyword(declaration->displayName(m_namePool))).arg(errorMsg)); + return false; + } + + // @see http://www.w3.org/TR/xmlschema11-1/#cvc-au + if (declaration->valueConstraint() && declaration->valueConstraint()->variety() == XsdAttribute::ValueConstraint::Fixed) { + const QString actualConstraintValue = XsdTypeChecker::normalizedValue(declaration->valueConstraint()->value(), facets); + if (!checker.valuesAreEqual(actualValue, actualConstraintValue, attributeType)) { + error(QtXmlPatterns::tr("content of attribute %1 does not match defined value constraint").arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + } + + if (BuiltinTypes::xsID->wxsTypeMatches(declaration->type())) { + addIdIdRefBinding(actualValue, declaration); + } + + if (m_idRefsType->wxsTypeMatches(declaration->type())) { + const QStringList idRefs = actualValue.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < idRefs.count(); ++i) + m_idRefs.insert(idRefs.at(i)); + } else if (BuiltinTypes::xsIDREF->wxsTypeMatches(declaration->type())) { + m_idRefs.insert(actualValue); + } + + m_model->setAssignedType(index, declaration->type()); + m_model->setAssignedAttribute(index, declaration); + + return true; +} + +bool XsdValidatingInstanceReader::validateAttributeWildcard(const QXmlName &attributeName, const XsdWildcard::Ptr &wildcard) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#cvc-wildcard + + // wildcards using XsdWildcard::absentNamespace, so we have to fix that here + QXmlName name(attributeName); + if (name.namespaceURI() == StandardNamespaces::empty) { + name.setNamespaceURI(m_namePool->allocateNamespace(XsdWildcard::absentNamespace())); + } + + return XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, m_namePool); +} + +bool XsdValidatingInstanceReader::validateIdentityConstraint(const XsdElement::Ptr &element, const QXmlItem ¤tItem) +{ + const XsdIdentityConstraint::List constraints = element->identityConstraints(); + + for (int i = 0; i < constraints.count(); ++i) { + const XsdIdentityConstraint::Ptr constraint = constraints.at(i); + + TargetNode::Set targetNodeSet, qualifiedNodeSet; + selectNodeSets(element, currentItem, constraint, targetNodeSet, qualifiedNodeSet); + + if (constraint->category() == XsdIdentityConstraint::Unique) { + if (!validateUniqueIdentityConstraint(element, constraint, qualifiedNodeSet)) + return false; + } else if (constraint->category() == XsdIdentityConstraint::Key) { + if (!validateKeyIdentityConstraint(element, constraint, targetNodeSet, qualifiedNodeSet)) + return false; + } + } + + // we do the keyref check in a separated run to make sure that all keys are available + for (int i = 0; i < constraints.count(); ++i) { + const XsdIdentityConstraint::Ptr constraint = constraints.at(i); + if (constraint->category() == XsdIdentityConstraint::KeyReference) { + TargetNode::Set targetNodeSet, qualifiedNodeSet; + selectNodeSets(element, currentItem, constraint, targetNodeSet, qualifiedNodeSet); + + if (!validateKeyRefIdentityConstraint(element, constraint, qualifiedNodeSet)) + return false; + } + } + + return true; +} + +bool XsdValidatingInstanceReader::validateUniqueIdentityConstraint(const XsdElement::Ptr&, const XsdIdentityConstraint::Ptr &constraint, const TargetNode::Set &qualifiedNodeSet) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#d0e32243 + + // 4.1 + const XsdSchemaSourceLocationReflection reflection(sourceLocation()); + + QSetIterator it(qualifiedNodeSet); + while (it.hasNext()) { + const TargetNode node = it.next(); + QSetIterator innerIt(qualifiedNodeSet); + while (innerIt.hasNext()) { + const TargetNode innerNode = innerIt.next(); + + if (node == innerNode) // do not compare with ourself + continue; + + if (node.fieldsAreEqual(innerNode, m_namePool, m_context, &reflection)) { + error(QtXmlPatterns::tr("non-unique value found for constraint %1").arg(formatKeyword(constraint->displayName(m_namePool)))); + return false; + } + } + } + + m_idcKeys.insert(constraint->name(m_namePool), qualifiedNodeSet); + + return true; +} + +bool XsdValidatingInstanceReader::validateKeyIdentityConstraint(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &constraint, const TargetNode::Set &targetNodeSet, const TargetNode::Set &qualifiedNodeSet) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#d0e32243 + + // 4.2 + const XsdSchemaSourceLocationReflection reflection(sourceLocation()); + + // 4.2.1 + if (targetNodeSet.count() != qualifiedNodeSet.count()) { + error(QtXmlPatterns::tr("key constraint %1 contains absent fields").arg(formatKeyword(constraint->displayName(m_namePool)))); + return false; + } + + // 4.2.2 + if (!validateUniqueIdentityConstraint(element, constraint, qualifiedNodeSet)) + return false; + + // 4.2.3 + QSetIterator it(qualifiedNodeSet); + while (it.hasNext()) { + const TargetNode node = it.next(); + const QVector fieldItems = node.fieldItems(); + for (int i = 0; i < fieldItems.count(); ++i) { + const QXmlNodeModelIndex index = fieldItems.at(i).toNodeModelIndex(); + if (m_model->kind(index) == QXmlNodeModelIndex::Element) { + const XsdElement::Ptr declaration = m_model->assignedElement(index); + if (declaration && declaration->isNillable()) { + error(QtXmlPatterns::tr("key constraint %1 contains references nillable element %2") + .arg(formatKeyword(constraint->displayName(m_namePool))) + .arg(formatKeyword(declaration->displayName(m_namePool)))); + return false; + } + } + } + } + + m_idcKeys.insert(constraint->name(m_namePool), qualifiedNodeSet); + + return true; +} + +bool XsdValidatingInstanceReader::validateKeyRefIdentityConstraint(const XsdElement::Ptr&, const XsdIdentityConstraint::Ptr &constraint, const TargetNode::Set &qualifiedNodeSet) +{ + // @see http://www.w3.org/TR/xmlschema11-1/#d0e32243 + + // 4.3 + const XsdSchemaSourceLocationReflection reflection(sourceLocation()); + + const TargetNode::Set keySet = m_idcKeys.value(constraint->referencedKey()->name(m_namePool)); + + QSetIterator it(qualifiedNodeSet); + while (it.hasNext()) { + const TargetNode node = it.next(); + + bool foundMatching = false; + + QSetIterator keyIt(keySet); + while (keyIt.hasNext()) { + const TargetNode keyNode = keyIt.next(); + + if (node.fieldsAreEqual(keyNode, m_namePool, m_context, &reflection)) { + foundMatching = true; + break; + } + } + + if (!foundMatching) { + error(QtXmlPatterns::tr("no referenced value found for key reference %1").arg(formatKeyword(constraint->displayName(m_namePool)))); + return false; + } + } + + return true; +} + +QXmlQuery XsdValidatingInstanceReader::createXQuery(const QList &namespaceBindings, const QXmlItem &contextNode, const QString &queryString) const +{ + // create a public name pool from our name pool + QXmlNamePool namePool(m_namePool.data()); + + // the QXmlQuery shall work with the same name pool as we do + QXmlQuery query(namePool); + + // add additional namespace bindings + QXmlQueryPrivate *queryPrivate = query.d; + + for (int i = 0; i < namespaceBindings.count(); ++i) { + if (!namespaceBindings.at(i).prefix() == StandardPrefixes::empty) + queryPrivate->addAdditionalNamespaceBinding(namespaceBindings.at(i)); + } + + // set the context node for that query and the query string + query.setFocus(contextNode); + query.setQuery(queryString, m_documentUri); + + return query; +} + +bool XsdValidatingInstanceReader::selectNodeSets(const XsdElement::Ptr&, const QXmlItem ¤tItem, const XsdIdentityConstraint::Ptr &constraint, TargetNode::Set &targetNodeSet, TargetNode::Set &qualifiedNodeSet) +{ + // at first select all target nodes + const XsdXPathExpression::Ptr selector = constraint->selector(); + const XsdXPathExpression::List fields = constraint->fields(); + + QXmlQuery query = createXQuery(selector->namespaceBindings(), currentItem, selector->expression()); + + QXmlResultItems resultItems; + query.evaluateTo(&resultItems); + + // now we iterate over all target nodes and select the fields for each node + QXmlItem item(resultItems.next()); + while (!item.isNull()) { + + TargetNode targetNode(item); + + for (int i = 0; i < fields.count(); ++i) { + const XsdXPathExpression::Ptr field = fields.at(i); + QXmlQuery fieldQuery = createXQuery(field->namespaceBindings(), item, field->expression()); + + QXmlResultItems fieldResultItems; + fieldQuery.evaluateTo(&fieldResultItems); + + // copy result into vetor for better testing... + QVector fieldVector; + QXmlItem fieldItem(fieldResultItems.next()); + while (!fieldItem.isNull()) { + fieldVector.append(fieldItem); + fieldItem = fieldResultItems.next(); + } + + if (fieldVector.count() > 1) { + error(QtXmlPatterns::tr("more than one value found for field %1").arg(formatData(field->expression()))); + return false; + } + + if (fieldVector.count() == 1) { + fieldItem = fieldVector.first(); + + const QXmlNodeModelIndex index = fieldItem.toNodeModelIndex(); + const SchemaType::Ptr type = m_model->assignedType(index); + + bool typeOk = true; + if (type->isComplexType()) { + if (type->isDefinedBySchema()) { + if (XsdComplexType::Ptr(type)->contentType()->variety() != XsdComplexType::ContentType::Simple) + typeOk = false; + } else { + typeOk = false; + } + } + if (!typeOk) { + error(QtXmlPatterns::tr("field %1 has no simple type").arg(formatData(field->expression()))); + return false; + } + + SchemaType::Ptr targetType = type; + QString value = m_model->stringValue(fieldItem.toNodeModelIndex()); + + if (type->isDefinedBySchema()) { + if (type->isSimpleType()) + targetType = XsdSimpleType::Ptr(type)->primitiveType(); + else + targetType = XsdComplexType::Ptr(type)->contentType()->simpleType(); + } else { + if (BuiltinTypes::xsAnySimpleType->name(m_namePool) == type->name(m_namePool)) { + targetType = BuiltinTypes::xsString; + value = QLatin1String("___anySimpleType_value"); + } + } + + // if it is xs:QName derived type, we normalize the name content + // and do a string comparison + if (BuiltinTypes::xsQName->wxsTypeMatches(type)) { + targetType = BuiltinTypes::xsString; + + const QXmlName qName = convertToQName(value.trimmed()); + value = QString::fromLatin1("%1:%2").arg(m_namePool->stringForNamespace(qName.namespaceURI())).arg(m_namePool->stringForLocalName(qName.localName())); + } + + targetNode.addField(fieldItem, value, targetType); + } else { + // we add an empty entry here, that makes comparison easier later on + targetNode.addField(QXmlItem(), QString(), SchemaType::Ptr()); + } + } + + targetNodeSet.insert(targetNode); + + item = resultItems.next(); + } + + // copy all items from target node set to qualified node set, that have no empty fields + QSetIterator it(targetNodeSet); + while (it.hasNext()) { + const TargetNode node = it.next(); + if (node.emptyFieldsCount() == 0) + qualifiedNodeSet.insert(node); + } + + return true; +} + +XsdElement::Ptr XsdValidatingInstanceReader::elementByName(const QXmlName &name) const +{ + return m_schema->element(name); +} + +XsdAttribute::Ptr XsdValidatingInstanceReader::attributeByName(const QXmlName &name) const +{ + return m_schema->attribute(name); +} + +SchemaType::Ptr XsdValidatingInstanceReader::typeByName(const QXmlName &name) const +{ + const SchemaType::Ptr type = m_schema->type(name); + if (type) + return type; + + return m_context->schemaTypeFactory()->createSchemaType(name); +} + +void XsdValidatingInstanceReader::addIdIdRefBinding(const QString &id, const NamedSchemaComponent::Ptr &binding) +{ + if (!m_model->idIdRefBindings(id).isEmpty()) { + error(QtXmlPatterns::tr("ID value '%1' is not unique").arg(formatKeyword(id))); + return; + } + + m_model->addIdIdRefBinding(id, binding); +} + +QString XsdValidatingInstanceReader::qNameAttribute(const QXmlName &attributeName) +{ + const QString value = attribute(attributeName).simplified(); + if (!XPathHelper::isQName(value)) { + error(QtXmlPatterns::tr("'%1' attribute contains invalid QName content: %2").arg(m_namePool->displayName(attributeName)).arg(formatData(value))); + return QString(); + } else { + return value; + } +} + +XsdComplexType::Ptr XsdValidatingInstanceReader::anyType() +{ + if (m_anyType) + return m_anyType; + + const XsdWildcard::Ptr wildcard(new XsdWildcard()); + wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any); + wildcard->setProcessContents(XsdWildcard::Lax); + + const XsdParticle::Ptr outerParticle(new XsdParticle()); + outerParticle->setMinimumOccurs(1); + outerParticle->setMaximumOccurs(1); + + const XsdParticle::Ptr innerParticle(new XsdParticle()); + innerParticle->setMinimumOccurs(0); + innerParticle->setMaximumOccursUnbounded(true); + innerParticle->setTerm(wildcard); + + const XsdModelGroup::Ptr outerModelGroup(new XsdModelGroup()); + outerModelGroup->setCompositor(XsdModelGroup::SequenceCompositor); + outerModelGroup->setParticles(XsdParticle::List() << innerParticle); + outerParticle->setTerm(outerModelGroup); + + m_anyType = XsdComplexType::Ptr(new XsdComplexType()); + m_anyType->setName(BuiltinTypes::xsAnyType->name(m_namePool)); + m_anyType->setDerivationMethod(XsdComplexType::DerivationRestriction); + m_anyType->contentType()->setVariety(XsdComplexType::ContentType::Mixed); + m_anyType->contentType()->setParticle(outerParticle); + m_anyType->setAttributeWildcard(wildcard); + m_anyType->setIsAbstract(false); + + return m_anyType; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h new file mode 100644 index 0000000..799ab44 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h @@ -0,0 +1,266 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdValidatingInstanceReader_H +#define Patternist_XsdValidatingInstanceReader_H + +#include "qxsdidchelper_p.h" +#include "qxsdinstancereader_p.h" +#include "qxsdstatemachine_p.h" +#include "qxsdvalidatedxmlnodemodel_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QXmlQuery; + +namespace QPatternist +{ + /** + * @short The validating schema instance reader. + * + * This class reads in a xml instance document from a QAbstractXmlNodeModel and + * validates it against a given xml schema. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdValidatingInstanceReader : public XsdInstanceReader + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Creates a new validating instance reader that reads the data from + * the given @p model. + * + * @param model The model the data shall be read from. + * @param documentUri The uri of the document the model is from. + * @param context The context that is used to report errors etc. + */ + XsdValidatingInstanceReader(const XsdValidatedXmlNodeModel *model, const QUrl &documentUri, const XsdSchemaContext::Ptr &context); + + /** + * Adds a new @p schema to the pool of schemas that shall be used + * for validation. + * The schema is located at the given @p url. + */ + void addSchema(const XsdSchema::Ptr &schema, const QUrl &url); + + /** + * Reads and validates the instance document. + */ + bool read(); + + private: + /** + * Loads a schema with the given @p targetNamespace from the given @p location + * and adds it to the pool of schemas that are used for validation. + * + * This method is used to load schemas defined in the xsi:schemaLocation or + * xsi:noNamespaceSchemaLocation attributes in the instance document. + */ + bool loadSchema(const QString &targetNamespace, const QUrl &location); + + /** + * Reports an error via the report context. + */ + void error(const QString &msg) const; + + /** + * Validates the current element tag of the instance document. + * + * @param hasStateMachine Used to remember whether this element represents the start tag + * of a complex type and therefor pushes a new state machine on the stack. + * @param element Used to remember which element has been validated in this step. + */ + bool validate(bool &hasStateMachine, XsdElement::Ptr &element); + + /** + * Validates the current tag of the instance document against the given element @p declaration. + * + * @param declaration The element declaration to validate against. + * @param hasStateMachine Used to remember whether this element represents the start tag + * of a complex type and therefor pushes a new state machine on the stack. + */ + bool validateElement(const XsdElement::Ptr &declaration, bool &hasStateMachine); + + /** + * Validates the current tag of the instance document against the given @p type of the element @p declaration. + * + * @param declaration The element declaration to validate against. + * @param type The type to validate against. + * @param isNilled Defines whether the element is nilled by the instance document. + * @param hasStateMachine Used to remember whether this element represents the start tag + * of a complex type and therefor pushes a new state machine on the stack. + * + * @note The @p type can differ from the element @p declaration type if the instance document has defined + * it via xsi:type attribute. + */ + bool validateElementType(const XsdElement::Ptr &declaration, const SchemaType::Ptr &type, bool isNilled, bool &hasStateMachine); + + /** + * Validates the current tag of the instance document against the given simple @p type of the element @p declaration. + * + * @param declaration The element declaration to validate against. + * @param type The type to validate against. + * @param isNilled Defines whether the element is nilled by the instance document. + * + * @note The @p type can differ from the element @p declaration type if the instance document has defined + * it via xsi:type attribute. + */ + bool validateElementSimpleType(const XsdElement::Ptr &declaration, const SchemaType::Ptr &type, bool isNilled); + + /** + * Validates the current tag of the instance document against the given complex @p type of the element @p declaration. + * + * @param declaration The element declaration to validate against. + * @param type The type to validate against. + * @param isNilled Defines whether the element is nilled by the instance document. + * @param hasStateMachine Used to remember whether this element represents the start tag + * of a complex type and therefor pushes a new state machine on the stack. + * + * @note The @p type can differ from the element @p declaration type if the instance document has defined + * it via xsi:type attribute. + */ + bool validateElementComplexType(const XsdElement::Ptr &declaration, const SchemaType::Ptr &type, bool isNilled, bool &hasStateMachine); + + /** + * Validates the given @p value against the attribute use @p declaration. + */ + bool validateAttribute(const XsdAttributeUse::Ptr &declaration, const QString &value); + + /** + * Validates the given @p value against the attribute @p declaration. + */ + bool validateAttribute(const XsdAttribute::Ptr &declaration, const QString &value); + + /** + * Validates the given @p attributeName against the @p wildcard. + */ + bool validateAttributeWildcard(const QXmlName &attributeName, const XsdWildcard::Ptr &wildcard); + + /** + * Validates the identity constraints of an @p element. + */ + bool validateIdentityConstraint(const XsdElement::Ptr &element, const QXmlItem ¤tItem); + + /** + * Validates the unique identity @p constraint of the @p element. + */ + bool validateUniqueIdentityConstraint(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &constraint, const TargetNode::Set &qualifiedNodeSet); + + /** + * Validates the key identity @p constraint of the @p element. + */ + bool validateKeyIdentityConstraint(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &constraint, const TargetNode::Set &targetNodeSet, const TargetNode::Set &qualifiedNodeSet); + + /** + * Validates the keyref identity @p constraint of the @p element. + */ + bool validateKeyRefIdentityConstraint(const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &constraint, const TargetNode::Set &qualifiedNodeSet); + + /** + * Selects two sets of nodes that match the given identity @p constraint. + * + * @param element The element the identity constraint belongs to. + * @param currentItem The current element that will be used as focus for the XQuery. + * @param constraint The constraint (selector and fields) that describe the two sets. + * @param targetNodeSet The target node set as defined by the schema specification. + * @param qualifiedNodeSet The qualified node set as defined by the schema specification. + */ + bool selectNodeSets(const XsdElement::Ptr &element, const QXmlItem ¤tItem, const XsdIdentityConstraint::Ptr &constraint, TargetNode::Set &targetNodeSet, TargetNode::Set &qualifiedNodeSet); + + /** + * Creates an QXmlQuery object with the defined @p namespaceBindings that has the @p contextNode as focus + * and will execute @p query. + */ + QXmlQuery createXQuery(const QList &namespaceBindings, const QXmlItem &contextNode, const QString &query) const; + + /** + * Returns the element declaration with the given @p name from the pool of all schemas. + */ + XsdElement::Ptr elementByName(const QXmlName &name) const; + + /** + * Returns the attribute declaration with the given @p name from the pool of all schemas. + */ + XsdAttribute::Ptr attributeByName(const QXmlName &name) const; + + /** + * Returns the type declaration with the given @p name from the pool of all schemas. + */ + SchemaType::Ptr typeByName(const QXmlName &name) const; + + /** + * Adds the ID/IDREF binding to the validated model and checks for duplicates. + */ + void addIdIdRefBinding(const QString &id, const NamedSchemaComponent::Ptr &binding); + + /** + * Helper method that reads an attribute of type xs:QName and does + * syntax checking. + */ + QString qNameAttribute(const QXmlName &attributeName); + + /** + * Returns the xs:anyType that is used to build up the state machine. + * We need that as the BuiltinTypes::xsAnyType is not a XsdComplexType. + */ + XsdComplexType::Ptr anyType(); + + /** + * Helper method that creates a state machine for the given @p particle + * and pushes it on the state machine stack. + */ + void createAndPushStateMachine(const XsdParticle::Ptr &particle); + + typedef QHash MergedSchemas; + typedef QHashIterator MergedSchemasIterator; + + XsdValidatedXmlNodeModel::Ptr m_model; + MergedSchemas m_mergedSchemas; + XsdSchema::Ptr m_schema; + const NamePool::Ptr m_namePool; + const QXmlName m_xsiNilName; + const QXmlName m_xsiTypeName; + const QXmlName m_xsiSchemaLocationName; + const QXmlName m_xsiNoNamespaceSchemaLocationName; + + QStack > m_stateMachines; + QUrl m_documentUri; + XsdComplexType::Ptr m_anyType; + QSet m_processedNamespaces; + QSet m_processedSchemaLocations; + QSet m_idRefs; + QHash m_idcKeys; + SchemaType::Ptr m_idRefsType; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdwildcard.cpp b/src/xmlpatterns/schema/qxsdwildcard.cpp new file mode 100644 index 0000000..6efb996 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdwildcard.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdwildcard_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +QString XsdWildcard::absentNamespace() +{ + return QLatin1String("__ns_absent"); +} + +void XsdWildcard::NamespaceConstraint::setVariety(Variety variety) +{ + m_variety = variety; +} + +XsdWildcard::NamespaceConstraint::Variety XsdWildcard::NamespaceConstraint::variety() const +{ + return m_variety; +} + +void XsdWildcard::NamespaceConstraint::setNamespaces(const QSet &namespaces) +{ + m_namespaces = namespaces; +} + +QSet XsdWildcard::NamespaceConstraint::namespaces() const +{ + return m_namespaces; +} + +void XsdWildcard::NamespaceConstraint::setDisallowedNames(const QSet &names) +{ + m_disallowedNames = names; +} + +QSet XsdWildcard::NamespaceConstraint::disallowedNames() const +{ + return m_disallowedNames; +} + +XsdWildcard::XsdWildcard() + : m_namespaceConstraint(new NamespaceConstraint()) + , m_processContents(Strict) +{ + m_namespaceConstraint->setVariety(NamespaceConstraint::Any); +} + +bool XsdWildcard::isWildcard() const +{ + return true; +} + +void XsdWildcard::setNamespaceConstraint(const NamespaceConstraint::Ptr &namespaceConstraint) +{ + m_namespaceConstraint = namespaceConstraint; +} + +XsdWildcard::NamespaceConstraint::Ptr XsdWildcard::namespaceConstraint() const +{ + return m_namespaceConstraint; +} + +void XsdWildcard::setProcessContents(ProcessContents contents) +{ + m_processContents = contents; +} + +XsdWildcard::ProcessContents XsdWildcard::processContents() const +{ + return m_processContents; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdwildcard_p.h b/src/xmlpatterns/schema/qxsdwildcard_p.h new file mode 100644 index 0000000..8fbecb3 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdwildcard_p.h @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdWildcard_H +#define Patternist_XsdWildcard_H + +#include "qxsdterm_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD wildcard object. + * + * This class represents the wildcard object of a XML schema as described + * here. + * + * It contains information from either an any object or an anyAttribute object. + * + * @see XML Schema API reference + * @ingroup Patternist_schema + * @author Tobias Koenig + */ + class XsdWildcard : public XsdTerm + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Defines the absent namespace that is used in wildcards. + */ + static QString absentNamespace(); + + /** + * Describes the namespace constraint of the wildcard. + */ + class NamespaceConstraint : public QSharedData + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the variety of the namespace constraint. + * + * @see Variety Definition + */ + enum Variety + { + Any, ///< Any namespace is allowed. + Enumeration, ///< Namespaces in the namespaces set are allowed. + Not ///< Namespaces in the namespaces set are not allowed. + }; + + /** + * Sets the @p variety of the namespace constraint. + * + * @see Variety Definition + */ + void setVariety(Variety variety); + + /** + * Returns the variety of the namespace constraint. + */ + Variety variety() const; + + /** + * Sets the set of @p namespaces of the namespace constraint. + */ + void setNamespaces(const QSet &namespaces); + + /** + * Returns the set of namespaces of the namespace constraint. + */ + QSet namespaces() const; + + /** + * Sets the set of disallowed @p names of the namespace constraint. + */ + void setDisallowedNames(const QSet &names); + + /** + * Returns the set of disallowed names of the namespace constraint. + */ + QSet disallowedNames() const; + + private: + Variety m_variety; + QSet m_namespaces; + QSet m_disallowedNames; + }; + + /** + * Describes the type of content processing of the wildcard. + */ + enum ProcessContents + { + Strict, ///< There must be a top-level declaration for the item available, or the item must have an xsi:type, and the item must be valid as appropriate. + Lax, ///< If the item has a uniquely determined declaration available, it must be valid with respect to that definition. + Skip ///< No constraints at all: the item must simply be well-formed XML. + }; + + /** + * Creates a new wildcard object. + */ + XsdWildcard(); + + /** + * Returns always @c true, used to avoid dynamic casts. + */ + virtual bool isWildcard() const; + + /** + * Sets the namespace @p constraint of the wildcard. + * + * @see Namespace Constraint Definition + */ + void setNamespaceConstraint(const NamespaceConstraint::Ptr &constraint); + + /** + * Returns the namespace constraint of the wildcard. + */ + NamespaceConstraint::Ptr namespaceConstraint() const; + + /** + * Sets the process @p contents of the wildcard. + * + * @see Process Contents Definition + */ + void setProcessContents(ProcessContents contents); + + /** + * Returns the process contents of the wildcard. + */ + ProcessContents processContents() const; + + private: + NamespaceConstraint::Ptr m_namespaceConstraint; + ProcessContents m_processContents; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/qxsdxpathexpression.cpp b/src/xmlpatterns/schema/qxsdxpathexpression.cpp new file mode 100644 index 0000000..ba9d0a4 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdxpathexpression.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qxsdxpathexpression_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +void XsdXPathExpression::setNamespaceBindings(const QList &set) +{ + m_namespaceBindings = set; +} + +QList XsdXPathExpression::namespaceBindings() const +{ + return m_namespaceBindings; +} + +void XsdXPathExpression::setDefaultNamespace(const AnyURI::Ptr &defaultNs) +{ + m_defaultNamespace = defaultNs; +} + +AnyURI::Ptr XsdXPathExpression::defaultNamespace() const +{ + return m_defaultNamespace; +} + +void XsdXPathExpression::setBaseURI(const AnyURI::Ptr &uri) +{ + m_baseURI = uri; +} + +AnyURI::Ptr XsdXPathExpression::baseURI() const +{ + return m_baseURI; +} + +void XsdXPathExpression::setExpression(const QString &expression) +{ + m_expression = expression; +} + +QString XsdXPathExpression::expression() const +{ + return m_expression; +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/schema/qxsdxpathexpression_p.h b/src/xmlpatterns/schema/qxsdxpathexpression_p.h new file mode 100644 index 0000000..e57f7b7 --- /dev/null +++ b/src/xmlpatterns/schema/qxsdxpathexpression_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_XsdXPathExpression_H +#define Patternist_XsdXPathExpression_H + +#include "qanyuri_p.h" +#include "qnamedschemacomponent_p.h" +#include "qxsdannotated_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Represents a XSD assertion object. + * + * @ingroup Patternist_schema + * @author Tobias Koenig + * @see XPathExpression Definition + */ + class XsdXPathExpression : public NamedSchemaComponent, public XsdAnnotated + { + public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; + + /** + * Sets the list of namespace @p bindings of the XPath expression. + * + * @see Namespace Bindings Definition + * + * @note We can't use a QSet here, as the hash method does not take the prefix + * in account, so we loose entries. + */ + void setNamespaceBindings(const QList &bindings); + + /** + * Returns the list of namespace bindings of the XPath expression. + */ + QList namespaceBindings() const; + + /** + * Sets the default namespace of the XPath expression. + * + * @see Default Namespace Definition + */ + void setDefaultNamespace(const AnyURI::Ptr &defaultNamespace); + + /** + * Returns the default namespace of the XPath expression. + */ + AnyURI::Ptr defaultNamespace() const; + + /** + * Sets the base @p uri of the XPath expression. + * + * @see Base URI Definition + */ + void setBaseURI(const AnyURI::Ptr &uri); + + /** + * Returns the base uri of the XPath expression. + */ + AnyURI::Ptr baseURI() const; + + /** + * Sets the @p expression string of the XPath expression. + * + * @see Expression Definition + */ + void setExpression(const QString &expression); + + /** + * Returns the expression string of the XPath expression. + */ + QString expression() const; + + private: + QList m_namespaceBindings; + AnyURI::Ptr m_defaultNamespace; + AnyURI::Ptr m_baseURI; + QString m_expression; + }; +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/schema/schema.pri b/src/xmlpatterns/schema/schema.pri new file mode 100644 index 0000000..b00d64b --- /dev/null +++ b/src/xmlpatterns/schema/schema.pri @@ -0,0 +1,93 @@ +HEADERS += $$PWD/qnamespacesupport_p.h \ + $$PWD/qxsdalternative_p.h \ + $$PWD/qxsdannotated_p.h \ + $$PWD/qxsdannotation_p.h \ + $$PWD/qxsdapplicationinformation_p.h \ + $$PWD/qxsdassertion_p.h \ + $$PWD/qxsdattribute_p.h \ + $$PWD/qxsdattributereference_p.h \ + $$PWD/qxsdattributeterm_p.h \ + $$PWD/qxsdattributeuse_p.h \ + $$PWD/qxsdattributegroup_p.h \ + $$PWD/qxsdcomplextype_p.h \ + $$PWD/qxsddocumentation_p.h \ + $$PWD/qxsdelement_p.h \ + $$PWD/qxsdfacet_p.h \ + $$PWD/qxsdidcache_p.h \ + $$PWD/qxsdidchelper_p.h \ + $$PWD/qxsdidentityconstraint_p.h \ + $$PWD/qxsdinstancereader_p.h \ + $$PWD/qxsdmodelgroup_p.h \ + $$PWD/qxsdnotation_p.h \ + $$PWD/qxsdparticle_p.h \ + $$PWD/qxsdparticlechecker_p.h \ + $$PWD/qxsdreference_p.h \ + $$PWD/qxsdsimpletype_p.h \ + $$PWD/qxsdschema_p.h \ + $$PWD/qxsdschemachecker_p.h \ + $$PWD/qxsdschemacontext_p.h \ + $$PWD/qxsdschemadebugger_p.h \ + $$PWD/qxsdschemahelper_p.h \ + $$PWD/qxsdschemamerger_p.h \ + $$PWD/qxsdschemaparser_p.h \ + $$PWD/qxsdschemaparsercontext_p.h \ + $$PWD/qxsdschemaresolver_p.h \ + $$PWD/qxsdschematoken_p.h \ + $$PWD/qxsdschematypesfactory_p.h \ + $$PWD/qxsdstatemachine_p.h \ + $$PWD/qxsdstatemachinebuilder_p.h \ + $$PWD/qxsdterm_p.h \ + $$PWD/qxsdtypechecker_p.h \ + $$PWD/qxsduserschematype_p.h \ + $$PWD/qxsdvalidatedxmlnodemodel_p.h \ + $$PWD/qxsdvalidatinginstancereader_p.h \ + $$PWD/qxsdwildcard_p.h \ + $$PWD/qxsdxpathexpression_p.h + +SOURCES += $$PWD/qnamespacesupport.cpp \ + $$PWD/qxsdalternative.cpp \ + $$PWD/qxsdannotated.cpp \ + $$PWD/qxsdannotation.cpp \ + $$PWD/qxsdapplicationinformation.cpp \ + $$PWD/qxsdassertion.cpp \ + $$PWD/qxsdattribute.cpp \ + $$PWD/qxsdattributereference.cpp \ + $$PWD/qxsdattributeterm.cpp \ + $$PWD/qxsdattributeuse.cpp \ + $$PWD/qxsdattributegroup.cpp \ + $$PWD/qxsdcomplextype.cpp \ + $$PWD/qxsddocumentation.cpp \ + $$PWD/qxsdelement.cpp \ + $$PWD/qxsdfacet.cpp \ + $$PWD/qxsdidcache.cpp \ + $$PWD/qxsdidchelper.cpp \ + $$PWD/qxsdidentityconstraint.cpp \ + $$PWD/qxsdinstancereader.cpp \ + $$PWD/qxsdmodelgroup.cpp \ + $$PWD/qxsdnotation.cpp \ + $$PWD/qxsdparticle.cpp \ + $$PWD/qxsdparticlechecker.cpp \ + $$PWD/qxsdreference.cpp \ + $$PWD/qxsdsimpletype.cpp \ + $$PWD/qxsdschema.cpp \ + $$PWD/qxsdschemachecker.cpp \ + $$PWD/qxsdschemachecker_setup.cpp \ + $$PWD/qxsdschemacontext.cpp \ + $$PWD/qxsdschemadebugger.cpp \ + $$PWD/qxsdschemahelper.cpp \ + $$PWD/qxsdschemamerger.cpp \ + $$PWD/qxsdschemaparser.cpp \ + $$PWD/qxsdschemaparser_setup.cpp \ + $$PWD/qxsdschemaparsercontext.cpp \ + $$PWD/qxsdschemaresolver.cpp \ + $$PWD/qxsdschematoken.cpp \ + $$PWD/qxsdschematypesfactory.cpp \ + $$PWD/qxsdstatemachinebuilder.cpp \ + $$PWD/qxsdterm.cpp \ + $$PWD/qxsdtypechecker.cpp \ + $$PWD/qxsdwildcard.cpp \ + $$PWD/qxsdvalidatedxmlnodemodel.cpp \ + $$PWD/qxsdvalidatinginstancereader.cpp \ + $$PWD/qxsdxpathexpression.cpp + +RESOURCES += $$PWD/builtinschemas.qrc diff --git a/src/xmlpatterns/schema/schemas/xml.xsd b/src/xmlpatterns/schema/schemas/xml.xsd new file mode 100644 index 0000000..eeb9db5 --- /dev/null +++ b/src/xmlpatterns/schema/schemas/xml.xsd @@ -0,0 +1,145 @@ + + + + + + See http://www.w3.org/XML/1998/namespace.html and + http://www.w3.org/TR/REC-xml for information about this namespace. + + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + + Note that local names in this namespace are intended to be defined + only by the World Wide Web Consortium or its subgroups. The + following names are currently defined in this namespace and should + not be used with conflicting semantics by any Working Group, + specification, or document instance: + + base (as an attribute name): denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification. + + id (as an attribute name): denotes an attribute whose value + should be interpreted as if declared to be of type ID. + This name is reserved by virtue of its definition in the + xml:id specification. + + lang (as an attribute name): denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification. + + space (as an attribute name): denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification. + + Father (in any context at all): denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + + In appreciation for his vision, leadership and dedication + the W3C XML Plenary on this 10th day of February, 2000 + reserves for Jon Bosak in perpetuity the XML name + xml:Father + + + + + This schema defines attributes and an attribute group + suitable for use by + schemas wishing to allow xml:base, xml:lang, xml:space or xml:id + attributes on elements they define. + + To enable this, such a schema must import this schema + for the XML namespace, e.g. as follows: + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + + Subsequently, qualified reference to any of the attributes + or the group defined below will have the desired effect, e.g. + + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + + will define a type which will schema-validate an instance + element with any of those attributes + + + + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + http://www.w3.org/2007/08/xml.xsd. + At the date of issue it can also be found at + http://www.w3.org/2001/xml.xsd. + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML Schema + itself, or with the XML namespace itself. In other words, if the XML + Schema or XML namespaces change, the version of this document at + http://www.w3.org/2001/xml.xsd will change + accordingly; the version at + http://www.w3.org/2007/08/xml.xsd will not change. + + + + + + Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. See + RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry + at http://www.iana.org/assignments/lang-tag-apps.htm for + further information. + + The union allows for the 'un-declaration' of xml:lang with + the empty string. + + + + + + + + + + + + + + + + + + + + + + + + See http://www.w3.org/TR/xmlbase/ for + information about this attribute. + + + + + + See http://www.w3.org/TR/xml-id/ for + information about this attribute. + + + + + + + + + + + diff --git a/src/xmlpatterns/schema/tokens.xml b/src/xmlpatterns/schema/tokens.xml new file mode 100644 index 0000000..7ec9752 --- /dev/null +++ b/src/xmlpatterns/schema/tokens.xml @@ -0,0 +1,125 @@ + + + + abstract + all + alternative + annotation + any + anyAttribute + appinfo + appliesToEmpty + assert + assertion + attribute + attributeFormDefault + attributeGroup + base + block + blockDefault + choice + collapse + complexContent + complexType + default + defaultAttributes + defaultAttributesApply + defaultOpenContent + documentation + element + elementFormDefault + enumeration + extension + field + final + finalDefault + fixed + form + fractionDigits + group + id + import + include + itemType + key + keyref + length + list + maxExclusive + maxInclusive + maxLength + maxOccurs + memberTypes + minExclusive + minInclusive + minLength + minOccurs + mixed + mode + name + namespace + nillable + notation + notNamespace + notQName + openContent + override + preserve + pattern + processContents + public + redefine + ref + refer + replace + restriction + schema + schemaLocation + selector + sequence + simpleContent + simpleType + source + substitutionGroup + system + targetNamespace + test + totalDigits + type + union + unique + use + value + version + whiteSpace + xpath + xpathDefaultNamespace + xml:lang + http://www.w3.org/2001/XMLSchema + + + + + /**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + + + + + + diff --git a/src/xmlpatterns/type/qanysimpletype.cpp b/src/xmlpatterns/type/qanysimpletype.cpp index c685d54..81120a7 100644 --- a/src/xmlpatterns/type/qanysimpletype.cpp +++ b/src/xmlpatterns/type/qanysimpletype.cpp @@ -80,4 +80,14 @@ SchemaType::DerivationMethod AnySimpleType::derivationMethod() const return DerivationRestriction; } +bool AnySimpleType::isSimpleType() const +{ + return true; +} + +bool AnySimpleType::isComplexType() const +{ + return false; +} + QT_END_NAMESPACE diff --git a/src/xmlpatterns/type/qanysimpletype_p.h b/src/xmlpatterns/type/qanysimpletype_p.h index b91c7d0..ebd4b5f 100644 --- a/src/xmlpatterns/type/qanysimpletype_p.h +++ b/src/xmlpatterns/type/qanysimpletype_p.h @@ -73,6 +73,8 @@ namespace QPatternist class AnySimpleType : public AnyType { public: + typedef QExplicitlySharedDataPointer Ptr; + typedef QList List; friend class BuiltinTypes; virtual ~AnySimpleType(); @@ -105,6 +107,16 @@ namespace QPatternist */ virtual SchemaType::DerivationMethod derivationMethod() const; + /** + * Always returns @c true. + */ + virtual bool isSimpleType() const; + + /** + * Always returns @c false. + */ + virtual bool isComplexType() const; + protected: AnySimpleType(); diff --git a/src/xmlpatterns/type/qanytype.cpp b/src/xmlpatterns/type/qanytype.cpp index 95ad2b3..19f029f 100644 --- a/src/xmlpatterns/type/qanytype.cpp +++ b/src/xmlpatterns/type/qanytype.cpp @@ -69,7 +69,7 @@ QXmlName AnyType::name(const NamePool::Ptr &np) const return np->allocateQName(StandardNamespaces::xs, QLatin1String("anyType")); } -QString AnyType::displayName(const NamePool::Ptr &) const +QString AnyType::displayName(const NamePool::Ptr &np) const { /* A bit faster than calling name()->displayName() */ return QLatin1String("xs:anyType"); @@ -85,9 +85,19 @@ SchemaType::TypeCategory AnyType::category() const return None; } +bool AnyType::isComplexType() const +{ + return true; +} + SchemaType::DerivationMethod AnyType::derivationMethod() const { return NoDerivation; } +SchemaType::DerivationConstraints AnyType::derivationConstraints() const +{ + return SchemaType::DerivationConstraints(); +} + QT_END_NAMESPACE diff --git a/src/xmlpatterns/type/qanytype_p.h b/src/xmlpatterns/type/qanytype_p.h index 70477af..8f2505e 100644 --- a/src/xmlpatterns/type/qanytype_p.h +++ b/src/xmlpatterns/type/qanytype_p.h @@ -114,6 +114,16 @@ namespace QPatternist */ virtual DerivationMethod derivationMethod() const; + /** + * @returns an empty set of derivation constraint flags. + */ + virtual DerivationConstraints derivationConstraints() const; + + /** + * Always returns @c true. + */ + virtual bool isComplexType() const; + protected: /** * @short This constructor is protected, because this diff --git a/src/xmlpatterns/type/qnamedschemacomponent.cpp b/src/xmlpatterns/type/qnamedschemacomponent.cpp new file mode 100644 index 0000000..e45b9b6 --- /dev/null +++ b/src/xmlpatterns/type/qnamedschemacomponent.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "qnamedschemacomponent_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QPatternist; + +NamedSchemaComponent::NamedSchemaComponent() +{ +} + +NamedSchemaComponent::~NamedSchemaComponent() +{ +} + +void NamedSchemaComponent::setName(const QXmlName &name) +{ + m_name = name; +} + +QXmlName NamedSchemaComponent::name(const NamePool::Ptr&) const +{ + return m_name; +} + +QString NamedSchemaComponent::displayName(const NamePool::Ptr &np) const +{ + return np->displayName(m_name); +} + +QT_END_NAMESPACE diff --git a/src/xmlpatterns/type/qnamedschemacomponent_p.h b/src/xmlpatterns/type/qnamedschemacomponent_p.h new file mode 100644 index 0000000..bc3121b --- /dev/null +++ b/src/xmlpatterns/type/qnamedschemacomponent_p.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_NamedSchemaComponent_H +#define Patternist_NamedSchemaComponent_H + +#include "qnamepool_p.h" +#include "qschemacomponent_p.h" +#include "qxmlname.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QPatternist +{ + /** + * @short Base class for all named components that can appear in a W3C XML Schema. + * + * @ingroup Patternist_types + * @author Tobias Koenig + */ + class NamedSchemaComponent : public SchemaComponent + { + public: + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Describes the blocking constraints that are given by the 'block' attributes. + */ + enum BlockingConstraint + { + RestrictionConstraint = 1, + ExtensionConstraint = 2, + SubstitutionConstraint = 4 + }; + Q_DECLARE_FLAGS(BlockingConstraints, BlockingConstraint) + + /** + * Creates a new named schema component. + */ + NamedSchemaComponent(); + + /** + * Destroys the named schema component. + */ + virtual ~NamedSchemaComponent(); + + /** + * Sets the @p name of the schema component. + */ + void setName(const QXmlName &name); + + /** + * Returns the name of the schema component. + * + * @param namePool The name pool the name belongs to. + */ + virtual QXmlName name(const NamePool::Ptr &namePool) const; + + /** + * Returns the display name of the schema component. + * + * @param namePool The name pool the name belongs to. + */ + virtual QString displayName(const NamePool::Ptr &namePool) const; + + private: + QXmlName m_name; + }; + + Q_DECLARE_OPERATORS_FOR_FLAGS(NamedSchemaComponent::BlockingConstraints) +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/xmlpatterns/type/qprimitives_p.h b/src/xmlpatterns/type/qprimitives_p.h index 354b690..a1a41ae 100644 --- a/src/xmlpatterns/type/qprimitives_p.h +++ b/src/xmlpatterns/type/qprimitives_p.h @@ -53,6 +53,8 @@ #define Patternist_Primitives_H #include +#include +#include /** * @file @@ -72,6 +74,17 @@ QT_BEGIN_NAMESPACE class QString; /** + * @internal + * + * A method to allow a QHash or QSet with QUrl + * as key type. + */ +inline uint qHash(const QUrl &uri) +{ + return qHash(uri.toString()); +} + +/** * @short The namespace for the internal API of QtXmlPatterns * @internal */ diff --git a/src/xmlpatterns/type/qschematype.cpp b/src/xmlpatterns/type/qschematype.cpp index b4d6bc0..1ffd151 100644 --- a/src/xmlpatterns/type/qschematype.cpp +++ b/src/xmlpatterns/type/qschematype.cpp @@ -72,4 +72,9 @@ bool SchemaType::isComplexType() const return category() == ComplexType; } +bool SchemaType::isDefinedBySchema() const +{ + return false; +} + QT_END_NAMESPACE diff --git a/src/xmlpatterns/type/qschematype_p.h b/src/xmlpatterns/type/qschematype_p.h index 30f63c8..ca59bdc 100644 --- a/src/xmlpatterns/type/qschematype_p.h +++ b/src/xmlpatterns/type/qschematype_p.h @@ -57,6 +57,7 @@ #include "qxmlname.h" template class QHash; +template class QList; QT_BEGIN_HEADER @@ -80,6 +81,7 @@ namespace QPatternist typedef QExplicitlySharedDataPointer Ptr; typedef QHash Hash; + typedef QList List; /** * Schema types are divided into different categories such as @@ -117,6 +119,18 @@ namespace QPatternist NoDerivation = 16 }; + /** + * Describes the derivation constraints that are given by the 'final' or 'block' attributes. + */ + enum DerivationConstraint + { + RestrictionConstraint = 1, + ExtensionConstraint = 2, + ListConstraint = 4, + UnionConstraint = 8 + }; + Q_DECLARE_FLAGS(DerivationConstraints, DerivationConstraint) + SchemaType(); virtual ~SchemaType(); @@ -137,6 +151,11 @@ namespace QPatternist virtual DerivationMethod derivationMethod() const = 0; /** + * Determines what derivation constraints exists for the type. + */ + virtual DerivationConstraints derivationConstraints() const = 0; + + /** * Determines whether the type is an abstract type. * * @note It is important a correct value is returned, since @@ -202,7 +221,7 @@ namespace QPatternist * @note Do not re-implement this function, but instead override category() * and let it return an appropriate value. */ - bool isSimpleType() const; + virtual bool isSimpleType() const; /** * Determines whether the type is a complex type, by introspecting @@ -211,8 +230,15 @@ namespace QPatternist * @note Do not re-implement this function, but instead override category() * and let it return an appropriate value. */ - bool isComplexType() const; + virtual bool isComplexType() const; + + /** + * Returns whether the value has been defined by a schema (is not a built in type). + */ + virtual bool isDefinedBySchema() const; }; + + Q_DECLARE_OPERATORS_FOR_FLAGS(SchemaType::DerivationConstraints) } QT_END_NAMESPACE diff --git a/src/xmlpatterns/type/type.pri b/src/xmlpatterns/type/type.pri index ef5976a..5425298 100644 --- a/src/xmlpatterns/type/type.pri +++ b/src/xmlpatterns/type/type.pri @@ -24,6 +24,7 @@ HEADERS += $$PWD/qabstractnodetest_p.h \ $$PWD/qitemtype_p.h \ $$PWD/qlocalnametest_p.h \ $$PWD/qmultiitemtype_p.h \ + $$PWD/qnamedschemacomponent_p.h \ $$PWD/qnamespacenametest_p.h \ $$PWD/qnonetype_p.h \ $$PWD/qnumerictype_p.h \ @@ -57,6 +58,7 @@ SOURCES += $$PWD/qabstractnodetest.cpp \ $$PWD/qitemtype.cpp \ $$PWD/qlocalnametest.cpp \ $$PWD/qmultiitemtype.cpp \ + $$PWD/qnamedschemacomponent.cpp \ $$PWD/qnamespacenametest.cpp \ $$PWD/qnonetype.cpp \ $$PWD/qnumerictype.cpp \ diff --git a/src/xmlpatterns/utils/qpatternistlocale_p.h b/src/xmlpatterns/utils/qpatternistlocale_p.h index e3f645f..c340d95 100644 --- a/src/xmlpatterns/utils/qpatternistlocale_p.h +++ b/src/xmlpatterns/utils/qpatternistlocale_p.h @@ -168,6 +168,16 @@ namespace QPatternist } /** + * @short Formats name of any type. + */ + static inline QString formatType(const NamePool::Ptr &np, const QXmlName &name) + { + return QLatin1String("") + + escape(np->displayName(name)) + + QLatin1String(""); + } + + /** * @short Formats Cardinality. */ static inline QString formatType(const Cardinality &type) diff --git a/src/xmlpatterns/xmlpatterns.pro b/src/xmlpatterns/xmlpatterns.pro index e9d8af9..fb6aa1a 100644 --- a/src/xmlpatterns/xmlpatterns.pro +++ b/src/xmlpatterns/xmlpatterns.pro @@ -21,6 +21,8 @@ include($$PWD/iterators/iterators.pri) include($$PWD/janitors/janitors.pri) include($$PWD/parser/parser.pri) include($$PWD/projection/projection.pri) +include($$PWD/schema/schema.pri) +include($$PWD/schematron/schematron.pri) include($$PWD/type/type.pri) include($$PWD/utils/utils.pri) include($$PWD/qobjectmodel/qobjectmodel.pri) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 443ee7e..e8eea71 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -402,9 +402,14 @@ SUBDIRS += checkxmlfiles \ qxmlnodemodelindex \ qxmlquery \ qxmlresultitems \ + qxmlschema \ + qxmlschemavalidator \ qxmlserializer \ xmlpatterns \ xmlpatternsdiagnosticsts \ + xmlpatternsschema \ + xmlpatternsschemats \ + xmlpatternsvalidator \ xmlpatternsview \ xmlpatternsxqts \ xmlpatternsxslts diff --git a/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp b/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp index 72b43ee..9eacd90 100644 --- a/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp +++ b/tests/auto/qabstractxmlnodemodel/tst_qabstractxmlnodemodel.cpp @@ -45,6 +45,7 @@ #ifdef QTEST_XMLPATTERNS +#include #include #include #include @@ -80,6 +81,7 @@ private Q_SLOTS: void id() const; void idref() const; void typedValue() const; + void sourceLocation() const; private: QAbstractXmlNodeModel::Ptr m_nodeModel; @@ -389,6 +391,12 @@ void tst_QAbstractXmlNodeModel::typedValue() const QVERIFY(output.isEmpty()); } +void tst_QAbstractXmlNodeModel::sourceLocation() const +{ + const QAbstractXmlNodeModel* const constModel = m_nodeModel.data(); + const QSourceLocation location = constModel->sourceLocation(m_rootNode); +} + QTEST_MAIN(tst_QAbstractXmlNodeModel) #include "tst_qabstractxmlnodemodel.moc" diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index d457581..6d8a803 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -220,6 +220,10 @@ private Q_SLOTS: void bindVariableQXmlNameQXmlQuery() const; void bindVariableQXmlQueryInvalidate() const; + void identityConstraintSuccess() const; + void identityConstraintFailure() const; + void identityConstraintFailure_data() const; + // TODO call all URI resolving functions where 1) the URI resolver return a null QUrl(); 2) resolves into valid, existing URI, 3) invalid, non-existing URI. // TODO bind stringlists, variant lists, both ways. // TODO trigger serialization error, or any error in evaluateToushCallback(). @@ -2920,6 +2924,9 @@ void tst_QXmlQuery::enumQueryLanguage() const /* These enum values should be possible to OR for future plans. */ QCOMPARE(int(QXmlQuery::XQuery10), 1); QCOMPARE(int(QXmlQuery::XSLT20), 2); + QCOMPARE(int(QXmlQuery::XmlSchema11IdentityConstraintSelector), 1024); + QCOMPARE(int(QXmlQuery::XmlSchema11IdentityConstraintField), 2048); + QCOMPARE(int(QXmlQuery::XPath20), 4096); } void tst_QXmlQuery::setInitialTemplateNameQXmlName() const @@ -3222,6 +3229,157 @@ void tst_QXmlQuery::bindVariableQXmlQueryInvalidate() const QVERIFY(!query.isValid()); } +void tst_QXmlQuery::identityConstraintSuccess() const +{ + QXmlQuery::QueryLanguage queryLanguage = QXmlQuery::XmlSchema11IdentityConstraintSelector; + + /* We run this code for Selector and Field. */ + for(int i = 0; i < 3; ++i) + { + QXmlNamePool namePool; + QXmlResultItems result; + QXmlItem node; + + { + QXmlQuery nodeSource(namePool); + nodeSource.setQuery(QLatin1String("")); + + nodeSource.evaluateTo(&result); + node = result.next(); + } + + /* Basic use: + * 1. The focus is undefined, but it's still valid. + * 2. We never evaluate. */ + { + QXmlQuery query(queryLanguage); + query.setQuery(QLatin1String("a")); + QVERIFY(query.isValid()); + } + + /* Basic use: + * 1. The focus is undefined, but it's still valid. + * 2. We afterwards set the focus. */ + { + QXmlQuery query(queryLanguage, namePool); + query.setQuery(QLatin1String("a")); + query.setFocus(node); + QVERIFY(query.isValid()); + } + + /* Basic use: + * 1. The focus is undefined, but it's still valid. + * 2. We afterwards set the focus. + * 3. We evaluate. */ + { + QXmlQuery query(queryLanguage, namePool); + query.setQuery(QString(QLatin1Char('.'))); + query.setFocus(node); + QVERIFY(query.isValid()); + + QString result; + QVERIFY(query.evaluateTo(&result)); + QCOMPARE(result, QString::fromLatin1("\n")); + } + + /* A slightly more complex Field. */ + { + QXmlQuery query(queryLanguage); + query.setQuery(QLatin1String("* | .//xml:*/.")); + QVERIFY(query.isValid()); + } + + /* @ is only allowed in Field. */ + if(queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintField) + { + QXmlQuery query(QXmlQuery::XmlSchema11IdentityConstraintField); + query.setQuery(QLatin1String("@abc")); + QVERIFY(query.isValid()); + } + + /* Field allows attribute:: and child:: .*/ + if(queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintField) + { + QXmlQuery query(QXmlQuery::XmlSchema11IdentityConstraintField); + query.setQuery(QLatin1String("attribute::name | child::name")); + QVERIFY(query.isValid()); + } + + /* Selector allows only child:: .*/ + { + QXmlQuery query(QXmlQuery::XmlSchema11IdentityConstraintSelector); + query.setQuery(QLatin1String("child::name")); + QVERIFY(query.isValid()); + } + + if(i == 0) + queryLanguage = QXmlQuery::XmlSchema11IdentityConstraintField; + else if(i == 1) + queryLanguage = QXmlQuery::XPath20; + } +} + +Q_DECLARE_METATYPE(QXmlQuery::QueryLanguage); + +/*! + We just do some basic tests for boot strapping and sanity checking. The actual regression + testing is in the Schema suite. + */ +void tst_QXmlQuery::identityConstraintFailure() const +{ + QFETCH(QXmlQuery::QueryLanguage, queryLanguage); + QFETCH(QString, inputQuery); + + QXmlQuery query(queryLanguage); + MessageSilencer silencer; + query.setMessageHandler(&silencer); + + query.setQuery(inputQuery); + QVERIFY(!query.isValid()); +} + +void tst_QXmlQuery::identityConstraintFailure_data() const +{ + QTest::addColumn("queryLanguage"); + QTest::addColumn("inputQuery"); + + QTest::newRow("We don't have element constructors in identity constraint pattern, " + "it's an XQuery feature(Selector).") + << QXmlQuery::XmlSchema11IdentityConstraintSelector + << QString::fromLatin1(""); + + QTest::newRow("We don't have functions in identity constraint pattern, " + "it's an XPath feature(Selector).") + << QXmlQuery::XmlSchema11IdentityConstraintSelector + << QString::fromLatin1("current-time()"); + + QTest::newRow("We don't have element constructors in identity constraint pattern, " + "it's an XQuery feature(Field).") + << QXmlQuery::XmlSchema11IdentityConstraintSelector + << QString::fromLatin1(""); + + QTest::newRow("We don't have functions in identity constraint pattern, " + "it's an XPath feature(Field).") + << QXmlQuery::XmlSchema11IdentityConstraintSelector + << QString::fromLatin1("current-time()"); + + QTest::newRow("@attributeName is disallowed for the selector.") + << QXmlQuery::XmlSchema11IdentityConstraintSelector + << QString::fromLatin1("@abc"); + + QTest::newRow("attribute:: is disallowed for the selector.") + << QXmlQuery::XmlSchema11IdentityConstraintSelector + << QString::fromLatin1("attribute::name"); + + QTest::newRow("ancestor::name is disallowed for the selector.") + << QXmlQuery::XmlSchema11IdentityConstraintSelector + << QString::fromLatin1("ancestor::name"); + + QTest::newRow("ancestor::name is disallowed for the field.") + << QXmlQuery::XmlSchema11IdentityConstraintField + << QString::fromLatin1("ancestor::name"); +} + QTEST_MAIN(tst_QXmlQuery) #include "tst_qxmlquery.moc" diff --git a/tests/auto/qxmlschema/.gitignore b/tests/auto/qxmlschema/.gitignore new file mode 100644 index 0000000..5cf52a0 --- /dev/null +++ b/tests/auto/qxmlschema/.gitignore @@ -0,0 +1 @@ +tst_qxmlschema diff --git a/tests/auto/qxmlschema/qxmlschema.pro b/tests/auto/qxmlschema/qxmlschema.pro new file mode 100644 index 0000000..9dd7469 --- /dev/null +++ b/tests/auto/qxmlschema/qxmlschema.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qxmlschema.cpp + +include (../xmlpatterns.pri) diff --git a/tests/auto/qxmlschema/tst_qxmlschema.cpp b/tests/auto/qxmlschema/tst_qxmlschema.cpp new file mode 100644 index 0000000..64012c1 --- /dev/null +++ b/tests/auto/qxmlschema/tst_qxmlschema.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +****************************************************************************/ + +#include + +#ifdef QTEST_XMLPATTERNS + +#include +#include +#include +#include +#include + +class DummyMessageHandler : public QAbstractMessageHandler +{ + public: + DummyMessageHandler(QObject *parent = 0) + : QAbstractMessageHandler(parent) + { + } + + protected: + virtual void handleMessage(QtMsgType, const QString&, const QUrl&, const QSourceLocation&) + { + } +}; + +class DummyUriResolver : public QAbstractUriResolver +{ + public: + DummyUriResolver(QObject *parent = 0) + : QAbstractUriResolver(parent) + { + } + + virtual QUrl resolve(const QUrl&, const QUrl&) const + { + return QUrl(); + } +}; + +/*! + \class tst_QXmlSchema + \internal + \brief Tests class QXmlSchema. + + This test is not intended for testing the engine, but the functionality specific + to the QXmlSchema class. + */ +class tst_QXmlSchema : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void defaultConstructor() const; + void copyConstructor() const; + void constructorQXmlNamePool() const; + + void networkAccessManagerSignature() const; + void networkAccessManagerDefaultValue() const; + void networkAccessManager() const; + + void messageHandlerSignature() const; + void messageHandlerDefaultValue() const; + void messageHandler() const; + + void uriResolverSignature() const; + void uriResolverDefaultValue() const; + void uriResolver() const; +}; + +void tst_QXmlSchema::defaultConstructor() const +{ + /* Allocate instance in different orders. */ + { + QXmlSchema schema; + } + + { + QXmlSchema schema1; + QXmlSchema schema2; + } + + { + QXmlSchema schema1; + QXmlSchema schema2; + QXmlSchema schema3; + } +} + +void tst_QXmlSchema::copyConstructor() const +{ + /* Verify that we can take a const reference, and simply do a copy of a default constructed object. */ + { + const QXmlSchema schema1; + QXmlSchema schema2(schema1); + } + + /* Copy twice. */ + { + const QXmlSchema schema1; + QXmlSchema schema2(schema1); + QXmlSchema schema3(schema2); + } + + /* Verify that copying default values works. */ + { + const QXmlSchema schema1; + const QXmlSchema schema2(schema1); + QCOMPARE(schema2.messageHandler(), schema1.messageHandler()); + QCOMPARE(schema2.uriResolver(), schema1.uriResolver()); + QCOMPARE(schema2.networkAccessManager(), schema1.networkAccessManager()); + QCOMPARE(schema2.isValid(), schema1.isValid()); + } +} + +void tst_QXmlSchema::constructorQXmlNamePool() const +{ + QXmlSchema schema; + + QXmlNamePool np = schema.namePool(); + + const QXmlName name(np, QLatin1String("localName"), + QLatin1String("http://example.com/"), + QLatin1String("prefix")); + + QXmlNamePool np2(schema.namePool()); + QCOMPARE(name.namespaceUri(np2), QString::fromLatin1("http://example.com/")); + QCOMPARE(name.localName(np2), QString::fromLatin1("localName")); + QCOMPARE(name.prefix(np2), QString::fromLatin1("prefix")); +} + +void tst_QXmlSchema::networkAccessManagerSignature() const +{ + /* Const object. */ + const QXmlSchema schema; + + /* The function should be const. */ + schema.networkAccessManager(); +} + +void tst_QXmlSchema::networkAccessManagerDefaultValue() const +{ + /* Test that the default value of network access manager is not empty. */ + { + QXmlSchema schema; + QVERIFY(schema.networkAccessManager() != static_cast(0)); + } +} + +void tst_QXmlSchema::networkAccessManager() const +{ + /* Test that we return the network manager that was set. */ + { + QNetworkAccessManager manager; + QXmlSchema schema; + schema.setNetworkAccessManager(&manager); + QCOMPARE(schema.networkAccessManager(), &manager); + } +} + +void tst_QXmlSchema::messageHandlerSignature() const +{ + /* Const object. */ + const QXmlSchema schema; + + /* The function should be const. */ + schema.messageHandler(); +} + +void tst_QXmlSchema::messageHandlerDefaultValue() const +{ + /* Test that the default value of message handler is not empty. */ + { + QXmlSchema schema; + QVERIFY(schema.messageHandler() != static_cast(0)); + } +} + +void tst_QXmlSchema::messageHandler() const +{ + /* Test that we return the message handler that was set. */ + { + DummyMessageHandler handler; + + QXmlSchema schema; + schema.setMessageHandler(&handler); + QCOMPARE(schema.messageHandler(), &handler); + } +} + +void tst_QXmlSchema::uriResolverSignature() const +{ + /* Const object. */ + const QXmlSchema schema; + + /* The function should be const. */ + schema.uriResolver(); +} + +void tst_QXmlSchema::uriResolverDefaultValue() const +{ + /* Test that the default value of uri resolver is empty. */ + { + QXmlSchema schema; + QVERIFY(schema.uriResolver() == static_cast(0)); + } +} + +void tst_QXmlSchema::uriResolver() const +{ + /* Test that we return the uri resolver that was set. */ + { + DummyUriResolver resolver; + + QXmlSchema schema; + schema.setUriResolver(&resolver); + QCOMPARE(schema.uriResolver(), &resolver); + } +} + +QTEST_MAIN(tst_QXmlSchema) + +#include "tst_qxmlschema.moc" +#else //QTEST_PATTERNIST +QTEST_NOOP_MAIN +#endif diff --git a/tests/auto/qxmlschemavalidator/.gitignore b/tests/auto/qxmlschemavalidator/.gitignore new file mode 100644 index 0000000..8857212 --- /dev/null +++ b/tests/auto/qxmlschemavalidator/.gitignore @@ -0,0 +1 @@ +tst_qxmlschemavalidator diff --git a/tests/auto/qxmlschemavalidator/qxmlschemavalidator.pro b/tests/auto/qxmlschemavalidator/qxmlschemavalidator.pro new file mode 100644 index 0000000..88ef317 --- /dev/null +++ b/tests/auto/qxmlschemavalidator/qxmlschemavalidator.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qxmlschemavalidator.cpp + +include (../xmlpatterns.pri) diff --git a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp new file mode 100644 index 0000000..b021b08 --- /dev/null +++ b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp @@ -0,0 +1,308 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +****************************************************************************/ + +#include + +#ifdef QTEST_XMLPATTERNS + +#include +#include +#include +#include +#include +#include + +class DummyMessageHandler : public QAbstractMessageHandler +{ + public: + DummyMessageHandler(QObject *parent = 0) + : QAbstractMessageHandler(parent) + { + } + + protected: + virtual void handleMessage(QtMsgType, const QString&, const QUrl&, const QSourceLocation&) + { + } +}; + +class DummyUriResolver : public QAbstractUriResolver +{ + public: + DummyUriResolver(QObject *parent = 0) + : QAbstractUriResolver(parent) + { + } + + virtual QUrl resolve(const QUrl&, const QUrl&) const + { + return QUrl(); + } +}; + +/*! + \class tst_QXmlSchemaValidatorValidator + \internal + \brief Tests class QXmlSchemaValidator. + + This test is not intended for testing the engine, but the functionality specific + to the QXmlSchemaValidator class. + */ +class tst_QXmlSchemaValidator : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void defaultConstructor() const; + void propertyInitialization() const; + + void networkAccessManagerSignature() const; + void networkAccessManagerDefaultValue() const; + void networkAccessManager() const; + + void messageHandlerSignature() const; + void messageHandlerDefaultValue() const; + void messageHandler() const; + + void uriResolverSignature() const; + void uriResolverDefaultValue() const; + void uriResolver() const; +}; + +void tst_QXmlSchemaValidator::defaultConstructor() const +{ + /* Allocate instance in different orders. */ + { + QXmlSchema schema; + QXmlSchemaValidator validator(schema); + } + + { + QXmlSchema schema1; + QXmlSchema schema2; + + QXmlSchemaValidator validator1(schema1); + QXmlSchemaValidator validator2(schema2); + } + + { + QXmlSchema schema; + + QXmlSchemaValidator validator1(schema); + QXmlSchemaValidator validator2(schema); + } +} + +void tst_QXmlSchemaValidator::propertyInitialization() const +{ + /* Verify that properties set in the schema are used as default values for the validator */ + { + DummyMessageHandler handler; + DummyUriResolver resolver; + QNetworkAccessManager manager; + + QXmlSchema schema; + schema.setMessageHandler(&handler); + schema.setUriResolver(&resolver); + schema.setNetworkAccessManager(&manager); + + QXmlSchemaValidator validator(schema); + QCOMPARE(validator.messageHandler(), &handler); + QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.networkAccessManager(), &manager); + } +} + +void tst_QXmlSchemaValidator::networkAccessManagerSignature() const +{ + const QXmlSchema schema; + + /* Const object. */ + const QXmlSchemaValidator validator(schema); + + /* The function should be const. */ + validator.networkAccessManager(); +} + +void tst_QXmlSchemaValidator::networkAccessManagerDefaultValue() const +{ + /* Test that the default value of network access manager is equal to the one from the schema. */ + { + const QXmlSchema schema; + const QXmlSchemaValidator validator(schema); + QVERIFY(validator.networkAccessManager() == schema.networkAccessManager()); + } + + /* Test that the default value of network access manager is equal to the one from the schema. */ + { + QXmlSchema schema; + + QNetworkAccessManager manager; + schema.setNetworkAccessManager(&manager); + + const QXmlSchemaValidator validator(schema); + QVERIFY(validator.networkAccessManager() == schema.networkAccessManager()); + } +} + +void tst_QXmlSchemaValidator::networkAccessManager() const +{ + /* Test that we return the network access manager that was set. */ + { + QNetworkAccessManager manager; + + const QXmlSchema schema; + QXmlSchemaValidator validator(schema); + + validator.setNetworkAccessManager(&manager); + QCOMPARE(validator.networkAccessManager(), &manager); + } + + /* Test that we return the network access manager that was set, even if the schema changed in between. */ + { + QNetworkAccessManager manager; + + const QXmlSchema schema; + QXmlSchemaValidator validator(schema); + + validator.setNetworkAccessManager(&manager); + + const QXmlSchema schema2; + validator.setSchema(schema2); + + QCOMPARE(validator.networkAccessManager(), &manager); + } +} + +void tst_QXmlSchemaValidator::messageHandlerSignature() const +{ + const QXmlSchema schema; + + /* Const object. */ + const QXmlSchemaValidator validator(schema); + + /* The function should be const. */ + validator.messageHandler(); +} + +void tst_QXmlSchemaValidator::messageHandlerDefaultValue() const +{ + /* Test that the default value of message handler is equal to the one from the schema. */ + { + const QXmlSchema schema; + const QXmlSchemaValidator validator(schema); + QVERIFY(validator.messageHandler() == schema.messageHandler()); + } + + /* Test that the default value of network access manager is equal to the one from the schema. */ + { + QXmlSchema schema; + + DummyMessageHandler handler; + schema.setMessageHandler(&handler); + + const QXmlSchemaValidator validator(schema); + QVERIFY(validator.messageHandler() == schema.messageHandler()); + } +} + +void tst_QXmlSchemaValidator::messageHandler() const +{ + /* Test that we return the message handler that was set. */ + { + DummyMessageHandler handler; + + const QXmlSchema schema; + QXmlSchemaValidator validator(schema); + + validator.setMessageHandler(&handler); + QCOMPARE(validator.messageHandler(), &handler); + } + + /* Test that we return the message handler that was set, even if the schema changed in between. */ + { + DummyMessageHandler handler; + + const QXmlSchema schema; + QXmlSchemaValidator validator(schema); + + validator.setMessageHandler(&handler); + + const QXmlSchema schema2; + validator.setSchema(schema2); + + QCOMPARE(validator.messageHandler(), &handler); + } +} + +void tst_QXmlSchemaValidator::uriResolverSignature() const +{ + const QXmlSchema schema; + + /* Const object. */ + const QXmlSchemaValidator validator(schema); + + /* The function should be const. */ + validator.uriResolver(); +} + +void tst_QXmlSchemaValidator::uriResolverDefaultValue() const +{ + /* Test that the default value of uri resolver is equal to the one from the schema. */ + { + const QXmlSchema schema; + const QXmlSchemaValidator validator(schema); + QVERIFY(validator.uriResolver() == schema.uriResolver()); + } + + /* Test that the default value of uri resolver is equal to the one from the schema. */ + { + QXmlSchema schema; + + DummyUriResolver resolver; + schema.setUriResolver(&resolver); + + const QXmlSchemaValidator validator(schema); + QVERIFY(validator.uriResolver() == schema.uriResolver()); + } +} + +void tst_QXmlSchemaValidator::uriResolver() const +{ + /* Test that we return the uri resolver that was set. */ + { + DummyUriResolver resolver; + + const QXmlSchema schema; + QXmlSchemaValidator validator(schema); + + validator.setUriResolver(&resolver); + QCOMPARE(validator.uriResolver(), &resolver); + } + + /* Test that we return the uri resolver that was set, even if the schema changed in between. */ + { + DummyUriResolver resolver; + + const QXmlSchema schema; + QXmlSchemaValidator validator(schema); + + validator.setUriResolver(&resolver); + + const QXmlSchema schema2; + validator.setSchema(schema2); + + QCOMPARE(validator.uriResolver(), &resolver); + } +} + +QTEST_MAIN(tst_QXmlSchemaValidator) + +#include "tst_qxmlschemavalidator.moc" +#else //QTEST_PATTERNIST +QTEST_NOOP_MAIN +#endif diff --git a/tests/auto/runQtXmlPatternsTests.sh b/tests/auto/runQtXmlPatternsTests.sh index 49ea840..41d6c83 100755 --- a/tests/auto/runQtXmlPatternsTests.sh +++ b/tests/auto/runQtXmlPatternsTests.sh @@ -34,6 +34,8 @@ qxmlserializer \ xmlpatterns \ xmlpatternsxqts \ xmlpatternsdiagnosticsts \ +xmlpatternsschema \ +xmlpatternsschemats \ xmlpatternsview \ xmlpatternsxslts" diff --git a/tests/auto/xmlpatterns.pri b/tests/auto/xmlpatterns.pri index bf13c3b..7cdd67f 100644 --- a/tests/auto/xmlpatterns.pri +++ b/tests/auto/xmlpatterns.pri @@ -19,3 +19,17 @@ if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { else: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}_debug } +INCLUDEPATH += \ + $$QT_SOURCE_TREE/src/xmlpatterns/acceltree \ + $$QT_SOURCE_TREE/src/xmlpatterns/api \ + $$QT_SOURCE_TREE/src/xmlpatterns/data \ + $$QT_SOURCE_TREE/src/xmlpatterns/environment \ + $$QT_SOURCE_TREE/src/xmlpatterns/expr \ + $$QT_SOURCE_TREE/src/xmlpatterns/functions \ + $$QT_SOURCE_TREE/src/xmlpatterns/iterators \ + $$QT_SOURCE_TREE/src/xmlpatterns/janitors \ + $$QT_SOURCE_TREE/src/xmlpatterns/parser \ + $$QT_SOURCE_TREE/src/xmlpatterns/projection \ + $$QT_SOURCE_TREE/src/xmlpatterns/schema \ + $$QT_SOURCE_TREE/src/xmlpatterns/type \ + $$QT_SOURCE_TREE/src/xmlpatterns/utils diff --git a/tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp b/tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp index 60037f9..13c3534 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp +++ b/tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp @@ -61,7 +61,7 @@ protected: virtual void catalogPath(QString &write) const; }; -tst_XmlPatternsXSLTS::tst_XmlPatternsXSLTS() : tst_SuiteTest(false, true) +tst_XmlPatternsXSLTS::tst_XmlPatternsXSLTS() : tst_SuiteTest(tst_SuiteTest::XQuerySuite, true) { } diff --git a/tests/auto/xmlpatternsschema/.gitignore b/tests/auto/xmlpatternsschema/.gitignore new file mode 100644 index 0000000..a37a2b7 --- /dev/null +++ b/tests/auto/xmlpatternsschema/.gitignore @@ -0,0 +1 @@ +tst_xmlpatternsschema diff --git a/tests/auto/xmlpatternsschema/tst_xmlpatternsschema.cpp b/tests/auto/xmlpatternsschema/tst_xmlpatternsschema.cpp new file mode 100644 index 0000000..030e9c0 --- /dev/null +++ b/tests/auto/xmlpatternsschema/tst_xmlpatternsschema.cpp @@ -0,0 +1,988 @@ + +#include + +#include "qxsdstatemachine_p.h" +#include "qxsdschematoken_p.h" + +using namespace QPatternist; + +class tst_XMLPatternsSchema : public QObject +{ + Q_OBJECT + + public slots: + void init(); + void cleanup(); + + private slots: + void stateMachineTest1(); + void stateMachineTest2(); + void stateMachineTest3(); + void stateMachineTest4(); + void stateMachineTest5(); + void stateMachineTest6(); + void stateMachineTest7(); + void stateMachineTest8(); + void stateMachineTest9(); + void stateMachineTest10(); + void stateMachineTest11(); + void stateMachineTest12(); + void stateMachineTest13(); + void stateMachineTest14(); + void stateMachineTest15(); + void stateMachineTest16(); + void stateMachineTest17(); + void stateMachineTest18(); + void stateMachineTest19(); + + private: + bool runTest(const QVector &list, XsdStateMachine &machine); +}; + +void tst_XMLPatternsSchema::init() +{ +} + +void tst_XMLPatternsSchema::cleanup() +{ +} + +bool tst_XMLPatternsSchema::runTest(const QVector &list, XsdStateMachine &machine) +{ + machine.reset(); + for (int i = 0; i < list.count(); ++i) { + if (!machine.proceed(list.at(i))) + return false; + } + if (!machine.inEndState()) + return false; + + return true; +} + +void tst_XMLPatternsSchema::stateMachineTest1() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, simpleType?) : attribute + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + + QVERIFY(machine.inEndState() == true); + QVERIFY(machine.proceed(XsdSchemaToken::Annotation) == true); + QVERIFY(machine.inEndState() == true); + QVERIFY(machine.proceed(XsdSchemaToken::SimpleType) == true); + QVERIFY(machine.inEndState() == true); + QVERIFY(machine.proceed(XsdSchemaToken::SimpleType) == false); + QVERIFY(machine.proceed(XsdSchemaToken::Annotation) == false); + machine.reset(); + QVERIFY(machine.proceed(XsdSchemaToken::SimpleType) == true); + QVERIFY(machine.inEndState() == true); + QVERIFY(machine.proceed(XsdSchemaToken::Annotation) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest2() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*)) : element + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s6 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s3); + machine.addTransition(startState, XsdSchemaToken::Unique, s4); + machine.addTransition(startState, XsdSchemaToken::Key, s5); + machine.addTransition(startState, XsdSchemaToken::Keyref, s6); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s3); + machine.addTransition(s1, XsdSchemaToken::Unique, s4); + machine.addTransition(s1, XsdSchemaToken::Key, s5); + machine.addTransition(s1, XsdSchemaToken::Keyref, s6); + + machine.addTransition(s2, XsdSchemaToken::Unique, s4); + machine.addTransition(s2, XsdSchemaToken::Key, s5); + machine.addTransition(s2, XsdSchemaToken::Keyref, s6); + + machine.addTransition(s3, XsdSchemaToken::Unique, s4); + machine.addTransition(s3, XsdSchemaToken::Key, s5); + machine.addTransition(s3, XsdSchemaToken::Keyref, s6); + + machine.addTransition(s4, XsdSchemaToken::Unique, s4); + machine.addTransition(s4, XsdSchemaToken::Key, s5); + machine.addTransition(s4, XsdSchemaToken::Keyref, s6); + + machine.addTransition(s5, XsdSchemaToken::Unique, s4); + machine.addTransition(s5, XsdSchemaToken::Key, s5); + machine.addTransition(s5, XsdSchemaToken::Keyref, s6); + + machine.addTransition(s6, XsdSchemaToken::Unique, s4); + machine.addTransition(s6, XsdSchemaToken::Key, s5); + machine.addTransition(s6, XsdSchemaToken::Keyref, s6); + + QVector data1, data2, data3; + + data1 << XsdSchemaToken::Annotation + << XsdSchemaToken::SimpleType + << XsdSchemaToken::Unique + << XsdSchemaToken::Keyref; + + data2 << XsdSchemaToken::Annotation + << XsdSchemaToken::SimpleType + << XsdSchemaToken::Annotation + << XsdSchemaToken::Keyref; + + data3 << XsdSchemaToken::Annotation + << XsdSchemaToken::SimpleType + << XsdSchemaToken::SimpleType; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == false); + QVERIFY(runTest(data3, machine) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest3() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))) : complexType + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s6 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s7 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s8 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s9 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s10 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleContent, s2); + machine.addTransition(startState, XsdSchemaToken::ComplexContent, s3); + machine.addTransition(startState, XsdSchemaToken::Group, s4); + machine.addTransition(startState, XsdSchemaToken::All, s5); + machine.addTransition(startState, XsdSchemaToken::Choice, s6); + machine.addTransition(startState, XsdSchemaToken::Sequence, s7); + machine.addTransition(startState, XsdSchemaToken::Attribute, s8); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s9); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s10); + + machine.addTransition(s1, XsdSchemaToken::SimpleContent, s2); + machine.addTransition(s1, XsdSchemaToken::ComplexContent, s3); + machine.addTransition(s1, XsdSchemaToken::Group, s4); + machine.addTransition(s1, XsdSchemaToken::All, s5); + machine.addTransition(s1, XsdSchemaToken::Choice, s6); + machine.addTransition(s1, XsdSchemaToken::Sequence, s7); + machine.addTransition(s1, XsdSchemaToken::Attribute, s8); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s9); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s10); + + machine.addTransition(s4, XsdSchemaToken::Attribute, s8); + machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s9); + machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s10); + + machine.addTransition(s5, XsdSchemaToken::Attribute, s8); + machine.addTransition(s5, XsdSchemaToken::AttributeGroup, s9); + machine.addTransition(s5, XsdSchemaToken::AnyAttribute, s10); + + machine.addTransition(s6, XsdSchemaToken::Attribute, s8); + machine.addTransition(s6, XsdSchemaToken::AttributeGroup, s9); + machine.addTransition(s6, XsdSchemaToken::AnyAttribute, s10); + + machine.addTransition(s7, XsdSchemaToken::Attribute, s8); + machine.addTransition(s7, XsdSchemaToken::AttributeGroup, s9); + machine.addTransition(s7, XsdSchemaToken::AnyAttribute, s10); + + machine.addTransition(s8, XsdSchemaToken::Attribute, s8); + machine.addTransition(s8, XsdSchemaToken::AttributeGroup, s9); + machine.addTransition(s8, XsdSchemaToken::AnyAttribute, s10); + + QVector data1, data2, data3, data4; + + data1 << XsdSchemaToken::Annotation + << XsdSchemaToken::SimpleContent; + + data2 << XsdSchemaToken::Group + << XsdSchemaToken::Attribute + << XsdSchemaToken::Attribute + << XsdSchemaToken::AnyAttribute; + + data3 << XsdSchemaToken::Group + << XsdSchemaToken::Choice + << XsdSchemaToken::Attribute + << XsdSchemaToken::AnyAttribute; + + data4 << XsdSchemaToken::Annotation + << XsdSchemaToken::Sequence + << XsdSchemaToken::AnyAttribute; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == false); + QVERIFY(runTest(data4, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest4() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, ((attribute | attributeGroup)*, anyAttribute?)) : named attribute group/simple content extension/ + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Attribute, s2); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s4); + + machine.addTransition(s1, XsdSchemaToken::Attribute, s2); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s4); + + machine.addTransition(s2, XsdSchemaToken::Attribute, s2); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s4); + + machine.addTransition(s3, XsdSchemaToken::Attribute, s2); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s4); + + QVector data1, data2, data3, data4; + + data1 << XsdSchemaToken::Annotation; + + data2 << XsdSchemaToken::Attribute + << XsdSchemaToken::Attribute + << XsdSchemaToken::Attribute + << XsdSchemaToken::AnyAttribute; + + data3 << XsdSchemaToken::Group + << XsdSchemaToken::Attribute + << XsdSchemaToken::AnyAttribute; + + data4 << XsdSchemaToken::Attribute + << XsdSchemaToken::AnyAttribute + << XsdSchemaToken::Attribute; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == false); + QVERIFY(runTest(data4, machine) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest5() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (all | choice | sequence)?) : group + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::All, s2); + machine.addTransition(startState, XsdSchemaToken::Choice, s3); + machine.addTransition(startState, XsdSchemaToken::Sequence, s4); + + machine.addTransition(s1, XsdSchemaToken::All, s2); + machine.addTransition(s1, XsdSchemaToken::Choice, s3); + machine.addTransition(s1, XsdSchemaToken::Sequence, s4); + + QVector data1, data2, data3, data4, data5, data6, data7, data8, data9; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::All; + data3 << XsdSchemaToken::Annotation << XsdSchemaToken::Choice; + data4 << XsdSchemaToken::Annotation << XsdSchemaToken::Sequence; + data5 << XsdSchemaToken::All; + data6 << XsdSchemaToken::Choice; + data7 << XsdSchemaToken::Sequence; + data8 << XsdSchemaToken::Sequence << XsdSchemaToken::All; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == true); + QVERIFY(runTest(data6, machine) == true); + QVERIFY(runTest(data7, machine) == true); + QVERIFY(runTest(data8, machine) == false); + QVERIFY(runTest(data9, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest6() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, element*) : all + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Element, s2); + + machine.addTransition(s1, XsdSchemaToken::Element, s2); + + machine.addTransition(s2, XsdSchemaToken::Element, s2); + + QVector data1, data2, data3, data4, data5, data6, data7, data8, data9; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Element; + data3 << XsdSchemaToken::Element; + data4 << XsdSchemaToken::Element << XsdSchemaToken::Sequence; + data5 << XsdSchemaToken::Annotation << XsdSchemaToken::Element << XsdSchemaToken::Annotation; + data6 << XsdSchemaToken::Annotation << XsdSchemaToken::Annotation << XsdSchemaToken::Element; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == false); + QVERIFY(runTest(data5, machine) == false); + QVERIFY(runTest(data6, machine) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest7() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (element | group | choice | sequence | any)*) : choice sequence + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s6 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Element, s2); + machine.addTransition(startState, XsdSchemaToken::Group, s3); + machine.addTransition(startState, XsdSchemaToken::Choice, s4); + machine.addTransition(startState, XsdSchemaToken::Sequence, s5); + machine.addTransition(startState, XsdSchemaToken::Any, s6); + + machine.addTransition(s1, XsdSchemaToken::Element, s2); + machine.addTransition(s1, XsdSchemaToken::Group, s3); + machine.addTransition(s1, XsdSchemaToken::Choice, s4); + machine.addTransition(s1, XsdSchemaToken::Sequence, s5); + machine.addTransition(s1, XsdSchemaToken::Any, s6); + + machine.addTransition(s2, XsdSchemaToken::Element, s2); + machine.addTransition(s2, XsdSchemaToken::Group, s3); + machine.addTransition(s2, XsdSchemaToken::Choice, s4); + machine.addTransition(s2, XsdSchemaToken::Sequence, s5); + machine.addTransition(s2, XsdSchemaToken::Any, s6); + + machine.addTransition(s3, XsdSchemaToken::Element, s2); + machine.addTransition(s3, XsdSchemaToken::Group, s3); + machine.addTransition(s3, XsdSchemaToken::Choice, s4); + machine.addTransition(s3, XsdSchemaToken::Sequence, s5); + machine.addTransition(s3, XsdSchemaToken::Any, s6); + + machine.addTransition(s4, XsdSchemaToken::Element, s2); + machine.addTransition(s4, XsdSchemaToken::Group, s3); + machine.addTransition(s4, XsdSchemaToken::Choice, s4); + machine.addTransition(s4, XsdSchemaToken::Sequence, s5); + machine.addTransition(s4, XsdSchemaToken::Any, s6); + + machine.addTransition(s5, XsdSchemaToken::Element, s2); + machine.addTransition(s5, XsdSchemaToken::Group, s3); + machine.addTransition(s5, XsdSchemaToken::Choice, s4); + machine.addTransition(s5, XsdSchemaToken::Sequence, s5); + machine.addTransition(s5, XsdSchemaToken::Any, s6); + + machine.addTransition(s6, XsdSchemaToken::Element, s2); + machine.addTransition(s6, XsdSchemaToken::Group, s3); + machine.addTransition(s6, XsdSchemaToken::Choice, s4); + machine.addTransition(s6, XsdSchemaToken::Sequence, s5); + machine.addTransition(s6, XsdSchemaToken::Any, s6); + + QVector data1, data2, data3, data4, data5, data6, data7, data8, data9; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Element << XsdSchemaToken::Sequence << XsdSchemaToken::Choice; + data3 << XsdSchemaToken::Group; + data4 << XsdSchemaToken::Element << XsdSchemaToken::Sequence << XsdSchemaToken::Annotation; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest8() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?) : any/selector/field/notation/include/import/referred attribute group/anyAttribute/all facets + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + + QVector data1, data2, data3, data4; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Element; + data3 << XsdSchemaToken::Group; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == false); + QVERIFY(runTest(data3, machine) == false); + QVERIFY(runTest(data4, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest9() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (selector, field+)) : unique/key/keyref + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Selector, s2); + + machine.addTransition(s1, XsdSchemaToken::Selector, s2); + machine.addTransition(s2, XsdSchemaToken::Field, s3); + machine.addTransition(s3, XsdSchemaToken::Field, s3); + + QVector data1, data2, data3, data4, data5; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Selector; + data3 << XsdSchemaToken::Annotation << XsdSchemaToken::Selector << XsdSchemaToken::Field; + data4 << XsdSchemaToken::Selector << XsdSchemaToken::Field; + data5 << XsdSchemaToken::Selector << XsdSchemaToken::Field << XsdSchemaToken::Field; + + QVERIFY(runTest(data1, machine) == false); + QVERIFY(runTest(data2, machine) == false); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest10() +{ + XsdStateMachine machine; + + // setup state machine for (appinfo | documentation)* : annotation + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Appinfo, s1); + machine.addTransition(startState, XsdSchemaToken::Documentation, s2); + + machine.addTransition(s1, XsdSchemaToken::Appinfo, s1); + machine.addTransition(s1, XsdSchemaToken::Documentation, s2); + + machine.addTransition(s2, XsdSchemaToken::Appinfo, s1); + machine.addTransition(s2, XsdSchemaToken::Documentation, s2); + + QVector data1, data2, data3, data4, data5; + + data1 << XsdSchemaToken::Appinfo; + data2 << XsdSchemaToken::Appinfo << XsdSchemaToken::Appinfo; + data3 << XsdSchemaToken::Documentation << XsdSchemaToken::Appinfo << XsdSchemaToken::Documentation; + data4 << XsdSchemaToken::Selector << XsdSchemaToken::Field; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == false); + QVERIFY(runTest(data5, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest11() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (restriction | list | union)) : simpleType + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Restriction, s2); + machine.addTransition(startState, XsdSchemaToken::List, s3); + machine.addTransition(startState, XsdSchemaToken::Union, s4); + + machine.addTransition(s1, XsdSchemaToken::Restriction, s2); + machine.addTransition(s1, XsdSchemaToken::List, s3); + machine.addTransition(s1, XsdSchemaToken::Union, s4); + + QVector data1, data2, data3, data4, data5, data6, data7, data8; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Restriction; + data3 << XsdSchemaToken::Annotation << XsdSchemaToken::List; + data4 << XsdSchemaToken::Annotation << XsdSchemaToken::Union; + data5 << XsdSchemaToken::Restriction; + data6 << XsdSchemaToken::List; + data7 << XsdSchemaToken::Union; + data8 << XsdSchemaToken::Union << XsdSchemaToken::Union; + + QVERIFY(runTest(data1, machine) == false); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == true); + QVERIFY(runTest(data6, machine) == true); + QVERIFY(runTest(data7, machine) == true); + QVERIFY(runTest(data8, machine) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest12() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)) : simple type restriction + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(startState, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(startState, XsdSchemaToken::Length, s3); + machine.addTransition(startState, XsdSchemaToken::MinLength, s3); + machine.addTransition(startState, XsdSchemaToken::MaxLength, s3); + machine.addTransition(startState, XsdSchemaToken::Enumeration, s3); + machine.addTransition(startState, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(startState, XsdSchemaToken::Pattern, s3); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s1, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s1, XsdSchemaToken::Length, s3); + machine.addTransition(s1, XsdSchemaToken::MinLength, s3); + machine.addTransition(s1, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s1, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s1, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s1, XsdSchemaToken::Pattern, s3); + + machine.addTransition(s2, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s2, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s2, XsdSchemaToken::Length, s3); + machine.addTransition(s2, XsdSchemaToken::MinLength, s3); + machine.addTransition(s2, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s2, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s2, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s2, XsdSchemaToken::Pattern, s3); + + machine.addTransition(s3, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s3, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s3, XsdSchemaToken::Length, s3); + machine.addTransition(s3, XsdSchemaToken::MinLength, s3); + machine.addTransition(s3, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s3, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s3, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s3, XsdSchemaToken::Pattern, s3); + + QVector data1, data2, data3, data4, data5; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Length << XsdSchemaToken::MaxLength; + data3 << XsdSchemaToken::Annotation << XsdSchemaToken::List; + data4 << XsdSchemaToken::SimpleType << XsdSchemaToken::Pattern; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == false); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest13() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, simpleType?) : list + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + + QVector data1, data2, data3, data4, data5; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::SimpleType; + data3 << XsdSchemaToken::SimpleType; + data4 << XsdSchemaToken::SimpleType << XsdSchemaToken::SimpleType; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == false); + QVERIFY(runTest(data5, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest14() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, simpleType*) : union + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s2, XsdSchemaToken::SimpleType, s2); + + QVector data1, data2, data3, data4, data5, data6; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::SimpleType; + data3 << XsdSchemaToken::SimpleType; + data4 << XsdSchemaToken::SimpleType << XsdSchemaToken::SimpleType; + data6 << XsdSchemaToken::Annotation << XsdSchemaToken::Annotation; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == true); + QVERIFY(runTest(data6, machine) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest15() +{ + XsdStateMachine machine; + + // setup state machine for ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*) : schema + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Include, s1); + machine.addTransition(startState, XsdSchemaToken::Import, s1); + machine.addTransition(startState, XsdSchemaToken::Redefine, s1); + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s2); + machine.addTransition(startState, XsdSchemaToken::Group, s2); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(startState, XsdSchemaToken::Element, s2); + machine.addTransition(startState, XsdSchemaToken::Attribute, s2); + machine.addTransition(startState, XsdSchemaToken::Notation, s2); + + machine.addTransition(s1, XsdSchemaToken::Include, s1); + machine.addTransition(s1, XsdSchemaToken::Import, s1); + machine.addTransition(s1, XsdSchemaToken::Redefine, s1); + machine.addTransition(s1, XsdSchemaToken::Annotation, s1); + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s2); + machine.addTransition(s1, XsdSchemaToken::Group, s2); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(s1, XsdSchemaToken::Element, s2); + machine.addTransition(s1, XsdSchemaToken::Attribute, s2); + machine.addTransition(s1, XsdSchemaToken::Notation, s2); + + machine.addTransition(s2, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s2, XsdSchemaToken::ComplexType, s2); + machine.addTransition(s2, XsdSchemaToken::Group, s2); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(s2, XsdSchemaToken::Element, s2); + machine.addTransition(s2, XsdSchemaToken::Attribute, s2); + machine.addTransition(s2, XsdSchemaToken::Notation, s2); + machine.addTransition(s2, XsdSchemaToken::Annotation, s3); + + machine.addTransition(s3, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s3, XsdSchemaToken::ComplexType, s2); + machine.addTransition(s3, XsdSchemaToken::Group, s2); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s2); + machine.addTransition(s3, XsdSchemaToken::Element, s2); + machine.addTransition(s3, XsdSchemaToken::Attribute, s2); + machine.addTransition(s3, XsdSchemaToken::Notation, s2); + machine.addTransition(s3, XsdSchemaToken::Annotation, s3); + + QVector data1, data2, data3, data4, data5, data6; + + data1 << XsdSchemaToken::Annotation << XsdSchemaToken::Import << XsdSchemaToken::SimpleType << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::SimpleType; + data3 << XsdSchemaToken::Annotation << XsdSchemaToken::Import << XsdSchemaToken::Include << XsdSchemaToken::Import; + data4 << XsdSchemaToken::SimpleType << XsdSchemaToken::ComplexType << XsdSchemaToken::Annotation << XsdSchemaToken::Attribute; + data5 << XsdSchemaToken::SimpleType << XsdSchemaToken::Include << XsdSchemaToken::Annotation << XsdSchemaToken::Attribute; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == false); + QVERIFY(runTest(data6, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest16() +{ + XsdStateMachine machine; + + // setup state machine for (annotation | (simpleType | complexType | group | attributeGroup))* : redefine + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s1); + machine.addTransition(startState, XsdSchemaToken::ComplexType, s1); + machine.addTransition(startState, XsdSchemaToken::Group, s1); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s1); + + machine.addTransition(s1, XsdSchemaToken::Annotation, s1); + machine.addTransition(s1, XsdSchemaToken::SimpleType, s1); + machine.addTransition(s1, XsdSchemaToken::ComplexType, s1); + machine.addTransition(s1, XsdSchemaToken::Group, s1); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s1); + + QVector data1, data2, data3, data4, data5, data6; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::SimpleType; + data3 << XsdSchemaToken::SimpleType; + data4 << XsdSchemaToken::SimpleType << XsdSchemaToken::SimpleType; + data6 << XsdSchemaToken::Annotation << XsdSchemaToken::Annotation; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == true); + QVERIFY(runTest(data6, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest17() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (restriction | extension)) : simpleContent + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::InternalState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Restriction, s2); + machine.addTransition(startState, XsdSchemaToken::Extension, s2); + + machine.addTransition(s1, XsdSchemaToken::Restriction, s2); + machine.addTransition(s1, XsdSchemaToken::Extension, s2); + + QVector data1, data2, data3, data4, data5, data6; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Extension; + data3 << XsdSchemaToken::Restriction; + data4 << XsdSchemaToken::Extension << XsdSchemaToken::Restriction; + data5 << XsdSchemaToken::Annotation << XsdSchemaToken::Annotation; + + QVERIFY(runTest(data1, machine) == false); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == true); + QVERIFY(runTest(data4, machine) == false); + QVERIFY(runTest(data5, machine) == false); + QVERIFY(runTest(data6, machine) == false); +} + +void tst_XMLPatternsSchema::stateMachineTest18() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?, ((attribute | attributeGroup)*, anyAttribute?)) : simpleContent restriction + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s5 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::SimpleType, s2); + machine.addTransition(startState, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(startState, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(startState, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(startState, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(startState, XsdSchemaToken::Length, s3); + machine.addTransition(startState, XsdSchemaToken::MinLength, s3); + machine.addTransition(startState, XsdSchemaToken::MaxLength, s3); + machine.addTransition(startState, XsdSchemaToken::Enumeration, s3); + machine.addTransition(startState, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(startState, XsdSchemaToken::Pattern, s3); + machine.addTransition(startState, XsdSchemaToken::Attribute, s4); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s5); + + machine.addTransition(s1, XsdSchemaToken::SimpleType, s2); + machine.addTransition(s1, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s1, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s1, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s1, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s1, XsdSchemaToken::Length, s3); + machine.addTransition(s1, XsdSchemaToken::MinLength, s3); + machine.addTransition(s1, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s1, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s1, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s1, XsdSchemaToken::Pattern, s3); + machine.addTransition(s1, XsdSchemaToken::Attribute, s4); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s5); + + machine.addTransition(s2, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s2, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s2, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s2, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s2, XsdSchemaToken::Length, s3); + machine.addTransition(s2, XsdSchemaToken::MinLength, s3); + machine.addTransition(s2, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s2, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s2, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s2, XsdSchemaToken::Pattern, s3); + machine.addTransition(s2, XsdSchemaToken::Attribute, s4); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s5); + + machine.addTransition(s3, XsdSchemaToken::MinExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MinInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxExclusive, s3); + machine.addTransition(s3, XsdSchemaToken::MaxInclusive, s3); + machine.addTransition(s3, XsdSchemaToken::TotalDigits, s3); + machine.addTransition(s3, XsdSchemaToken::FractionDigits, s3); + machine.addTransition(s3, XsdSchemaToken::Length, s3); + machine.addTransition(s3, XsdSchemaToken::MinLength, s3); + machine.addTransition(s3, XsdSchemaToken::MaxLength, s3); + machine.addTransition(s3, XsdSchemaToken::Enumeration, s3); + machine.addTransition(s3, XsdSchemaToken::WhiteSpace, s3); + machine.addTransition(s3, XsdSchemaToken::Pattern, s3); + machine.addTransition(s3, XsdSchemaToken::Attribute, s4); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s5); + + machine.addTransition(s4, XsdSchemaToken::Attribute, s4); + machine.addTransition(s4, XsdSchemaToken::AttributeGroup, s4); + machine.addTransition(s4, XsdSchemaToken::AnyAttribute, s5); + + QVector data1, data2, data3, data4, data5, data6; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::SimpleType << XsdSchemaToken::MinExclusive << XsdSchemaToken::MaxExclusive; + data3 << XsdSchemaToken::AnyAttribute << XsdSchemaToken::Attribute; + data4 << XsdSchemaToken::MinExclusive << XsdSchemaToken::TotalDigits << XsdSchemaToken::Enumeration; + data5 << XsdSchemaToken::Annotation << XsdSchemaToken::Annotation; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == false); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == false); + QVERIFY(runTest(data6, machine) == true); +} + +void tst_XMLPatternsSchema::stateMachineTest19() +{ + XsdStateMachine machine; + + // setup state machine for (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)) : complex content restriction/complex content extension + const XsdStateMachine::StateId startState = machine.addState(XsdStateMachine::StartEndState); + const XsdStateMachine::StateId s1 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s2 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s3 = machine.addState(XsdStateMachine::EndState); + const XsdStateMachine::StateId s4 = machine.addState(XsdStateMachine::EndState); + + machine.addTransition(startState, XsdSchemaToken::Annotation, s1); + machine.addTransition(startState, XsdSchemaToken::Group, s2); + machine.addTransition(startState, XsdSchemaToken::All, s2); + machine.addTransition(startState, XsdSchemaToken::Choice, s2); + machine.addTransition(startState, XsdSchemaToken::Sequence, s2); + machine.addTransition(startState, XsdSchemaToken::Attribute, s3); + machine.addTransition(startState, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(startState, XsdSchemaToken::AnyAttribute, s4); + + machine.addTransition(s1, XsdSchemaToken::Group, s2); + machine.addTransition(s1, XsdSchemaToken::All, s2); + machine.addTransition(s1, XsdSchemaToken::Choice, s2); + machine.addTransition(s1, XsdSchemaToken::Sequence, s2); + machine.addTransition(s1, XsdSchemaToken::Attribute, s3); + machine.addTransition(s1, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(s1, XsdSchemaToken::AnyAttribute, s4); + + machine.addTransition(s2, XsdSchemaToken::Attribute, s3); + machine.addTransition(s2, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(s2, XsdSchemaToken::AnyAttribute, s4); + + machine.addTransition(s3, XsdSchemaToken::Attribute, s3); + machine.addTransition(s3, XsdSchemaToken::AttributeGroup, s3); + machine.addTransition(s3, XsdSchemaToken::AnyAttribute, s4); + + QVector data1, data2, data3, data4, data5, data6; + + data1 << XsdSchemaToken::Annotation; + data2 << XsdSchemaToken::Annotation << XsdSchemaToken::Group; + data3 << XsdSchemaToken::Annotation << XsdSchemaToken::Group << XsdSchemaToken::Sequence; + data4 << XsdSchemaToken::Attribute << XsdSchemaToken::Attribute; + data5 << XsdSchemaToken::Attribute << XsdSchemaToken::Sequence; + data6 << XsdSchemaToken::Annotation << XsdSchemaToken::Annotation; + + QVERIFY(runTest(data1, machine) == true); + QVERIFY(runTest(data2, machine) == true); + QVERIFY(runTest(data3, machine) == false); + QVERIFY(runTest(data4, machine) == true); + QVERIFY(runTest(data5, machine) == false); + QVERIFY(runTest(data6, machine) == false); +} + +QTEST_MAIN(tst_XMLPatternsSchema) +#include "tst_xmlpatternsschema.moc" diff --git a/tests/auto/xmlpatternsschema/xmlpatternsschema.pro b/tests/auto/xmlpatternsschema/xmlpatternsschema.pro new file mode 100644 index 0000000..2ba869a --- /dev/null +++ b/tests/auto/xmlpatternsschema/xmlpatternsschema.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +SOURCES += tst_xmlpatternsschema.cpp \ + +include (../xmlpatterns.pri) + +INCLUDEPATH += $$QT_BUILD_TREE/include/QtXmlPatterns/private diff --git a/tests/auto/xmlpatternsschemats/.gitignore b/tests/auto/xmlpatternsschemats/.gitignore new file mode 100644 index 0000000..5fd11f8 --- /dev/null +++ b/tests/auto/xmlpatternsschemats/.gitignore @@ -0,0 +1,4 @@ +CandidateBaseline.xml +runTests +tst_xmlpatternsschemats +runTests diff --git a/tests/auto/xmlpatternsschemats/Baseline.xml b/tests/auto/xmlpatternsschemats/Baseline.xml new file mode 100644 index 0000000..9baef9c --- /dev/null +++ b/tests/auto/xmlpatternsschemats/Baseline.xml @@ -0,0 +1,2 @@ + +

Patternist is an implementation written in C++ and with the Qt/KDE libraries. It is licensed under GNU LGPL and part of KDE, the K Desktop Environment.

XQuery
\ No newline at end of file diff --git a/tests/auto/xmlpatternsschemats/TESTSUITE/.gitignore b/tests/auto/xmlpatternsschemats/TESTSUITE/.gitignore new file mode 100644 index 0000000..35cb85e --- /dev/null +++ b/tests/auto/xmlpatternsschemats/TESTSUITE/.gitignore @@ -0,0 +1,3 @@ +testSuites.xml +xmlschema2006-11-06 +xmlschema2006-11-06-new diff --git a/tests/auto/xmlpatternsschemats/TESTSUITE/unifyCatalog.xsl b/tests/auto/xmlpatternsschemats/TESTSUITE/unifyCatalog.xsl new file mode 100644 index 0000000..325f626 --- /dev/null +++ b/tests/auto/xmlpatternsschemats/TESTSUITE/unifyCatalog.xsl @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh b/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh new file mode 100755 index 0000000..1770f1e --- /dev/null +++ b/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# This script updates the suite from W3C's server. +# +# NOTE: the files checked out CANNOT be added to Trolltech's +# repository at the moment, due to legal complications. + +DIRECTORY_NAME="xmlschema2006-11-06" +ARCHIVE_NAME="xsts-2007-06-20.tar.gz" + +rm -Rf $DIRECTORY_NAME + +wget http://www.w3.org/XML/2004/xml-schema-test-suite/xmlschema2006-11-06/$ARCHIVE_NAME +tar -xzf $ARCHIVE_NAME +rm $ARCHIVE_NAME + +CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public cvs login +CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public cvs checkout -d xmlschema2006-11-06-new XML/xml-schema-test-suite/2004-01-14/xmlschema2006-11-06 + +java net.sf.saxon.Transform -xsl:unifyCatalog.xsl $DIRECTORY_NAME/suite.xml > testSuites.xml diff --git a/tests/auto/xmlpatternsschemats/tst_xmlpatternsschemats.cpp b/tests/auto/xmlpatternsschemats/tst_xmlpatternsschemats.cpp new file mode 100644 index 0000000..7a6f4c8 --- /dev/null +++ b/tests/auto/xmlpatternsschemats/tst_xmlpatternsschemats.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +****************************************************************************/ + +#include + +#ifdef QTEST_XMLPATTERNS + +#include "tst_suitetest.h" + +/*! + \internal + \brief Test QXsdSchemaParser against W3C's XSD test suite. + */ +class tst_XmlPatternsSchemaTS : public tst_SuiteTest +{ + Q_OBJECT +public: + tst_XmlPatternsSchemaTS(); +protected: + virtual void catalogPath(QString &write) const; +}; + +tst_XmlPatternsSchemaTS::tst_XmlPatternsSchemaTS() + : tst_SuiteTest(tst_SuiteTest::XsdSuite) +{ +} + +void tst_XmlPatternsSchemaTS::catalogPath(QString &write) const +{ + write = QLatin1String("TESTSUITE/testSuites.xml"); +} + +QTEST_MAIN(tst_XmlPatternsSchemaTS) + +#include "tst_xmlpatternsschemats.moc" +#else +QTEST_NOOP_MAIN +#endif + +// vim: et:ts=4:sw=4:sts=4 diff --git a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro new file mode 100644 index 0000000..4978c35 --- /dev/null +++ b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro @@ -0,0 +1,23 @@ +load(qttest_p4) +SOURCES += tst_xmlpatternsschemats.cpp \ + ../qxmlquery/TestFundament.cpp + +include (../xmlpatterns.pri) + +contains(QT_CONFIG,xmlpatterns) { +HEADERS += ../xmlpatternsxqts/test/tst_suitetest.h +SOURCES += ../xmlpatternsxqts/test/tst_suitetest.cpp +} + +PATTERNIST_SDK = QtXmlPatternsSDK +if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { + win32:PATTERNIST_SDK = $${PATTERNIST_SDK}d + else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug +} +LIBS += -l$$PATTERNIST_SDK + +INCLUDEPATH += $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts/lib/ \ + $$QT_BUILD_TREE/include/QtXmlPatterns/private \ + $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts/test \ + ../xmlpatternsxqts/test \ + ../xmlpatternsxqts/lib diff --git a/tests/auto/xmlpatternsvalidator/files/instance.xml b/tests/auto/xmlpatternsvalidator/files/instance.xml new file mode 100644 index 0000000..544ff8c --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/instance.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tests/auto/xmlpatternsvalidator/files/invalid_schema.xsd b/tests/auto/xmlpatternsvalidator/files/invalid_schema.xsd new file mode 100644 index 0000000..99e3525 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/invalid_schema.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/other_valid_schema.xsd b/tests/auto/xmlpatternsvalidator/files/other_valid_schema.xsd new file mode 100644 index 0000000..850ed92 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/other_valid_schema.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/sa_invalid_instance.xml b/tests/auto/xmlpatternsvalidator/files/sa_invalid_instance.xml new file mode 100644 index 0000000..1804e88 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/sa_invalid_instance.xml @@ -0,0 +1,3 @@ + + + diff --git a/tests/auto/xmlpatternsvalidator/files/sa_valid_instance.xml b/tests/auto/xmlpatternsvalidator/files/sa_valid_instance.xml new file mode 100644 index 0000000..47c980e --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/sa_valid_instance.xml @@ -0,0 +1,3 @@ + + + diff --git a/tests/auto/xmlpatternsvalidator/files/valid_schema.xsd b/tests/auto/xmlpatternsvalidator/files/valid_schema.xsd new file mode 100644 index 0000000..a1b765a --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/valid_schema.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp new file mode 100644 index 0000000..9643e56 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +****************************************************************************/ + +#include +#include + +#ifdef QTEST_XMLPATTERNS + +#include "../qxmlquery/TestFundament.h" +#include "../network-settings.h" + +/*! + \class tst_XmlPatterns + \internal + \since 4.6 + \brief Tests the command line interface, \c xmlpatternsvalidator, for the XML validation code. + */ +class tst_XmlPatternsValidator : public QObject + , private TestFundament +{ + Q_OBJECT + +public: + tst_XmlPatternsValidator(); + +private Q_SLOTS: + void initTestCase(); + void xsdSupport(); + void xsdSupport_data() const; + +private: + const QString m_command; + bool m_dontRun; +}; + +tst_XmlPatternsValidator::tst_XmlPatternsValidator() + : m_command(QLatin1String("xmlpatternsvalidator")) + , m_dontRun(false) +{ +} + +void tst_XmlPatternsValidator::initTestCase() +{ + QProcess process; + process.start(m_command); + + if(!process.waitForFinished()) + { + m_dontRun = true; + QEXPECT_FAIL("", "The command line tool is not in the path, most likely because Qt " + "has been partically built, such as only the sub-src rule. No tests will be run.", Abort); + QVERIFY(false); + } +} + +void tst_XmlPatternsValidator::xsdSupport() +{ + if(m_dontRun) + QSKIP("The command line utility is not in the path.", SkipAll); + +#ifdef Q_OS_WINCE + QSKIP("WinCE: This test uses unsupported WinCE functionality", SkipAll); +#endif + + QFETCH(int, expectedExitCode); + QFETCH(QStringList, arguments); + QFETCH(QString, cwd); + + QProcess process; + + if(!cwd.isEmpty()) + process.setWorkingDirectory(inputFile(cwd)); + + process.start(m_command, arguments); + + QCOMPARE(process.exitStatus(), QProcess::NormalExit); + QVERIFY(process.waitForFinished()); + + if(process.exitCode() != expectedExitCode) + QTextStream(stderr) << "foo:" << process.readAllStandardError(); + + QCOMPARE(process.exitCode(), expectedExitCode); +} + +void tst_XmlPatternsValidator::xsdSupport_data() const +{ +#ifdef Q_OS_WINCE + return; +#endif + + QTest::addColumn("expectedExitCode"); + QTest::addColumn("arguments"); + QTest::addColumn("cwd"); + + QTest::newRow("No arguments") + << 2 + << QStringList() + << QString(); + + QTest::newRow("A valid schema") + << 0 + << QStringList(QLatin1String("files/valid_schema.xsd")) + << QString(); + + QTest::newRow("An invalid schema") + << 1 + << QStringList(QLatin1String("files/invalid_schema.xsd")) + << QString(); + + QTest::newRow("An instance and valid schema") + << 0 + << (QStringList() << QLatin1String("files/instance.xml") + << QLatin1String("files/valid_schema.xsd")) + << QString(); + + QTest::newRow("An instance and invalid schema") + << 1 + << (QStringList() << QLatin1String("files/instance.xml") + << QLatin1String("files/invalid_schema.xsd")) + << QString(); + + QTest::newRow("An instance and not matching schema") + << 1 + << (QStringList() << QLatin1String("files/instance.xml") + << QLatin1String("files/other_valid_schema.xsd")) + << QString(); + + QTest::newRow("Two instance documents") + << 1 + << (QStringList() << QLatin1String("files/instance.xml") + << QLatin1String("files/instance.xml")) + << QString(); + + QTest::newRow("Three instance documents") + << 2 + << (QStringList() << QLatin1String("files/instance.xml") + << QLatin1String("files/instance.xml") + << QLatin1String("files/instance.xml")) + << QString(); + + QTest::newRow("Two schema documents") + << 1 + << (QStringList() << QLatin1String("files/valid_schema.xsd") + << QLatin1String("files/valid_schema.xsd")) + << QString(); + + QTest::newRow("A schema aware valid instance document") + << 0 + << (QStringList() << QLatin1String("files/sa_valid_instance.xml")) + << QString(); + + QTest::newRow("A schema aware invalid instance document") + << 1 + << (QStringList() << QLatin1String("files/sa_invalid_instance.xml")) + << QString(); + + QTest::newRow("A non-schema aware instance document") + << 1 + << (QStringList() << QLatin1String("files/instance.xml")) + << QString(); +} + +QTEST_MAIN(tst_XmlPatternsValidator) + +#include "tst_xmlpatternsvalidator.moc" +#else +QTEST_NOOP_MAIN +#endif + +// vim: et:ts=4:sw=4:sts=4 diff --git a/tests/auto/xmlpatternsvalidator/xmlpatternsvalidator.pro b/tests/auto/xmlpatternsvalidator/xmlpatternsvalidator.pro new file mode 100644 index 0000000..7091840 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/xmlpatternsvalidator.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +SOURCES += tst_xmlpatternsvalidator.cpp \ + ../qxmlquery/TestFundament.cpp + +include (../xmlpatterns.pri) diff --git a/tests/auto/xmlpatternsview/view/MainWindow.cpp b/tests/auto/xmlpatternsview/view/MainWindow.cpp index 57aaca0..b5424a3 100644 --- a/tests/auto/xmlpatternsview/view/MainWindow.cpp +++ b/tests/auto/xmlpatternsview/view/MainWindow.cpp @@ -220,7 +220,8 @@ void MainWindow::on_actionOpen_triggered() if(fileName.isNull()) return; - openCatalog(QUrl::fromLocalFile(fileName), true, false); + m_currentSuiteType = TestSuite::XQuerySuite; + openCatalog(QUrl::fromLocalFile(fileName), true, TestSuite::XQuerySuite); } void MainWindow::on_actionOpenXSLTSCatalog_triggered() @@ -234,18 +235,34 @@ void MainWindow::on_actionOpenXSLTSCatalog_triggered() if(fileName.isNull()) return; - openCatalog(QUrl::fromLocalFile(fileName), true, true); + m_currentSuiteType = TestSuite::XsltSuite; + openCatalog(QUrl::fromLocalFile(fileName), true, TestSuite::XsltSuite); +} + +void MainWindow::on_actionOpenXSDTSCatalog_triggered() +{ + const QString fileName(QFileDialog::getOpenFileName(this, + QLatin1String("Open Test Suite Catalog"), + m_previousOpenedCatalog.toLocalFile(), + QLatin1String("Test Suite Catalog file (*.xml)"))); + + /* "If the user presses Cancel, it returns a null string." */ + if(fileName.isNull()) + return; + + m_currentSuiteType = TestSuite::XsdSuite; + openCatalog(QUrl::fromLocalFile(fileName), true, TestSuite::XsdSuite); } void MainWindow::openCatalog(const QUrl &fileName, const bool reportError, - const bool isXSLT) + const TestSuite::SuiteType suiteType) { setCurrentFile(fileName); m_previousOpenedCatalog = fileName; QString errorMsg; - TestSuite *const loadedSuite = TestSuite::openCatalog(fileName, errorMsg, false, isXSLT); + TestSuite *const loadedSuite = TestSuite::openCatalog(fileName, errorMsg, false, suiteType); if(!loadedSuite) { @@ -334,12 +351,12 @@ void MainWindow::readSettings() focusURI->setText(settings.value(QLatin1String("focusURI")).toString()); isXSLT20->setChecked(settings.value(QLatin1String("isXSLT20")).toBool()); compileOnly->setChecked(settings.value(QLatin1String("compileOnly")).toBool()); + m_currentSuiteType = (TestSuite::SuiteType)settings.value(QLatin1String("PreviousSuiteType"), isXSLT20->isChecked() ? TestSuite::XsltSuite : TestSuite::XQuerySuite).toInt(); /* Open the previously opened catalog. */ if(!m_previousOpenedCatalog.isEmpty()) { - /* We don't know what kind of catalog it is, so we just take a chance. */ - openCatalog(m_previousOpenedCatalog, false, isXSLT20->isChecked()); + openCatalog(m_previousOpenedCatalog, false, m_currentSuiteType); } sourceInput->setPlainText(settings.value(QLatin1String("sourceInput")).toString()); @@ -393,6 +410,7 @@ void MainWindow::writeSettings() settings.setValue(QLatin1String("size"), size()); settings.setValue(QLatin1String("sourceInput"), sourceInput->toPlainText()); settings.setValue(QLatin1String("PreviousOpenedCatalogFile"), m_previousOpenedCatalog); + settings.setValue(QLatin1String("PreviousSuiteType"), m_currentSuiteType); settings.setValue(QLatin1String("SelectedTab"), sourceTab->currentIndex()); settings.setValue(QLatin1String("ResultViewMethod"), testResultView->resultViewSelection->currentIndex()); @@ -470,7 +488,7 @@ void MainWindow::openRecentFile() { const QAction *const action = qobject_cast(sender()); if(action) - openCatalog(action->data().toUrl(), true, false); + openCatalog(action->data().toUrl(), true, TestSuite::XQuerySuite); } void MainWindow::closeEvent(QCloseEvent *ev) diff --git a/tests/auto/xmlpatternsview/view/MainWindow.h b/tests/auto/xmlpatternsview/view/MainWindow.h index 1d14f41..778d7cd 100644 --- a/tests/auto/xmlpatternsview/view/MainWindow.h +++ b/tests/auto/xmlpatternsview/view/MainWindow.h @@ -88,6 +88,7 @@ #include "ui_ui_MainWindow.h" #include "DebugExpressionFactory.h" +#include "TestSuite.h" QT_BEGIN_HEADER @@ -142,6 +143,8 @@ namespace QPatternistSDK void on_actionOpenXSLTSCatalog_triggered(); + void on_actionOpenXSDTSCatalog_triggered(); + /** * Executes the selected test case or test group. */ @@ -153,7 +156,7 @@ namespace QPatternistSDK * an informative message box will be displayed, if any errors occurred. */ void openCatalog(const QUrl &file, const bool reportError, - const bool isXSLT); + const TestSuite::SuiteType suitType); void openRecentFile(); @@ -205,6 +208,7 @@ namespace QPatternistSDK TestCaseView * testCaseView; TestResultView * testResultView; FunctionSignaturesView * functionView; + TestSuite::SuiteType m_currentSuiteType; }; } QT_END_NAMESPACE diff --git a/tests/auto/xmlpatternsview/view/ui_MainWindow.ui b/tests/auto/xmlpatternsview/view/ui_MainWindow.ui index 5d74331..0240350 100644 --- a/tests/auto/xmlpatternsview/view/ui_MainWindow.ui +++ b/tests/auto/xmlpatternsview/view/ui_MainWindow.ui @@ -234,6 +234,7 @@ + @@ -304,6 +305,14 @@ Ctrl+L + + + O&pen XSDTS Catalog... + + + Ctrl+S + + diff --git a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp b/tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp index b699ead..841266c 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp +++ b/tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp @@ -178,6 +178,7 @@ void TestBaseLine::toXML(XMLWriter &receiver) const { case XML: /* Fallthrough. */ case Fragment: /* Fallthrough. */ + case SchemaIsValid: /* Fallthrough. */ case Text: { QXmlAttributes inspectAtts; @@ -343,6 +344,8 @@ TestResult::Status TestBaseLine::verify(const QString &serializedInput) const { switch(m_type) { + case SchemaIsValid: + /* Fall through. */ case Text: { if(serializedInput == details()) @@ -491,6 +494,8 @@ QString TestBaseLine::displayName(const Type id) return QLatin1String("Inspect"); case ExpectedError: return QLatin1String("ExpectedError"); + case SchemaIsValid: + return QLatin1String("SchemaIsValid"); } Q_ASSERT(false); @@ -503,6 +508,8 @@ QString TestBaseLine::details() const return QString(); if(m_type == ExpectedError) /* We're an error code. */ return m_details; + if(m_type == SchemaIsValid) /* We're a schema validation information . */ + return m_details; if(m_details.isEmpty()) return m_details; diff --git a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.h b/tests/auto/xmlpatternsxqts/lib/TestBaseLine.h index 577c4b1..b5dc46e 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.h +++ b/tests/auto/xmlpatternsxqts/lib/TestBaseLine.h @@ -168,7 +168,14 @@ namespace QPatternistSDK * because an implementation does not support the feature is not * considered a correct result. */ - ExpectedError + ExpectedError, + + /** + * A special comparison for the schema validation tests. The details + * can only be 'true' or 'false' depending on whether it is a valid + * schema or not. + */ + SchemaIsValid }; /** diff --git a/tests/auto/xmlpatternsxqts/lib/TestGroup.cpp b/tests/auto/xmlpatternsxqts/lib/TestGroup.cpp index 060f993..e59e4b4 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestGroup.cpp +++ b/tests/auto/xmlpatternsxqts/lib/TestGroup.cpp @@ -94,7 +94,7 @@ TestGroup::TestGroup(TreeItem *p) : m_parent(p) QVariant TestGroup::data(const Qt::ItemDataRole role, int column) const { - if(role != Qt::DisplayRole && role != Qt::BackgroundRole) + if(role != Qt::DisplayRole && role != Qt::BackgroundRole && role != Qt::ToolTipRole) return QVariant(); /* In ResultSummary, the first is the amount of passes and the second is the total. */ @@ -154,6 +154,10 @@ QVariant TestGroup::data(const Qt::ItemDataRole role, int column) const return QVariant(); } } + case Qt::ToolTipRole: + { + return description(); + } default: { Q_ASSERT_X(false, Q_FUNC_INFO, "This shouldn't be reached"); diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuite.cpp b/tests/auto/xmlpatternsxqts/lib/TestSuite.cpp index 3bca281..13d5880 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestSuite.cpp +++ b/tests/auto/xmlpatternsxqts/lib/TestSuite.cpp @@ -91,6 +91,7 @@ #include "TestSuiteResult.h" #include "XMLWriter.h" #include "XSLTTestSuiteHandler.h" +#include "XSDTestSuiteHandler.h" #include "qdebug_p.h" #include "TestSuite.h" @@ -132,7 +133,7 @@ TestSuiteResult *TestSuite::runSuite() TestSuite *TestSuite::openCatalog(const QUrl &catalogURI, QString &errorMsg, const bool useExclusionList, - const bool isXSLTCatalog) + SuiteType suiteType) { pDebug() << "Opening catalog:" << catalogURI.toString(); QFile ts(catalogURI.toLocalFile()); @@ -167,14 +168,14 @@ TestSuite *TestSuite::openCatalog(const QUrl &catalogURI, return 0; } - return openCatalog(&ts, errorMsg, catalogURI, useExclusionList, isXSLTCatalog); + return openCatalog(&ts, errorMsg, catalogURI, useExclusionList, suiteType); } TestSuite *TestSuite::openCatalog(QIODevice *input, QString &errorMsg, const QUrl &fileName, const bool useExclusionList, - const bool isXSLTCatalog) + SuiteType suiteType) { Q_ASSERT(input); @@ -183,10 +184,12 @@ TestSuite *TestSuite::openCatalog(QIODevice *input, HandlerPtr loader; - if(isXSLTCatalog) - loader = HandlerPtr(new XSLTTestSuiteHandler(fileName)); - else - loader = HandlerPtr(new TestSuiteHandler(fileName, useExclusionList)); + switch (suiteType) { + case XQuerySuite: loader = HandlerPtr(new TestSuiteHandler(fileName, useExclusionList)); break; + case XsltSuite: loader = HandlerPtr(new XSLTTestSuiteHandler(fileName)); break; + case XsdSuite: loader = HandlerPtr(new XSDTestSuiteHandler(fileName)); break; + default: Q_ASSERT(false); break; + } reader.setContentHandler(loader.data()); @@ -198,8 +201,13 @@ TestSuite *TestSuite::openCatalog(QIODevice *input, return 0; } - TestSuite *const suite = isXSLTCatalog ? static_cast(loader.data())->testSuite() - : static_cast(loader.data())->testSuite(); + TestSuite *suite = 0; + switch (suiteType) { + case XQuerySuite: suite = static_cast(loader.data())->testSuite(); break; + case XsltSuite: suite = static_cast(loader.data())->testSuite(); break; + case XsdSuite: suite = static_cast(loader.data())->testSuite(); break; + default: Q_ASSERT(false); break; + } if(suite) return suite; diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuite.h b/tests/auto/xmlpatternsxqts/lib/TestSuite.h index cdd511f..5141886 100644 --- a/tests/auto/xmlpatternsxqts/lib/TestSuite.h +++ b/tests/auto/xmlpatternsxqts/lib/TestSuite.h @@ -112,6 +112,16 @@ namespace QPatternistSDK class Q_PATTERNISTSDK_EXPORT TestSuite : public TestContainer { public: + /** + * Describes the type of test suite. + */ + enum SuiteType + { + XQuerySuite, ///< The test suite for XQuery + XsltSuite, ///< The test suite for XSLT + XsdSuite ///< The test suite for XML Schema + }; + TestSuite(); virtual QVariant data(const Qt::ItemDataRole role, int column) const; @@ -148,7 +158,7 @@ namespace QPatternistSDK static TestSuite *openCatalog(const QUrl &catalogFile, QString &errorMsg, const bool useExclusionList, - const bool isXSLTCatalog = false); + SuiteType type); void toXML(XMLWriter &receiver, TestCase *const tc) const; @@ -177,7 +187,7 @@ namespace QPatternistSDK QString &errorMsg, const QUrl &fileName, const bool useExclusionList, - const bool isXSLTCatalog); + SuiteType type); QString m_version; QDate m_designDate; }; diff --git a/tests/auto/xmlpatternsxqts/lib/TreeModel.cpp b/tests/auto/xmlpatternsxqts/lib/TreeModel.cpp index d9ba200..4991b26 100644 --- a/tests/auto/xmlpatternsxqts/lib/TreeModel.cpp +++ b/tests/auto/xmlpatternsxqts/lib/TreeModel.cpp @@ -118,9 +118,14 @@ QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int rol return QVariant(); } -void TreeModel::childChanged(TreeItem *) +void TreeModel::childChanged(TreeItem *item) { - layoutChanged(); + if (item) { + const QModelIndex index = createIndex(item->row(), 0, item); + dataChanged(index, index); + } else { + layoutChanged(); + } } QModelIndex TreeModel::index(int row, int column, const QModelIndex &p) const diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp b/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp new file mode 100644 index 0000000..b19eb91 --- /dev/null +++ b/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp @@ -0,0 +1,346 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Patternist project on Trolltech Labs. +** +** $TROLLTECH_GPL_LICENSE$ +** +*************************************************************************** +*/ + +#include +#include +#include +#include +#include + +#include "XSDTSTestCase.h" + +#include "qxmlschema.h" +#include "qxmlschemavalidator.h" + +using namespace QPatternistSDK; +using namespace QPatternist; + +XSDTSTestCase::XSDTSTestCase(const Scenario scen, TreeItem *p, TestType testType) + : m_scenario(scen) + , m_parent(p) + , m_testType(testType) +{ +} + +XSDTSTestCase::~XSDTSTestCase() +{ + qDeleteAll(m_baseLines); +} + +TestResult::List XSDTSTestCase::execute(const ExecutionStage, TestSuite*) +{ + ErrorHandler errHandler; + ErrorHandler::installQtMessageHandler(&errHandler); + + TestResult::List retval; + TestResult::Status resultStatus = TestResult::Unknown; + QString serialized; + + if (m_testType == SchemaTest) { + executeSchemaTest(resultStatus, serialized, &errHandler); + } else { + executeInstanceTest(resultStatus, serialized, &errHandler); + } + + resultStatus = TestBaseLine::scan(serialized, baseLines()); + Q_ASSERT(resultStatus != TestResult::Unknown); + + m_result = new TestResult(name(), resultStatus, 0, errHandler.messages(), + QPatternist::Item::List(), serialized); + retval.append(m_result); + ErrorHandler::installQtMessageHandler(0); + changed(this); + return retval; +} + +void XSDTSTestCase::executeSchemaTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler) +{ + QFile file(m_schemaUri.path()); + if (!file.open(QIODevice::ReadOnly)) { + resultStatus = TestResult::Fail; + serialized = QString(); + return; + } + + QXmlSchema schema; + schema.setMessageHandler(handler); + schema.load(&file, m_schemaUri); + + if (schema.isValid()) { + resultStatus = TestResult::Pass; + serialized = QString::fromLatin1("true"); + } else { + resultStatus = TestResult::Pass; + serialized = QString::fromLatin1("false"); + } +} + +void XSDTSTestCase::executeInstanceTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler) +{ + QFile instanceFile(m_instanceUri.path()); + if (!instanceFile.open(QIODevice::ReadOnly)) { + resultStatus = TestResult::Fail; + serialized = QString(); + return; + } + + QXmlSchema schema; + if (m_schemaUri.isValid()) { + QFile file(m_schemaUri.path()); + if (!file.open(QIODevice::ReadOnly)) { + resultStatus = TestResult::Fail; + serialized = QString(); + return; + } + + schema.setMessageHandler(handler); + schema.load(&file, m_schemaUri); + + if (!schema.isValid()) { + resultStatus = TestResult::Pass; + serialized = QString::fromLatin1("false"); + return; + } + } + + QXmlSchemaValidator validator(schema); + validator.setMessageHandler(handler); + + qDebug("check %s", qPrintable(m_instanceUri.path())); + if (validator.validate(&instanceFile, m_instanceUri)) { + resultStatus = TestResult::Pass; + serialized = QString::fromLatin1("true"); + } else { + resultStatus = TestResult::Pass; + serialized = QString::fromLatin1("false"); + } +} + +QVariant XSDTSTestCase::data(const Qt::ItemDataRole role, int column) const +{ + if(role == Qt::DisplayRole) + { + if(column == 0) + return title(); + + const TestResult *const tr = testResult(); + if(!tr) + { + if(column == 1) + return TestResult::displayName(TestResult::NotTested); + else + return QString(); + } + const TestResult::Status status = tr->status(); + + switch(column) + { + case 1: + return status == TestResult::Pass ? QString(QChar::fromLatin1('1')) + : QString(QChar::fromLatin1('0')); + case 2: + return status == TestResult::Fail ? QString(QChar::fromLatin1('1')) + : QString(QChar::fromLatin1('0')); + default: + return QString(); + } + } + + if(role != Qt::BackgroundRole) + return QVariant(); + + const TestResult *const tr = testResult(); + + if(!tr) + { + if(column == 0) + return Qt::yellow; + else + return QVariant(); + } + + const TestResult::Status status = tr->status(); + + if(status == TestResult::NotTested || status == TestResult::Unknown) + return Qt::yellow; + + switch(column) + { + case 1: + return status == TestResult::Pass ? Qt::green : QVariant(); + case 2: + return status == TestResult::Fail ? Qt::red : QVariant(); + default: + return QVariant(); + } +} + +QString XSDTSTestCase::sourceCode(bool &ok) const +{ + QFile file((m_testType == SchemaTest ? m_schemaUri : m_instanceUri).toLocalFile()); + + QString err; + + if(!file.exists()) + err = QString::fromLatin1("Error: %1 does not exist.").arg(file.fileName()); + else if(!QFileInfo(file.fileName()).isFile()) + err = QString::fromLatin1("Error: %1 is not a file, cannot display it.").arg(file.fileName()); + else if(!file.open(QIODevice::ReadOnly)) + err = QString::fromLatin1("Error: Could not open %1. Likely a permission error.") + .arg(file.fileName()); + + if(err.isNull()) /* No errors. */ + { + ok = true; + /* Scary, we assume the query is stored in UTF-8. */ + return QString::fromUtf8(file.readAll()); + } + else + { + ok = false; + return err; + } +} + +int XSDTSTestCase::columnCount() const +{ + return 2; +} + +void XSDTSTestCase::addBaseLine(TestBaseLine *line) +{ + m_baseLines.append(line); +} + +QString XSDTSTestCase::name() const +{ + return m_name; +} + +QString XSDTSTestCase::creator() const +{ + return m_creator; +} + +QString XSDTSTestCase::description() const +{ + return m_description; +} + +QDate XSDTSTestCase::lastModified() const +{ + return m_lastModified; +} + +bool XSDTSTestCase::isXPath() const +{ + return false; +} + +TestCase::Scenario XSDTSTestCase::scenario() const +{ + return m_scenario; +} + +void XSDTSTestCase::setName(const QString &n) +{ + m_name = n; +} + +void XSDTSTestCase::setCreator(const QString &ctor) +{ + m_creator = ctor; +} + +void XSDTSTestCase::setDescription(const QString &descriptionP) +{ + m_description = descriptionP; +} + +void XSDTSTestCase::setLastModified(const QDate &date) +{ + m_lastModified = date; +} + +void XSDTSTestCase::setSchemaUri(const QUrl &uri) +{ + m_schemaUri = uri; +} + +void XSDTSTestCase::setInstanceUri(const QUrl &uri) +{ + m_instanceUri = uri; +} + +TreeItem *XSDTSTestCase::parent() const +{ + return m_parent; +} + +QString XSDTSTestCase::title() const +{ + return m_name; +} + +TestBaseLine::List XSDTSTestCase::baseLines() const +{ + Q_ASSERT_X(!m_baseLines.isEmpty(), Q_FUNC_INFO, + qPrintable(QString::fromLatin1("The test %1 has no base lines, it should have at least one.").arg(name()))); + return m_baseLines; +} + +QUrl XSDTSTestCase::schemaUri() const +{ + return m_schemaUri; +} + +QUrl XSDTSTestCase::instanceUri() const +{ + return m_instanceUri; +} + +void XSDTSTestCase::setContextItemSource(const QUrl &uri) +{ + m_contextItemSource = uri; +} + +QUrl XSDTSTestCase::contextItemSource() const +{ + return m_contextItemSource; +} + +void XSDTSTestCase::setParent(TreeItem *const p) +{ + m_parent = p; +} + +QPatternist::ExternalVariableLoader::Ptr XSDTSTestCase::externalVariableLoader() const +{ + return QPatternist::ExternalVariableLoader::Ptr(); +} + +TestResult *XSDTSTestCase::testResult() const +{ + return m_result; +} + +TestItem::ResultSummary XSDTSTestCase::resultSummary() const +{ + if(m_result) + return ResultSummary(m_result->status() == TestResult::Pass ? 1 : 0, + 1); + + return ResultSummary(0, 1); +} + +// vim: et:ts=4:sw=4:sts=4 + diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h b/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h new file mode 100644 index 0000000..ce84988 --- /dev/null +++ b/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Patternist project on Trolltech Labs. +** +** $TROLLTECH_GPL_LICENSE$ +** +*************************************************************************** +*/ + +#ifndef PatternistSDK_XSDTSTestCase_H +#define PatternistSDK_XSDTSTestCase_H + +#include +#include +#include + +#include "TestBaseLine.h" +#include "TestCase.h" + +QT_BEGIN_HEADER + +namespace QPatternistSDK +{ + /** + * @short Represents a test case in a test suite in the XML Query Test Suite. + * + * TestCase is a memory representation of a test case, and maps + * to the @c test-case element in the XQuery Test Suite test + * case catalog. + * + * @ingroup PatternistSDK + * @author Frans Englich + */ + class Q_PATTERNISTSDK_EXPORT XSDTSTestCase : public TestCase + { + public: + enum TestType + { + SchemaTest, + InstanceTest + }; + + XSDTSTestCase(const Scenario scen, TreeItem *parent, TestType testType); + virtual ~XSDTSTestCase(); + + /** + * Executes the test, and returns the result. The returned list + * will always contain exactly one TestResult. + * + * @p stage is ignored when running out-of-process. + */ + virtual TestResult::List execute(const ExecutionStage stage, + TestSuite *ts); + /** + * The identifier, the name of the test. For example, "Literals034". + * The name of a test case must be unique. + */ + virtual QString name() const; + virtual QString creator() const; + virtual QString description() const; + /** + * @returns the query inside the file, specified by testCasePath(). Loading + * of the file is not cached in order to avoid complications. + * @param ok is set to @c false if loading the query file fails + */ + virtual QString sourceCode(bool &ok) const; + virtual QUrl schemaUri() const; + virtual QUrl instanceUri() const; + virtual QUrl testCasePath() const {return QUrl();} + virtual QDate lastModified() const; + + bool isXPath() const; + + /** + * What kind of test case this is, what kind of scenario it takes part + * of. For example, whether the test case should evaluate normally or fail. + */ + Scenario scenario() const; + + void setCreator(const QString &creator); + void setLastModified(const QDate &date); + void setDescription(const QString &description); + void setName(const QString &name); + void setSchemaUri(const QUrl &uri); + void setInstanceUri(const QUrl &uri); + void setTestCasePath(const QUrl &uri) {} + void setContextItemSource(const QUrl &uri); + void addBaseLine(TestBaseLine *lines); + + virtual TreeItem *parent() const; + + virtual QVariant data(const Qt::ItemDataRole role, int column) const; + + virtual QString title() const; + virtual TestBaseLine::List baseLines() const; + + virtual int columnCount() const; + + virtual QUrl contextItemSource() const; + void setParent(TreeItem *const parent); + virtual QPatternist::ExternalVariableLoader::Ptr externalVariableLoader() const; + virtual TestResult *testResult() const; + virtual ResultSummary resultSummary() const; + + private: + void executeSchemaTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler); + void executeInstanceTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler); + + QString m_name; + QString m_creator; + QString m_description; + QUrl m_schemaUri; + QUrl m_instanceUri; + QDate m_lastModified; + const Scenario m_scenario; + TreeItem * m_parent; + TestBaseLine::List m_baseLines; + QUrl m_contextItemSource; + TestType m_testType; + QPointer m_result; + }; +} + +QT_END_HEADER + +#endif +// vim: et:ts=4:sw=4:sts=4 diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp b/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp new file mode 100644 index 0000000..b6ee379 --- /dev/null +++ b/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp @@ -0,0 +1,881 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Patternist project on Trolltech Labs. +** +** $TROLLTECH_GPL_LICENSE$ +** +*************************************************************************** +*/ + +#include + +#include "qacceltreeresourceloader_p.h" +#include "qnetworkaccessdelegator_p.h" + +#include "Global.h" +#include "TestBaseLine.h" +#include "TestGroup.h" + +#include "XSDTestSuiteHandler.h" +#include "XSDTSTestCase.h" + +using namespace QPatternistSDK; + +extern QNetworkAccessManager s_networkManager; + +XSDTestSuiteHandler::XSDTestSuiteHandler(const QUrl &catalogFile) : m_ts(0) + , m_catalogFile(catalogFile) + , m_inSchemaTest(false) + , m_inInstanceTest(false) + , m_inTestGroup(false) + , m_inDescription(false) + , m_schemaBlacklisted(false) + , m_counter(0) +{ + Q_ASSERT(!m_catalogFile.isRelative()); + m_ts = new TestSuite(); + m_topLevelGroup = new TestGroup(m_ts); + m_topLevelGroup->setTitle("XML Schema Test Suite"); + m_ts->appendChild(m_topLevelGroup); + + // exclude these test cases, as they break our current state machine + m_blackList << QLatin1String("addB099") + << QLatin1String("addB118") + << QLatin1String("elemJ003") + << QLatin1String("elemJ011") + << QLatin1String("elemZ004") + << QLatin1String("elemZ020") + << QLatin1String("groupH021v") + << QLatin1String("groupJ009v") + << QLatin1String("name00101m2") + << QLatin1String("schL5") + << QLatin1String("ste110") + << QLatin1String("stZ007") + << QLatin1String("stZ047") + << QLatin1String("stZ055") + << QLatin1String("addB049") + << QLatin1String("addB068") + << QLatin1String("addB078") + << QLatin1String("addB078A") + << QLatin1String("addB078B") + << QLatin1String("addB167") + << QLatin1String("addB191") + << QLatin1String("isDefault060_2") + << QLatin1String("isDefault069") + << QLatin1String("annotB025") + << QLatin1String("base64Binary_enumeration003_1321") + << QLatin1String("anyURI_a001_1336") + << QLatin1String("anyURI_a001_1336") + << QLatin1String("anyURI_a003_1338") + << QLatin1String("anyURI_a004_1339") + << QLatin1String("anyURI_b004_1354") + << QLatin1String("anyURI_b004_1354") + << QLatin1String("anyURI_b006_1356") + << QLatin1String("QName_length001_1357") + << QLatin1String("QName_length003_1359") + << QLatin1String("QName_minLength003_1362") + << QLatin1String("QName_maxLength001_1364") + << QLatin1String("NOTATION_length001_1372") + << QLatin1String("NOTATION_length003_1374") + << QLatin1String("NOTATION_minLength003_1377") + << QLatin1String("NOTATION_maxLength001_1379") + << QLatin1String("hexBinary003_2069") + << QLatin1String("QName009_2092") + << QLatin1String("dtZ107447_a_2245") + << QLatin1String("elemE001") + << QLatin1String("elemE002") + << QLatin1String("elemE003") + << QLatin1String("elemE004") + << QLatin1String("elemE005") + << QLatin1String("elemT026") + << QLatin1String("elemT027") + << QLatin1String("elemT028") + << QLatin1String("elemT029") + << QLatin1String("elemT054") + << QLatin1String("elemT055") + << QLatin1String("elemT056") + << QLatin1String("elemT057") + << QLatin1String("elemZ006") + << QLatin1String("elemZ007") + << QLatin1String("elemZ026") + << QLatin1String("elemZ027_c") + << QLatin1String("elemZ028c") + << QLatin1String("elemZ028d") + << QLatin1String("elemZ028f1") + << QLatin1String("elemZ028f1") + << QLatin1String("elemZ028f2") + << QLatin1String("elemZ028f2") + << QLatin1String("elemZ028f3") + << QLatin1String("elemZ028f3") + << QLatin1String("elemZ031") + << QLatin1String("errF001") + << QLatin1String("idC019") + << QLatin1String("idL100") + << QLatin1String("idZ011") + << QLatin1String("idZ015") + << QLatin1String("mgO013") + << QLatin1String("particlesA012") + << QLatin1String("particlesA013") + << QLatin1String("particlesA014") + << QLatin1String("particlesA015") + << QLatin1String("particlesHa161") + << QLatin1String("particlesHb008") + << QLatin1String("particlesHb011") + << QLatin1String("particlesIe003") + << QLatin1String("particlesIg003") + << QLatin1String("particlesIg004") + << QLatin1String("particlesJb003") + << QLatin1String("particlesJd003") + << QLatin1String("particlesJf003") + << QLatin1String("particlesJk003") + << QLatin1String("particlesOb001") + << QLatin1String("particlesOb002") + << QLatin1String("particlesOb004") + << QLatin1String("particlesOb008") + << QLatin1String("particlesOb009") + << QLatin1String("particlesOb013") + << QLatin1String("particlesOb018") + << QLatin1String("particlesQ005") + << QLatin1String("particlesS002") + << QLatin1String("particlesT002") + << QLatin1String("particlesT009") + << QLatin1String("particlesT014") + << QLatin1String("particlesV001") + << QLatin1String("particlesV002") + << QLatin1String("particlesV020") + << QLatin1String("particlesZ001") + << QLatin1String("particlesZ005") + << QLatin1String("particlesZ007") + << QLatin1String("particlesZ023") + << QLatin1String("particlesZ024") + << QLatin1String("particlesZ026") + << QLatin1String("particlesZ028") + << QLatin1String("particlesZ033_c") + << QLatin1String("particlesZ033_d") + << QLatin1String("particlesZ033_e") + << QLatin1String("particlesZ033_f") + << QLatin1String("particlesZ033_g") + << QLatin1String("particlesZ034_a1") + << QLatin1String("particlesZ034_a2") + << QLatin1String("particlesZ034_a3") + << QLatin1String("particlesZ034_b") + << QLatin1String("particlesZ035_a") + << QLatin1String("particlesZ035_b") + << QLatin1String("particlesZ036_a") + << QLatin1String("particlesZ036_b1") + << QLatin1String("particlesZ036_b2") + << QLatin1String("particlesZ036_c") +/* + << QLatin1String("reC65") + << QLatin1String("reC66") + << QLatin1String("reC67") + << QLatin1String("reC68") + << QLatin1String("reF58") + << QLatin1String("reG50") + << QLatin1String("reJ11") + << QLatin1String("reJ13") + << QLatin1String("reJ19") + << QLatin1String("reJ21") + << QLatin1String("reJ23") + << QLatin1String("reJ25") + << QLatin1String("reJ29") + << QLatin1String("reJ31") + << QLatin1String("reJ33") + << QLatin1String("reJ35") + << QLatin1String("reJ61") + << QLatin1String("reJ69") + << QLatin1String("reJ75") + << QLatin1String("reJ77") + << QLatin1String("reL98") + << QLatin1String("reL99") + << QLatin1String("reM98") + << QLatin1String("reN99") + << QLatin1String("reS21") + << QLatin1String("reS42") + << QLatin1String("reT63") + << QLatin1String("reT84") + << QLatin1String("reDG2") + << QLatin1String("RegexTest_9") + << QLatin1String("RegexTest_11") + << QLatin1String("RegexTest_14") + << QLatin1String("RegexTest_15") + << QLatin1String("RegexTest_16") + << QLatin1String("RegexTest_17") + << QLatin1String("RegexTest_23") + << QLatin1String("RegexTest_24") + << QLatin1String("RegexTest_25") + << QLatin1String("RegexTest_26") + << QLatin1String("RegexTest_27") + << QLatin1String("RegexTest_28") + << QLatin1String("RegexTest_30") + << QLatin1String("RegexTest_30") + << QLatin1String("RegexTest_33") + << QLatin1String("RegexTest_34") + << QLatin1String("RegexTest_34") + << QLatin1String("RegexTest_43") + << QLatin1String("RegexTest_44") + << QLatin1String("RegexTest_45") + << QLatin1String("RegexTest_46") + << QLatin1String("RegexTest_47") + << QLatin1String("RegexTest_48") + << QLatin1String("RegexTest_49") + << QLatin1String("RegexTest_50") + << QLatin1String("RegexTest_51") + << QLatin1String("RegexTest_52") + << QLatin1String("RegexTest_53") + << QLatin1String("RegexTest_54") + << QLatin1String("RegexTest_55") + << QLatin1String("RegexTest_56") + << QLatin1String("RegexTest_57") + << QLatin1String("RegexTest_57") + << QLatin1String("RegexTest_58") + << QLatin1String("RegexTest_58") + << QLatin1String("RegexTest_65") + << QLatin1String("RegexTest_113") + << QLatin1String("RegexTest_116") + << QLatin1String("RegexTest_119") + << QLatin1String("RegexTest_120") + << QLatin1String("RegexTest_121") + << QLatin1String("RegexTest_141") + << QLatin1String("RegexTest_142") + << QLatin1String("RegexTest_143") + << QLatin1String("RegexTest_145") + << QLatin1String("RegexTest_146") + << QLatin1String("RegexTest_147") + << QLatin1String("RegexTest_148") + << QLatin1String("RegexTest_149") + << QLatin1String("RegexTest_150") + << QLatin1String("RegexTest_151") + << QLatin1String("RegexTest_152") + << QLatin1String("RegexTest_154") + << QLatin1String("RegexTest_155") + << QLatin1String("RegexTest_156") + << QLatin1String("RegexTest_157") + << QLatin1String("RegexTest_158") + << QLatin1String("RegexTest_163") + << QLatin1String("RegexTest_164") + << QLatin1String("RegexTest_165") + << QLatin1String("RegexTest_166") + << QLatin1String("RegexTest_167") + << QLatin1String("RegexTest_168") + << QLatin1String("RegexTest_169") + << QLatin1String("RegexTest_170") + << QLatin1String("RegexTest_171") + << QLatin1String("RegexTest_172") + << QLatin1String("RegexTest_173") + << QLatin1String("RegexTest_174") + << QLatin1String("RegexTest_178") + << QLatin1String("RegexTest_194") + << QLatin1String("RegexTest_194") + << QLatin1String("RegexTest_195") + << QLatin1String("RegexTest_195") + << QLatin1String("RegexTest_196") + << QLatin1String("RegexTest_196") + << QLatin1String("RegexTest_197") + << QLatin1String("RegexTest_198") + << QLatin1String("RegexTest_199") + << QLatin1String("RegexTest_200") + << QLatin1String("RegexTest_200") + << QLatin1String("RegexTest_201") + << QLatin1String("RegexTest_201") + << QLatin1String("RegexTest_202") + << QLatin1String("RegexTest_202") + << QLatin1String("RegexTest_203") + << QLatin1String("RegexTest_204") + << QLatin1String("RegexTest_205") + << QLatin1String("RegexTest_206") + << QLatin1String("RegexTest_207") + << QLatin1String("RegexTest_208") + << QLatin1String("RegexTest_209") + << QLatin1String("RegexTest_209") + << QLatin1String("RegexTest_210") + << QLatin1String("RegexTest_210") + << QLatin1String("RegexTest_211") + << QLatin1String("RegexTest_211") + << QLatin1String("RegexTest_212") + << QLatin1String("RegexTest_213") + << QLatin1String("RegexTest_214") + << QLatin1String("RegexTest_215") + << QLatin1String("RegexTest_216") + << QLatin1String("RegexTest_217") + << QLatin1String("RegexTest_218") + << QLatin1String("RegexTest_220") + << QLatin1String("RegexTest_221") + << QLatin1String("RegexTest_222") + << QLatin1String("RegexTest_226") + << QLatin1String("RegexTest_230") + << QLatin1String("RegexTest_232") + << QLatin1String("RegexTest_233") + << QLatin1String("RegexTest_294") + << QLatin1String("RegexTest_294") + << QLatin1String("RegexTest_295") + << QLatin1String("RegexTest_295") + << QLatin1String("RegexTest_299") + << QLatin1String("RegexTest_300") + << QLatin1String("RegexTest_301") + << QLatin1String("RegexTest_302") + << QLatin1String("RegexTest_303") + << QLatin1String("RegexTest_304") + << QLatin1String("RegexTest_305") + << QLatin1String("RegexTest_306") + << QLatin1String("RegexTest_307") + << QLatin1String("RegexTest_308") + << QLatin1String("RegexTest_309") + << QLatin1String("RegexTest_310") + << QLatin1String("RegexTest_311") + << QLatin1String("RegexTest_312") + << QLatin1String("RegexTest_313") + << QLatin1String("RegexTest_314") + << QLatin1String("RegexTest_315") + << QLatin1String("RegexTest_315") + << QLatin1String("RegexTest_316") + << QLatin1String("RegexTest_316") + << QLatin1String("RegexTest_317") + << QLatin1String("RegexTest_317") + << QLatin1String("RegexTest_440") + << QLatin1String("RegexTest_441") + << QLatin1String("RegexTest_442") + << QLatin1String("RegexTest_443") + << QLatin1String("RegexTest_448") + << QLatin1String("RegexTest_449") + << QLatin1String("RegexTest_450") + << QLatin1String("RegexTest_451") + << QLatin1String("RegexTest_458") + << QLatin1String("RegexTest_464") + << QLatin1String("RegexTest_464") + << QLatin1String("RegexTest_465") + << QLatin1String("RegexTest_469") + << QLatin1String("RegexTest_470") + << QLatin1String("RegexTest_471") + << QLatin1String("RegexTest_472") + << QLatin1String("RegexTest_473") + << QLatin1String("RegexTest_477") + << QLatin1String("RegexTest_478") + << QLatin1String("RegexTest_478") + << QLatin1String("RegexTest_479") + << QLatin1String("RegexTest_480") + << QLatin1String("RegexTest_481") + << QLatin1String("RegexTest_482") + << QLatin1String("RegexTest_482") + << QLatin1String("RegexTest_483") + << QLatin1String("RegexTest_483") + << QLatin1String("RegexTest_484") + << QLatin1String("RegexTest_487") + << QLatin1String("RegexTest_516") + << QLatin1String("RegexTest_516") + << QLatin1String("RegexTest_517") + << QLatin1String("RegexTest_517") + << QLatin1String("RegexTest_518") + << QLatin1String("RegexTest_518") + << QLatin1String("RegexTest_519") + << QLatin1String("RegexTest_519") + << QLatin1String("RegexTest_521") + << QLatin1String("RegexTest_523") + << QLatin1String("RegexTest_524") + << QLatin1String("RegexTest_524") + << QLatin1String("RegexTest_586") + << QLatin1String("RegexTest_587") + << QLatin1String("RegexTest_592") + << QLatin1String("RegexTest_593") + << QLatin1String("RegexTest_594") + << QLatin1String("RegexTest_595") + << QLatin1String("RegexTest_596") + << QLatin1String("RegexTest_597") + << QLatin1String("RegexTest_598") + << QLatin1String("RegexTest_599") + << QLatin1String("RegexTest_600") + << QLatin1String("RegexTest_601") + << QLatin1String("RegexTest_602") + << QLatin1String("RegexTest_603") + << QLatin1String("RegexTest_604") + << QLatin1String("RegexTest_605") + << QLatin1String("RegexTest_648") + << QLatin1String("RegexTest_655") + << QLatin1String("RegexTest_688") + << QLatin1String("RegexTest_696") + << QLatin1String("RegexTest_697") + << QLatin1String("RegexTest_698") + << QLatin1String("RegexTest_700") + << QLatin1String("RegexTest_701") + << QLatin1String("RegexTest_702") + << QLatin1String("RegexTest_703") + << QLatin1String("RegexTest_704") + << QLatin1String("RegexTest_705") + << QLatin1String("RegexTest_706") + << QLatin1String("RegexTest_707") + << QLatin1String("RegexTest_717") + << QLatin1String("RegexTest_718") + << QLatin1String("RegexTest_719") + << QLatin1String("RegexTest_724") + << QLatin1String("RegexTest_725") + << QLatin1String("RegexTest_726") + << QLatin1String("RegexTest_727") + << QLatin1String("RegexTest_728") + << QLatin1String("RegexTest_729") + << QLatin1String("RegexTest_730") + << QLatin1String("RegexTest_731") + << QLatin1String("RegexTest_732") + << QLatin1String("RegexTest_733") + << QLatin1String("RegexTest_743") + << QLatin1String("RegexTest_755") + << QLatin1String("RegexTest_756") + << QLatin1String("RegexTest_761") + << QLatin1String("RegexTest_762") + << QLatin1String("RegexTest_781") + << QLatin1String("RegexTest_782") + << QLatin1String("RegexTest_783") + << QLatin1String("RegexTest_790") + << QLatin1String("RegexTest_791") + << QLatin1String("RegexTest_824") + << QLatin1String("RegexTest_826") + << QLatin1String("RegexTest_827") + << QLatin1String("RegexTest_836") + << QLatin1String("RegexTest_837") + << QLatin1String("RegexTest_841") + << QLatin1String("RegexTest_842") + << QLatin1String("RegexTest_843") + << QLatin1String("RegexTest_844") + << QLatin1String("RegexTest_845") + << QLatin1String("RegexTest_846") + << QLatin1String("RegexTest_847") + << QLatin1String("RegexTest_848") + << QLatin1String("RegexTest_851") + << QLatin1String("RegexTest_852") + << QLatin1String("RegexTest_853") + << QLatin1String("RegexTest_854") + << QLatin1String("RegexTest_855") + << QLatin1String("RegexTest_856") + << QLatin1String("RegexTest_857") + << QLatin1String("RegexTest_861") + << QLatin1String("RegexTest_862") + << QLatin1String("RegexTest_863") + << QLatin1String("RegexTest_864") + << QLatin1String("RegexTest_865") + << QLatin1String("RegexTest_866") + << QLatin1String("RegexTest_870") + << QLatin1String("RegexTest_879") + << QLatin1String("RegexTest_880") + << QLatin1String("RegexTest_888") + << QLatin1String("RegexTest_889") + << QLatin1String("RegexTest_890") + << QLatin1String("RegexTest_891") + << QLatin1String("RegexTest_892") + << QLatin1String("RegexTest_893") + << QLatin1String("RegexTest_894") + << QLatin1String("RegexTest_895") + << QLatin1String("RegexTest_896") + << QLatin1String("RegexTest_897") + << QLatin1String("RegexTest_898") + << QLatin1String("RegexTest_899") + << QLatin1String("RegexTest_900") + << QLatin1String("RegexTest_901") + << QLatin1String("RegexTest_902") + << QLatin1String("RegexTest_903") + << QLatin1String("RegexTest_904") + << QLatin1String("RegexTest_905") + << QLatin1String("RegexTest_906") + << QLatin1String("RegexTest_907") + << QLatin1String("RegexTest_908") + << QLatin1String("RegexTest_909") + << QLatin1String("RegexTest_910") + << QLatin1String("RegexTest_911") + << QLatin1String("RegexTest_912") + << QLatin1String("RegexTest_913") + << QLatin1String("RegexTest_914") + << QLatin1String("RegexTest_915") + << QLatin1String("RegexTest_916") + << QLatin1String("RegexTest_917") + << QLatin1String("RegexTest_918") + << QLatin1String("RegexTest_919") + << QLatin1String("RegexTest_920") + << QLatin1String("RegexTest_921") + << QLatin1String("RegexTest_922") + << QLatin1String("RegexTest_923") + << QLatin1String("RegexTest_924") + << QLatin1String("RegexTest_925") + << QLatin1String("RegexTest_926") + << QLatin1String("RegexTest_928") + << QLatin1String("RegexTest_929") + << QLatin1String("RegexTest_930") + << QLatin1String("RegexTest_936") + << QLatin1String("RegexTest_937") + << QLatin1String("RegexTest_938") + << QLatin1String("RegexTest_939") + << QLatin1String("RegexTest_940") + << QLatin1String("RegexTest_941") + << QLatin1String("RegexTest_942") + << QLatin1String("RegexTest_943") + << QLatin1String("RegexTest_944") + << QLatin1String("RegexTest_945") + << QLatin1String("RegexTest_946") + << QLatin1String("RegexTest_949") + << QLatin1String("RegexTest_950") + << QLatin1String("RegexTest_951") + << QLatin1String("RegexTest_952") + << QLatin1String("RegexTest_953") + << QLatin1String("RegexTest_954") + << QLatin1String("RegexTest_955") + << QLatin1String("RegexTest_956") + << QLatin1String("RegexTest_957") + << QLatin1String("RegexTest_958") + << QLatin1String("RegexTest_959") + << QLatin1String("RegexTest_960") + << QLatin1String("RegexTest_961") + << QLatin1String("RegexTest_962") + << QLatin1String("RegexTest_963") + << QLatin1String("RegexTest_964") + << QLatin1String("RegexTest_976") + << QLatin1String("RegexTest_977") + << QLatin1String("RegexTest_988") + << QLatin1String("RegexTest_989") + << QLatin1String("RegexTest_990") + << QLatin1String("RegexTest_991") + << QLatin1String("RegexTest_994") + << QLatin1String("RegexTest_995") + << QLatin1String("RegexTest_996") + << QLatin1String("RegexTest_997") + << QLatin1String("RegexTest_1000") + << QLatin1String("RegexTest_1001") + << QLatin1String("RegexTest_1002") + << QLatin1String("RegexTest_1003") + << QLatin1String("RegexTest_1004") + << QLatin1String("RegexTest_1007") + << QLatin1String("RegexTest_1008") + << QLatin1String("RegexTest_1009") + << QLatin1String("RegexTest_1010") + << QLatin1String("RegexTest_1011") + << QLatin1String("RegexTest_1012") + << QLatin1String("RegexTest_1013") + << QLatin1String("RegexTest_1014") + << QLatin1String("RegexTest_1015") + << QLatin1String("RegexTest_1016") + << QLatin1String("RegexTest_1017") + << QLatin1String("RegexTest_1018") + << QLatin1String("RegexTest_1019") + << QLatin1String("RegexTest_1070") + << QLatin1String("RegexTest_1071") + << QLatin1String("RegexTest_1076") + << QLatin1String("RegexTest_1077") + << QLatin1String("RegexTest_1078") + << QLatin1String("RegexTest_1079") + << QLatin1String("RegexTest_1080") + << QLatin1String("RegexTest_1081") + << QLatin1String("RegexTest_1082") + << QLatin1String("RegexTest_1083") + << QLatin1String("RegexTest_1084") + << QLatin1String("RegexTest_1085") + << QLatin1String("RegexTest_1086") + << QLatin1String("RegexTest_1087") + << QLatin1String("RegexTest_1088") + << QLatin1String("RegexTest_1089") + << QLatin1String("RegexTest_1132") + << QLatin1String("RegexTest_1139") + << QLatin1String("RegexTest_1172") + << QLatin1String("RegexTest_1180") + << QLatin1String("RegexTest_1181") + << QLatin1String("RegexTest_1182") + << QLatin1String("RegexTest_1184") + << QLatin1String("RegexTest_1185") + << QLatin1String("RegexTest_1186") + << QLatin1String("RegexTest_1187") + << QLatin1String("RegexTest_1188") + << QLatin1String("RegexTest_1189") + << QLatin1String("RegexTest_1190") + << QLatin1String("RegexTest_1191") + << QLatin1String("RegexTest_1201") + << QLatin1String("RegexTest_1202") + << QLatin1String("RegexTest_1203") + << QLatin1String("RegexTest_1208") + << QLatin1String("RegexTest_1209") + << QLatin1String("RegexTest_1210") + << QLatin1String("RegexTest_1211") + << QLatin1String("RegexTest_1212") + << QLatin1String("RegexTest_1213") + << QLatin1String("RegexTest_1214") + << QLatin1String("RegexTest_1215") + << QLatin1String("RegexTest_1216") + << QLatin1String("RegexTest_1217") + << QLatin1String("RegexTest_1227") + << QLatin1String("RegexTest_1239") + << QLatin1String("RegexTest_1240") + << QLatin1String("RegexTest_1245") + << QLatin1String("RegexTest_1246") + << QLatin1String("RegexTest_1265") + << QLatin1String("RegexTest_1266") + << QLatin1String("RegexTest_1267") + << QLatin1String("RegexTest_1274") + << QLatin1String("RegexTest_1275") + << QLatin1String("RegexTest_1308") + << QLatin1String("RegexTest_1310") + << QLatin1String("RegexTest_1311") + << QLatin1String("RegexTest_1320") + << QLatin1String("RegexTest_1321") + << QLatin1String("RegexTest_1322") + << QLatin1String("RegexTest_1323") + << QLatin1String("RegexTest_1324") + << QLatin1String("RegexTest_1325") + << QLatin1String("RegexTest_1326") + << QLatin1String("RegexTest_1327") + << QLatin1String("RegexTest_1328") + << QLatin1String("RegexTest_1329") + << QLatin1String("RegexTest_1330") + << QLatin1String("RegexTest_1331") + << QLatin1String("RegexTest_1332") + << QLatin1String("RegexTest_1335") + << QLatin1String("RegexTest_1336") + << QLatin1String("RegexTest_1337") + << QLatin1String("RegexTest_1338") + << QLatin1String("RegexTest_1339") + << QLatin1String("RegexTest_1340") + << QLatin1String("RegexTest_1341") + << QLatin1String("RegexTest_1345") + << QLatin1String("RegexTest_1346") + << QLatin1String("RegexTest_1347") + << QLatin1String("RegexTest_1348") + << QLatin1String("RegexTest_1349") + << QLatin1String("RegexTest_1350") + << QLatin1String("RegexTest_1354") + << QLatin1String("RegexTest_1363") + << QLatin1String("RegexTest_1364") + << QLatin1String("RegexTest_1365") + << QLatin1String("RegexTest_1372") + << QLatin1String("RegexTest_1373") + << QLatin1String("RegexTest_1374") + << QLatin1String("RegexTest_1375") + << QLatin1String("RegexTest_1376") + << QLatin1String("RegexTest_1377") + << QLatin1String("RegexTest_1378") + << QLatin1String("RegexTest_1379") + << QLatin1String("RegexTest_1380") + << QLatin1String("RegexTest_1381") + << QLatin1String("RegexTest_1382") + << QLatin1String("RegexTest_1383") + << QLatin1String("RegexTest_1384") + << QLatin1String("RegexTest_1385") + << QLatin1String("RegexTest_1386") + << QLatin1String("RegexTest_1387") + << QLatin1String("RegexTest_1388") + << QLatin1String("RegexTest_1389") + << QLatin1String("RegexTest_1390") + << QLatin1String("RegexTest_1391") + << QLatin1String("RegexTest_1392") + << QLatin1String("RegexTest_1393") + << QLatin1String("RegexTest_1394") + << QLatin1String("RegexTest_1395") + << QLatin1String("RegexTest_1396") + << QLatin1String("RegexTest_1397") + << QLatin1String("RegexTest_1398") + << QLatin1String("RegexTest_1399") + << QLatin1String("RegexTest_1400") + << QLatin1String("RegexTest_1401") + << QLatin1String("RegexTest_1402") + << QLatin1String("RegexTest_1403") + << QLatin1String("RegexTest_1404") + << QLatin1String("RegexTest_1405") + << QLatin1String("RegexTest_1406") + << QLatin1String("RegexTest_1407") + << QLatin1String("RegexTest_1408") + << QLatin1String("RegexTest_1409") + << QLatin1String("RegexTest_1410") + << QLatin1String("RegexTest_1412") + << QLatin1String("RegexTest_1413") + << QLatin1String("RegexTest_1414") + << QLatin1String("RegexTest_1420") + << QLatin1String("RegexTest_1421") + << QLatin1String("RegexTest_1422") + << QLatin1String("RegexTest_1423") + << QLatin1String("RegexTest_1424") + << QLatin1String("RegexTest_1425") + << QLatin1String("RegexTest_1426") + << QLatin1String("RegexTest_1427") + << QLatin1String("RegexTest_1428") + << QLatin1String("RegexTest_1429") + << QLatin1String("RegexTest_1430") + << QLatin1String("RegexTest_1433") + << QLatin1String("RegexTest_1434") + << QLatin1String("RegexTest_1435") + << QLatin1String("RegexTest_1436") + << QLatin1String("RegexTest_1437") + << QLatin1String("RegexTest_1438") + << QLatin1String("RegexTest_1439") + << QLatin1String("RegexTest_1440") + << QLatin1String("RegexTest_1441") + << QLatin1String("RegexTest_1442") + << QLatin1String("RegexTest_1443") + << QLatin1String("RegexTest_1444") + << QLatin1String("RegexTest_1445") + << QLatin1String("RegexTest_1446") + << QLatin1String("RegexTest_1447") + << QLatin1String("RegexTest_1448") + << QLatin1String("RegexTest_1451") + << QLatin1String("RegexTest_1452") + << QLatin1String("RegexTest_1453") + << QLatin1String("RegexTest_1454") + << QLatin1String("RegexTest_1455") + << QLatin1String("RegexTest_1456") + << QLatin1String("RegexTest_1472") + << QLatin1String("RegexTest_1473") + << QLatin1String("RegexTest_1474") + << QLatin1String("RegexTest_1475") + << QLatin1String("RegexTest_1478") + << QLatin1String("RegexTest_1479") + << QLatin1String("RegexTest_1480") + << QLatin1String("RegexTest_1481") + << QLatin1String("RegexTest_1484") + << QLatin1String("RegexTest_1485") + << QLatin1String("RegexTest_1486") + << QLatin1String("RegexTest_1487") + << QLatin1String("RegexTest_1488") + << QLatin1String("RegexTest_1491") + << QLatin1String("RegexTest_1492") + << QLatin1String("RegexTest_1493") + << QLatin1String("RegexTest_1494") + << QLatin1String("RegexTest_1495") + << QLatin1String("RegexTest_1496") + << QLatin1String("RegexTest_1497") + << QLatin1String("RegexTest_1498") + << QLatin1String("RegexTest_1499") + << QLatin1String("RegexTest_1500") + << QLatin1String("RegexTest_1501") + << QLatin1String("RegexTest_1502") + << QLatin1String("RegexTest_1503") + << QLatin1String("RegexTest_1543") + << QLatin1String("RegexTest_1544") + << QLatin1String("reZ001") +*/ + << QLatin1String("schA2") + << QLatin1String("schA5") + << QLatin1String("schA7") + << QLatin1String("schD8") + << QLatin1String("schG3") + << QLatin1String("schG6") + << QLatin1String("schG9") + << QLatin1String("schG11") + << QLatin1String("schG12") + << QLatin1String("schU1") + << QLatin1String("schU3") + << QLatin1String("schU4") + << QLatin1String("schU5") + << QLatin1String("schZ004") + << QLatin1String("schZ005") + << QLatin1String("schZ012_a") + << QLatin1String("stZ041") + << QLatin1String("wildZ010"); +} + +bool XSDTestSuiteHandler::startElement(const QString &namespaceURI, + const QString &localName, + const QString &/*qName*/, + const QXmlAttributes &atts) +{ + if(namespaceURI != QString::fromLatin1("http://www.w3.org/XML/2004/xml-schema-test-suite/")) + return true; + + if (localName == QLatin1String("testSet")) { + m_currentTestSet = new TestGroup(m_topLevelGroup); + Q_ASSERT(m_currentTestSet); + m_currentTestSet->setTitle(atts.value("name")); + m_topLevelGroup->appendChild(m_currentTestSet); + } else if (localName == QLatin1String("testGroup")) { + m_currentTestGroup = new TestGroup(m_currentTestSet); + Q_ASSERT(m_currentTestGroup); + m_currentTestGroup->setTitle(atts.value("name")); + m_currentTestSet->appendChild(m_currentTestGroup); + m_inTestGroup = true; + } else if (localName == QLatin1String("schemaTest")) { + if (m_blackList.contains(atts.value("name"))) { + m_currentTestCase = 0; + m_schemaBlacklisted = true; + return true; + } + m_schemaBlacklisted = false; + + m_currentTestCase = new XSDTSTestCase(TestCase::Standard, m_currentTestGroup, XSDTSTestCase::SchemaTest); + Q_ASSERT(m_currentTestCase); + m_counter++; + m_currentTestCase->setName(QString::number(m_counter) + atts.value("name")); + m_currentTestGroup->appendChild(m_currentTestCase); + m_currentTestCase->setParent(m_currentTestGroup); + + m_inSchemaTest = true; + } else if (localName == QLatin1String("instanceTest")) { + if (m_schemaBlacklisted) { + m_currentTestCase = 0; + return true; + } + + m_currentTestCase = new XSDTSTestCase(TestCase::Standard, m_currentTestGroup, XSDTSTestCase::InstanceTest); + Q_ASSERT(m_currentTestCase); + m_counter++; + m_currentTestCase->setName(QString::number(m_counter) + atts.value("name")); + m_currentTestGroup->appendChild(m_currentTestCase); + + m_inInstanceTest = true; + } else if (localName == QLatin1String("schemaDocument") || localName == QLatin1String("instanceDocument")) { + if (m_inSchemaTest) { + m_currentTestCase->setSchemaUri(QUrl(atts.value("xlink:href"))); + if (m_currentSchemaLink.isEmpty()) // we only use the first schema document for validation + m_currentSchemaLink = atts.value("xlink:href"); + } + if (m_inInstanceTest) { + m_currentTestCase->setInstanceUri(QUrl(atts.value("xlink:href"))); + m_currentTestCase->setSchemaUri(QUrl(m_currentSchemaLink)); + } + } else if (localName == QLatin1String("expected") && (m_inSchemaTest || m_inInstanceTest)) { + TestBaseLine *baseLine = new TestBaseLine(TestBaseLine::SchemaIsValid); + if (atts.value("validity") == QLatin1String("valid")) { + baseLine->setDetails(QLatin1String("true")); + m_currentTestCase->setName(m_currentTestCase->name() + QLatin1String(" tokoe:valid")); + } else { + baseLine->setDetails(QLatin1String("false")); + m_currentTestCase->setName(m_currentTestCase->name() + QLatin1String(" tokoe:invalid")); + } + + m_currentTestCase->addBaseLine(baseLine); + } else if (localName == QLatin1String("documentation") && m_inTestGroup) { + m_inDescription = true; + } + + return true; +} + +bool XSDTestSuiteHandler::endElement(const QString &namespaceURI, + const QString &localName, + const QString &/*qName*/) +{ + if (localName == QLatin1String("testGroup")) { + m_inTestGroup = false; + m_currentTestGroup->setDescription(m_documentation); + m_documentation.clear(); + m_currentSchemaLink.clear(); + + if (m_currentTestGroup->childCount() == 0) + m_currentTestSet->removeLast(); + } else if (localName == QLatin1String("schemaTest")) + m_inSchemaTest = false; + else if (localName == QLatin1String("instanceTest")) + m_inInstanceTest = false; + else if (localName == QLatin1String("documentation")) + m_inDescription = false; + + return true; +} + +bool XSDTestSuiteHandler::characters(const QString &ch) +{ + if (m_inDescription) + m_documentation += ch; + + return true; +} + +TestSuite *XSDTestSuiteHandler::testSuite() const +{ + return m_ts; +} + +// vim: et:ts=4:sw=4:sts=4 + diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h b/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h new file mode 100644 index 0000000..8c57e82 --- /dev/null +++ b/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Patternist project on Trolltech Labs. +** +** $TROLLTECH_GPL_LICENSE$ +** +*************************************************************************** +*/ + +#ifndef PatternistSDK_XSDTestSuiteHandler_H +#define PatternistSDK_XSDTestSuiteHandler_H + +#include +#include + +#include "ExternalSourceLoader.h" +#include "TestSuite.h" +#include "XQTSTestCase.h" + +QT_BEGIN_HEADER + +namespace QPatternistSDK +{ + class TestBaseLine; + class TestGroup; + class XSDTSTestCase; + + /** + * @short Creates a TestSuite from the XSD Test Suite. + * + * The created TestSuite can be retrieved via testSuite(). + * + * @note XSDTestSuiteHandler assumes the XML is valid by having been validated + * against the W3C XML Schema. It has no safety checks for that the XML format + * is correct but is hard coded for it. Thus, the behavior is undefined if + * the XML is invalid. + * + * @ingroup PatternistSDK + * @author Tobias Koenig + */ + class Q_PATTERNISTSDK_EXPORT XSDTestSuiteHandler : public QXmlDefaultHandler + { + public: + /** + * @param catalogFile the URI for the catalog file being parsed. This + * URI is used for creating absolute URIs for files mentioned in + * the catalog with relative URIs. + * @param useExclusionList whether excludeTestGroups.txt should be used to ignore + * test groups when loading + */ + XSDTestSuiteHandler(const QUrl &catalogFile); + virtual bool characters(const QString &ch); + + virtual bool endElement(const QString &namespaceURI, + const QString &localName, + const QString &qName); + virtual bool startElement(const QString &namespaceURI, + const QString &localName, + const QString &qName, + const QXmlAttributes &atts); + + virtual TestSuite *testSuite() const; + + private: + TestSuite* m_ts; + const QUrl m_catalogFile; + + TestGroup* m_topLevelGroup; + TestGroup* m_currentTestSet; + TestGroup* m_currentTestGroup; + XSDTSTestCase* m_currentTestCase; + bool m_inSchemaTest; + bool m_inInstanceTest; + bool m_inTestGroup; + bool m_inDescription; + bool m_schemaBlacklisted; + QString m_documentation; + QString m_currentSchemaLink; + int m_counter; + QSet m_blackList; + }; +} + +QT_END_HEADER + +#endif +// vim: et:ts=4:sw=4:sts=4 diff --git a/tests/auto/xmlpatternsxqts/lib/lib.pro b/tests/auto/xmlpatternsxqts/lib/lib.pro index 5b12d63..cb9453a 100644 --- a/tests/auto/xmlpatternsxqts/lib/lib.pro +++ b/tests/auto/xmlpatternsxqts/lib/lib.pro @@ -50,6 +50,8 @@ HEADERS = ASTItem.h \ Worker.h \ XMLWriter.h \ XQTSTestCase.h \ + XSDTestSuiteHandler.h \ + XSDTSTestCase.h \ XSLTTestSuiteHandler.h SOURCES = ASTItem.cpp \ @@ -75,4 +77,6 @@ SOURCES = ASTItem.cpp \ Worker.cpp \ XMLWriter.cpp \ XQTSTestCase.cpp \ + XSDTestSuiteHandler.cpp \ + XSDTSTestCase.cpp \ XSLTTestSuiteHandler.cpp diff --git a/tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp index 1f9e396..71abbb9 100644 --- a/tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp +++ b/tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp @@ -55,11 +55,11 @@ using namespace QPatternistSDK; -tst_SuiteTest::tst_SuiteTest(const bool isXSLT, +tst_SuiteTest::tst_SuiteTest(const SuiteType suiteType, const bool alwaysRun) : m_existingBaseline(inputFile(QLatin1String("Baseline.xml"))) , m_candidateBaseline(inputFile(QLatin1String("CandidateBaseline.xml"))) , m_abortRun(!alwaysRun && !QFile::exists(QLatin1String("runTests"))) - , m_isXSLT(isXSLT) + , m_suiteType(suiteType) { } @@ -86,7 +86,16 @@ void tst_SuiteTest::runTestSuite() const QString errMsg; const QFileInfo fi(m_catalogPath); const QUrl catalogPath(QUrl::fromLocalFile(fi.absoluteFilePath())); - TestSuite *const ts = TestSuite::openCatalog(catalogPath, errMsg, true, m_isXSLT); + + TestSuite::SuiteType suiteType; + switch (m_suiteType) { + case XQuerySuite: suiteType = TestSuite::XQuerySuite; + case XsltSuite: suiteType = TestSuite::XsltSuite; + case XsdSuite: suiteType = TestSuite::XsdSuite; + default: break; + } + + TestSuite *const ts = TestSuite::openCatalog(catalogPath, errMsg, true, suiteType); QVERIFY2(ts, qPrintable(QString::fromLatin1("Failed to open the catalog, maybe it doesn't exist or is broken: %1").arg(errMsg))); diff --git a/tests/auto/xmlpatternsxqts/test/tst_suitetest.h b/tests/auto/xmlpatternsxqts/test/tst_suitetest.h index 922f645..05bf6cb 100644 --- a/tests/auto/xmlpatternsxqts/test/tst_suitetest.h +++ b/tests/auto/xmlpatternsxqts/test/tst_suitetest.h @@ -50,13 +50,21 @@ \class tst_SuiteTest \internal \since 4.5 - \brief Base class for tst_XmlPatternsXQTS and tst_XmlPatternsXSLTS. + \brief Base class for tst_XmlPatternsXQTS, tst_XmlPatternsXSLTS and tst_XmlPatternsXSDTS. */ class tst_SuiteTest : public QObject , private TestFundament { Q_OBJECT +public: + enum SuiteType + { + XQuerySuite, + XsltSuite, + XsdSuite + }; + protected: /** * @p isXSLT is @c true if the catalog opened is an @@ -65,7 +73,7 @@ protected: * @p alwaysRun is @c true if the test should always be run, * regardless of if the file runTests exists. */ - tst_SuiteTest(const bool isXSLT, + tst_SuiteTest(SuiteType type, const bool alwaysRun = false); /** @@ -91,7 +99,7 @@ private: const QString m_existingBaseline; const QString m_candidateBaseline; const bool m_abortRun; - const bool m_isXSLT; + const SuiteType m_suiteType; }; #endif diff --git a/tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp b/tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp index 6d9502d..1193372 100644 --- a/tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp +++ b/tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp @@ -61,7 +61,7 @@ public: virtual void catalogPath(QString &write) const; }; -tst_XmlPatternsXQTS::tst_XmlPatternsXQTS() : tst_SuiteTest(false) +tst_XmlPatternsXQTS::tst_XmlPatternsXQTS() : tst_SuiteTest(tst_SuiteTest::XQuerySuite) { } diff --git a/tests/auto/xmlpatternsxslts/tst_xmlpatternsxslts.cpp b/tests/auto/xmlpatternsxslts/tst_xmlpatternsxslts.cpp index 6f1d217..f9b1c76 100644 --- a/tests/auto/xmlpatternsxslts/tst_xmlpatternsxslts.cpp +++ b/tests/auto/xmlpatternsxslts/tst_xmlpatternsxslts.cpp @@ -61,7 +61,7 @@ protected: virtual void catalogPath(QString &write) const; }; -tst_XmlPatternsXSLTS::tst_XmlPatternsXSLTS() : tst_SuiteTest(true) +tst_XmlPatternsXSLTS::tst_XmlPatternsXSLTS() : tst_SuiteTest(tst_SuiteTest::XsltSuite) { } diff --git a/tools/tools.pro b/tools/tools.pro index 0a56cfb..e7f7b03 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -25,7 +25,7 @@ mac { SUBDIRS += kmap2qmap contains(QT_CONFIG, dbus):SUBDIRS += qdbus -!wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns +!wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator embedded: SUBDIRS += makeqpf CONFIG+=ordered diff --git a/tools/xmlpatternsvalidator/main.cpp b/tools/xmlpatternsvalidator/main.cpp new file mode 100644 index 0000000..032afc0 --- /dev/null +++ b/tools/xmlpatternsvalidator/main.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Patternist project on Trolltech Labs. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "main.h" + +#include +#include +#include +#include +#include + +QT_USE_NAMESPACE + +enum ExecutionMode +{ + InvalidMode, + SchemaOnlyMode, + SchemaAndInstanceMode, + InstanceOnlyMode +}; + +int main(int argc, char **argv) +{ + const QCoreApplication app(argc, argv); + QCoreApplication::setApplicationName(QLatin1String("xmlpatternsvalidator")); + + if (argc != 2 && argc != 3) { + qDebug() << QXmlPatternistCLI::tr("usage: xmlpatternsvalidator ( | | )"); + return 2; + } + + // parse command line arguments + ExecutionMode mode = InvalidMode; + + if (argc == 2) { + // either it is a schema or instance document + + QString url = QFile::decodeName(argv[1]); + if (url.toLower().endsWith(QLatin1String(".xsd"))) { + mode = SchemaOnlyMode; + } else { + // as we could validate all types of xml documents, don't check the extension here + mode = InstanceOnlyMode; + } + } else if (argc == 3) { + mode = SchemaAndInstanceMode; + } + + // do validation + QXmlSchema schema; + + if (mode == SchemaOnlyMode) { + const QString schemaUri = QFile::decodeName(argv[1]); + + schema.load(QUrl(schemaUri)); + + if (schema.isValid()) + return 0; + else + return 1; + } else if (mode == SchemaAndInstanceMode) { + const QString instanceUri = QFile::decodeName(argv[1]); + const QString schemaUri = QFile::decodeName(argv[2]); + + schema.load(QUrl(schemaUri)); + + if (!schema.isValid()) + return 1; + + QXmlSchemaValidator validator(schema); + if (validator.validate(QUrl(instanceUri))) + return 0; + else + return 1; + } else if (mode == InstanceOnlyMode) { + const QString instanceUri = QFile::decodeName(argv[1]); + + QXmlSchemaValidator validator(schema); + if (validator.validate(QUrl(instanceUri))) + return 0; + else + return 1; + } + + Q_ASSERT(false); + + return 1; +} diff --git a/tools/xmlpatternsvalidator/main.h b/tools/xmlpatternsvalidator/main.h new file mode 100644 index 0000000..477a45a --- /dev/null +++ b/tools/xmlpatternsvalidator/main.h @@ -0,0 +1,46 @@ +/**************************************************************************** + ** + ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + ** Contact: Qt Software Information (qt-info@nokia.com) + ** + ** This file is part of the Patternist project on Trolltech Labs. * ** + ** $TROLLTECH_DUAL_LICENSE$ + ** + ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + ** + ****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef Patternist_main_h +#define Patternist_main_h + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QXmlPatternistCLI +{ +public: + Q_DECLARE_TR_FUNCTIONS(QXmlPatternistCLI) +private: + inline QXmlPatternistCLI(); + Q_DISABLE_COPY(QXmlPatternistCLI) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/tools/xmlpatternsvalidator/xmlpatternsvalidator.pro b/tools/xmlpatternsvalidator/xmlpatternsvalidator.pro new file mode 100644 index 0000000..dd5bd37 --- /dev/null +++ b/tools/xmlpatternsvalidator/xmlpatternsvalidator.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = xmlpatternsvalidator +DESTDIR = ../../bin +QT -= gui +QT += xmlpatterns + +target.path = $$[QT_INSTALL_BINS] +INSTALLS += target + +# This ensures we get stderr and stdout on Windows. +CONFIG += console + +# This ensures that this is a command-line program on OS X and not a GUI application. +CONFIG -= app_bundle + +SOURCES = main.cpp +HEADERS = main.h + +include(../src/common.pri) -- cgit v0.12 From 456463169c6d00b9938f0d975dbd7f398edea39d Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sat, 16 May 2009 12:30:25 +0200 Subject: Various api, documentation and code cleanups --- src/xmlpatterns/api/qxmlquery.cpp | 6 +- src/xmlpatterns/api/qxmlquery_p.h | 13 -- src/xmlpatterns/api/qxmlschema.cpp | 19 +- src/xmlpatterns/api/qxmlschema.h | 11 +- src/xmlpatterns/api/qxmlschema_p.cpp | 8 +- src/xmlpatterns/api/qxmlschema_p.h | 6 +- src/xmlpatterns/api/qxmlschemavalidator.cpp | 38 +++- src/xmlpatterns/api/qxmlschemavalidator.h | 13 +- src/xmlpatterns/api/qxmlschemavalidator_p.h | 5 +- src/xmlpatterns/schema/qnamespacesupport.cpp | 4 +- src/xmlpatterns/schema/qxsdparticlechecker.cpp | 6 +- src/xmlpatterns/schema/qxsdschemacontext.cpp | 2 +- src/xmlpatterns/schema/qxsdschemacontext_p.h | 4 +- src/xmlpatterns/schema/qxsdschemadebugger_p.h | 2 +- src/xmlpatterns/schema/qxsdschemahelper.cpp | 4 +- src/xmlpatterns/schema/qxsdschemahelper_p.h | 63 +++++-- src/xmlpatterns/schema/qxsdschemaparser.cpp | 46 +++-- src/xmlpatterns/schema/qxsdstatemachine.cpp | 16 +- src/xmlpatterns/schema/qxsdstatemachine_p.h | 6 + .../schema/qxsdvalidatedxmlnodemodel.cpp | 2 +- .../schema/qxsdvalidatedxmlnodemodel_p.h | 10 +- .../schema/qxsdvalidatinginstancereader.cpp | 15 +- .../schema/qxsdvalidatinginstancereader_p.h | 2 +- src/xmlpatterns/utils/qxpathhelper.cpp | 12 ++ src/xmlpatterns/utils/qxpathhelper_p.h | 5 + .../patternistheaders/tst_patternistheaders.cpp | 8 + tests/auto/qxmlschema/tst_qxmlschema.cpp | 195 ++++++++++++++++++--- .../tst_qxmlschemavalidator.cpp | 145 +++++++++++---- tools/xmlpatternsvalidator/main.cpp | 41 +++-- 29 files changed, 521 insertions(+), 186 deletions(-) diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp index 423da3e..1cf0a2e 100644 --- a/src/xmlpatterns/api/qxmlquery.cpp +++ b/src/xmlpatterns/api/qxmlquery.cpp @@ -427,7 +427,7 @@ void QXmlQuery::setQuery(QIODevice *sourceCode, const QUrl &documentURI) return; } - d->queryURI = QXmlQueryPrivate::normalizeQueryURI(documentURI); + d->queryURI = QPatternist::XPathHelper::normalizeQueryURI(documentURI); d->expression(sourceCode); } @@ -475,12 +475,12 @@ void QXmlQuery::setQuery(const QUrl &queryURI, const QUrl &baseURI) { Q_ASSERT_X(queryURI.isValid(), Q_FUNC_INFO, "The passed URI must be valid."); - const QUrl canonicalURI(QXmlQueryPrivate::normalizeQueryURI(queryURI)); + const QUrl canonicalURI(QPatternist::XPathHelper::normalizeQueryURI(queryURI)); Q_ASSERT(canonicalURI.isValid()); Q_ASSERT(!canonicalURI.isRelative()); Q_ASSERT(baseURI.isValid() || baseURI.isEmpty()); - d->queryURI = QXmlQueryPrivate::normalizeQueryURI(baseURI.isEmpty() ? queryURI : baseURI); + d->queryURI = QPatternist::XPathHelper::normalizeQueryURI(baseURI.isEmpty() ? queryURI : baseURI); QPatternist::AutoPtr result; diff --git a/src/xmlpatterns/api/qxmlquery_p.h b/src/xmlpatterns/api/qxmlquery_p.h index 7f58f97..486d885 100644 --- a/src/xmlpatterns/api/qxmlquery_p.h +++ b/src/xmlpatterns/api/qxmlquery_p.h @@ -212,19 +212,6 @@ public: return m_resourceLoader; } - - static inline QUrl normalizeQueryURI(const QUrl &uri) - { - Q_ASSERT_X(uri.isEmpty() || uri.isValid(), Q_FUNC_INFO, - "The URI passed to QXmlQuery::setQuery() must be valid or empty."); - if(uri.isEmpty()) - return QUrl::fromLocalFile(QCoreApplication::applicationFilePath()); - else if(uri.isRelative()) - return QUrl::fromLocalFile(QCoreApplication::applicationFilePath()).resolved(uri); - else - return uri; - } - void setRequiredType(const QPatternist::SequenceType::Ptr &seqType) { Q_ASSERT(seqType); diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index 55b96cd..108212e 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -21,7 +21,7 @@ \brief The QXmlSchema class provides loading and validation of a W3C XML Schema. \reentrant - \since 4.X + \since 4.6 \ingroup xml-tools The QXmlSchema class loads, compiles and validates W3C XML Schema files @@ -31,7 +31,7 @@ /*! Constructs an invalid, empty schema that cannot be used until - setSchema() is called. + load() is called. */ QXmlSchema::QXmlSchema() : d(new QXmlSchemaPrivate(QXmlNamePool())) @@ -59,9 +59,10 @@ QXmlSchema::~QXmlSchema() Sets this QXmlSchema to a schema loaded from the \a source URI. */ -void QXmlSchema::load(const QUrl &source) +bool QXmlSchema::load(const QUrl &source) { d->load(source, QString()); + return d->isValid(); } /*! @@ -78,9 +79,10 @@ void QXmlSchema::load(const QUrl &source) a valid URI, behavior is undefined. \sa isValid() */ -void QXmlSchema::load(QIODevice *source, const QUrl &documentUri) +bool QXmlSchema::load(QIODevice *source, const QUrl &documentUri) { d->load(source, documentUri, QString()); + return d->isValid(); } /*! @@ -94,9 +96,10 @@ void QXmlSchema::load(QIODevice *source, const QUrl &documentUri) If \a documentUri is not a valid URI, behavior is undefined. \sa isValid() */ -void QXmlSchema::load(const QByteArray &data, const QUrl &documentUri) +bool QXmlSchema::load(const QByteArray &data, const QUrl &documentUri) { d->load(data, documentUri, QString()); + return d->isValid(); } /*! @@ -183,14 +186,14 @@ QAbstractMessageHandler *QXmlSchema::messageHandler() const \sa uriResolver() */ -void QXmlSchema::setUriResolver(QAbstractUriResolver *resolver) +void QXmlSchema::setUriResolver(const QAbstractUriResolver *resolver) { d->setUriResolver(resolver); } /*! Returns the schema's URI resolver. If no URI resolver has been set, - QtXmlPatterns will use the URIs in queries as they are. + QtXmlPatterns will use the URIs in schemas as they are. The URI resolver provides a level of abstraction, or \e{polymorphic URIs}. A resolver can rewrite \e{logical} URIs to physical ones, or @@ -202,7 +205,7 @@ void QXmlSchema::setUriResolver(QAbstractUriResolver *resolver) \sa setUriResolver() */ -QAbstractUriResolver *QXmlSchema::uriResolver() const +const QAbstractUriResolver *QXmlSchema::uriResolver() const { return d->uriResolver(); } diff --git a/src/xmlpatterns/api/qxmlschema.h b/src/xmlpatterns/api/qxmlschema.h index 225cce2..cf56b1e 100644 --- a/src/xmlpatterns/api/qxmlschema.h +++ b/src/xmlpatterns/api/qxmlschema.h @@ -13,6 +13,7 @@ #define QXMLSCHEMA_H #include +#include #include QT_BEGIN_HEADER @@ -37,9 +38,9 @@ class Q_XMLPATTERNS_EXPORT QXmlSchema QXmlSchema(const QXmlSchema &other); ~QXmlSchema(); - void load(const QUrl &source); - void load(QIODevice *source, const QUrl &documentUri); - void load(const QByteArray &data, const QUrl &documentUri); + bool load(const QUrl &source); + bool load(QIODevice *source, const QUrl &documentUri = QUrl()); + bool load(const QByteArray &data, const QUrl &documentUri = QUrl()); bool isValid() const; @@ -49,8 +50,8 @@ class Q_XMLPATTERNS_EXPORT QXmlSchema void setMessageHandler(QAbstractMessageHandler *handler); QAbstractMessageHandler *messageHandler() const; - void setUriResolver(QAbstractUriResolver *resolver); - QAbstractUriResolver *uriResolver() const; + void setUriResolver(const QAbstractUriResolver *resolver); + const QAbstractUriResolver *uriResolver() const; void setNetworkAccessManager(QNetworkAccessManager *networkmanager); QNetworkAccessManager *networkAccessManager() const; diff --git a/src/xmlpatterns/api/qxmlschema_p.cpp b/src/xmlpatterns/api/qxmlschema_p.cpp index ebcccee..21dc04a 100644 --- a/src/xmlpatterns/api/qxmlschema_p.cpp +++ b/src/xmlpatterns/api/qxmlschema_p.cpp @@ -61,7 +61,7 @@ QXmlSchemaPrivate::QXmlSchemaPrivate(const QXmlSchemaPrivate &other) void QXmlSchemaPrivate::load(const QUrl &source, const QString &targetNamespace) { - m_documentUri = source; + m_documentUri = QPatternist::XPathHelper::normalizeQueryURI(source); m_schemaContext->setMessageHandler(messageHandler()); m_schemaContext->setUriResolver(uriResolver()); @@ -98,7 +98,7 @@ void QXmlSchemaPrivate::load(QIODevice *source, const QUrl &documentUri, const Q return; } - m_documentUri = documentUri; + m_documentUri = QPatternist::XPathHelper::normalizeQueryURI(documentUri); m_schemaContext->setMessageHandler(messageHandler()); m_schemaContext->setUriResolver(uriResolver()); m_schemaContext->setNetworkAccessManager(networkAccessManager()); @@ -145,12 +145,12 @@ QAbstractMessageHandler *QXmlSchemaPrivate::messageHandler() const return m_messageHandler.data()->value; } -void QXmlSchemaPrivate::setUriResolver(QAbstractUriResolver *resolver) +void QXmlSchemaPrivate::setUriResolver(const QAbstractUriResolver *resolver) { m_uriResolver = resolver; } -QAbstractUriResolver *QXmlSchemaPrivate::uriResolver() const +const QAbstractUriResolver *QXmlSchemaPrivate::uriResolver() const { return m_uriResolver; } diff --git a/src/xmlpatterns/api/qxmlschema_p.h b/src/xmlpatterns/api/qxmlschema_p.h index e625f1e..efba256 100644 --- a/src/xmlpatterns/api/qxmlschema_p.h +++ b/src/xmlpatterns/api/qxmlschema_p.h @@ -54,14 +54,14 @@ class QXmlSchemaPrivate : public QSharedData QUrl documentUri() const; void setMessageHandler(QAbstractMessageHandler *handler); QAbstractMessageHandler *messageHandler() const; - void setUriResolver(QAbstractUriResolver *resolver); - QAbstractUriResolver *uriResolver() const; + void setUriResolver(const QAbstractUriResolver *resolver); + const QAbstractUriResolver *uriResolver() const; void setNetworkAccessManager(QNetworkAccessManager *networkmanager); QNetworkAccessManager *networkAccessManager() const; QXmlNamePool m_namePool; QAbstractMessageHandler* m_userMessageHandler; - QAbstractUriResolver* m_uriResolver; + const QAbstractUriResolver* m_uriResolver; QNetworkAccessManager* m_userNetworkAccessManager; QPatternist::ReferenceCountedValue::Ptr m_messageHandler; QPatternist::ReferenceCountedValue::Ptr m_networkAccessManager; diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index aa80537..fcde49c 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -27,7 +27,7 @@ \brief The QXmlSchemaValidator class validates XML instance documents against a W3C XML Schema. \reentrant - \since 4.X + \since 4.6 \ingroup xml-tools The QXmlSchemaValidator class loads, parses an XML instance document and validates it @@ -35,6 +35,16 @@ */ /*! + Constructs a schema validator. + The schema used for validation must be referenced in the XML instance document + via the xsi:schemaLocation attribute. + */ +QXmlSchemaValidator::QXmlSchemaValidator() + : d(new QXmlSchemaValidatorPrivate(QXmlSchema())) +{ +} + +/*! Constructs a schema validator that will use \a schema for validation. */ QXmlSchemaValidator::QXmlSchemaValidator(const QXmlSchema &schema) @@ -65,7 +75,7 @@ void QXmlSchemaValidator::setSchema(const QXmlSchema &schema) Returns \c true if the XML instance document is valid according the schema, \c false otherwise. */ -bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentUri) +bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentUri) const { QByteArray localData(data); @@ -81,7 +91,7 @@ bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentU Returns \c true if the XML instance document is valid according the schema, \c false otherwise. */ -bool QXmlSchemaValidator::validate(const QUrl &source) +bool QXmlSchemaValidator::validate(const QUrl &source) const { d->m_context->setMessageHandler(messageHandler()); d->m_context->setUriResolver(uriResolver()); @@ -102,7 +112,7 @@ bool QXmlSchemaValidator::validate(const QUrl &source) Returns \c true if the XML instance document is valid according the schema, \c false otherwise. */ -bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) +bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) const { if (!source) { qWarning("A null QIODevice pointer cannot be passed."); @@ -114,6 +124,8 @@ bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) return false; } + const QUrl normalizedUri = QPatternist::XPathHelper::normalizeQueryURI(documentUri); + d->m_context->setMessageHandler(messageHandler()); d->m_context->setUriResolver(uriResolver()); d->m_context->setNetworkAccessManager(networkAccessManager()); @@ -125,7 +137,7 @@ bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) QPatternist::Item item; try { - item = loader.openDocument(source, documentUri, d->m_context); + item = loader.openDocument(source, normalizedUri, d->m_context); } catch (QPatternist::Exception exception) { return false; } @@ -135,7 +147,7 @@ bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) QPatternist::XsdValidatedXmlNodeModel *validatedModel = new QPatternist::XsdValidatedXmlNodeModel(model); - QPatternist::XsdValidatingInstanceReader reader(validatedModel, documentUri, d->m_context); + QPatternist::XsdValidatingInstanceReader reader(validatedModel, normalizedUri, d->m_context); if (d->m_schema) reader.addSchema(d->m_schema, d->m_schemaDocumentUri); try { @@ -158,6 +170,14 @@ QXmlNamePool QXmlSchemaValidator::namePool() const } /*! + Returns the schema that is used for validation. + */ +QXmlSchema QXmlSchemaValidator::schema() const +{ + return d->m_originalSchema; +} + +/*! Changes the \l {QAbstractMessageHandler}{message handler} for this QXmlSchemaValidator to \a handler. The schema validator sends all parsing and validation messages to this message handler. QXmlSchemaValidator does not take @@ -215,14 +235,14 @@ QAbstractMessageHandler *QXmlSchemaValidator::messageHandler() const \sa uriResolver() */ -void QXmlSchemaValidator::setUriResolver(QAbstractUriResolver *resolver) +void QXmlSchemaValidator::setUriResolver(const QAbstractUriResolver *resolver) { d->m_uriResolver = resolver; } /*! Returns the schema's URI resolver. If no URI resolver has been set, - QtXmlPatterns will use the URIs in queries as they are. + QtXmlPatterns will use the URIs in instance documents as they are. The URI resolver provides a level of abstraction, or \e{polymorphic URIs}. A resolver can rewrite \e{logical} URIs to physical ones, or @@ -234,7 +254,7 @@ void QXmlSchemaValidator::setUriResolver(QAbstractUriResolver *resolver) \sa setUriResolver() */ -QAbstractUriResolver *QXmlSchemaValidator::uriResolver() const +const QAbstractUriResolver *QXmlSchemaValidator::uriResolver() const { return d->m_uriResolver; } diff --git a/src/xmlpatterns/api/qxmlschemavalidator.h b/src/xmlpatterns/api/qxmlschemavalidator.h index e643995..c82c522 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.h +++ b/src/xmlpatterns/api/qxmlschemavalidator.h @@ -12,6 +12,7 @@ #ifndef QXMLSCHEMAVALIDATOR_H #define QXMLSCHEMAVALIDATOR_H +#include #include QT_BEGIN_HEADER @@ -31,22 +32,24 @@ class QXmlSchemaValidatorPrivate; class Q_XMLPATTERNS_EXPORT QXmlSchemaValidator { public: + QXmlSchemaValidator(); QXmlSchemaValidator(const QXmlSchema &schema); ~QXmlSchemaValidator(); void setSchema(const QXmlSchema &schema); - bool validate(const QUrl &source); - bool validate(QIODevice *source, const QUrl &documentUri); - bool validate(const QByteArray &data, const QUrl &documentUri); + bool validate(const QUrl &source) const; + bool validate(QIODevice *source, const QUrl &documentUri = QUrl()) const; + bool validate(const QByteArray &data, const QUrl &documentUri = QUrl()) const; QXmlNamePool namePool() const; + QXmlSchema schema() const; void setMessageHandler(QAbstractMessageHandler *handler); QAbstractMessageHandler *messageHandler() const; - void setUriResolver(QAbstractUriResolver *resolver); - QAbstractUriResolver *uriResolver() const; + void setUriResolver(const QAbstractUriResolver *resolver); + const QAbstractUriResolver *uriResolver() const; void setNetworkAccessManager(QNetworkAccessManager *networkmanager); QNetworkAccessManager *networkAccessManager() const; diff --git a/src/xmlpatterns/api/qxmlschemavalidator_p.h b/src/xmlpatterns/api/qxmlschemavalidator_p.h index 0990f73..9910f6e 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator_p.h +++ b/src/xmlpatterns/api/qxmlschemavalidator_p.h @@ -77,15 +77,18 @@ public: m_context = QPatternist::XsdSchemaContext::Ptr(new QPatternist::XsdSchemaContext(m_namePool.d)); m_context->m_schemaTypeFactory = schema.d->m_schemaContext->m_schemaTypeFactory; m_context->m_builtinTypesFacetList = schema.d->m_schemaContext->m_builtinTypesFacetList; + + m_originalSchema = schema; } QXmlNamePool m_namePool; QAbstractMessageHandler* m_userMessageHandler; - QAbstractUriResolver* m_uriResolver; + const QAbstractUriResolver* m_uriResolver; QNetworkAccessManager* m_userNetworkAccessManager; QPatternist::ReferenceCountedValue::Ptr m_messageHandler; QPatternist::ReferenceCountedValue::Ptr m_networkAccessManager; + QXmlSchema m_originalSchema; QPatternist::XsdSchemaContext::Ptr m_context; QPatternist::XsdSchema::Ptr m_schema; QUrl m_schemaDocumentUri; diff --git a/src/xmlpatterns/schema/qnamespacesupport.cpp b/src/xmlpatterns/schema/qnamespacesupport.cpp index 00698d6..349f451 100644 --- a/src/xmlpatterns/schema/qnamespacesupport.cpp +++ b/src/xmlpatterns/schema/qnamespacesupport.cpp @@ -33,9 +33,7 @@ NamespaceSupport::NamespaceSupport(const NamePool::Ptr &namePool) : m_namePool(namePool) { // the XML namespace - const QXmlName binding = namePool->allocateBinding(QLatin1String("xml"), - QLatin1String("http://www.w3.org/XML/1998/namespace")); - m_ns.insert(binding.prefix(), binding.namespaceURI()); + m_ns.insert(StandardPrefixes::xml, StandardNamespaces::xml); } void NamespaceSupport::setPrefix(const QXmlName::PrefixCode prefixCode, const QXmlName::NamespaceCode namespaceCode) diff --git a/src/xmlpatterns/schema/qxsdparticlechecker.cpp b/src/xmlpatterns/schema/qxsdparticlechecker.cpp index 1bdef00..7a09f8a 100644 --- a/src/xmlpatterns/schema/qxsdparticlechecker.cpp +++ b/src/xmlpatterns/schema/qxsdparticlechecker.cpp @@ -180,9 +180,9 @@ static bool derivedTermValid(const XsdTerm::Ptr &baseTerm, const XsdTerm::Ptr &d // check that the constraints of the derived element are more strict then the constraints of the base element const XsdElement::BlockingConstraints baseConstraints = element->disallowedSubstitutions(); const XsdElement::BlockingConstraints derivedConstraints = derivedElement->disallowedSubstitutions(); - if ((baseConstraints & XsdElement::RestrictionConstraint) && !(derivedConstraints & XsdElement::RestrictionConstraint) || - (baseConstraints & XsdElement::ExtensionConstraint) && !(derivedConstraints & XsdElement::ExtensionConstraint) || - (baseConstraints & XsdElement::SubstitutionConstraint) && !(derivedConstraints & XsdElement::SubstitutionConstraint)) { + if (((baseConstraints & XsdElement::RestrictionConstraint) && !(derivedConstraints & XsdElement::RestrictionConstraint)) || + ((baseConstraints & XsdElement::ExtensionConstraint) && !(derivedConstraints & XsdElement::ExtensionConstraint)) || + ((baseConstraints & XsdElement::SubstitutionConstraint) && !(derivedConstraints & XsdElement::SubstitutionConstraint))) { errorMsg = QtXmlPatterns::tr("block constraints of derived element %1 must not be more weaker than in the base element").arg(formatKeyword(derivedElement->displayName(namePool))); return false; } diff --git a/src/xmlpatterns/schema/qxsdschemacontext.cpp b/src/xmlpatterns/schema/qxsdschemacontext.cpp index 57736bd..65b2e52 100644 --- a/src/xmlpatterns/schema/qxsdschemacontext.cpp +++ b/src/xmlpatterns/schema/qxsdschemacontext.cpp @@ -67,7 +67,7 @@ QSourceLocation XsdSchemaContext::locationFor(const SourceLocationReflection *co return QSourceLocation(); } -void XsdSchemaContext::setUriResolver(QAbstractUriResolver *uriResolver) +void XsdSchemaContext::setUriResolver(const QAbstractUriResolver *uriResolver) { m_uriResolver = uriResolver; } diff --git a/src/xmlpatterns/schema/qxsdschemacontext_p.h b/src/xmlpatterns/schema/qxsdschemacontext_p.h index cf52028..c3a9f15 100644 --- a/src/xmlpatterns/schema/qxsdschemacontext_p.h +++ b/src/xmlpatterns/schema/qxsdschemacontext_p.h @@ -115,7 +115,7 @@ namespace QPatternist * Sets the uri @p resolver that is used for resolving URIs in the * schema parser. */ - void setUriResolver(QAbstractUriResolver *resolver); + void setUriResolver(const QAbstractUriResolver *resolver); /** * Returns the uri resolver that is used for resolving URIs in the @@ -145,7 +145,7 @@ namespace QPatternist NamePool::Ptr m_namePool; QNetworkAccessManager* m_networkAccessManager; QUrl m_baseURI; - QAbstractUriResolver* m_uriResolver; + const QAbstractUriResolver* m_uriResolver; QAbstractMessageHandler* m_messageHandler; }; } diff --git a/src/xmlpatterns/schema/qxsdschemadebugger_p.h b/src/xmlpatterns/schema/qxsdschemadebugger_p.h index 8c12f0f..8966963 100644 --- a/src/xmlpatterns/schema/qxsdschemadebugger_p.h +++ b/src/xmlpatterns/schema/qxsdschemadebugger_p.h @@ -85,7 +85,7 @@ namespace QPatternist void dumpSchema(const XsdSchema::Ptr &schema); private: - NamePool::Ptr m_namePool; + const NamePool::Ptr m_namePool; }; } diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp index 752af89..ff169f7 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper.cpp +++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp @@ -409,7 +409,7 @@ bool XsdSchemaHelper::isValidlySubstitutable(const SchemaType::Ptr &type, const return false; } -bool XsdSchemaHelper::isSimpleDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints) +bool XsdSchemaHelper::isSimpleDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr &baseType, const SchemaType::DerivationConstraints &constraints) { // @see http://www.w3.org/TR/xmlschema11-1/#cos-st-derived-ok @@ -453,7 +453,7 @@ bool XsdSchemaHelper::isSimpleDerivationOk(const SchemaType::Ptr &derivedType, c return false; } -bool XsdSchemaHelper::isComplexDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints) +bool XsdSchemaHelper::isComplexDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr &baseType, const SchemaType::DerivationConstraints &constraints) { if (!derivedType) return false; diff --git a/src/xmlpatterns/schema/qxsdschemahelper_p.h b/src/xmlpatterns/schema/qxsdschemahelper_p.h index 1722b4c..918664e 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper_p.h +++ b/src/xmlpatterns/schema/qxsdschemahelper_p.h @@ -55,12 +55,15 @@ namespace QPatternist /** * Checks whether the given @p nameSpace is allowed by the given namespace @p constraint. */ - static bool wildcardAllowsNamespaceName(const QString &nameSpace, const XsdWildcard::NamespaceConstraint::Ptr &constraint); + static bool wildcardAllowsNamespaceName(const QString &nameSpace, + const XsdWildcard::NamespaceConstraint::Ptr &constraint); /** * Checks whether the given @p name is allowed by the namespace constraint of the given @p wildcard. */ - static bool wildcardAllowsExpandedName(const QXmlName &name, const XsdWildcard::Ptr &wildcard, const NamePool::Ptr &namePool); + static bool wildcardAllowsExpandedName(const QXmlName &name, + const XsdWildcard::Ptr &wildcard, + const NamePool::Ptr &namePool); /** * Checks whether the @p wildcard is a subset of @p otherWildcard. @@ -75,25 +78,32 @@ namespace QPatternist /** * Returns the intersection of the given @p wildcard and @p otherWildcard. */ - static XsdWildcard::Ptr wildcardIntersection(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard); + static XsdWildcard::Ptr wildcardIntersection(const XsdWildcard::Ptr &wildcard, + const XsdWildcard::Ptr &otherWildcard); /** * Returns whether the given @p type is validly substitutable for an @p otherType * under the given @p constraints. */ - static bool isValidlySubstitutable(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, const SchemaType::DerivationConstraints &constraints); + static bool isValidlySubstitutable(const SchemaType::Ptr &type, + const SchemaType::Ptr &otherType, + const SchemaType::DerivationConstraints &constraints); /** * Returns whether the simple @p derivedType can be derived from the simple @p baseType * under the given @p constraints. */ - static bool isSimpleDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints); + static bool isSimpleDerivationOk(const SchemaType::Ptr &derivedType, + const SchemaType::Ptr &baseType, + const SchemaType::DerivationConstraints &constraints); /** * Returns whether the complex @p derivedType can be derived from the complex @p baseType * under the given @p constraints. */ - static bool isComplexDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr baseType, const SchemaType::DerivationConstraints &constraints); + static bool isComplexDerivationOk(const SchemaType::Ptr &derivedType, + const SchemaType::Ptr &baseType, + const SchemaType::DerivationConstraints &constraints); /** * This method takes the two string based operands @p operand1 and @p operand2 and converts them to instances of type @p type. @@ -111,41 +121,62 @@ namespace QPatternist * Returns whether the process content property of the @p derivedWildcard is valid * according to the process content property of its @p baseWildcard. */ - static bool checkWildcardProcessContents(const XsdWildcard::Ptr &baseWildcard, const XsdWildcard::Ptr &derivedWildcard); + static bool checkWildcardProcessContents(const XsdWildcard::Ptr &baseWildcard, + const XsdWildcard::Ptr &derivedWildcard); /** * Checks whether @[ member is a member of the substitution group with the given @p head. */ - static bool foundSubstitutionGroupTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, QSet &visitedElements); + static bool foundSubstitutionGroupTransitive(const XsdElement::Ptr &head, + const XsdElement::Ptr &member, + QSet &visitedElements); /** * A helper method that iterates over the type hierarchy from @p memberType up to @p headType and collects all * @p derivationSet and @p blockSet constraints that exists on the way there. */ - static void foundSubstitutionGroupTypeInheritance(const SchemaType::Ptr &headType, const SchemaType::Ptr &memberType, - QSet &derivationSet, NamedSchemaComponent::BlockingConstraints &blockSet); + static void foundSubstitutionGroupTypeInheritance(const SchemaType::Ptr &headType, + const SchemaType::Ptr &memberType, + QSet &derivationSet, + NamedSchemaComponent::BlockingConstraints &blockSet); /** * Checks if the @p member is transitive to @p head. */ - static bool substitutionGroupOkTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, const NamePool::Ptr &namePool); + static bool substitutionGroupOkTransitive(const XsdElement::Ptr &head, + const XsdElement::Ptr &member, + const NamePool::Ptr &namePool); /** * Checks if @p derivedAttributeGroup is a valid restriction for @p attributeGroup. */ - static bool isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup, const XsdAttributeGroup::Ptr &attributeGroup, const XsdSchemaContext::Ptr &context, QString &errorMsg); + static bool isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup, + const XsdAttributeGroup::Ptr &attributeGroup, + const XsdSchemaContext::Ptr &context, + QString &errorMsg); /** * Checks if @p derivedAttributeUses are a valid restriction for @p attributeUses. */ - static bool isValidAttributeUsesRestriction(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses, - const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg); + static bool isValidAttributeUsesRestriction(const XsdAttributeUse::List &derivedAttributeUses, + const XsdAttributeUse::List &attributeUses, + const XsdWildcard::Ptr &derivedWildcard, + const XsdWildcard::Ptr &wildcard, + const XsdSchemaContext::Ptr &context, + QString &errorMsg); /** * Checks if @p derivedAttributeUses are a valid extension for @p attributeUses. */ - static bool isValidAttributeUsesExtension(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses, - const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg); + static bool isValidAttributeUsesExtension(const XsdAttributeUse::List &derivedAttributeUses, + const XsdAttributeUse::List &attributeUses, + const XsdWildcard::Ptr &derivedWildcard, + const XsdWildcard::Ptr &wildcard, + const XsdSchemaContext::Ptr &context, + QString &errorMsg); + + private: + Q_DISABLE_COPY(XsdSchemaHelper) }; } diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 9f1e75d..cabc12e 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -5,6 +5,7 @@ #include "qacceltreeresourceloader_p.h" #include "qautoptr_p.h" #include "qboolean_p.h" +#include "qcommonnamespaces_p.h" #include "qderivedinteger_p.h" #include "qderivedstring_p.h" #include "qqnamevalue_p.h" @@ -119,12 +120,28 @@ class TagValidationHandler void validate(XsdSchemaToken::NodeName token) { if (token == XsdSchemaToken::NoKeyword) { - m_parser->error(QtXmlPatterns::tr("can not process unknown element %1").arg(formatElement(m_parser->name().toString()))); + const QList tokens = m_machine.possibleTransitions(); + + QStringList elementNames; + for (int i = 0; i < tokens.count(); ++i) + elementNames.append(formatElement(XsdSchemaToken::toString(tokens.at(i)))); + + m_parser->error(QtXmlPatterns::tr("can not process unknown element %1, expected elements are: %2") + .arg(formatElement(m_parser->name().toString())) + .arg(elementNames.join(QLatin1String(", ")))); return; } if (!m_machine.proceed(token)) { - m_parser->error(QtXmlPatterns::tr("element %1 is not allowed in this scope").arg(formatElement(XsdSchemaToken::toString(token)))); + const QList tokens = m_machine.possibleTransitions(); + + QStringList elementNames; + for (int i = 0; i < tokens.count(); ++i) + elementNames.append(formatElement(XsdSchemaToken::toString(tokens.at(i)))); + + m_parser->error(QtXmlPatterns::tr("element %1 is not allowed in this scope, possible elements are: %2") + .arg(formatElement(XsdSchemaToken::toString(token))) + .arg(elementNames.join(QLatin1String(", ")))); return; } } @@ -132,7 +149,14 @@ class TagValidationHandler void finalize() const { if (!m_machine.inEndState()) { - m_parser->error(QtXmlPatterns::tr("child element is missing in that scope")); + const QList tokens = m_machine.possibleTransitions(); + + QStringList elementNames; + for (int i = 0; i < tokens.count(); ++i) + elementNames.append(formatElement(XsdSchemaToken::toString(tokens.at(i)))); + + m_parser->error(QtXmlPatterns::tr("child element is missing in that scope, possible child elements are: %1") + .arg(elementNames.join(QLatin1String(", ")))); } } @@ -425,8 +449,8 @@ void XsdSchemaParser::parseSchema(ParserType parserType) const QString version = readAttribute(QString::fromLatin1("version")); } - if (hasAttribute(QString::fromLatin1("http://www.w3.org/XML/1998/namespace"), QString::fromLatin1("lang"))) { - const QString value = readAttribute(QString::fromLatin1("lang"), QString::fromLatin1("http://www.w3.org/XML/1998/namespace")); + if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) { + const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML); const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); if (!exp.exactMatch(value)) { @@ -750,7 +774,7 @@ void XsdSchemaParser::parseRedefine() if (url.isRelative()) { Q_ASSERT(m_documentURI.isValid()); - url = m_documentURI.resolved(url); + url = m_documentURI.resolved(url); } // we parse the schema given in the redefine tag into its own context @@ -1176,8 +1200,8 @@ XsdDocumentation::Ptr XsdSchemaParser::parseDocumentation() } } - if (hasAttribute(QString::fromLatin1("http://www.w3.org/XML/1998/namespace"), QString::fromLatin1("lang"))) { - const QString value = readAttribute(QString::fromLatin1("lang"), QString::fromLatin1("http://www.w3.org/XML/1998/namespace")); + if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) { + const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML); const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); if (!exp.exactMatch(value)) { @@ -3948,7 +3972,7 @@ XsdAttribute::Ptr XsdSchemaParser::parseGlobalAttribute() error(QtXmlPatterns::tr("content of %1 attribute of %2 element must not be from namespace %3") .arg(formatAttribute("name")) .arg(formatElement("attribute")) - .arg(formatURI(QLatin1String("http://www.w3.org/2001/XMLSchema-instance")))); + .arg(formatURI(CommonNamespaces::XSI))); return attribute; } if (m_namePool->stringForLocalName(objectName.localName()) == QString::fromLatin1("xmlns")) { @@ -4170,7 +4194,7 @@ XsdAttributeUse::Ptr XsdSchemaParser::parseLocalAttribute(const NamedSchemaCompo error(QtXmlPatterns::tr("content of %1 attribute of %2 element must not be from namespace %3") .arg(formatAttribute("name")) .arg(formatElement("attribute")) - .arg(formatURI(QLatin1String("http://www.w3.org/2001/XMLSchema-instance")))); + .arg(formatURI(CommonNamespaces::XSI))); return attributeUse; } if (m_namePool->stringForLocalName(objectName.localName()) == QString::fromLatin1("xmlns")) { @@ -5858,7 +5882,7 @@ QString XsdSchemaParser::readXPathAttribute(const QString &attributeName, XPathT QXmlNamePool namePool(m_namePool.data()); - QXmlQuery::QueryLanguage language; + QXmlQuery::QueryLanguage language = QXmlQuery::XPath20; switch (type) { case XPath20: language = QXmlQuery::XPath20; break; case XPathSelector: language = QXmlQuery::XmlSchema11IdentityConstraintSelector; break; diff --git a/src/xmlpatterns/schema/qxsdstatemachine.cpp b/src/xmlpatterns/schema/qxsdstatemachine.cpp index e40e55b..4f36f22 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachine.cpp @@ -114,6 +114,20 @@ bool XsdStateMachine::proceed(TransitionType transition) } template +QList XsdStateMachine::possibleTransitions() const +{ + // check that we are not in an invalid state + if (!m_transitions.contains(m_currentState)) { + return QList(); + } + + // fetch the transition entry for the current state + const QHash > &entry = m_transitions[m_currentState]; + + return entry.keys(); +} + +template template bool XsdStateMachine::proceed(InputType input) { @@ -259,7 +273,7 @@ typename XsdStateMachine::StateId XsdStateMachine it(nfaState); diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h index 7988335..f0cf99d 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h @@ -113,6 +113,12 @@ namespace QPatternist bool proceed(TransitionType transition); /** + * Returns the list of transitions that are reachable from the current + * state. + */ + QList possibleTransitions() const; + + /** * Continues execution of the machine with the given @p input. * * @note To use this method, inputEqualsTransition must be implemented diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp index 8e1645a..33bca4e 100644 --- a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp @@ -20,7 +20,7 @@ QT_BEGIN_NAMESPACE using namespace QPatternist; XsdValidatedXmlNodeModel::XsdValidatedXmlNodeModel(const QAbstractXmlNodeModel *model) - : m_internalModel(const_cast(model)) + : m_internalModel(model) { } diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h index 579f41a..d52e369 100644 --- a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h @@ -134,11 +134,11 @@ namespace QPatternist virtual QVector attributes(const QXmlNodeModelIndex &element) const; private: - QAbstractXmlNodeModel::Ptr m_internalModel; - QHash m_assignedElements; - QHash m_assignedAttributes; - QHash m_assignedTypes; - QHash > m_idIdRefBindings; + QExplicitlySharedDataPointer m_internalModel; + QHash m_assignedElements; + QHash m_assignedAttributes; + QHash m_assignedTypes; + QHash > m_idIdRefBindings; }; } diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp index 12fc477..8cb34d4 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp @@ -15,6 +15,7 @@ #include "qacceltreeresourceloader_p.h" #include "qbase64binary_p.h" #include "qboolean_p.h" +#include "qcommonnamespaces_p.h" #include "qderivedinteger_p.h" #include "qduration_p.h" #include "qgenericstaticcontext_p.h" @@ -64,14 +65,14 @@ namespace QPatternist } } -XsdValidatingInstanceReader::XsdValidatingInstanceReader(const XsdValidatedXmlNodeModel *model, const QUrl &documentUri, const XsdSchemaContext::Ptr &context) +XsdValidatingInstanceReader::XsdValidatingInstanceReader(XsdValidatedXmlNodeModel *model, const QUrl &documentUri, const XsdSchemaContext::Ptr &context) : XsdInstanceReader(model, context) - , m_model(const_cast(model)) + , m_model(model) , m_namePool(m_context->namePool()) - , m_xsiNilName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("nil"))) - , m_xsiTypeName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("type"))) - , m_xsiSchemaLocationName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("schemaLocation"))) - , m_xsiNoNamespaceSchemaLocationName(m_namePool->allocateQName(QLatin1String("http://www.w3.org/2001/XMLSchema-instance"), QLatin1String("noNamespaceSchemaLocation"))) + , m_xsiNilName(m_namePool->allocateQName(CommonNamespaces::XSI, QLatin1String("nil"))) + , m_xsiTypeName(m_namePool->allocateQName(CommonNamespaces::XSI, QLatin1String("type"))) + , m_xsiSchemaLocationName(m_namePool->allocateQName(CommonNamespaces::XSI, QLatin1String("schemaLocation"))) + , m_xsiNoNamespaceSchemaLocationName(m_namePool->allocateQName(CommonNamespaces::XSI, QLatin1String("noNamespaceSchemaLocation"))) , m_documentUri(documentUri) { m_idRefsType = m_context->schemaTypeFactory()->createSchemaType(m_namePool->allocateQName(CommonNamespaces::WXS, QLatin1String("IDREFS"))); @@ -152,7 +153,7 @@ bool XsdValidatingInstanceReader::read() void XsdValidatingInstanceReader::error(const QString &msg) const { - const_cast(m_context.data())->error(msg, XsdSchemaContext::XSDError, sourceLocation()); + m_context.data()->error(msg, XsdSchemaContext::XSDError, sourceLocation()); } bool XsdValidatingInstanceReader::loadSchema(const QString &targetNamespace, const QUrl &location) diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h index 799ab44..28f3c3f 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h @@ -59,7 +59,7 @@ namespace QPatternist * @param documentUri The uri of the document the model is from. * @param context The context that is used to report errors etc. */ - XsdValidatingInstanceReader(const XsdValidatedXmlNodeModel *model, const QUrl &documentUri, const XsdSchemaContext::Ptr &context); + XsdValidatingInstanceReader(XsdValidatedXmlNodeModel *model, const QUrl &documentUri, const XsdSchemaContext::Ptr &context); /** * Adds a new @p schema to the pool of schemas that shall be used diff --git a/src/xmlpatterns/utils/qxpathhelper.cpp b/src/xmlpatterns/utils/qxpathhelper.cpp index 127e21f..5b32906 100644 --- a/src/xmlpatterns/utils/qxpathhelper.cpp +++ b/src/xmlpatterns/utils/qxpathhelper.cpp @@ -125,4 +125,16 @@ ItemType::Ptr XPathHelper::typeFromKind(const QXmlNodeModelIndex::NodeKind nodeK } } +QUrl XPathHelper::normalizeQueryURI(const QUrl &uri) +{ + Q_ASSERT_X(uri.isEmpty() || uri.isValid(), Q_FUNC_INFO, + "The URI passed to QXmlQuery::setQuery() must be valid or empty."); + if(uri.isEmpty()) + return QUrl::fromLocalFile(QCoreApplication::applicationFilePath()); + else if(uri.isRelative()) + return QUrl::fromLocalFile(QCoreApplication::applicationFilePath()).resolved(uri); + else + return uri; +} + QT_END_NAMESPACE diff --git a/src/xmlpatterns/utils/qxpathhelper_p.h b/src/xmlpatterns/utils/qxpathhelper_p.h index 7bf33e6..e36b8cb 100644 --- a/src/xmlpatterns/utils/qxpathhelper_p.h +++ b/src/xmlpatterns/utils/qxpathhelper_p.h @@ -128,6 +128,11 @@ namespace QPatternist static QPatternist::ItemTypePtr typeFromKind(const QXmlNodeModelIndex::NodeKind nodeKind); /** + * Normalizes an @p uri by resolving it to the application directory if empty. + */ + static QUrl normalizeQueryURI(const QUrl &uri); + + /** * @short Determines whether @p consists only of whitespace. Characters * considered whitespace are the ones for which QChar::isSpace() returns @c true for. * diff --git a/tests/auto/patternistheaders/tst_patternistheaders.cpp b/tests/auto/patternistheaders/tst_patternistheaders.cpp index ba7623e..3352a58 100644 --- a/tests/auto/patternistheaders/tst_patternistheaders.cpp +++ b/tests/auto/patternistheaders/tst_patternistheaders.cpp @@ -94,6 +94,10 @@ void tst_PatternistHeaders::run() const #include #include #include +#include +#include +#include +#include #include #include @@ -122,6 +126,10 @@ void tst_PatternistHeaders::run() const #include #include #include +#include +#include +#include +#include #include #include diff --git a/tests/auto/qxmlschema/tst_qxmlschema.cpp b/tests/auto/qxmlschema/tst_qxmlschema.cpp index 64012c1..7fc59bb 100644 --- a/tests/auto/qxmlschema/tst_qxmlschema.cpp +++ b/tests/auto/qxmlschema/tst_qxmlschema.cpp @@ -15,33 +15,8 @@ #include #include -class DummyMessageHandler : public QAbstractMessageHandler -{ - public: - DummyMessageHandler(QObject *parent = 0) - : QAbstractMessageHandler(parent) - { - } - - protected: - virtual void handleMessage(QtMsgType, const QString&, const QUrl&, const QSourceLocation&) - { - } -}; - -class DummyUriResolver : public QAbstractUriResolver -{ - public: - DummyUriResolver(QObject *parent = 0) - : QAbstractUriResolver(parent) - { - } - - virtual QUrl resolve(const QUrl&, const QUrl&) const - { - return QUrl(); - } -}; +#include "../qabstracturiresolver/TestURIResolver.h" +#include "../qxmlquery/MessageSilencer.h" /*! \class tst_QXmlSchema @@ -59,6 +34,17 @@ private Q_SLOTS: void defaultConstructor() const; void copyConstructor() const; void constructorQXmlNamePool() const; + void copyMutationTest() const; + + void isValid() const; + void documentUri() const; + + void loadSchemaUrlSuccess() const; + void loadSchemaUrlFail() const; + void loadSchemaDeviceSuccess() const; + void loadSchemaDeviceFail() const; + void loadSchemaDataSuccess() const; + void loadSchemaDataFail() const; void networkAccessManagerSignature() const; void networkAccessManagerDefaultValue() const; @@ -134,6 +120,150 @@ void tst_QXmlSchema::constructorQXmlNamePool() const QCOMPARE(name.prefix(np2), QString::fromLatin1("prefix")); } +void tst_QXmlSchema::copyMutationTest() const +{ + QXmlSchema schema1; + QXmlSchema schema2(schema1); + + // check that everything is equal + QVERIFY(schema2.messageHandler() == schema1.messageHandler()); + QVERIFY(schema2.uriResolver() == schema1.uriResolver()); + QVERIFY(schema2.networkAccessManager() == schema1.networkAccessManager()); + + MessageSilencer handler; + const TestURIResolver resolver; + QNetworkAccessManager manager; + + // modify schema1 + schema1.setMessageHandler(&handler); + schema1.setUriResolver(&resolver); + schema1.setNetworkAccessManager(&manager); + + // check that schema2 is not effected by the modifications of schema1 + QVERIFY(schema2.messageHandler() != schema1.messageHandler()); + QVERIFY(schema2.uriResolver() != schema1.uriResolver()); + QVERIFY(schema2.networkAccessManager() != schema1.networkAccessManager()); + + // modify schema1 further + const QByteArray data( "" + "" + "" ); + + const QUrl documentUri("http://www.qtsoftware.com/xmlschematest"); + schema1.load(data, documentUri); + + QVERIFY(schema2.isValid() != schema1.isValid()); +} + +void tst_QXmlSchema::isValid() const +{ + /* Check default value. */ + QXmlSchema schema; + QVERIFY(!schema.isValid()); +} + +void tst_QXmlSchema::documentUri() const +{ + const QByteArray data( "" + "" + "" ); + + const QUrl documentUri("http://www.qtsoftware.com/xmlschematest"); + QXmlSchema schema; + schema.load(data, documentUri); + + QCOMPARE(documentUri, schema.documentUri()); +} + +void tst_QXmlSchema::loadSchemaUrlSuccess() const +{ +/** + TODO: put valid schema file on given url and enable test + const QUrl url("http://notavailable/"); + + QXmlSchema schema; + QVERIFY(!schema.load(url)); +*/ +} + +void tst_QXmlSchema::loadSchemaUrlFail() const +{ + const QUrl url("http://notavailable/"); + + QXmlSchema schema; + QVERIFY(!schema.load(url)); +} + +void tst_QXmlSchema::loadSchemaDeviceSuccess() const +{ + QByteArray data( "" + "" + "" ); + + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly); + + QXmlSchema schema; + QVERIFY(schema.load(&buffer)); +} + +void tst_QXmlSchema::loadSchemaDeviceFail() const +{ + QByteArray data( "" + "" + "" ); + + QBuffer buffer(&data); + // a closed device can not be loaded + + QXmlSchema schema; + QVERIFY(!schema.load(&buffer)); +} + +void tst_QXmlSchema::loadSchemaDataSuccess() const +{ + const QByteArray data( "" + "" + "" ); + QXmlSchema schema; + QVERIFY(schema.load(data)); +} + +void tst_QXmlSchema::loadSchemaDataFail() const +{ + // empty schema can not be loaded + const QByteArray data; + + QXmlSchema schema; + QVERIFY(!schema.load(data)); +} + + void tst_QXmlSchema::networkAccessManagerSignature() const { /* Const object. */ @@ -185,7 +315,7 @@ void tst_QXmlSchema::messageHandler() const { /* Test that we return the message handler that was set. */ { - DummyMessageHandler handler; + MessageSilencer handler; QXmlSchema schema; schema.setMessageHandler(&handler); @@ -200,6 +330,13 @@ void tst_QXmlSchema::uriResolverSignature() const /* The function should be const. */ schema.uriResolver(); + + /* Const object. */ + const TestURIResolver resolver; + + /* This should compile */ + QXmlSchema schema2; + schema2.setUriResolver(&resolver); } void tst_QXmlSchema::uriResolverDefaultValue() const @@ -215,7 +352,7 @@ void tst_QXmlSchema::uriResolver() const { /* Test that we return the uri resolver that was set. */ { - DummyUriResolver resolver; + TestURIResolver resolver; QXmlSchema schema; schema.setUriResolver(&resolver); diff --git a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp index b021b08..3bbf506 100644 --- a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp +++ b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp @@ -16,33 +16,8 @@ #include #include -class DummyMessageHandler : public QAbstractMessageHandler -{ - public: - DummyMessageHandler(QObject *parent = 0) - : QAbstractMessageHandler(parent) - { - } - - protected: - virtual void handleMessage(QtMsgType, const QString&, const QUrl&, const QSourceLocation&) - { - } -}; - -class DummyUriResolver : public QAbstractUriResolver -{ - public: - DummyUriResolver(QObject *parent = 0) - : QAbstractUriResolver(parent) - { - } - - virtual QUrl resolve(const QUrl&, const QUrl&) const - { - return QUrl(); - } -}; +#include "../qabstracturiresolver/TestURIResolver.h" +#include "../qxmlquery/MessageSilencer.h" /*! \class tst_QXmlSchemaValidatorValidator @@ -60,6 +35,13 @@ private Q_SLOTS: void defaultConstructor() const; void propertyInitialization() const; + void loadInstanceUrlSuccess() const; + void loadInstanceUrlFail() const; + void loadInstanceDeviceSuccess() const; + void loadInstanceDeviceFail() const; + void loadInstanceDataSuccess() const; + void loadInstanceDataFail() const; + void networkAccessManagerSignature() const; void networkAccessManagerDefaultValue() const; void networkAccessManager() const; @@ -73,6 +55,26 @@ private Q_SLOTS: void uriResolver() const; }; +static QXmlSchema createValidSchema() +{ + const QByteArray data( "" + "" + " " + "" ); + + const QUrl documentUri("http://www.qtsoftware.com/xmlschematest"); + + QXmlSchema schema; + schema.load(data, documentUri); + + return schema; +} + void tst_QXmlSchemaValidator::defaultConstructor() const { /* Allocate instance in different orders. */ @@ -101,8 +103,8 @@ void tst_QXmlSchemaValidator::propertyInitialization() const { /* Verify that properties set in the schema are used as default values for the validator */ { - DummyMessageHandler handler; - DummyUriResolver resolver; + MessageSilencer handler; + TestURIResolver resolver; QNetworkAccessManager manager; QXmlSchema schema; @@ -117,6 +119,72 @@ void tst_QXmlSchemaValidator::propertyInitialization() const } } +void tst_QXmlSchemaValidator::loadInstanceUrlSuccess() const +{ +/* + TODO: put valid schema file on given url and enable test + const QXmlSchema schema(createValidSchema()); + const QUrl url("http://notavailable/"); + + QXmlSchemaValidator validator(schema); + QVERIFY(!validator.validate(url)); +*/ +} + +void tst_QXmlSchemaValidator::loadInstanceUrlFail() const +{ + const QXmlSchema schema(createValidSchema()); + const QUrl url("http://notavailable/"); + + QXmlSchemaValidator validator(schema); + QVERIFY(!validator.validate(url)); +} + +void tst_QXmlSchemaValidator::loadInstanceDeviceSuccess() const +{ + const QXmlSchema schema(createValidSchema()); + + QByteArray data( "Testme" ); + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly); + + QXmlSchemaValidator validator(schema); + QVERIFY(validator.validate(&buffer)); +} + +void tst_QXmlSchemaValidator::loadInstanceDeviceFail() const +{ + const QXmlSchema schema(createValidSchema()); + + QByteArray data( "Testme" ); + QBuffer buffer(&data); + // a closed device can not be loaded + + QXmlSchemaValidator validator(schema); + QVERIFY(!validator.validate(&buffer)); +} + +void tst_QXmlSchemaValidator::loadInstanceDataSuccess() const +{ + const QXmlSchema schema(createValidSchema()); + + const QByteArray data( "Testme" ); + + QXmlSchemaValidator validator(schema); + QVERIFY(validator.validate(data)); +} + +void tst_QXmlSchemaValidator::loadInstanceDataFail() const +{ + const QXmlSchema schema(createValidSchema()); + + // empty instance can not be loaded + const QByteArray data; + + QXmlSchemaValidator validator(schema); + QVERIFY(!validator.validate(data)); +} + void tst_QXmlSchemaValidator::networkAccessManagerSignature() const { const QXmlSchema schema; @@ -202,7 +270,7 @@ void tst_QXmlSchemaValidator::messageHandlerDefaultValue() const { QXmlSchema schema; - DummyMessageHandler handler; + MessageSilencer handler; schema.setMessageHandler(&handler); const QXmlSchemaValidator validator(schema); @@ -214,7 +282,7 @@ void tst_QXmlSchemaValidator::messageHandler() const { /* Test that we return the message handler that was set. */ { - DummyMessageHandler handler; + MessageSilencer handler; const QXmlSchema schema; QXmlSchemaValidator validator(schema); @@ -225,7 +293,7 @@ void tst_QXmlSchemaValidator::messageHandler() const /* Test that we return the message handler that was set, even if the schema changed in between. */ { - DummyMessageHandler handler; + MessageSilencer handler; const QXmlSchema schema; QXmlSchemaValidator validator(schema); @@ -248,6 +316,13 @@ void tst_QXmlSchemaValidator::uriResolverSignature() const /* The function should be const. */ validator.uriResolver(); + + /* Const object. */ + const TestURIResolver resolver; + + /* This should compile */ + QXmlSchema schema2; + schema2.setUriResolver(&resolver); } void tst_QXmlSchemaValidator::uriResolverDefaultValue() const @@ -263,7 +338,7 @@ void tst_QXmlSchemaValidator::uriResolverDefaultValue() const { QXmlSchema schema; - DummyUriResolver resolver; + TestURIResolver resolver; schema.setUriResolver(&resolver); const QXmlSchemaValidator validator(schema); @@ -275,7 +350,7 @@ void tst_QXmlSchemaValidator::uriResolver() const { /* Test that we return the uri resolver that was set. */ { - DummyUriResolver resolver; + TestURIResolver resolver; const QXmlSchema schema; QXmlSchemaValidator validator(schema); @@ -286,7 +361,7 @@ void tst_QXmlSchemaValidator::uriResolver() const /* Test that we return the uri resolver that was set, even if the schema changed in between. */ { - DummyUriResolver resolver; + TestURIResolver resolver; const QXmlSchema schema; QXmlSchemaValidator validator(schema); diff --git a/tools/xmlpatternsvalidator/main.cpp b/tools/xmlpatternsvalidator/main.cpp index 032afc0..0ccbcfc 100644 --- a/tools/xmlpatternsvalidator/main.cpp +++ b/tools/xmlpatternsvalidator/main.cpp @@ -19,22 +19,29 @@ QT_USE_NAMESPACE -enum ExecutionMode -{ - InvalidMode, - SchemaOnlyMode, - SchemaAndInstanceMode, - InstanceOnlyMode -}; - int main(int argc, char **argv) { + enum ExitCode + { + Valid = 0, + Invalid, + ParseError + }; + + enum ExecutionMode + { + InvalidMode, + SchemaOnlyMode, + SchemaAndInstanceMode, + InstanceOnlyMode + }; + const QCoreApplication app(argc, argv); QCoreApplication::setApplicationName(QLatin1String("xmlpatternsvalidator")); if (argc != 2 && argc != 3) { qDebug() << QXmlPatternistCLI::tr("usage: xmlpatternsvalidator ( | | )"); - return 2; + return ParseError; } // parse command line arguments @@ -63,9 +70,9 @@ int main(int argc, char **argv) schema.load(QUrl(schemaUri)); if (schema.isValid()) - return 0; + return Valid; else - return 1; + return Invalid; } else if (mode == SchemaAndInstanceMode) { const QString instanceUri = QFile::decodeName(argv[1]); const QString schemaUri = QFile::decodeName(argv[2]); @@ -73,24 +80,24 @@ int main(int argc, char **argv) schema.load(QUrl(schemaUri)); if (!schema.isValid()) - return 1; + return Invalid; QXmlSchemaValidator validator(schema); if (validator.validate(QUrl(instanceUri))) - return 0; + return Valid; else - return 1; + return Invalid; } else if (mode == InstanceOnlyMode) { const QString instanceUri = QFile::decodeName(argv[1]); QXmlSchemaValidator validator(schema); if (validator.validate(QUrl(instanceUri))) - return 0; + return Valid; else - return 1; + return Invalid; } Q_ASSERT(false); - return 1; + return Invalid; } -- cgit v0.12 From 017fd8ebb129947603eeea5474a067d45a33eccb Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sat, 16 May 2009 20:45:26 +0200 Subject: Adapt license headers to LGPL --- examples/xmlpatterns/schema/main.cpp | 34 ++++++++++++++++++++-- examples/xmlpatterns/schema/mainwindow.cpp | 34 ++++++++++++++++++++-- examples/xmlpatterns/schema/mainwindow.h | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qabstractxmlpullprovider.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qabstractxmlpullprovider_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qpullbridge.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qpullbridge_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qxmlschema.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qxmlschema.h | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qxmlschema_p.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qxmlschema_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qxmlschemavalidator.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qxmlschemavalidator.h | 34 ++++++++++++++++++++-- src/xmlpatterns/api/qxmlschemavalidator_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/data/qcomparisonfactory.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/data/qcomparisonfactory_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/data/qvaluefactory.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/data/qvaluefactory_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/parser/qquerytransformparser_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qnamespacesupport.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qnamespacesupport_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdalternative.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdalternative_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdannotated.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdannotated_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdannotation.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdannotation_p.h | 34 ++++++++++++++++++++-- .../schema/qxsdapplicationinformation.cpp | 34 ++++++++++++++++++++-- .../schema/qxsdapplicationinformation_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdassertion.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdassertion_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattribute.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattribute_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributegroup.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributegroup_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributereference.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributereference_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributeterm.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributeterm_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributeuse.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdattributeuse_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdcomplextype.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdcomplextype_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsddocumentation.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsddocumentation_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdelement.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdelement_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdfacet.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdfacet_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdidcache.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdidcache_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdidchelper.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdidchelper_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdidentityconstraint.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdidentityconstraint_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdinstancereader.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdinstancereader_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdmodelgroup.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdmodelgroup_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdnotation.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdnotation_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdparticle.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdparticle_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdparticlechecker.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdparticlechecker_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdreference.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdreference_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschema.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschema_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemachecker.cpp | 34 ++++++++++++++++++++-- .../schema/qxsdschemachecker_helper.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemachecker_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemacontext.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemacontext_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemadebugger.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemadebugger_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemahelper.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemahelper_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemamerger.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemamerger_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemaparser_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemaparsercontext.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemaparsercontext_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemaresolver.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemaresolver_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschematoken.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschematoken_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschematypesfactory.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschematypesfactory_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdsimpletype.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdsimpletype_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdstatemachine.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdstatemachine_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdterm.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdterm_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdtypechecker.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdtypechecker_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsduserschematype.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsduserschematype_p.h | 34 ++++++++++++++++++++-- .../schema/qxsdvalidatedxmlnodemodel.cpp | 34 ++++++++++++++++++++-- .../schema/qxsdvalidatedxmlnodemodel_p.h | 34 ++++++++++++++++++++-- .../schema/qxsdvalidatinginstancereader.cpp | 34 ++++++++++++++++++++-- .../schema/qxsdvalidatinginstancereader_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdwildcard.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdwildcard_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdxpathexpression.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdxpathexpression_p.h | 34 ++++++++++++++++++++-- src/xmlpatterns/schema/tokens.xml | 34 ++++++++++++++++++++-- src/xmlpatterns/type/qnamedschemacomponent.cpp | 34 ++++++++++++++++++++-- src/xmlpatterns/type/qnamedschemacomponent_p.h | 34 ++++++++++++++++++++-- tools/xmlpatternsvalidator/main.cpp | 32 +++++++++++++++++++- tools/xmlpatternsvalidator/main.h | 32 +++++++++++++++++++- 114 files changed, 3646 insertions(+), 226 deletions(-) diff --git a/examples/xmlpatterns/schema/main.cpp b/examples/xmlpatterns/schema/main.cpp index 9537a87..50e1139 100644 --- a/examples/xmlpatterns/schema/main.cpp +++ b/examples/xmlpatterns/schema/main.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/xmlpatterns/schema/mainwindow.cpp b/examples/xmlpatterns/schema/mainwindow.cpp index 807a65b..6b43d7b 100644 --- a/examples/xmlpatterns/schema/mainwindow.cpp +++ b/examples/xmlpatterns/schema/mainwindow.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/examples/xmlpatterns/schema/mainwindow.h b/examples/xmlpatterns/schema/mainwindow.h index e5dc2df..5f56afc 100644 --- a/examples/xmlpatterns/schema/mainwindow.h +++ b/examples/xmlpatterns/schema/mainwindow.h @@ -3,9 +3,39 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qabstractxmlpullprovider.cpp b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp index a80604b..7a7d87d 100644 --- a/src/xmlpatterns/api/qabstractxmlpullprovider.cpp +++ b/src/xmlpatterns/api/qabstractxmlpullprovider.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qabstractxmlpullprovider_p.h b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h index d05e649..99fb280 100644 --- a/src/xmlpatterns/api/qabstractxmlpullprovider_p.h +++ b/src/xmlpatterns/api/qabstractxmlpullprovider_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qpullbridge.cpp b/src/xmlpatterns/api/qpullbridge.cpp index f347339..1456b32 100644 --- a/src/xmlpatterns/api/qpullbridge.cpp +++ b/src/xmlpatterns/api/qpullbridge.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qpullbridge_p.h b/src/xmlpatterns/api/qpullbridge_p.h index 823d27b..14aa29a 100644 --- a/src/xmlpatterns/api/qpullbridge_p.h +++ b/src/xmlpatterns/api/qpullbridge_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index 108212e..aa5b77c 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qxmlschema.h b/src/xmlpatterns/api/qxmlschema.h index cf56b1e..d057b2c 100644 --- a/src/xmlpatterns/api/qxmlschema.h +++ b/src/xmlpatterns/api/qxmlschema.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qxmlschema_p.cpp b/src/xmlpatterns/api/qxmlschema_p.cpp index 21dc04a..7b96f82 100644 --- a/src/xmlpatterns/api/qxmlschema_p.cpp +++ b/src/xmlpatterns/api/qxmlschema_p.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qxmlschema_p.h b/src/xmlpatterns/api/qxmlschema_p.h index efba256..b54d88f 100644 --- a/src/xmlpatterns/api/qxmlschema_p.h +++ b/src/xmlpatterns/api/qxmlschema_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index fcde49c..7a4ce03 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qxmlschemavalidator.h b/src/xmlpatterns/api/qxmlschemavalidator.h index c82c522..e6683a5 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.h +++ b/src/xmlpatterns/api/qxmlschemavalidator.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/api/qxmlschemavalidator_p.h b/src/xmlpatterns/api/qxmlschemavalidator_p.h index 9910f6e..fbf7b1c 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator_p.h +++ b/src/xmlpatterns/api/qxmlschemavalidator_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/data/qcomparisonfactory.cpp b/src/xmlpatterns/data/qcomparisonfactory.cpp index 7fe298b..79ff105 100644 --- a/src/xmlpatterns/data/qcomparisonfactory.cpp +++ b/src/xmlpatterns/data/qcomparisonfactory.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/data/qcomparisonfactory_p.h b/src/xmlpatterns/data/qcomparisonfactory_p.h index 09fc50b..88c587e 100644 --- a/src/xmlpatterns/data/qcomparisonfactory_p.h +++ b/src/xmlpatterns/data/qcomparisonfactory_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/data/qvaluefactory.cpp b/src/xmlpatterns/data/qvaluefactory.cpp index 04df29d..6c8fbec 100644 --- a/src/xmlpatterns/data/qvaluefactory.cpp +++ b/src/xmlpatterns/data/qvaluefactory.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/data/qvaluefactory_p.h b/src/xmlpatterns/data/qvaluefactory_p.h index 80b6207..0efe247 100644 --- a/src/xmlpatterns/data/qvaluefactory_p.h +++ b/src/xmlpatterns/data/qvaluefactory_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/parser/qquerytransformparser_p.h b/src/xmlpatterns/parser/qquerytransformparser_p.h index 759c39f..fb3ff72 100644 --- a/src/xmlpatterns/parser/qquerytransformparser_p.h +++ b/src/xmlpatterns/parser/qquerytransformparser_p.h @@ -54,9 +54,39 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qnamespacesupport.cpp b/src/xmlpatterns/schema/qnamespacesupport.cpp index 349f451..dc76a6f 100644 --- a/src/xmlpatterns/schema/qnamespacesupport.cpp +++ b/src/xmlpatterns/schema/qnamespacesupport.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qnamespacesupport_p.h b/src/xmlpatterns/schema/qnamespacesupport_p.h index d338eae..1f8f955 100644 --- a/src/xmlpatterns/schema/qnamespacesupport_p.h +++ b/src/xmlpatterns/schema/qnamespacesupport_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdalternative.cpp b/src/xmlpatterns/schema/qxsdalternative.cpp index f3f589a..6e4a7ab 100644 --- a/src/xmlpatterns/schema/qxsdalternative.cpp +++ b/src/xmlpatterns/schema/qxsdalternative.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdalternative_p.h b/src/xmlpatterns/schema/qxsdalternative_p.h index 451441e..2b1c75d 100644 --- a/src/xmlpatterns/schema/qxsdalternative_p.h +++ b/src/xmlpatterns/schema/qxsdalternative_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdannotated.cpp b/src/xmlpatterns/schema/qxsdannotated.cpp index a29b5c4..6674180 100644 --- a/src/xmlpatterns/schema/qxsdannotated.cpp +++ b/src/xmlpatterns/schema/qxsdannotated.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdannotated_p.h b/src/xmlpatterns/schema/qxsdannotated_p.h index 251b252..18f0612 100644 --- a/src/xmlpatterns/schema/qxsdannotated_p.h +++ b/src/xmlpatterns/schema/qxsdannotated_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdannotation.cpp b/src/xmlpatterns/schema/qxsdannotation.cpp index 0a9dc04..37ec09f 100644 --- a/src/xmlpatterns/schema/qxsdannotation.cpp +++ b/src/xmlpatterns/schema/qxsdannotation.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdannotation_p.h b/src/xmlpatterns/schema/qxsdannotation_p.h index 8c23bae..1f2cd14 100644 --- a/src/xmlpatterns/schema/qxsdannotation_p.h +++ b/src/xmlpatterns/schema/qxsdannotation_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation.cpp b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp index 5669220..3b4da24 100644 --- a/src/xmlpatterns/schema/qxsdapplicationinformation.cpp +++ b/src/xmlpatterns/schema/qxsdapplicationinformation.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdapplicationinformation_p.h b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h index 30839d3..224b511 100644 --- a/src/xmlpatterns/schema/qxsdapplicationinformation_p.h +++ b/src/xmlpatterns/schema/qxsdapplicationinformation_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdassertion.cpp b/src/xmlpatterns/schema/qxsdassertion.cpp index f6cbf81..5a97385 100644 --- a/src/xmlpatterns/schema/qxsdassertion.cpp +++ b/src/xmlpatterns/schema/qxsdassertion.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdassertion_p.h b/src/xmlpatterns/schema/qxsdassertion_p.h index 0ae5ff6..58f6073 100644 --- a/src/xmlpatterns/schema/qxsdassertion_p.h +++ b/src/xmlpatterns/schema/qxsdassertion_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattribute.cpp b/src/xmlpatterns/schema/qxsdattribute.cpp index 6cf60ec..bf640e7 100644 --- a/src/xmlpatterns/schema/qxsdattribute.cpp +++ b/src/xmlpatterns/schema/qxsdattribute.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattribute_p.h b/src/xmlpatterns/schema/qxsdattribute_p.h index 46d7355..e0ff854 100644 --- a/src/xmlpatterns/schema/qxsdattribute_p.h +++ b/src/xmlpatterns/schema/qxsdattribute_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributegroup.cpp b/src/xmlpatterns/schema/qxsdattributegroup.cpp index 8f2a47e..b6549eb 100644 --- a/src/xmlpatterns/schema/qxsdattributegroup.cpp +++ b/src/xmlpatterns/schema/qxsdattributegroup.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributegroup_p.h b/src/xmlpatterns/schema/qxsdattributegroup_p.h index 7a3bd79..4fe9c37 100644 --- a/src/xmlpatterns/schema/qxsdattributegroup_p.h +++ b/src/xmlpatterns/schema/qxsdattributegroup_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributereference.cpp b/src/xmlpatterns/schema/qxsdattributereference.cpp index 3c36a4e..6e5809c 100644 --- a/src/xmlpatterns/schema/qxsdattributereference.cpp +++ b/src/xmlpatterns/schema/qxsdattributereference.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributereference_p.h b/src/xmlpatterns/schema/qxsdattributereference_p.h index be48b3a..6500109 100644 --- a/src/xmlpatterns/schema/qxsdattributereference_p.h +++ b/src/xmlpatterns/schema/qxsdattributereference_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributeterm.cpp b/src/xmlpatterns/schema/qxsdattributeterm.cpp index a9c3898..6463e35 100644 --- a/src/xmlpatterns/schema/qxsdattributeterm.cpp +++ b/src/xmlpatterns/schema/qxsdattributeterm.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributeterm_p.h b/src/xmlpatterns/schema/qxsdattributeterm_p.h index 507df32..6e49cfc 100644 --- a/src/xmlpatterns/schema/qxsdattributeterm_p.h +++ b/src/xmlpatterns/schema/qxsdattributeterm_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributeuse.cpp b/src/xmlpatterns/schema/qxsdattributeuse.cpp index 96d81bc..0f7ed9f 100644 --- a/src/xmlpatterns/schema/qxsdattributeuse.cpp +++ b/src/xmlpatterns/schema/qxsdattributeuse.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdattributeuse_p.h b/src/xmlpatterns/schema/qxsdattributeuse_p.h index 86021e1..bf2eac5 100644 --- a/src/xmlpatterns/schema/qxsdattributeuse_p.h +++ b/src/xmlpatterns/schema/qxsdattributeuse_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdcomplextype.cpp b/src/xmlpatterns/schema/qxsdcomplextype.cpp index ddc9110..6f5a240 100644 --- a/src/xmlpatterns/schema/qxsdcomplextype.cpp +++ b/src/xmlpatterns/schema/qxsdcomplextype.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdcomplextype_p.h b/src/xmlpatterns/schema/qxsdcomplextype_p.h index 078c8f0..4333d24 100644 --- a/src/xmlpatterns/schema/qxsdcomplextype_p.h +++ b/src/xmlpatterns/schema/qxsdcomplextype_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsddocumentation.cpp b/src/xmlpatterns/schema/qxsddocumentation.cpp index 4994143..b2490f6 100644 --- a/src/xmlpatterns/schema/qxsddocumentation.cpp +++ b/src/xmlpatterns/schema/qxsddocumentation.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsddocumentation_p.h b/src/xmlpatterns/schema/qxsddocumentation_p.h index c44a2bb..35463da 100644 --- a/src/xmlpatterns/schema/qxsddocumentation_p.h +++ b/src/xmlpatterns/schema/qxsddocumentation_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdelement.cpp b/src/xmlpatterns/schema/qxsdelement.cpp index 2b8ccab..c344799 100644 --- a/src/xmlpatterns/schema/qxsdelement.cpp +++ b/src/xmlpatterns/schema/qxsdelement.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdelement_p.h b/src/xmlpatterns/schema/qxsdelement_p.h index e571687..70ecb7e 100644 --- a/src/xmlpatterns/schema/qxsdelement_p.h +++ b/src/xmlpatterns/schema/qxsdelement_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdfacet.cpp b/src/xmlpatterns/schema/qxsdfacet.cpp index 513eee8..b49d530 100644 --- a/src/xmlpatterns/schema/qxsdfacet.cpp +++ b/src/xmlpatterns/schema/qxsdfacet.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdfacet_p.h b/src/xmlpatterns/schema/qxsdfacet_p.h index f1f8110..fe845d0 100644 --- a/src/xmlpatterns/schema/qxsdfacet_p.h +++ b/src/xmlpatterns/schema/qxsdfacet_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdidcache.cpp b/src/xmlpatterns/schema/qxsdidcache.cpp index d4a7b64..2d4adc9 100644 --- a/src/xmlpatterns/schema/qxsdidcache.cpp +++ b/src/xmlpatterns/schema/qxsdidcache.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdidcache_p.h b/src/xmlpatterns/schema/qxsdidcache_p.h index b1d3c0f..c81e4dc 100644 --- a/src/xmlpatterns/schema/qxsdidcache_p.h +++ b/src/xmlpatterns/schema/qxsdidcache_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdidchelper.cpp b/src/xmlpatterns/schema/qxsdidchelper.cpp index 70980cb..0442f26 100644 --- a/src/xmlpatterns/schema/qxsdidchelper.cpp +++ b/src/xmlpatterns/schema/qxsdidchelper.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdidchelper_p.h b/src/xmlpatterns/schema/qxsdidchelper_p.h index 3034292..d25d713 100644 --- a/src/xmlpatterns/schema/qxsdidchelper_p.h +++ b/src/xmlpatterns/schema/qxsdidchelper_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint.cpp b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp index e72a005..eec1235 100644 --- a/src/xmlpatterns/schema/qxsdidentityconstraint.cpp +++ b/src/xmlpatterns/schema/qxsdidentityconstraint.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdidentityconstraint_p.h b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h index 6870b1e..712ea98 100644 --- a/src/xmlpatterns/schema/qxsdidentityconstraint_p.h +++ b/src/xmlpatterns/schema/qxsdidentityconstraint_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdinstancereader.cpp b/src/xmlpatterns/schema/qxsdinstancereader.cpp index 81c40c9..9d2dc60 100644 --- a/src/xmlpatterns/schema/qxsdinstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdinstancereader.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdinstancereader_p.h b/src/xmlpatterns/schema/qxsdinstancereader_p.h index 9df02d6..1896ad9 100644 --- a/src/xmlpatterns/schema/qxsdinstancereader_p.h +++ b/src/xmlpatterns/schema/qxsdinstancereader_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdmodelgroup.cpp b/src/xmlpatterns/schema/qxsdmodelgroup.cpp index 1245822..a791284 100644 --- a/src/xmlpatterns/schema/qxsdmodelgroup.cpp +++ b/src/xmlpatterns/schema/qxsdmodelgroup.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdmodelgroup_p.h b/src/xmlpatterns/schema/qxsdmodelgroup_p.h index b7b59ac..eae46b0 100644 --- a/src/xmlpatterns/schema/qxsdmodelgroup_p.h +++ b/src/xmlpatterns/schema/qxsdmodelgroup_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdnotation.cpp b/src/xmlpatterns/schema/qxsdnotation.cpp index cfa0cd3..6c1d7c0 100644 --- a/src/xmlpatterns/schema/qxsdnotation.cpp +++ b/src/xmlpatterns/schema/qxsdnotation.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdnotation_p.h b/src/xmlpatterns/schema/qxsdnotation_p.h index dc1d597..6af3f0c 100644 --- a/src/xmlpatterns/schema/qxsdnotation_p.h +++ b/src/xmlpatterns/schema/qxsdnotation_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdparticle.cpp b/src/xmlpatterns/schema/qxsdparticle.cpp index a2671fa..3e5be44 100644 --- a/src/xmlpatterns/schema/qxsdparticle.cpp +++ b/src/xmlpatterns/schema/qxsdparticle.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdparticle_p.h b/src/xmlpatterns/schema/qxsdparticle_p.h index 61e3eb3..491cb47 100644 --- a/src/xmlpatterns/schema/qxsdparticle_p.h +++ b/src/xmlpatterns/schema/qxsdparticle_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdparticlechecker.cpp b/src/xmlpatterns/schema/qxsdparticlechecker.cpp index 7a09f8a..fa26b8b 100644 --- a/src/xmlpatterns/schema/qxsdparticlechecker.cpp +++ b/src/xmlpatterns/schema/qxsdparticlechecker.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdparticlechecker_p.h b/src/xmlpatterns/schema/qxsdparticlechecker_p.h index 16a8d95..739eca0 100644 --- a/src/xmlpatterns/schema/qxsdparticlechecker_p.h +++ b/src/xmlpatterns/schema/qxsdparticlechecker_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdreference.cpp b/src/xmlpatterns/schema/qxsdreference.cpp index 0a934dd..e7fc409 100644 --- a/src/xmlpatterns/schema/qxsdreference.cpp +++ b/src/xmlpatterns/schema/qxsdreference.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdreference_p.h b/src/xmlpatterns/schema/qxsdreference_p.h index afcca25..d6a1693 100644 --- a/src/xmlpatterns/schema/qxsdreference_p.h +++ b/src/xmlpatterns/schema/qxsdreference_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschema.cpp b/src/xmlpatterns/schema/qxsdschema.cpp index 260b06b..b9b9e99 100644 --- a/src/xmlpatterns/schema/qxsdschema.cpp +++ b/src/xmlpatterns/schema/qxsdschema.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschema_p.h b/src/xmlpatterns/schema/qxsdschema_p.h index b41a2d5..9954f56 100644 --- a/src/xmlpatterns/schema/qxsdschema_p.h +++ b/src/xmlpatterns/schema/qxsdschema_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemachecker.cpp b/src/xmlpatterns/schema/qxsdschemachecker.cpp index 2a64327..42cfff6 100644 --- a/src/xmlpatterns/schema/qxsdschemachecker.cpp +++ b/src/xmlpatterns/schema/qxsdschemachecker.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp index 98c4c63..850b17b 100644 --- a/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp +++ b/src/xmlpatterns/schema/qxsdschemachecker_helper.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemachecker_p.h b/src/xmlpatterns/schema/qxsdschemachecker_p.h index 65fb87f..1ec85f9 100644 --- a/src/xmlpatterns/schema/qxsdschemachecker_p.h +++ b/src/xmlpatterns/schema/qxsdschemachecker_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemacontext.cpp b/src/xmlpatterns/schema/qxsdschemacontext.cpp index 65b2e52..4648864 100644 --- a/src/xmlpatterns/schema/qxsdschemacontext.cpp +++ b/src/xmlpatterns/schema/qxsdschemacontext.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemacontext_p.h b/src/xmlpatterns/schema/qxsdschemacontext_p.h index c3a9f15..3aad656 100644 --- a/src/xmlpatterns/schema/qxsdschemacontext_p.h +++ b/src/xmlpatterns/schema/qxsdschemacontext_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemadebugger.cpp b/src/xmlpatterns/schema/qxsdschemadebugger.cpp index 850192c..629333c 100644 --- a/src/xmlpatterns/schema/qxsdschemadebugger.cpp +++ b/src/xmlpatterns/schema/qxsdschemadebugger.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemadebugger_p.h b/src/xmlpatterns/schema/qxsdschemadebugger_p.h index 8966963..a88f432 100644 --- a/src/xmlpatterns/schema/qxsdschemadebugger_p.h +++ b/src/xmlpatterns/schema/qxsdschemadebugger_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp index ff169f7..f31ebd6 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper.cpp +++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemahelper_p.h b/src/xmlpatterns/schema/qxsdschemahelper_p.h index 918664e..1335691 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper_p.h +++ b/src/xmlpatterns/schema/qxsdschemahelper_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemamerger.cpp b/src/xmlpatterns/schema/qxsdschemamerger.cpp index a924c9c..a0f22a2 100644 --- a/src/xmlpatterns/schema/qxsdschemamerger.cpp +++ b/src/xmlpatterns/schema/qxsdschemamerger.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemamerger_p.h b/src/xmlpatterns/schema/qxsdschemamerger_p.h index 54cc0f2..8154689 100644 --- a/src/xmlpatterns/schema/qxsdschemamerger_p.h +++ b/src/xmlpatterns/schema/qxsdschemamerger_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemaparser_p.h b/src/xmlpatterns/schema/qxsdschemaparser_p.h index 960fb86..c52702b 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser_p.h +++ b/src/xmlpatterns/schema/qxsdschemaparser_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp index 896619e..e4dc348 100644 --- a/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparsercontext.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h index 616aff3..f95f571 100644 --- a/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h +++ b/src/xmlpatterns/schema/qxsdschemaparsercontext_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemaresolver.cpp b/src/xmlpatterns/schema/qxsdschemaresolver.cpp index 4c6910f..46d0c69 100644 --- a/src/xmlpatterns/schema/qxsdschemaresolver.cpp +++ b/src/xmlpatterns/schema/qxsdschemaresolver.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschemaresolver_p.h b/src/xmlpatterns/schema/qxsdschemaresolver_p.h index 1222619..79d2a2d 100644 --- a/src/xmlpatterns/schema/qxsdschemaresolver_p.h +++ b/src/xmlpatterns/schema/qxsdschemaresolver_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschematoken.cpp b/src/xmlpatterns/schema/qxsdschematoken.cpp index b527de6..e383b16 100644 --- a/src/xmlpatterns/schema/qxsdschematoken.cpp +++ b/src/xmlpatterns/schema/qxsdschematoken.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschematoken_p.h b/src/xmlpatterns/schema/qxsdschematoken_p.h index 8cb1e76..58d1f4d 100644 --- a/src/xmlpatterns/schema/qxsdschematoken_p.h +++ b/src/xmlpatterns/schema/qxsdschematoken_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory.cpp b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp index 6cac0ff..b8f92a6 100644 --- a/src/xmlpatterns/schema/qxsdschematypesfactory.cpp +++ b/src/xmlpatterns/schema/qxsdschematypesfactory.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdschematypesfactory_p.h b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h index 4fcd5fb..874a701 100644 --- a/src/xmlpatterns/schema/qxsdschematypesfactory_p.h +++ b/src/xmlpatterns/schema/qxsdschematypesfactory_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdsimpletype.cpp b/src/xmlpatterns/schema/qxsdsimpletype.cpp index 2e5b7f5..0365e5e 100644 --- a/src/xmlpatterns/schema/qxsdsimpletype.cpp +++ b/src/xmlpatterns/schema/qxsdsimpletype.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdsimpletype_p.h b/src/xmlpatterns/schema/qxsdsimpletype_p.h index 9ba34b6..d9f84c7 100644 --- a/src/xmlpatterns/schema/qxsdsimpletype_p.h +++ b/src/xmlpatterns/schema/qxsdsimpletype_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdstatemachine.cpp b/src/xmlpatterns/schema/qxsdstatemachine.cpp index 4f36f22..0672e1a 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachine.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h index f0cf99d..81fb853 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp index 866e010..a9e1d98 100644 --- a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h b/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h index 011153a..82eeea8 100644 --- a/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdterm.cpp b/src/xmlpatterns/schema/qxsdterm.cpp index 1dbe34b..92ea006 100644 --- a/src/xmlpatterns/schema/qxsdterm.cpp +++ b/src/xmlpatterns/schema/qxsdterm.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdterm_p.h b/src/xmlpatterns/schema/qxsdterm_p.h index f45d791..278b74d 100644 --- a/src/xmlpatterns/schema/qxsdterm_p.h +++ b/src/xmlpatterns/schema/qxsdterm_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp index ab971a9..aabfcf6 100644 --- a/src/xmlpatterns/schema/qxsdtypechecker.cpp +++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdtypechecker_p.h b/src/xmlpatterns/schema/qxsdtypechecker_p.h index 2af20db..4b3f7c2 100644 --- a/src/xmlpatterns/schema/qxsdtypechecker_p.h +++ b/src/xmlpatterns/schema/qxsdtypechecker_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsduserschematype.cpp b/src/xmlpatterns/schema/qxsduserschematype.cpp index b8bf7e7..a985ba4 100644 --- a/src/xmlpatterns/schema/qxsduserschematype.cpp +++ b/src/xmlpatterns/schema/qxsduserschematype.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsduserschematype_p.h b/src/xmlpatterns/schema/qxsduserschematype_p.h index ab70f91..842fb00 100644 --- a/src/xmlpatterns/schema/qxsduserschematype_p.h +++ b/src/xmlpatterns/schema/qxsduserschematype_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp index 33bca4e..e7a1503 100644 --- a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h index d52e369..77fc8f4 100644 --- a/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h +++ b/src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp index 8cb34d4..1505152 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h index 28f3c3f..0402e99 100644 --- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h +++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdwildcard.cpp b/src/xmlpatterns/schema/qxsdwildcard.cpp index 6efb996..55eb4ba 100644 --- a/src/xmlpatterns/schema/qxsdwildcard.cpp +++ b/src/xmlpatterns/schema/qxsdwildcard.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdwildcard_p.h b/src/xmlpatterns/schema/qxsdwildcard_p.h index 8fbecb3..15fc159 100644 --- a/src/xmlpatterns/schema/qxsdwildcard_p.h +++ b/src/xmlpatterns/schema/qxsdwildcard_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdxpathexpression.cpp b/src/xmlpatterns/schema/qxsdxpathexpression.cpp index ba9d0a4..64bd687 100644 --- a/src/xmlpatterns/schema/qxsdxpathexpression.cpp +++ b/src/xmlpatterns/schema/qxsdxpathexpression.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/qxsdxpathexpression_p.h b/src/xmlpatterns/schema/qxsdxpathexpression_p.h index e57f7b7..e4f5427 100644 --- a/src/xmlpatterns/schema/qxsdxpathexpression_p.h +++ b/src/xmlpatterns/schema/qxsdxpathexpression_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/schema/tokens.xml b/src/xmlpatterns/schema/tokens.xml index 7ec9752..6736ad75 100644 --- a/src/xmlpatterns/schema/tokens.xml +++ b/src/xmlpatterns/schema/tokens.xml @@ -112,9 +112,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/type/qnamedschemacomponent.cpp b/src/xmlpatterns/type/qnamedschemacomponent.cpp index e45b9b6..71b7519 100644 --- a/src/xmlpatterns/type/qnamedschemacomponent.cpp +++ b/src/xmlpatterns/type/qnamedschemacomponent.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/xmlpatterns/type/qnamedschemacomponent_p.h b/src/xmlpatterns/type/qnamedschemacomponent_p.h index bc3121b..70da093 100644 --- a/src/xmlpatterns/type/qnamedschemacomponent_p.h +++ b/src/xmlpatterns/type/qnamedschemacomponent_p.h @@ -3,9 +3,39 @@ ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtXmlPatterns of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tools/xmlpatternsvalidator/main.cpp b/tools/xmlpatternsvalidator/main.cpp index 0ccbcfc..d53c783 100644 --- a/tools/xmlpatternsvalidator/main.cpp +++ b/tools/xmlpatternsvalidator/main.cpp @@ -5,7 +5,37 @@ ** ** This file is part of the Patternist project on Trolltech Labs. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tools/xmlpatternsvalidator/main.h b/tools/xmlpatternsvalidator/main.h index 477a45a..85a4561 100644 --- a/tools/xmlpatternsvalidator/main.h +++ b/tools/xmlpatternsvalidator/main.h @@ -4,7 +4,37 @@ ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the Patternist project on Trolltech Labs. * ** - ** $TROLLTECH_DUAL_LICENSE$ + ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- cgit v0.12 From fa26e5759c645c9ed9c81a86dba72881dd1d776c Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Tue, 19 May 2009 16:17:18 +0200 Subject: Add missing example files --- examples/xmlpatterns/schema/files/contact.xsd | 25 ++++++++++++++ .../xmlpatterns/schema/files/invalid_contact.xml | 11 ++++++ .../xmlpatterns/schema/files/invalid_order.xml | 13 +++++++ .../xmlpatterns/schema/files/invalid_recipe.xml | 14 ++++++++ examples/xmlpatterns/schema/files/order.xsd | 23 +++++++++++++ examples/xmlpatterns/schema/files/recipe.xsd | 40 ++++++++++++++++++++++ .../xmlpatterns/schema/files/valid_contact.xml | 11 ++++++ examples/xmlpatterns/schema/files/valid_order.xml | 18 ++++++++++ examples/xmlpatterns/schema/files/valid_recipe.xml | 13 +++++++ 9 files changed, 168 insertions(+) create mode 100644 examples/xmlpatterns/schema/files/contact.xsd create mode 100644 examples/xmlpatterns/schema/files/invalid_contact.xml create mode 100644 examples/xmlpatterns/schema/files/invalid_order.xml create mode 100644 examples/xmlpatterns/schema/files/invalid_recipe.xml create mode 100644 examples/xmlpatterns/schema/files/order.xsd create mode 100644 examples/xmlpatterns/schema/files/recipe.xsd create mode 100644 examples/xmlpatterns/schema/files/valid_contact.xml create mode 100644 examples/xmlpatterns/schema/files/valid_order.xml create mode 100644 examples/xmlpatterns/schema/files/valid_recipe.xml diff --git a/examples/xmlpatterns/schema/files/contact.xsd b/examples/xmlpatterns/schema/files/contact.xsd new file mode 100644 index 0000000..3e1b570 --- /dev/null +++ b/examples/xmlpatterns/schema/files/contact.xsd @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/xmlpatterns/schema/files/invalid_contact.xml b/examples/xmlpatterns/schema/files/invalid_contact.xml new file mode 100644 index 0000000..42f1edd --- /dev/null +++ b/examples/xmlpatterns/schema/files/invalid_contact.xml @@ -0,0 +1,11 @@ + + John + Doe + Prof. + + Sandakerveien 116 + N-0550 + Oslo + Norway + + diff --git a/examples/xmlpatterns/schema/files/invalid_order.xml b/examples/xmlpatterns/schema/files/invalid_order.xml new file mode 100644 index 0000000..8ffc5fd --- /dev/null +++ b/examples/xmlpatterns/schema/files/invalid_order.xml @@ -0,0 +1,13 @@ + + 234219 +
+ 21692 + 3 +
+
+ 24749 + 9 +
+ 2009-01-23 + yes +
diff --git a/examples/xmlpatterns/schema/files/invalid_recipe.xml b/examples/xmlpatterns/schema/files/invalid_recipe.xml new file mode 100644 index 0000000..4d75af6 --- /dev/null +++ b/examples/xmlpatterns/schema/files/invalid_recipe.xml @@ -0,0 +1,14 @@ + + Cheese on Toast + + + diff --git a/examples/xmlpatterns/schema/files/order.xsd b/examples/xmlpatterns/schema/files/order.xsd new file mode 100644 index 0000000..405cafe --- /dev/null +++ b/examples/xmlpatterns/schema/files/order.xsd @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/xmlpatterns/schema/files/recipe.xsd b/examples/xmlpatterns/schema/files/recipe.xsd new file mode 100644 index 0000000..bbbafd9 --- /dev/null +++ b/examples/xmlpatterns/schema/files/recipe.xsd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/xmlpatterns/schema/files/valid_contact.xml b/examples/xmlpatterns/schema/files/valid_contact.xml new file mode 100644 index 0000000..53c04d4 --- /dev/null +++ b/examples/xmlpatterns/schema/files/valid_contact.xml @@ -0,0 +1,11 @@ + + John + Doe + 1977-12-25 + + Sandakerveien 116 + N-0550 + Oslo + Norway + + diff --git a/examples/xmlpatterns/schema/files/valid_order.xml b/examples/xmlpatterns/schema/files/valid_order.xml new file mode 100644 index 0000000..f83c36c --- /dev/null +++ b/examples/xmlpatterns/schema/files/valid_order.xml @@ -0,0 +1,18 @@ + + 194223 +
+ 22242 + 5 +
+
+ 32372 + 12 + without stripes +
+
+ 23649 + 2 +
+ 2009-01-23 + true +
diff --git a/examples/xmlpatterns/schema/files/valid_recipe.xml b/examples/xmlpatterns/schema/files/valid_recipe.xml new file mode 100644 index 0000000..f6499ba --- /dev/null +++ b/examples/xmlpatterns/schema/files/valid_recipe.xml @@ -0,0 +1,13 @@ + + Cheese on Toast + + + -- cgit v0.12 From adad01b142a0839a9c6e59275844f0c38924c25d Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Tue, 19 May 2009 16:18:07 +0200 Subject: Remove unneeded qDebug statement --- src/xmlpatterns/schema/qxsdschemaparser.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index cabc12e..3cd21af 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -251,7 +251,6 @@ void XsdSchemaParser::setTargetNamespaceExtended(const QString &targetNamespace) void XsdSchemaParser::setDocumentURI(const QUrl &uri) { - qDebug("%s", qPrintable(uri.toString())); m_documentURI = uri; // prevent to get included/imported/redefined twice -- cgit v0.12 From 317ab44d0c99fbc8b0a9f4136a107ad5d17e4539 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Tue, 19 May 2009 18:24:22 +0200 Subject: Extend auto tests for namepool checks --- tests/auto/qxmlschema/tst_qxmlschema.cpp | 4 ++ .../tst_qxmlschemavalidator.cpp | 62 ++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/tests/auto/qxmlschema/tst_qxmlschema.cpp b/tests/auto/qxmlschema/tst_qxmlschema.cpp index 7fc59bb..33978e8 100644 --- a/tests/auto/qxmlschema/tst_qxmlschema.cpp +++ b/tests/auto/qxmlschema/tst_qxmlschema.cpp @@ -118,6 +118,10 @@ void tst_QXmlSchema::constructorQXmlNamePool() const QCOMPARE(name.namespaceUri(np2), QString::fromLatin1("http://example.com/")); QCOMPARE(name.localName(np2), QString::fromLatin1("localName")); QCOMPARE(name.prefix(np2), QString::fromLatin1("prefix")); + + // make sure namePool() is const + const QXmlSchema constSchema; + np = constSchema.namePool(); } void tst_QXmlSchema::copyMutationTest() const diff --git a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp index 3bbf506..0f15bc8 100644 --- a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp +++ b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp @@ -33,7 +33,9 @@ class tst_QXmlSchemaValidator : public QObject private Q_SLOTS: void defaultConstructor() const; + void constructorQXmlNamePool() const; void propertyInitialization() const; + void resetSchemaNamePool() const; void loadInstanceUrlSuccess() const; void loadInstanceUrlFail() const; @@ -119,6 +121,66 @@ void tst_QXmlSchemaValidator::propertyInitialization() const } } +void tst_QXmlSchemaValidator::constructorQXmlNamePool() const +{ + // test that the name pool from the schema is used by + // the schema validator as well + QXmlSchema schema; + + QXmlNamePool np = schema.namePool(); + + const QXmlName name(np, QLatin1String("localName"), + QLatin1String("http://example.com/"), + QLatin1String("prefix")); + + QXmlSchemaValidator validator(schema); + + QXmlNamePool np2(validator.namePool()); + QCOMPARE(name.namespaceUri(np2), QString::fromLatin1("http://example.com/")); + QCOMPARE(name.localName(np2), QString::fromLatin1("localName")); + QCOMPARE(name.prefix(np2), QString::fromLatin1("prefix")); + + // make sure namePool() is const + const QXmlSchemaValidator constValidator(schema); + np = constValidator.namePool(); +} + +void tst_QXmlSchemaValidator::resetSchemaNamePool() const +{ + QXmlSchema schema1; + QXmlNamePool np1 = schema1.namePool(); + + const QXmlName name1(np1, QLatin1String("localName"), + QLatin1String("http://example.com/"), + QLatin1String("prefix")); + + QXmlSchemaValidator validator(schema1); + + { + QXmlNamePool compNamePool(validator.namePool()); + QCOMPARE(name1.namespaceUri(compNamePool), QString::fromLatin1("http://example.com/")); + QCOMPARE(name1.localName(compNamePool), QString::fromLatin1("localName")); + QCOMPARE(name1.prefix(compNamePool), QString::fromLatin1("prefix")); + } + + QXmlSchema schema2; + QXmlNamePool np2 = schema2.namePool(); + + const QXmlName name2(np2, QLatin1String("remoteName"), + QLatin1String("http://trolltech.com/"), + QLatin1String("suffix")); + + // make sure that after re-setting the schema, the new namepool is used + validator.setSchema(schema2); + + { + QXmlNamePool compNamePool(validator.namePool()); + QCOMPARE(name2.namespaceUri(compNamePool), QString::fromLatin1("http://trolltech.com/")); + QCOMPARE(name2.localName(compNamePool), QString::fromLatin1("remoteName")); + QCOMPARE(name2.prefix(compNamePool), QString::fromLatin1("suffix")); + } +} + void tst_QXmlSchemaValidator::loadInstanceUrlSuccess() const { /* -- cgit v0.12 From ab5833178307fa9370868f61ff4cc7b18eb51fc0 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Tue, 19 May 2009 18:59:30 +0200 Subject: Forward errors from QXmlStreamReader to XsdSchemaParser (missed this commit on the first merge, autotest works again) --- src/xmlpatterns/schema/qxsdschemaparser.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 3cd21af..b74964d 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -290,6 +290,9 @@ bool XsdSchemaParser::parse(ParserType parserType) m_schemaResolver->addComponentLocationHash(m_componentLocationHash); m_schemaResolver->setDefaultOpenContent(m_defaultOpenContent, m_defaultOpenContentAppliesToEmpty); + if (QXmlStreamReader::error() != QXmlStreamReader::NoError) + error(errorString()); + return true; } -- cgit v0.12 From 9519f3ee67c8ab2de8d1ab5e584f8d3adb8875bd Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Tue, 19 May 2009 20:04:10 +0200 Subject: Document xml schema enum in QRegExp --- src/corelib/tools/qregexp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index f69a99f..664dfc0 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -3700,6 +3700,9 @@ static void invalidateEngine(QRegExpPrivate *priv) equivalent to using the RegExp pattern on a string in which all metacharacters are escaped using escape(). + \value W3CXmlSchema11 The pattern is a regular expression as + defined by the W3C XML Schema 1.1 specification. + \sa setPatternSyntax() */ -- cgit v0.12 From f66a475a236649c94a47f668ba3461bdc325c308 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Tue, 19 May 2009 20:09:09 +0200 Subject: First version of documentation for schema example --- doc/src/examples.qdoc | 1 + doc/src/examples/schema.qdoc | 58 +++++++++++++++++++++++++++++ doc/src/images/schema-example.png | Bin 0 -> 84320 bytes examples/xmlpatterns/schema/mainwindow.cpp | 19 ++++++---- examples/xmlpatterns/schema/schema.ui | 2 +- src/xmlpatterns/api/qxmlschema.cpp | 10 +++++ 6 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 doc/src/examples/schema.qdoc create mode 100644 doc/src/images/schema-example.png diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 29c6c0b..a0e9b23 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -398,6 +398,7 @@ \o \l{xmlpatterns/qobjectxmlmodel}{QObject XML Model Example} \o \l{xmlpatterns/xquery/globalVariables}{C++ Source Code Analyzer Example} \o \l{xmlpatterns/trafficinfo}{Traffic Info}\raisedaster + \o \l{xmlpatterns/schema}{XML Schema Validation}\raisedaster \endlist \section1 Inter-Process Communication diff --git a/doc/src/examples/schema.qdoc b/doc/src/examples/schema.qdoc new file mode 100644 index 0000000..2287796 --- /dev/null +++ b/doc/src/examples/schema.qdoc @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example xmlpatterns/schema + \title XML Schema Validation Example + + This example shows how to use QtXmlPatterns to validate XML with + a W3C XML Schema. + + \section1 Introduction + + The example application shows different XML schema definitions and + for every definition two XML instance documents, one that is valid + according to the schema and one that is not. + The user can select the valid or invalid instance document, change + it and validate it again. + + \image schema-example.png +*/ diff --git a/doc/src/images/schema-example.png b/doc/src/images/schema-example.png new file mode 100644 index 0000000..5e95bf5 Binary files /dev/null and b/doc/src/images/schema-example.png differ diff --git a/examples/xmlpatterns/schema/mainwindow.cpp b/examples/xmlpatterns/schema/mainwindow.cpp index 6b43d7b..98276a3 100644 --- a/examples/xmlpatterns/schema/mainwindow.cpp +++ b/examples/xmlpatterns/schema/mainwindow.cpp @@ -69,7 +69,8 @@ class MessageHandler : public QAbstractMessageHandler } protected: - virtual void handleMessage(QtMsgType type, const QString &description, const QUrl &identifier, const QSourceLocation &sourceLocation) + virtual void handleMessage(QtMsgType type, const QString &description, + const QUrl &identifier, const QSourceLocation &sourceLocation) { Q_UNUSED(type); Q_UNUSED(identifier); @@ -127,7 +128,7 @@ void MainWindow::schemaSelected(int index) QFile schemaFile(QString(":/schema_%1.xsd").arg(index)); schemaFile.open(QIODevice::ReadOnly); - const QString schemaText(QString::fromLatin1(schemaFile.readAll())); + const QString schemaText(QString::fromUtf8(schemaFile.readAll())); schemaView->setPlainText(schemaText); validate(); @@ -137,7 +138,7 @@ void MainWindow::instanceSelected(int index) { QFile instanceFile(QString(":/instance_%1.xml").arg((2*schemaSelection->currentIndex()) + index)); instanceFile.open(QIODevice::ReadOnly); - const QString instanceText(QString::fromLatin1(instanceFile.readAll())); + const QString instanceText(QString::fromUtf8(instanceFile.readAll())); instanceEdit->setPlainText(instanceText); validate(); @@ -145,22 +146,22 @@ void MainWindow::instanceSelected(int index) void MainWindow::validate() { - const QByteArray schemaData = schemaView->toPlainText().toLatin1(); - const QByteArray instanceData = instanceEdit->toPlainText().toLatin1(); + const QByteArray schemaData = schemaView->toPlainText().toUtf8(); + const QByteArray instanceData = instanceEdit->toPlainText().toUtf8(); MessageHandler messageHandler; QXmlSchema schema; schema.setMessageHandler(&messageHandler); - schema.load(schemaData, QUrl("http://dummySchemaUrl/")); + schema.load(schemaData); bool errorOccurred = false; if (!schema.isValid()) { errorOccurred = true; } else { QXmlSchemaValidator validator(schema); - if (!validator.validate(instanceData, QUrl("http://dummyInstanceUrl"))) + if (!validator.validate(instanceData)) errorOccurred = true; } @@ -171,7 +172,9 @@ void MainWindow::validate() validationStatus->setText(tr("validation successful")); } - QString styleSheet = QString("QLabel {background: %1; padding: 3px}").arg(errorOccurred ? QColor(Qt::red).lighter(160).name() : QColor(Qt::green).lighter(160).name()); + const QString styleSheet = QString("QLabel {background: %1; padding: 3px}") + .arg(errorOccurred ? QColor(Qt::red).lighter(160).name() : + QColor(Qt::green).lighter(160).name()); validationStatus->setStyleSheet(styleSheet); } diff --git a/examples/xmlpatterns/schema/schema.ui b/examples/xmlpatterns/schema/schema.ui index af7020a..b67f444 100644 --- a/examples/xmlpatterns/schema/schema.ui +++ b/examples/xmlpatterns/schema/schema.ui @@ -11,7 +11,7 @@ - MainWindow + XML Schema Validation diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index aa5b77c..8e14f3f 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -88,6 +88,9 @@ QXmlSchema::~QXmlSchema() /*! Sets this QXmlSchema to a schema loaded from the \a source URI. + + If the schema \l {isValid()} {is invalid}, \c{false} is returned + and the behavior is undefined. */ bool QXmlSchema::load(const QUrl &source) { @@ -107,6 +110,10 @@ bool QXmlSchema::load(const QUrl &source) If \a source is \c null or not readable, or if \a documentUri is not a valid URI, behavior is undefined. + + If the schema \l {isValid()} {is invalid}, \c{false} is returned + and the behavior is undefined. + \sa isValid() */ bool QXmlSchema::load(QIODevice *source, const QUrl &documentUri) @@ -125,6 +132,9 @@ bool QXmlSchema::load(QIODevice *source, const QUrl &documentUri) If \a documentUri is not a valid URI, behavior is undefined. \sa isValid() + + If the schema \l {isValid()} {is invalid}, \c{false} is returned + and the behavior is undefined. */ bool QXmlSchema::load(const QByteArray &data, const QUrl &documentUri) { -- cgit v0.12 From 676d97d56a96c46cd9b9a2d6ba5d5f535f974d42 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Wed, 20 May 2009 21:11:14 +0200 Subject: Complete documentation of schema example and reference it from api docs --- doc/src/examples/schema.qdoc | 85 +++++++++++++++++++++++++++++ examples/xmlpatterns/schema/mainwindow.cpp | 10 ++++ src/xmlpatterns/api/qxmlschema.cpp | 2 + src/xmlpatterns/api/qxmlschemavalidator.cpp | 2 + 4 files changed, 99 insertions(+) diff --git a/doc/src/examples/schema.qdoc b/doc/src/examples/schema.qdoc index 2287796..80d158b 100644 --- a/doc/src/examples/schema.qdoc +++ b/doc/src/examples/schema.qdoc @@ -46,6 +46,8 @@ This example shows how to use QtXmlPatterns to validate XML with a W3C XML Schema. + \tableofcontents + \section1 Introduction The example application shows different XML schema definitions and @@ -54,5 +56,88 @@ The user can select the valid or invalid instance document, change it and validate it again. + \section2 The User Interface + + The UI for this example was created using \l{Qt Designer Manual} {Qt + Designer}: + \image schema-example.png + + The UI consists of three parts, at the top the XML schema \l{QComboBox} {selection} + and the schema \l{QTextBrowser} {viewer}, below the XML instance \l{QComboBox} {selection} + and the instance \l{QTextEdit} {editor} and at the bottom the validation status \l{QLabel} {label} + next to the validation \l{QPushButton} {button}. + + \section2 Validating XML Instance Documents + + You can select one of the three predefined XML schemas and for each schema + an valid or invalid instance document. A click on the 'Validate' button will + validate the content of the XML instance editor against the schema from the + XML schema viewer. As you can modify the content of the instance editor, different + instances can be tested and validation error messages analysed. + + \section1 Code Walk-Through + + The example's main() function creates the standard instance of + QApplication. Then it creates an instance of the mainwindow class, shows it, + and starts the Qt event loop: + + \snippet examples/xmlpatterns/schema/main.cpp 0 + + \section2 The UI Class: MainWindow + + The example's UI is a conventional Qt GUI application inheriting + QMainWindow and the class generated by \l{Qt Designer Manual} {Qt + Designer}: + + \snippet examples/xmlpatterns/schema/mainwindow.h 0 + + The constructor fills the schema and instance \l{QComboBox} selections with the predefined + schemas and instances and connects their \l{QComboBox::currentIndexChanged()} {currentIndexChanged()} + signals to the window's \c{schemaSelected()} resp. \c{instanceSelected()} slot. + Furthermore the signal-slot connections for the validation \l{QPushButton} {button} + and the instance \l{QTextEdit} {editor} are set up. + + The call to \c{schemaSelected(0)} and \c{instanceSelected(0)} will trigger the validation + of the initial Contact Schema example. + + \snippet examples/xmlpatterns/schema/mainwindow.cpp 0 + + In the \c{schemaSelected()} slot the content of the instance \l{QComboBox} {selection} + is adapted to the selected schema and the corresponding schema is loaded from the + \l{The Qt Resource System} {resource file} and displayed in the schema \l{QTextBrowser} {viewer}. + At the end of the method a revalidation is triggered. + + \snippet examples/xmlpatterns/schema/mainwindow.cpp 1 + + In the \c{instanceSelected()} slot the selected instance is loaded from the + \l{The Qt Resource System} {resource file} and loaded into the instance \l{QTextEdit} {editor} + an the revalidation is triggered again. + + \snippet examples/xmlpatterns/schema/mainwindow.cpp 2 + + The \c{validate()} slot does the actual work in this example. + At first it stores the content of the schema \l{QTextBrowser} {viewer} and the + \l{QTextEdit} {editor} into temporary \l{QByteArray} {variables}. + Then it instanciates a \c{MessageHandler} object which inherits from + \l{QAbstractMessageHandler} {QAbstractMessageHandler} and is a convenience + class to store error messages from the XmlPatterns system. + + \snippet examples/xmlpatterns/schema/mainwindow.cpp 4 + + After the \l{QXmlSchema} {QXmlSchema} is instanciated and the message handler set + on it, the \l{QXmlSchema::load()} {load()} method is called with the schema data as argument. + If the schema is invalid or a parsing error has occured, \l{QXmlSchema::isValid()} {isValid()} + returns \c{false} and the error is flagged in \c{errorOccurred}. + If the loading was successful, a \l{QXmlSchemaValidator} {QXmlSchemaValidator} is + instanciated and the schema passed in the constructor. + A call to \l{QXmlSchemaValidator::validate()} {validate()} will validate the passed + XML instance data against the XML schema. The return value of that method signals + whether the validation was successful. + Depending on the success the status \l{QLabel} {label} is set to 'validation successful' + or the error message stored in the \c{MessageHandler} + + The rest of the code does only some fancy coloring and eyecandy. + + \snippet examples/xmlpatterns/schema/mainwindow.cpp 3 */ diff --git a/examples/xmlpatterns/schema/mainwindow.cpp b/examples/xmlpatterns/schema/mainwindow.cpp index 98276a3..bee7407 100644 --- a/examples/xmlpatterns/schema/mainwindow.cpp +++ b/examples/xmlpatterns/schema/mainwindow.cpp @@ -45,6 +45,7 @@ #include "mainwindow.h" #include "xmlsyntaxhighlighter.h" +//! [4] class MessageHandler : public QAbstractMessageHandler { public: @@ -85,7 +86,9 @@ class MessageHandler : public QAbstractMessageHandler QString m_description; QSourceLocation m_sourceLocation; }; +//! [4] +//! [0] MainWindow::MainWindow() { setupUi(this); @@ -110,7 +113,9 @@ MainWindow::MainWindow() schemaSelected(0); instanceSelected(0); } +//! [0] +//! [1] void MainWindow::schemaSelected(int index) { instanceSelection->clear(); @@ -133,7 +138,9 @@ void MainWindow::schemaSelected(int index) validate(); } +//! [1] +//! [2] void MainWindow::instanceSelected(int index) { QFile instanceFile(QString(":/instance_%1.xml").arg((2*schemaSelection->currentIndex()) + index)); @@ -143,7 +150,9 @@ void MainWindow::instanceSelected(int index) validate(); } +//! [2] +//! [3] void MainWindow::validate() { const QByteArray schemaData = schemaView->toPlainText().toUtf8(); @@ -177,6 +186,7 @@ void MainWindow::validate() QColor(Qt::green).lighter(160).name()); validationStatus->setStyleSheet(styleSheet); } +//! [3] void MainWindow::textChanged() { diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index 8e14f3f..62b6a0e 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -57,6 +57,8 @@ The QXmlSchema class loads, compiles and validates W3C XML Schema files that can be used further for validation of XML instance documents via \l{QXmlSchemaValidator}. + + \sa QXmlSchemaValidator, {xmlpatterns/schema}{XML Schema Validation Example} */ /*! diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index 7a4ce03..a69b081 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -62,6 +62,8 @@ The QXmlSchemaValidator class loads, parses an XML instance document and validates it against a W3C XML Schema that has been compiled with \l{QXmlSchema}. + + \sa QXmlSchema, {xmlpatterns/schema}{XML Schema Validation Example} */ /*! -- cgit v0.12 From be0285b193d23fcf28ad84a73895ad15ece18e4c Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Thu, 21 May 2009 12:25:00 +0200 Subject: Added code snippets for QXmlSchema and referenced them from api docs --- doc/src/snippets/qxmlschema/main.cpp | 118 +++++++++++++++++++++++++++++ doc/src/snippets/qxmlschema/qxmlschema.pro | 3 + doc/src/snippets/snippets.pro | 1 + src/xmlpatterns/api/qxmlschema.cpp | 16 ++++ 4 files changed, 138 insertions(+) create mode 100644 doc/src/snippets/qxmlschema/main.cpp create mode 100644 doc/src/snippets/qxmlschema/qxmlschema.pro diff --git a/doc/src/snippets/qxmlschema/main.cpp b/doc/src/snippets/qxmlschema/main.cpp new file mode 100644 index 0000000..9e72f40 --- /dev/null +++ b/doc/src/snippets/qxmlschema/main.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +class Schema +{ + public: + void loadFromUrl() const; + void loadFromFile() const; + void loadFromData() const; +}; + +void Schema::loadFromUrl() const +{ +//! [0] + QUrl url("http://www.schema-example.org/myschema.xsd"); + + QXmlSchema schema; + if (schema.load(url) == true) + qDebug() << "schema is valid"; + else + qDebug() << "schema is invalid"; +//! [0] +} + +void Schema::loadFromFile() const +{ +//! [1] + QFile file("myschema.xsd"); + file.open(QIODevice::ReadOnly); + + QXmlSchema schema; + schema.load(&file, QUrl::fromLocalFile(file.fileName())); + + if (schema.isValid()) + qDebug() << "schema is valid"; + else + qDebug() << "schema is invalid"; +//! [1] +} + +void Schema::loadFromData() const +{ +//! [2] + QByteArray data( "" + "" + "" ); + + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly); + + QXmlSchema schema; + schema.load(&buffer); + + if (schema.isValid()) + qDebug() << "schema is valid"; + else + qDebug() << "schema is invalid"; +//! [2] +} + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + + Schema schema; + + schema.loadFromUrl(); + schema.loadFromFile(); + schema.loadFromData(); + + return 0; +} diff --git a/doc/src/snippets/qxmlschema/qxmlschema.pro b/doc/src/snippets/qxmlschema/qxmlschema.pro new file mode 100644 index 0000000..7e8782a --- /dev/null +++ b/doc/src/snippets/qxmlschema/qxmlschema.pro @@ -0,0 +1,3 @@ +SOURCES += main.cpp + +QT += xmlpatterns diff --git a/doc/src/snippets/snippets.pro b/doc/src/snippets/snippets.pro index 50e33b3..e7219a6 100644 --- a/doc/src/snippets/snippets.pro +++ b/doc/src/snippets/snippets.pro @@ -73,6 +73,7 @@ SUBDIRS = brush \ quiloader \ qx11embedcontainer \ qx11embedwidget \ + qxmlschema \ reading-selections \ scribe-overview \ separations \ diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index 62b6a0e..ec370ca 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -93,6 +93,12 @@ QXmlSchema::~QXmlSchema() If the schema \l {isValid()} {is invalid}, \c{false} is returned and the behavior is undefined. + + Example: + + \snippet doc/src/snippets/qxmlschema/main.cpp 0 + + \sa isValid() */ bool QXmlSchema::load(const QUrl &source) { @@ -116,6 +122,10 @@ bool QXmlSchema::load(const QUrl &source) If the schema \l {isValid()} {is invalid}, \c{false} is returned and the behavior is undefined. + Example: + + \snippet doc/src/snippets/qxmlschema/main.cpp 1 + \sa isValid() */ bool QXmlSchema::load(QIODevice *source, const QUrl &documentUri) @@ -137,6 +147,12 @@ bool QXmlSchema::load(QIODevice *source, const QUrl &documentUri) If the schema \l {isValid()} {is invalid}, \c{false} is returned and the behavior is undefined. + + Example: + + \snippet doc/src/snippets/qxmlschema/main.cpp 2 + + \sa isValid() */ bool QXmlSchema::load(const QByteArray &data, const QUrl &documentUri) { -- cgit v0.12 From b24611f14453e6b870e25bdc3edcd4f6447ae87e Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Thu, 21 May 2009 15:16:40 +0200 Subject: Added code snippets for QXmlSchemaValidator and referenced them from api docs --- doc/src/snippets/qxmlschemavalidator/main.cpp | 137 +++++++++++++++++++++ .../qxmlschemavalidator/qxmlschemavalidator.pro | 3 + doc/src/snippets/snippets.pro | 1 + src/xmlpatterns/api/qxmlschemavalidator.cpp | 12 ++ 4 files changed, 153 insertions(+) create mode 100644 doc/src/snippets/qxmlschemavalidator/main.cpp create mode 100644 doc/src/snippets/qxmlschemavalidator/qxmlschemavalidator.pro diff --git a/doc/src/snippets/qxmlschemavalidator/main.cpp b/doc/src/snippets/qxmlschemavalidator/main.cpp new file mode 100644 index 0000000..13cd45f --- /dev/null +++ b/doc/src/snippets/qxmlschemavalidator/main.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +class SchemaValidator +{ + public: + void validateFromUrl() const; + void validateFromFile() const; + void validateFromData() const; + + private: + QXmlSchema getSchema() const; +}; + +void SchemaValidator::validateFromUrl() const +{ +//! [0] + const QXmlSchema schema = getSchema(); + + const QUrl url("http://www.schema-example.org/test.xml"); + + QXmlSchemaValidator validator(schema); + if (validator.validate(url)) + qDebug() << "instance document is valid"; + else + qDebug() << "instance document is invalid"; +//! [0] +} + +void SchemaValidator::validateFromFile() const +{ +//! [1] + const QXmlSchema schema = getSchema(); + + QFile file("test.xml"); + file.open(QIODevice::ReadOnly); + + QXmlSchemaValidator validator(schema); + if (validator.validate(&file, QUrl::fromLocalFile(file.fileName()))) + qDebug() << "instance document is valid"; + else + qDebug() << "instance document is invalid"; +//! [1] +} + +void SchemaValidator::validateFromData() const +{ +//! [2] + const QXmlSchema schema = getSchema(); + + QByteArray data("" + ""); + + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly); + + QXmlSchemaValidator validator(schema); + if (validator.validate(&buffer)) + qDebug() << "instance document is valid"; + else + qDebug() << "instance document is invalid"; +//! [2] +} + +QXmlSchema SchemaValidator::getSchema() const +{ + QByteArray data("" + "" + ""); + + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly); + + QXmlSchema schema; + schema.load(&buffer); + + return schema; +} + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + + SchemaValidator validator; + + validator.validateFromUrl(); + validator.validateFromFile(); + validator.validateFromData(); + + return 0; +} diff --git a/doc/src/snippets/qxmlschemavalidator/qxmlschemavalidator.pro b/doc/src/snippets/qxmlschemavalidator/qxmlschemavalidator.pro new file mode 100644 index 0000000..7e8782a --- /dev/null +++ b/doc/src/snippets/qxmlschemavalidator/qxmlschemavalidator.pro @@ -0,0 +1,3 @@ +SOURCES += main.cpp + +QT += xmlpatterns diff --git a/doc/src/snippets/snippets.pro b/doc/src/snippets/snippets.pro index e7219a6..e3e7eca 100644 --- a/doc/src/snippets/snippets.pro +++ b/doc/src/snippets/snippets.pro @@ -74,6 +74,7 @@ SUBDIRS = brush \ qx11embedcontainer \ qx11embedwidget \ qxmlschema \ + qxmlschemavalidator \ reading-selections \ scribe-overview \ separations \ diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index a69b081..b72b1ef 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -106,6 +106,10 @@ void QXmlSchemaValidator::setSchema(const QXmlSchema &schema) Returns \c true if the XML instance document is valid according the schema, \c false otherwise. + + Example: + + \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 2 */ bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentUri) const { @@ -122,6 +126,10 @@ bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentU Returns \c true if the XML instance document is valid according the schema, \c false otherwise. + + Example: + + \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 0 */ bool QXmlSchemaValidator::validate(const QUrl &source) const { @@ -143,6 +151,10 @@ bool QXmlSchemaValidator::validate(const QUrl &source) const Returns \c true if the XML instance document is valid according the schema, \c false otherwise. + + Example: + + \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 1 */ bool QXmlSchemaValidator::validate(QIODevice *source, const QUrl &documentUri) const { -- cgit v0.12 From 9281f4c219cec2e6a1e24b43e1edd0feb0fcfce5 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 29 May 2009 14:45:35 +0200 Subject: First bunch of changes after an very first API review This basically move some logic from the scene to the index base class. Lot of work need to be done in order to benefits from the device transform. The sorting needs to be move in the BSP tree. --- src/gui/graphicsview/graphicsview.pri | 1 + src/gui/graphicsview/qgraphicsitem.cpp | 17 +- src/gui/graphicsview/qgraphicsitem.h | 4 + src/gui/graphicsview/qgraphicsscene.cpp | 618 +++------------------ src/gui/graphicsview/qgraphicsscene.h | 9 + src/gui/graphicsview/qgraphicsscene_bsp.cpp | 12 +- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 8 +- src/gui/graphicsview/qgraphicsscene_p.h | 88 ++- .../graphicsview/qgraphicsscenebsptreeindex_p.cpp | 120 ++-- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 18 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 558 +++++++++++++++++-- src/gui/graphicsview/qgraphicssceneindex.h | 50 +- src/gui/graphicsview/qgraphicssceneindex_p.h | 96 ++++ src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 17 +- src/gui/graphicsview/qgraphicsview.cpp | 21 +- 15 files changed, 857 insertions(+), 780 deletions(-) create mode 100644 src/gui/graphicsview/qgraphicssceneindex_p.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index 9097497..cc57892 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -10,6 +10,7 @@ HEADERS += \ graphicsview/qgraphicsscene_bsp_p.h \ graphicsview/qgraphicsscenelinearindex_p.h \ graphicsview/qgraphicssceneindex.h \ + graphicsview/qgraphicssceneindex_p.h \ graphicsview/qgraphicssceneevent.h \ graphicsview/qgraphicsview_p.h \ graphicsview/qgraphicsview.h diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index c1d44d3..fc5895c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -567,17 +567,6 @@ QT_BEGIN_NAMESPACE -// QRectF::intersects() returns false always if either the source or target -// rectangle's width or height are 0. This works around that problem. -static inline void _q_adjustRect(QRectF *rect) -{ - Q_ASSERT(rect); - if (!rect->width()) - rect->adjust(-0.00001, 0, 0.00001, 0); - if (!rect->height()) - rect->adjust(0, -0.00001, 0, 0.00001); -} - static inline void _q_adjustRect(QRect *rect) { Q_ASSERT(rect); @@ -6357,7 +6346,7 @@ void QGraphicsItem::addToIndex() return; } if (d_ptr->scene) - d_ptr->scene->d_func()->index->insertItem(this); + d_ptr->scene->d_func()->index->addItem(this); d_ptr->updateHelper(); } @@ -6372,7 +6361,7 @@ void QGraphicsItem::removeFromIndex() { d_ptr->updateHelper(); if (d_ptr->scene) - d_ptr->scene->d_func()->index->removeItem(this,false); + d_ptr->scene->d_func()->index->removeItem(this); } /*! @@ -6393,7 +6382,7 @@ void QGraphicsItem::prepareGeometryChange() if (d_ptr->scene) { d_ptr->updateHelper(QRectF(), false, /*maybeDirtyClipPath=*/!d_ptr->inSetPosHelper); QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func(); - scenePrivate->index->updateItem(this); + scenePrivate->index->prepareBoundingRectChange(this); } if (d_ptr->inSetPosHelper) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index cb86020..e244c13 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -409,6 +409,8 @@ protected: virtual void setExtension(Extension extension, const QVariant &variant); virtual QVariant extension(const QVariant &variant) const; + bool operator<(const QGraphicsItem *other) const; + protected: QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); @@ -430,6 +432,8 @@ private: friend class QGraphicsWidget; friend class QGraphicsWidgetPrivate; friend class QGraphicsProxyWidgetPrivate; + friend class QGraphicsSceneIndex; + friend class QGraphicsSceneIndexPrivate; friend class QGraphicsSceneBspTreeIndex; friend class ::tst_QGraphicsItem; friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 51c8294..9b6d40b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -249,65 +249,6 @@ QT_BEGIN_NAMESPACE -static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) -{ - qreal xp = s.left(); - qreal yp = s.top(); - qreal w = s.width(); - qreal h = s.height(); - qreal l1 = xp; - qreal r1 = xp; - if (w < 0) - l1 += w; - else - r1 += w; - - qreal l2 = r.left(); - qreal r2 = r.left(); - if (w < 0) - l2 += r.width(); - else - r2 += r.width(); - - if (l1 >= r2 || l2 >= r1) - return false; - - qreal t1 = yp; - qreal b1 = yp; - if (h < 0) - t1 += h; - else - b1 += h; - - qreal t2 = r.top(); - qreal b2 = r.top(); - if (r.height() < 0) - t2 += r.height(); - else - b2 += r.height(); - - return !(t1 >= b2 || t2 >= b1); -} - -// QRectF::intersects() returns false always if either the source or target -// rectangle's width or height are 0. This works around that problem. -static inline void _q_adjustRect(QRectF *rect) -{ - Q_ASSERT(rect); - if (!rect->width()) - rect->adjust(-0.00001, 0, 0.00001, 0); - if (!rect->height()) - rect->adjust(0, -0.00001, 0, 0.00001); -} - -static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item) -{ - Q_ASSERT(item); - QRectF boundingRect(item->boundingRect()); - _q_adjustRect(&boundingRect); - return boundingRect; -} - static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent) { hover->setWidget(mouseEvent->widget()); @@ -374,21 +315,6 @@ void QGraphicsScenePrivate::init() /*! \internal */ -QList QGraphicsScenePrivate::estimateItemsInRect(const QRectF &rect) const -{ - const_cast(this)->_q_updateSortCache(); - - // ### Only do this once in a while. - QGraphicsScenePrivate *that = const_cast(this); - - // Get items from index - return that->index->items(rect); - -} - -/*! - \internal -*/ void QGraphicsScenePrivate::_q_emitUpdated() { Q_Q(QGraphicsScene); @@ -528,7 +454,7 @@ void QGraphicsScenePrivate::_q_removeItemLater(QGraphicsItem *item) item->clearFocus(); //We ask for a removing in the index - this->index->removeItem(item, true); + this->index->deleteItem(item); // Reset the mouse grabber and focus item data. if (item == focusItem) @@ -1145,444 +1071,6 @@ QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item) return 0; } - -QList QGraphicsScenePrivate::items_helper(const QPointF &pos) const -{ - QList items; - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - QRectF adjustedRect = QRectF(pos, QSize(1,1)); - foreach (QGraphicsItem *item, estimateItemsInRect(adjustedRect)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - // Rect intersects/contains item's shape - if (QRectF_intersects(adjustedRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (item->contains(xinv.map(pos))) { - items << item; - keep = true; - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - // Recurse into children that clip children. - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) - childItems_helper(&items, item, xinv.map(pos)); - } - } - - sortItems(&items, Qt::AscendingOrder, sortCacheEnabled); - return items; -} - -QList QGraphicsScenePrivate::items_helper(const QRectF &rect, - Qt::ItemSelectionMode mode, - Qt::SortOrder order) const -{ - QList items; - - QPainterPath path; - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - QRectF adjustedRect(rect); - _q_adjustRect(&adjustedRect); - foreach (QGraphicsItem *item, estimateItemsInRect(adjustedRect)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Rect intersects/contains item's bounding rect - QRectF mbr = x.mapRect(br); - if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) - || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(mbr))) { - items << item; - keep = true; - } - } else { - // Rect intersects/contains item's shape - if (QRectF_intersects(adjustedRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (path.isEmpty()) - path.addRect(rect); - if (itemCollidesWithPath(item, xinv.map(path), mode)) { - items << item; - keep = true; - } - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - // Recurse into children that clip children. - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (x.type() <= QTransform::TxScale) { - // Rect - childItems_helper(&items, item, xinv.mapRect(rect), mode); - } else { - // Polygon - childItems_helper(&items, item, xinv.map(rect), mode); - } - } - } - } - - if (order != Qt::SortOrder(-1)) - sortItems(&items, order, sortCacheEnabled); - return items; -} - -QList QGraphicsScenePrivate::items_helper(const QPolygonF &polygon, - Qt::ItemSelectionMode mode, - Qt::SortOrder order) const -{ - QList items; - - QRectF polyRect(polygon.boundingRect()); - _q_adjustRect(&polyRect); - QPainterPath path; - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - foreach (QGraphicsItem *item, estimateItemsInRect(polyRect)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Polygon contains/intersects item's bounding rect - if (path == QPainterPath()) - path.addPolygon(polygon); - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) { - items << item; - keep = true; - } - } else { - // Polygon contains/intersects item's shape - if (QRectF_intersects(polyRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (path == QPainterPath()) - path.addPolygon(polygon); - if (itemCollidesWithPath(item, xinv.map(path), mode)) { - items << item; - keep = true; - } - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - // Recurse into children that clip children. - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) - childItems_helper(&items, item, xinv.map(polygon), mode); - } - } - - if (order != Qt::SortOrder(-1)) - sortItems(&items, order, sortCacheEnabled); - return items; -} - -QList QGraphicsScenePrivate::items_helper(const QPainterPath &path, - Qt::ItemSelectionMode mode, - Qt::SortOrder order) const -{ - QList items; - QRectF pathRect(path.controlPointRect()); - _q_adjustRect(&pathRect); - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - foreach (QGraphicsItem *item, estimateItemsInRect(pathRect)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Path contains/intersects item's bounding rect - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) { - items << item; - keep = true; - } - } else { - // Path contains/intersects item's shape - if (QRectF_intersects(pathRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (itemCollidesWithPath(item, xinv.map(path), mode)) { - items << item; - keep = true; - } - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) - childItems_helper(&items, item, xinv.map(path), mode); - } - } - - if (order != Qt::SortOrder(-1)) - sortItems(&items, order, sortCacheEnabled); - return items; -} - -void QGraphicsScenePrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPointF &pos) const -{ - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - // ### is this needed? - if (parentClip && !parent->boundingRect().contains(pos)) - return; - - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->hasTransform && !item->transform().isInvertible()) - continue; - - // Skip invisible items and all their children. - if (item->d_ptr->isInvisible()) - continue; - - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - if (item->contains(item->mapFromParent(pos))) { - items->append(item); - keep = true; - } - } - - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) - // Recurse into children. - childItems_helper(items, item, item->mapFromParent(pos)); - } -} - - -void QGraphicsScenePrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QRectF &rect, - Qt::ItemSelectionMode mode) const -{ - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - QRectF adjustedRect(rect); - _q_adjustRect(&adjustedRect); - QRectF r = !parentClip ? adjustedRect : adjustedRect.intersected(adjustedItemBoundingRect(parent)); - if (r.isEmpty()) - return; - - QPainterPath path; - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->hasTransform && !item->transform().isInvertible()) - continue; - - // Skip invisible items and all their children. - if (item->d_ptr->isInvisible()) - continue; - - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - QRectF mbr = item->mapRectToParent(br); - if (mode >= Qt::ContainsItemBoundingRect) { - // Rect intersects/contains item's bounding rect - if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) - || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(br))) { - items->append(item); - keep = true; - } - } else { - // Rect intersects/contains item's shape - if (QRectF_intersects(rect, mbr)) { - if (path == QPainterPath()) - path.addRect(rect); - if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { - items->append(item); - keep = true; - } - } - } - } - - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { - // Recurse into children. - if (!item->d_ptr->hasTransform || item->transform().type() <= QTransform::TxScale) { - // Rect - childItems_helper(items, item, item->mapRectFromParent(rect), mode); - } else { - // Polygon - childItems_helper(items, item, item->mapFromParent(rect), mode); - } - } - } -} - - -void QGraphicsScenePrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPolygonF &polygon, - Qt::ItemSelectionMode mode) const -{ - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - QRectF polyRect(polygon.boundingRect()); - _q_adjustRect(&polyRect); - QRectF r = !parentClip ? polyRect : polyRect.intersected(adjustedItemBoundingRect(parent)); - if (r.isEmpty()) - return; - - QPainterPath path; - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->hasTransform && !item->transform().isInvertible()) - continue; - - // Skip invisible items. - if (item->d_ptr->isInvisible()) - continue; - - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Polygon contains/intersects item's bounding rect - if (path == QPainterPath()) - path.addPolygon(polygon); - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { - items->append(item); - keep = true; - } - } else { - // Polygon contains/intersects item's shape - if (QRectF_intersects(polyRect, item->mapRectToParent(br))) { - if (path == QPainterPath()) - path.addPolygon(polygon); - if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { - items->append(item); - keep = true; - } - } - } - } - - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { - // Recurse into children that clip children. - childItems_helper(items, item, item->mapFromParent(polygon), mode); - } - } -} - -void QGraphicsScenePrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPainterPath &path, - Qt::ItemSelectionMode mode) const -{ - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - QRectF pathRect(path.boundingRect()); - _q_adjustRect(&pathRect); - QRectF r = !parentClip ? pathRect : pathRect.intersected(adjustedItemBoundingRect(parent)); - if (r.isEmpty()) - return; - - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->hasTransform && !item->transform().isInvertible()) - continue; - - // Skip invisible items. - if (item->d_ptr->isInvisible()) - continue; - - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Polygon contains/intersects item's bounding rect - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { - items->append(item); - keep = true; - } - } else { - // Path contains/intersects item's shape - if (QRectF_intersects(pathRect, item->mapRectToParent(br))) { - if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { - items->append(item); - keep = true; - } - } - } - } - - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { - // Recurse into children that clip children. - childItems_helper(items, item, item->mapFromParent(path), mode); - } - } -} - void QGraphicsScenePrivate::invalidateSortCache() { Q_Q(QGraphicsScene); @@ -1709,7 +1197,8 @@ void QGraphicsScenePrivate::climbTree(QGraphicsItem *item, int *stackingOrder) void QGraphicsScenePrivate::_q_updateSortCache() { - index->updateIndex(); + //### FIXME + //index->updateIndex(); if (!sortCacheEnabled || !updatingSortCache) return; @@ -1719,8 +1208,8 @@ void QGraphicsScenePrivate::_q_updateSortCache() QList topLevels; - for (int i = 0; i < index->indexedItems().count(); ++i) { - QGraphicsItem *item = index->indexedItems().at(i); + for (int i = 0; i < index->items().count(); ++i) { + QGraphicsItem *item = index->items().at(i); if (item && item->parentItem() == 0) topLevels << item; } @@ -1933,8 +1422,7 @@ QGraphicsScene::~QGraphicsScene() QRectF QGraphicsScene::sceneRect() const { Q_D(const QGraphicsScene); - d->index->updateIndex(); - return d->hasSceneRect ? d->index->rect() : d->growingItemsBoundingRect; + return d->hasSceneRect ? d->sceneRect : d->growingItemsBoundingRect; } void QGraphicsScene::setSceneRect(const QRectF &rect) { @@ -1942,7 +1430,7 @@ void QGraphicsScene::setSceneRect(const QRectF &rect) if (rect != d->sceneRect) { d->hasSceneRect = !rect.isNull(); d->sceneRect = rect; - d->index->setRect(rect); + d->index->sceneRectChanged(rect); emit sceneRectChanged(rect); } } @@ -2106,9 +1594,11 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) } if (d->indexMethod == CustomIndex && method == BspTreeIndex) { + //We re-add in the new index all items from the old index QGraphicsSceneIndex *oldIndex = d->index; d->index = new QGraphicsSceneBspTreeIndex(this); - d->index->insertItems(oldIndex->items(oldIndex->rect())); + for (int i = 0 ; i < oldIndex->items().size() ; ++ i) + d->index->addItem(oldIndex->items().at(i)); } if (d->indexMethod == CustomIndex && method == NoIndex) { @@ -2246,7 +1736,7 @@ QRectF QGraphicsScene::itemsBoundingRect() const QList QGraphicsScene::items() const { Q_D(const QGraphicsScene); - return d->index->indexedItems(); + return d->index->items(); } /*! @@ -2259,7 +1749,7 @@ QList QGraphicsScene::items() const QList QGraphicsScene::items(const QPointF &pos) const { Q_D(const QGraphicsScene); - return d->items_helper(pos); + return d->index->items(pos, Qt::IntersectsItemShape, Qt::AscendingOrder); } @@ -2279,7 +1769,7 @@ QList QGraphicsScene::items(const QPointF &pos) const QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode) const { Q_D(const QGraphicsScene); - return d->items_helper(rect, mode, Qt::AscendingOrder); + return d->index->items(rect, mode, Qt::AscendingOrder); } /*! @@ -2303,7 +1793,7 @@ QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const { Q_D(const QGraphicsScene); - return d->items_helper(polygon, mode, Qt::AscendingOrder); + return d->index->items(polygon, mode, Qt::AscendingOrder); } /*! @@ -2320,7 +1810,74 @@ QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS QList QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const { Q_D(const QGraphicsScene); - return d->items_helper(path, mode, Qt::AscendingOrder); + return d->index->items(path, mode, Qt::AscendingOrder); +} + +/*! + Returns all visible items at position \a pos in the scene. + + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with or is contained by \a path are returned. + + \sa itemAt() +*/ +QList QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsScene); + return d->index->items(pos, mode, order, deviceTransform); +} + +/*! + \fn QList QGraphicsScene::items(const QRectF &rectangle, Qt::SortOrder order, const QTransform &deviceTransform) const + + \overload + + Returns all visible items that, depending on \a mode, are either inside or + intersect with the specified \a rectangle. + + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with or is contained by \a rectangle are returned. + + \sa itemAt() +*/ +QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsScene); + return d->index->items(rect, mode, order, deviceTransform); +} + +/*! + \overload + + Returns all visible items that, depending on \a mode, are either inside or + intersect with the polygon \a polygon. + + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with or is contained by \a polygon are returned. + + \sa itemAt() +*/ +QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsScene); + return d->index->items(polygon, mode, order, deviceTransform); +} + +/*! + \overload + + Returns all visible items that, depending on \a path, are either inside or + intersect with the path \a path. + + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with or is contained by \a path are returned. + + \sa itemAt() +*/ +QList QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsScene); + return d->index->items(path, mode, order, deviceTransform); } /*! @@ -2344,10 +1901,11 @@ QList QGraphicsScene::collidingItems(const QGraphicsItem *item, } QList tmp; - foreach (QGraphicsItem *itemInVicinity, d->estimateItemsInRect(item->sceneBoundingRect())) { + foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder, QTransform())) { if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode)) tmp << itemInVicinity; } + //### remove me d->sortItems(&tmp, Qt::AscendingOrder, d->sortCacheEnabled); return tmp; } @@ -2517,8 +2075,8 @@ void QGraphicsScene::clear() Q_D(QGraphicsScene); QList items; // Recursive descent delete - for (int i = 0; i < d->index->indexedItems().size(); ++i) { - if (QGraphicsItem *item = d->index->indexedItems().at(i)) { + for (int i = 0; i < d->index->items().size(); ++i) { + if (QGraphicsItem *item = d->index->items().at(i)) { if (!item->parentItem()) items << item; } @@ -2663,7 +2221,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) item->d_func()->scene = targetScene; // Add the item in the index - d->index->insertItem(item); + d->index->addItem(item); // Add to list of toplevels if this item is a toplevel. if (!item->d_ptr->parent) @@ -3023,7 +2581,7 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) // Note: This will access item's sceneBoundingRect(), which (as this is // C++) is why we cannot call removeItem() from QGraphicsItem's // destructor. - d->index->removeItem(item, false); + d->index->deleteItem(item); if (item == d->tabFocusFirst) { QGraphicsWidget *widget = static_cast(item); diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 6476b8c..5d70087 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -156,10 +156,17 @@ public: QRectF itemsBoundingRect() const; QList items() const; + + QList items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList items(const QPointF &pos) const; QList items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; QList items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; QGraphicsItem *itemAt(const QPointF &pos) const; @@ -291,6 +298,8 @@ private: friend class QGraphicsViewPrivate; friend class QGraphicsWidget; friend class QGraphicsWidgetPrivate; + friend class QGraphicsSceneIndex; + friend class QGraphicsSceneIndexPrivate; friend class QGraphicsSceneBspTreeIndex; }; diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index f8fa450..5c1820f 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -143,7 +143,7 @@ void QGraphicsSceneBspTree::removeItems(const QSet &items) } } -QList QGraphicsSceneBspTree::items(const QRectF &rect) +QList QGraphicsSceneBspTree::items(const QRectF &rect) const { QList tmp; findVisitor->foundItems = &tmp; @@ -151,7 +151,7 @@ QList QGraphicsSceneBspTree::items(const QRectF &rect) return tmp; } -QList QGraphicsSceneBspTree::items(const QPointF &pos) +QList QGraphicsSceneBspTree::items(const QPointF &pos) const { QList tmp; findVisitor->foundItems = &tmp; @@ -235,7 +235,7 @@ void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth, int index) } } -void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index) +void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index) const { if (nodes.isEmpty()) return; @@ -245,7 +245,7 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con switch (node.type) { case Node::Leaf: { - visitor->visit(&leaves[node.leafIndex]); + visitor->visit(const_cast*>(&leaves[node.leafIndex])); break; } case Node::Vertical: @@ -265,7 +265,7 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con } } -void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index) +void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index) const { if (nodes.isEmpty()) return; @@ -275,7 +275,7 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con switch (node.type) { case Node::Leaf: { - visitor->visit(&leaves[node.leafIndex]); + visitor->visit(const_cast*>(&leaves[node.leafIndex])); break; } case Node::Vertical: diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index e6ceb78..a13d862 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -92,8 +92,8 @@ public: void removeItem(QGraphicsItem *item, const QRectF &rect); void removeItems(const QSet &items); - QList items(const QRectF &rect); - QList items(const QPointF &pos); + QList items(const QRectF &rect) const; + QList items(const QPointF &pos) const; int leafCount() const; inline int firstChildIndex(int index) const @@ -106,8 +106,8 @@ public: private: void initialize(const QRectF &rect, int depth, int index); - void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index = 0); - void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0); + void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index = 0) const; + void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0) const; void findItems(QList *foundItems, const QRectF &rect, int index); void findItems(QList *foundItems, const QPointF &pos, int index); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 2c0d464..a035159 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -88,8 +88,6 @@ public: QGraphicsScene::ItemIndexMethod indexMethod; int bspTreeDepth; - QList estimateItemsInRect(const QRectF &rect) const; - int lastItemCount; QGraphicsSceneIndex *index; @@ -189,33 +187,6 @@ public: void sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent); void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent); QGraphicsWidget *windowForItem(const QGraphicsItem *item) const; - - QList items_helper(const QPointF &pos) const; - QList items_helper(const QRectF &rect, - Qt::ItemSelectionMode mode, - Qt::SortOrder order) const; - QList items_helper(const QPolygonF &rect, - Qt::ItemSelectionMode mode, - Qt::SortOrder order) const; - QList items_helper(const QPainterPath &rect, - Qt::ItemSelectionMode mode, - Qt::SortOrder order) const; - void childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPointF &pos) const; - void childItems_helper(QList *items, - const QGraphicsItem *parent, - const QRectF &rect, - Qt::ItemSelectionMode mode) const; - void childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPolygonF &polygon, - Qt::ItemSelectionMode mode) const; - void childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPainterPath &path, - Qt::ItemSelectionMode mode) const; - bool sortCacheEnabled; bool updatingSortCache; void invalidateSortCache(); @@ -255,6 +226,65 @@ public: mutable QVector freeSceneTransformSlots; }; +static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) +{ + qreal xp = s.left(); + qreal yp = s.top(); + qreal w = s.width(); + qreal h = s.height(); + qreal l1 = xp; + qreal r1 = xp; + if (w < 0) + l1 += w; + else + r1 += w; + + qreal l2 = r.left(); + qreal r2 = r.left(); + if (w < 0) + l2 += r.width(); + else + r2 += r.width(); + + if (l1 >= r2 || l2 >= r1) + return false; + + qreal t1 = yp; + qreal b1 = yp; + if (h < 0) + t1 += h; + else + b1 += h; + + qreal t2 = r.top(); + qreal b2 = r.top(); + if (r.height() < 0) + t2 += r.height(); + else + b2 += r.height(); + + return !(t1 >= b2 || t2 >= b1); +} + +// QRectF::intersects() returns false always if either the source or target +// rectangle's width or height are 0. This works around that problem. +static inline void _q_adjustRect(QRectF *rect) +{ + Q_ASSERT(rect); + if (!rect->width()) + rect->adjust(-0.00001, 0, 0.00001, 0); + if (!rect->height()) + rect->adjust(0, -0.00001, 0, 0.00001); +} + +static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item) +{ + Q_ASSERT(item); + QRectF boundingRect(item->boundingRect()); + _q_adjustRect(&boundingRect); + return boundingRect; +} + QT_END_NAMESPACE #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp index ebc167a..1f2b81d 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp @@ -61,18 +61,6 @@ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) } -void QGraphicsSceneBspTreeIndex::setRect(const QRectF &rect) -{ - m_sceneRect = rect; - resetIndex(); -} - -QRectF QGraphicsSceneBspTreeIndex::rect() const -{ - const_cast(this)->updateIndex(); - return m_sceneRect; -} - void QGraphicsSceneBspTreeIndex::clear() { bsp.clear(); @@ -82,7 +70,7 @@ void QGraphicsSceneBspTreeIndex::clear() unindexedItems.clear(); } -void QGraphicsSceneBspTreeIndex::insertItem(QGraphicsItem *item) +void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) { // Prevent reusing a recently deleted pointer: purge all removed items // from our lists. @@ -113,42 +101,43 @@ void QGraphicsSceneBspTreeIndex::addToIndex(QGraphicsItem *item) } } -void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item, bool itemIsAboutToDie) +void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) { - if (!itemIsAboutToDie) { - // Note: This will access item's sceneBoundingRect(), which (as this is - // C++) is why we cannot call removeItem() from QGraphicsItem's - // destructor. - removeFromIndex(item); - - // Remove from our item lists. - int index = item->d_func()->index; - if (index != -1) { - freeItemIndexes << index; - m_indexedItems[index] = 0; - } else { - unindexedItems.removeAll(item); - } + // Note: This will access item's sceneBoundingRect(), which (as this is + // C++) is why we cannot call removeItem() from QGraphicsItem's + // destructor. + removeFromIndex(item); + // Remove from our item lists. + int index = item->d_func()->index; + if (index != -1) { + freeItemIndexes << index; + m_indexedItems[index] = 0; } else { - int index = item->d_func()->index; - if (index != -1) { - // Important: The index is useless until purgeRemovedItems() is - // called. - m_indexedItems[index] = (QGraphicsItem *)0; - if (!purgePending) { - purgePending = true; - scene()->update(); - } - removedItems << item; - } else { - // Recently added items are purged immediately. unindexedItems() never - // contains stale items. - unindexedItems.removeAll(item); + unindexedItems.removeAll(item); + } +} + +void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) +{ + int index = item->d_func()->index; + if (index != -1) { + // Important: The index is useless until purgeRemovedItems() is + // called. + m_indexedItems[index] = (QGraphicsItem *)0; + if (!purgePending) { + purgePending = true; scene()->update(); } + removedItems << item; + } else { + // Recently added items are purged immediately. unindexedItems() never + // contains stale items. + unindexedItems.removeAll(item); + scene()->update(); } } + /*! \internal */ @@ -173,41 +162,17 @@ void QGraphicsSceneBspTreeIndex::removeFromIndex(QGraphicsItem *item) startIndexTimer(); } -void QGraphicsSceneBspTreeIndex::updateItem(QGraphicsItem *item) +void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) { // Note: This will access item's sceneBoundingRect(), which (as this is // C++) is why we cannot call removeItem() from QGraphicsItem's // destructor. - removeFromIndex(item); -} - -QList QGraphicsSceneBspTreeIndex::items(const QPointF &point) -{ - purgeRemovedItems(); - QList rectItems = bsp.items(QRectF(point, QSizeF(1, 1))); - // Fill in with any unindexed items - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { - QRectF boundingRect = item->sceneBoundingRect(); - if (boundingRect.intersects(QRectF(point, QSizeF(1, 1)))) { - item->d_ptr->itemDiscovered = 1; - rectItems << item; - } - } - } - } - - // Reset the discovered state of all discovered items - for (int i = 0; i < rectItems.size(); ++i) - rectItems.at(i)->d_func()->itemDiscovered = 0; - - return rectItems; + removeFromIndex(const_cast(item)); } -QList QGraphicsSceneBspTreeIndex::items(const QRectF &rect) +QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { - purgeRemovedItems(); + const_cast(this)->purgeRemovedItems(); QList rectItems = bsp.items(rect); // Fill in with any unindexed items for (int i = 0; i < unindexedItems.size(); ++i) { @@ -229,9 +194,9 @@ QList QGraphicsSceneBspTreeIndex::items(const QRectF &rect) return rectItems; } -QList QGraphicsSceneBspTreeIndex::indexedItems() +QList QGraphicsSceneBspTreeIndex::items() const { - purgeRemovedItems(); + const_cast(this)->purgeRemovedItems(); // If freeItemIndexes is empty, we know there are no holes in indexedItems and // unindexedItems. if (freeItemIndexes.isEmpty()) { @@ -250,11 +215,6 @@ QList QGraphicsSceneBspTreeIndex::indexedItems() return itemList; } -void QGraphicsSceneBspTreeIndex::updateIndex() -{ - _q_updateIndex(); -} - int QGraphicsSceneBspTreeIndex::bspDepth() { return bspTreeDepth; @@ -266,6 +226,12 @@ void QGraphicsSceneBspTreeIndex::setBspDepth(int depth) resetIndex(); } +void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) +{ + m_sceneRect = rect; + resetIndex(); +} + bool QGraphicsSceneBspTreeIndex::event(QEvent *event) { switch (event->type()) { diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 74af910..63cd0e1 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -62,27 +62,23 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex public: QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); - void setRect(const QRectF &rect); - virtual QRectF rect() const; - void clear(); - void insertItem(QGraphicsItem *item); - void removeItem(QGraphicsItem *item, bool itemIsAboutToDie); - void updateItem(QGraphicsItem *item); - - QList items(const QPointF &point); - QList items(const QRectF &rect); + void addItem(QGraphicsItem *item); + void removeItem(QGraphicsItem *item); + void deleteItem(QGraphicsItem *item); + void prepareBoundingRectChange(const QGraphicsItem *item); - QList indexedItems(); + QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; - void updateIndex(); + QList items() const; int bspDepth(); void setBspDepth(int depth); protected: bool event(QEvent *event); + void sceneRectChanged(const QRectF &rect); public slots : void _q_updateIndex(); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 86a2fbb..870a62a 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -40,16 +40,244 @@ ****************************************************************************/ #include "qgraphicssceneindex.h" +#include "qgraphicssceneindex_p.h" #include "qgraphicsscene.h" +#include "qgraphicsitem_p.h" +#include "qgraphicsscene_p.h" #ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE /*! + Constructs a private scene index. +*/ +QGraphicsSceneIndexPrivate::QGraphicsSceneIndexPrivate(QGraphicsScene *scene) : scene(scene) +{ +} + +void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, + const QGraphicsItem *parent, + const QPointF &pos) const +{ + bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); + if (parentClip && parent->d_ptr->isClippedAway()) + return; + // ### is this needed? + if (parentClip && !parent->boundingRect().contains(pos)) + return; + + QList &children = parent->d_ptr->children; + for (int i = 0; i < children.size(); ++i) { + QGraphicsItem *item = children.at(i); + if (item->d_ptr->hasTransform && !item->transform().isInvertible()) + continue; + + // Skip invisible items and all their children. + if (item->d_ptr->isInvisible()) + continue; + + bool keep = false; + if (!item->d_ptr->isClippedAway()) { + if (item->contains(item->mapFromParent(pos))) { + items->append(item); + keep = true; + } + } + + if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) + // Recurse into children. + childItems_helper(items, item, item->mapFromParent(pos)); + } +} + + +void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, + const QGraphicsItem *parent, + const QRectF &rect, + Qt::ItemSelectionMode mode) const +{ + bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); + if (parentClip && parent->d_ptr->isClippedAway()) + return; + QRectF adjustedRect(rect); + _q_adjustRect(&adjustedRect); + QRectF r = !parentClip ? adjustedRect : adjustedRect.intersected(adjustedItemBoundingRect(parent)); + if (r.isEmpty()) + return; + + QPainterPath path; + QList &children = parent->d_ptr->children; + for (int i = 0; i < children.size(); ++i) { + QGraphicsItem *item = children.at(i); + if (item->d_ptr->hasTransform && !item->transform().isInvertible()) + continue; + + // Skip invisible items and all their children. + if (item->d_ptr->isInvisible()) + continue; + + bool keep = false; + if (!item->d_ptr->isClippedAway()) { + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + QRectF mbr = item->mapRectToParent(br); + if (mode >= Qt::ContainsItemBoundingRect) { + // Rect intersects/contains item's bounding rect + if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) + || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(br))) { + items->append(item); + keep = true; + } + } else { + // Rect intersects/contains item's shape + if (QRectF_intersects(rect, mbr)) { + if (path == QPainterPath()) + path.addRect(rect); + if (scene->d_func()->itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + items->append(item); + keep = true; + } + } + } + } + + if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { + // Recurse into children. + if (!item->d_ptr->hasTransform || item->transform().type() <= QTransform::TxScale) { + // Rect + childItems_helper(items, item, item->mapRectFromParent(rect), mode); + } else { + // Polygon + childItems_helper(items, item, item->mapFromParent(rect), mode); + } + } + } +} + + +void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, + const QGraphicsItem *parent, + const QPolygonF &polygon, + Qt::ItemSelectionMode mode) const +{ + bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); + if (parentClip && parent->d_ptr->isClippedAway()) + return; + QRectF polyRect(polygon.boundingRect()); + _q_adjustRect(&polyRect); + QRectF r = !parentClip ? polyRect : polyRect.intersected(adjustedItemBoundingRect(parent)); + if (r.isEmpty()) + return; + + QPainterPath path; + QList &children = parent->d_ptr->children; + for (int i = 0; i < children.size(); ++i) { + QGraphicsItem *item = children.at(i); + if (item->d_ptr->hasTransform && !item->transform().isInvertible()) + continue; + + // Skip invisible items. + if (item->d_ptr->isInvisible()) + continue; + + bool keep = false; + if (!item->d_ptr->isClippedAway()) { + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Polygon contains/intersects item's bounding rect + if (path == QPainterPath()) + path.addPolygon(polygon); + if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) + || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { + items->append(item); + keep = true; + } + } else { + // Polygon contains/intersects item's shape + if (QRectF_intersects(polyRect, item->mapRectToParent(br))) { + if (path == QPainterPath()) + path.addPolygon(polygon); + if (scene->d_func()->itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + items->append(item); + keep = true; + } + } + } + } + + if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { + // Recurse into children that clip children. + childItems_helper(items, item, item->mapFromParent(polygon), mode); + } + } +} + +void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, + const QGraphicsItem *parent, + const QPainterPath &path, + Qt::ItemSelectionMode mode) const +{ + bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); + if (parentClip && parent->d_ptr->isClippedAway()) + return; + QRectF pathRect(path.boundingRect()); + _q_adjustRect(&pathRect); + QRectF r = !parentClip ? pathRect : pathRect.intersected(adjustedItemBoundingRect(parent)); + if (r.isEmpty()) + return; + + QList &children = parent->d_ptr->children; + for (int i = 0; i < children.size(); ++i) { + QGraphicsItem *item = children.at(i); + if (item->d_ptr->hasTransform && !item->transform().isInvertible()) + continue; + + // Skip invisible items. + if (item->d_ptr->isInvisible()) + continue; + + bool keep = false; + if (!item->d_ptr->isClippedAway()) { + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Polygon contains/intersects item's bounding rect + if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) + || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { + items->append(item); + keep = true; + } + } else { + // Path contains/intersects item's shape + if (QRectF_intersects(pathRect, item->mapRectToParent(br))) { + if (scene->d_func()->itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + items->append(item); + keep = true; + } + } + } + } + + if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { + // Recurse into children that clip children. + childItems_helper(items, item, item->mapFromParent(path), mode); + } + } +} + +/*! Constructs an abstract scene index. */ -QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene): QObject(scene), m_scene(scene) +QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene) +: QObject(*new QGraphicsSceneIndexPrivate(scene)) { } @@ -62,109 +290,325 @@ QGraphicsSceneIndex::~QGraphicsSceneIndex() } /*! - \fn virtual void setRect(const QRectF &rect) = 0 - - This pure virtual function is called when the scene changes its bounding - rectangle. - - \sa rect(), QGraphicsScene::setSceneRect + Returns the scene of this index. */ - +QGraphicsScene* QGraphicsSceneIndex::scene() const +{ + Q_D(const QGraphicsSceneIndex); + return d->scene; +} /*! - \fn virtual QRectF rect() const = 0 + \fn QList items() const = 0 - This pure virtual function returns the bounding rectangle of this - scene index. It could be as large as or larger than the scene - bounding rectangle, depending on the implementation of the - scene index. + This pure virtual function return the list of items that are actually in the index. - \sa setRect(), QGraphicsScene::sceneRect */ -/*! - \fn virtual void clear() = 0 +QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsSceneIndex); + QList items; + + // The index returns a rough estimate of what items are inside the rect. + // Refine it by iterating through all returned items. + QRectF adjustedRect = QRectF(pos, QSize(1,1)); + foreach (QGraphicsItem *item, estimateItems(adjustedRect, order, deviceTransform)) { + // Find the item's scene transform in a clever way. + QTransform x = item->sceneTransform(); + bool keep = false; + + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + // Rect intersects/contains item's shape + if (QRectF_intersects(adjustedRect, x.mapRect(br))) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) { + if (item->contains(xinv.map(pos))) { + items << item; + keep = true; + } + } + } + + if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { + // Recurse into children that clip children. + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) + d->childItems_helper(&items, item, xinv.map(pos)); + } + } + + d->scene->d_func()->sortItems(&items, Qt::AscendingOrder, d->scene->d_func()->sortCacheEnabled); + return items; +} - This pure virtual function removes all items in the scene index. -*/ +QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsSceneIndex); + QList items; + + QPainterPath path; + + // The index returns a rough estimate of what items are inside the rect. + // Refine it by iterating through all returned items. + QRectF adjustedRect(rect); + _q_adjustRect(&adjustedRect); + foreach (QGraphicsItem *item, estimateItems(adjustedRect, order, deviceTransform)) { + // Find the item's scene transform in a clever way. + QTransform x = item->sceneTransform(); + bool keep = false; + + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Rect intersects/contains item's bounding rect + QRectF mbr = x.mapRect(br); + if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) + || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(mbr))) { + items << item; + keep = true; + } + } else { + // Rect intersects/contains item's shape + if (QRectF_intersects(adjustedRect, x.mapRect(br))) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) { + if (path.isEmpty()) + path.addRect(rect); + if (d->scene->d_func()->itemCollidesWithPath(item, xinv.map(path), mode)) { + items << item; + keep = true; + } + } + } + } + + if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { + // Recurse into children that clip children. + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) { + if (x.type() <= QTransform::TxScale) { + // Rect + d->childItems_helper(&items, item, xinv.mapRect(rect), mode); + } else { + // Polygon + d->childItems_helper(&items, item, xinv.map(rect), mode); + } + } + } + } + + if (order != Qt::SortOrder(-1)) + d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); + return items; +} -/*! - \fn virtual void insertItem(QGraphicsItem *item) = 0 +QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsSceneIndex); + QList items; + + QRectF polyRect(polygon.boundingRect()); + _q_adjustRect(&polyRect); + QPainterPath path; + + // The index returns a rough estimate of what items are inside the rect. + // Refine it by iterating through all returned items. + foreach (QGraphicsItem *item, estimateItems(polyRect, order, deviceTransform)) { + // Find the item's scene transform in a clever way. + QTransform x = item->sceneTransform(); + bool keep = false; + + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Polygon contains/intersects item's bounding rect + if (path == QPainterPath()) + path.addPolygon(polygon); + if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br))) + || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) { + items << item; + keep = true; + } + } else { + // Polygon contains/intersects item's shape + if (QRectF_intersects(polyRect, x.mapRect(br))) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) { + if (path == QPainterPath()) + path.addPolygon(polygon); + if (d->scene->d_func()->itemCollidesWithPath(item, xinv.map(path), mode)) { + items << item; + keep = true; + } + } + } + } + + if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { + // Recurse into children that clip children. + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) + d->childItems_helper(&items, item, xinv.map(polygon), mode); + } + } + + if (order != Qt::SortOrder(-1)) + d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); + return items; +} +QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsSceneIndex); + QList items; + QRectF pathRect(path.controlPointRect()); + _q_adjustRect(&pathRect); + + // The index returns a rough estimate of what items are inside the rect. + // Refine it by iterating through all returned items. + foreach (QGraphicsItem *item, estimateItems(pathRect, order, deviceTransform)) { + // Find the item's scene transform in a clever way. + QTransform x = item->sceneTransform(); + bool keep = false; + + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Path contains/intersects item's bounding rect + if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br))) + || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) { + items << item; + keep = true; + } + } else { + // Path contains/intersects item's shape + if (QRectF_intersects(pathRect, x.mapRect(br))) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) { + if (d->scene->d_func()->itemCollidesWithPath(item, xinv.map(path), mode)) { + items << item; + keep = true; + } + } + } + } + + if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) + d->childItems_helper(&items, item, xinv.map(path), mode); + } + } + + if (order != Qt::SortOrder(-1)) + d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); + return items; +} - This pure virtual function inserts an item to the scene index. +/*! + This pure virtual function return an estimation of items at position \a pos. - \sa removeItem(), updateItem(), insertItems() */ +QList QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + return estimateItems(QRectF(point, QSize(1,1)), order, deviceTransform); +} /*! - \fn virtual void removeItem(QGraphicsItem *item) = 0 + \fn virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const = 0 - This pure virtual function removes an item to the scene index. + This pure virtual function return an estimation of items in the \a rect. - \sa insertItem(), updateItem(), removeItems() */ + /*! - Returns the scene of this index. + This virtual function removes all items in the scene index. */ -QGraphicsScene* QGraphicsSceneIndex::scene() const +void QGraphicsSceneIndex::clear() { - return m_scene; + for (int i = 0 ; i < items().size(); ++i) + removeItem(items().at(i)); } /*! - Updates an item when its geometry has changed. + \fn virtual void addItem(QGraphicsItem *item) = 0 - The default implemention will remove the item from the index - and then insert it again. + This pure virtual function inserts an item to the scene index. - \sa insertItem(), removeItem(), updateItems() + \sa removeItem(), deleteItem() */ -void QGraphicsSceneIndex::updateItem(QGraphicsItem *item) -{ - removeItem(item,false); - insertItem(item); -} /*! - Inserts a list of items to the index. + \fn virtual void removeItem(QGraphicsItem *item) = 0 - The default implemention will insert the items one by one. + This pure virtual function removes an item to the scene index. - \sa insertItem(), removeItems(), updateItems() + \sa addItem(), deleteItem() */ -void QGraphicsSceneIndex::insertItems(const QList &items) + +/*! + This method is called when an item has been deleted. + The default implementation call removeItem. Be carefull, + if your implementation of removeItem use pure virtual method + of QGraphicsItem like boundingRect(), then you should reimplement + this method. + + \sa addItem(), removeItem() +*/ +void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item) { - foreach (QGraphicsItem *item, items) - insertItem(item); + removeItem(item); } /*! - Removes a list of items from the index. + This virtual function is called by QGraphicsItem to notify the index + that some part of the item's state changes. By reimplementing this + function, your can react to a change, and in some cases, (depending on \a + change,) adjustments in the index can be made. - The default implemention will remove the items one by one. + \a change is the parameter of the item that is changing. \a value is the + value that changed; the type of the value depends on \a change. - \sa removeItem(), removeItems(), updateItems() + The default implementation does nothing. + + \sa GraphicsItemChange */ -void QGraphicsSceneIndex::removeItems(const QList &items, bool itemsAreAboutToDie) +void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value) { - foreach (QGraphicsItem *item, items) - removeItem(item,itemsAreAboutToDie); } /*! - Update a list of items which have changed the geometry. - - The default implemention will update the items one by one. + Notify the index for a geometry change of an item. - \sa updateItem(), insertItems(), removeItems() + \sa QGraphicsItem::prepareGeometryChange */ -void QGraphicsSceneIndex::updateItems(const QList &items) +void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) { - foreach (QGraphicsItem *item, items) - updateItem(item); } -void QGraphicsSceneIndex::updateIndex() +/*! + This virtual function is called when the scene changes its bounding + rectangle. + \sa QGraphicsScene::sceneRect +*/ +void QGraphicsSceneIndex::sceneRectChanged(const QRectF &rect) { } diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index a782323..da3096e 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -44,6 +44,8 @@ #include #include +#include +#include QT_BEGIN_HEADER @@ -53,7 +55,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW -class QGraphicsItem; +class QGraphicsSceneIndexPrivate; class QGraphicsScene; class QRectF; class QPointF; @@ -67,29 +69,31 @@ public: QGraphicsSceneIndex(QGraphicsScene *scene = 0); virtual ~QGraphicsSceneIndex(); - QGraphicsScene* scene() const; - - virtual void setRect(const QRectF &rect) = 0; - virtual QRectF rect() const = 0; - virtual void clear() = 0; - - virtual void insertItem(QGraphicsItem *item) = 0; - virtual void removeItem(QGraphicsItem *items, bool itemIsAboutToDie) = 0; - virtual void updateItem(QGraphicsItem *item); - - virtual void insertItems(const QList &items); - virtual void removeItems(const QList &items, bool itemsAreAboutToDie); - virtual void updateItems(const QList &items); - - virtual QList items(const QPointF &point) = 0; - virtual QList items(const QRectF &rect) = 0; - - virtual QList indexedItems() = 0; - - virtual void updateIndex(); - + QGraphicsScene *scene() const; + + virtual QList items() const = 0; + virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList estimateItems(const QPointF &point, Qt::SortOrder order, const QTransform &deviceTransform) const; + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const = 0; + +protected: + virtual void clear(); + virtual void addItem(QGraphicsItem *item) = 0; + virtual void removeItem(QGraphicsItem *item) = 0; + virtual void deleteItem(QGraphicsItem *item); + + virtual void itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); + virtual void prepareBoundingRectChange(const QGraphicsItem *item); + virtual void sceneRectChanged(const QRectF &rect); + + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; + friend class QGraphicsItem; private: - QGraphicsScene *m_scene; + Q_DECLARE_PRIVATE(QGraphicsSceneIndex) }; #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h new file mode 100644 index 0000000..f2cdca3 --- /dev/null +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENEINDEX_P_H +#define QGRAPHICSSCENEINDEX_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qgraphicssceneindex.h" + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +#include + +QT_BEGIN_NAMESPACE + +class QGraphicsScene; + +class QGraphicsSceneIndexPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QGraphicsSceneIndex) +public: + QGraphicsSceneIndexPrivate(QGraphicsScene *scene); + + + void childItems_helper(QList *items, + const QGraphicsItem *parent, + const QPointF &pos) const; + void childItems_helper(QList *items, + const QGraphicsItem *parent, + const QRectF &rect, + Qt::ItemSelectionMode mode) const; + void childItems_helper(QList *items, + const QGraphicsItem *parent, + const QPolygonF &polygon, + Qt::ItemSelectionMode mode) const; + void childItems_helper(QList *items, + const QGraphicsItem *parent, + const QPainterPath &path, + Qt::ItemSelectionMode mode) const; + + QGraphicsScene *scene; +}; + +QT_END_NAMESPACE + +#endif // QGRAPHICSSCENEINDEX_P_H + +#endif diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h index 30948d9..dc45a17 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -89,24 +89,15 @@ public: m_items.clear(); } - virtual void insertItem(QGraphicsItem *item) { + virtual void addItem(QGraphicsItem *item) { m_items << item; } - virtual void removeItem(QGraphicsItem *item, bool itemIsAboutToDie) { - Q_UNUSED(itemIsAboutToDie); + virtual void removeItem(QGraphicsItem *item) { m_items.removeAll(item); } - virtual QList items(const QPointF &point) { - QList result; - foreach (QGraphicsItem *item, m_items) - if (item->sceneBoundingRect().contains(point)) - result << item; - return result; - } - - virtual QList items(const QRectF &rect) { + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { QList result; foreach (QGraphicsItem *item, m_items) if (item->sceneBoundingRect().intersects(rect)) @@ -114,7 +105,7 @@ public: return result; } - QList indexedItems() { + QList items() const { return m_items; } }; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 10b837a..91f97a1 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -791,19 +791,6 @@ QRegion QGraphicsViewPrivate::mapToViewRegion(const QGraphicsItem *item, const Q return item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect(); } -// QRectF::intersects() returns false always if either the source or target -// rectangle's width or height are 0. This works around that problem. -static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item) -{ - Q_ASSERT(item); - QRectF boundingRect(item->boundingRect()); - if (!boundingRect.width()) - boundingRect.adjust(-0.00001, 0, 0.00001, 0); - if (!boundingRect.height()) - boundingRect.adjust(0, -0.00001, 0, 0.00001); - return boundingRect; -} - /*! \internal */ @@ -1094,7 +1081,7 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg bool simpleRectLookup = (scene->d_func()->largestUntransformableItem.isNull() && exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale); if (simpleRectLookup) { - return scene->d_func()->items_helper(exposedRegionSceneBounds, + return scene->d_func()->index->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder); } @@ -1109,7 +1096,7 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg const QPainterPath exposedPath(qt_regionToPath(adjustedRegion)); if (scene->d_func()->largestUntransformableItem.isNull()) { const QPainterPath exposedScenePath(q->mapToScene(exposedPath)); - return scene->d_func()->items_helper(exposedScenePath, + return scene->d_func()->index->items(exposedScenePath, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder); } @@ -2143,7 +2130,7 @@ QList QGraphicsViewPrivate::itemsInArea(const QPainterPath &pat // First build a (potentially large) list of all items in the vicinity // that might be untransformable. - QList allCandidates = scene->d_func()->estimateItemsInRect(adjustedRect); + QList allCandidates = scene->d_func()->index->estimateItems(adjustedRect, order, q->transform()); // Then find the minimal list of items that are inside \a path, and // convert it to a set. @@ -2154,6 +2141,8 @@ QList QGraphicsViewPrivate::itemsInArea(const QPainterPath &pat QList result; + //### this will disapear + // Run through all candidates and keep all items that are in candSet, or // are untransformable and collide with \a path. ### We can improve this // algorithm. -- cgit v0.12 From 32155ed07a6f8b8c831db6ba219395b4825fa9fd Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 29 May 2009 15:15:58 +0200 Subject: Fix a wrong parenting. --- src/gui/graphicsview/qgraphicssceneindex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 870a62a..36da295 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -277,7 +277,7 @@ void QGraphicsSceneIndexPrivate::childItems_helper(QList *items Constructs an abstract scene index. */ QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene) -: QObject(*new QGraphicsSceneIndexPrivate(scene)) +: QObject(*new QGraphicsSceneIndexPrivate(scene), scene) { } -- cgit v0.12 From 53187fabdbfb8a513e735fdd034e1a9fbbccc9cd Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 29 May 2009 17:18:38 +0200 Subject: Add an API to know the indexed rect of the index. Usefull for the POV of the scene and let the BSP update its internal structure before the next event loop reentrancy. --- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp | 7 +++++++ src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h | 1 + src/gui/graphicsview/qgraphicssceneindex.cpp | 10 ++++++++++ src/gui/graphicsview/qgraphicssceneindex.h | 2 ++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9b6d40b..479a548 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1422,7 +1422,7 @@ QGraphicsScene::~QGraphicsScene() QRectF QGraphicsScene::sceneRect() const { Q_D(const QGraphicsScene); - return d->hasSceneRect ? d->sceneRect : d->growingItemsBoundingRect; + return d->index->indexedRect(); } void QGraphicsScene::setSceneRect(const QRectF &rect) { diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp index 1f2b81d..8a26447 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp @@ -61,6 +61,13 @@ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) } + +QRectF QGraphicsSceneBspTreeIndex::indexedRect() +{ + _q_updateIndex(); + return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; +} + void QGraphicsSceneBspTreeIndex::clear() { bsp.clear(); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 63cd0e1..7a6ea0b 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -61,6 +61,7 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex Q_OBJECT public: QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); + QRectF indexedRect(); void clear(); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 36da295..fe3a68a 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -297,6 +297,16 @@ QGraphicsScene* QGraphicsSceneIndex::scene() const Q_D(const QGraphicsSceneIndex); return d->scene; } + +/*! + Returns the indexed area for the index +*/ +QRectF QGraphicsSceneIndex::indexedRect() +{ + Q_D(const QGraphicsSceneIndex); + return d->scene->d_func()->sceneRect; +} + /*! \fn QList items() const = 0 diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index da3096e..11d9aae 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -71,6 +71,8 @@ public: QGraphicsScene *scene() const; + virtual QRectF indexedRect(); + virtual QList items() const = 0; virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; virtual QList items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; -- cgit v0.12 From 4785ed9b76104c272476f62780dde086e21b20ce Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sun, 31 May 2009 13:28:18 +0200 Subject: Add conformance section to qtxmlpatterns doc and extended api docs --- doc/src/qtxmlpatterns.qdoc | 21 +++++++++++++++++++++ src/xmlpatterns/api/qxmlschemavalidator.cpp | 8 +++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/src/qtxmlpatterns.qdoc b/doc/src/qtxmlpatterns.qdoc index cb260fc..a48d713 100644 --- a/doc/src/qtxmlpatterns.qdoc +++ b/doc/src/qtxmlpatterns.qdoc @@ -839,6 +839,27 @@ with the \c fn:id() function. See \l{http://www.w3.org/TR/xml-id/}{xml:id Version 1.0} for details. + \section2 XML Schema 1.0 + + The QtXmlPatterns implementation of XML Schema validation supports + the schema specification version 1.0 in large parts. Known problems + of the implementation and areas where conformancy may be questionable + are: + + \list + \o Large \c minOccurs or \c maxOccurs values or deeply nested ones + require huge amount of memory which might cause the system to freeze. + Such a schema should be rewritten to use \c unbounded as value instead + of large numbers. This restriction will hopefully be fixed in a later release. + \o Comparison of really small or large floating point values might lead to + wrong results in some cases. However such numbers should not be relevant + for day-to-day usage. + \o Regular expression support is currently not conformant but follows + Qt's QRegExp standard syntax. + \o Identity constraint checks can not use the values of default or fixed + attribute definitions. + \endlist + \section2 Resource Loading When QtXmlPatterns loads an XML resource, e.g., using the diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index b72b1ef..dc8e55d 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -69,7 +69,7 @@ /*! Constructs a schema validator. The schema used for validation must be referenced in the XML instance document - via the xsi:schemaLocation attribute. + via the \c xsi:schemaLocation or \c xsi:noNamespaceSchemaLocation attribute. */ QXmlSchemaValidator::QXmlSchemaValidator() : d(new QXmlSchemaValidatorPrivate(QXmlSchema())) @@ -78,6 +78,9 @@ QXmlSchemaValidator::QXmlSchemaValidator() /*! Constructs a schema validator that will use \a schema for validation. + If an empty \l {QXmlSchema} schema is passed to the validator, the schema used + for validation must be referenced in the XML instance document + via the \c xsi:schemaLocation or \c xsi:noNamespaceSchemaLocation attribute. */ QXmlSchemaValidator::QXmlSchemaValidator(const QXmlSchema &schema) : d(new QXmlSchemaValidatorPrivate(schema)) @@ -94,6 +97,9 @@ QXmlSchemaValidator::~QXmlSchemaValidator() /*! Sets the \a schema that shall be used for further validation. + If the schema is empty, the schema used for validation must be referenced + in the XML instance document via the \c xsi:schemaLocation or + \c xsi:noNamespaceSchemaLocation attribute. */ void QXmlSchemaValidator::setSchema(const QXmlSchema &schema) { -- cgit v0.12 From 427c4d6b0a8b3004c86facd382de33c171c0458b Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 2 Jun 2009 17:45:27 +0200 Subject: Fix all auto-tests regressions. --- src/gui/graphicsview/qgraphicsscene.cpp | 15 +++++++++------ src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp | 11 ++++++----- src/gui/graphicsview/qgraphicssceneindex.cpp | 2 +- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 3 +++ .../auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 4 ++-- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 479a548..0172a23 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -453,7 +453,9 @@ void QGraphicsScenePrivate::_q_removeItemLater(QGraphicsItem *item) // chain. item->clearFocus(); - //We ask for a removing in the index + // Note: This will access item's sceneBoundingRect(), which (as this is + // C++) is why we cannot call removeItem() from QGraphicsItem's + // destructor. this->index->deleteItem(item); // Reset the mouse grabber and focus item data. @@ -1198,7 +1200,10 @@ void QGraphicsScenePrivate::climbTree(QGraphicsItem *item, int *stackingOrder) void QGraphicsScenePrivate::_q_updateSortCache() { //### FIXME - //index->updateIndex(); + QGraphicsSceneBspTreeIndex *tree = qobject_cast(index); + if (tree) { + tree->_q_updateIndex(); + } if (!sortCacheEnabled || !updatingSortCache) return; @@ -2578,10 +2583,8 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) // Clear its background item->update(); - // Note: This will access item's sceneBoundingRect(), which (as this is - // C++) is why we cannot call removeItem() from QGraphicsItem's - // destructor. - d->index->deleteItem(item); + // Remove it from the index properly + d->index->removeItem(item); if (item == d->tabFocusFirst) { QGraphicsWidget *widget = static_cast(item); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp index 8a26447..f8f1f56 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp @@ -61,11 +61,10 @@ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) } - QRectF QGraphicsSceneBspTreeIndex::indexedRect() { _q_updateIndex(); - return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; + return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; } void QGraphicsSceneBspTreeIndex::clear() @@ -162,7 +161,7 @@ void QGraphicsSceneBspTreeIndex::removeFromIndex(QGraphicsItem *item) item->d_func()->index = -1; unindexedItems << item; - //prepareGeometryChange will call updateItem + //prepareGeometryChange will call prepareBoundingRectChange foreach (QGraphicsItem *child, item->children()) child->prepareGeometryChange(); } @@ -180,13 +179,15 @@ void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem * QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { const_cast(this)->purgeRemovedItems(); + scene()->d_func()->_q_updateSortCache(); + QList rectItems = bsp.items(rect); // Fill in with any unindexed items for (int i = 0; i < unindexedItems.size(); ++i) { if (QGraphicsItem *item = unindexedItems.at(i)) { if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { QRectF boundingRect = item->sceneBoundingRect(); - if (boundingRect.intersects(rect)) { + if (QRectF_intersects(boundingRect, rect)) { item->d_ptr->itemDiscovered = 1; rectItems << item; } @@ -328,7 +329,7 @@ void QGraphicsSceneBspTreeIndex::_q_updateIndex() if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) continue; - bsp.insertItem(item,rect); + bsp.insertItem(item, rect); // If the item ignores view transformations, update our // largest-item-counter to ensure that the view can accurately diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index fe3a68a..d0d6081 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -352,7 +352,7 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe } } - d->scene->d_func()->sortItems(&items, Qt::AscendingOrder, d->scene->d_func()->sortCacheEnabled); + d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); return items; } diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 0c5ebf6..eb117ab 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -395,6 +395,9 @@ void tst_QGraphicsScene::items() QGraphicsLineItem *l2 = scene.addLine(0, -5, 0, 5); QVERIFY(!l1->sceneBoundingRect().intersects(l2->sceneBoundingRect())); QVERIFY(!l2->sceneBoundingRect().intersects(l1->sceneBoundingRect())); + QList items; + items<setRect(QRectF(0, 0, 2000, 2000)); - QCOMPARE(index->rect(), QRectF(0, 0, 2000, 2000)); + scene->setSceneRect(QRectF(0, 0, 2000, 2000)); + QCOMPARE(index->indexedRect(), QRectF(0, 0, 2000, 2000)); } void tst_QGraphicsSceneIndex::customIndex_data() -- cgit v0.12 From f7741b78c90abcb272345810d55e446a7f390032 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Wed, 3 Jun 2009 17:40:41 +0200 Subject: Fixed typo in apidocs and extended example code --- doc/src/snippets/qxmlschemavalidator/main.cpp | 23 +++++++++++++++++++++++ src/xmlpatterns/api/qxmlschema.cpp | 5 +++++ src/xmlpatterns/api/qxmlschemavalidator.cpp | 12 +++++++++--- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/doc/src/snippets/qxmlschemavalidator/main.cpp b/doc/src/snippets/qxmlschemavalidator/main.cpp index 13cd45f..0803380 100644 --- a/doc/src/snippets/qxmlschemavalidator/main.cpp +++ b/doc/src/snippets/qxmlschemavalidator/main.cpp @@ -48,6 +48,7 @@ class SchemaValidator void validateFromUrl() const; void validateFromFile() const; void validateFromData() const; + void validateComplete() const; private: QXmlSchema getSchema() const; @@ -123,6 +124,27 @@ QXmlSchema SchemaValidator::getSchema() const return schema; } +void SchemaValidator::validateComplete() const +{ +//! [3] + QUrl schemaUrl("file:///home/user/schema.xsd"); + + QXmlSchema schema; + schema.load(schemaUrl); + + if (schema.isValid()) { + QFile file("test.xml"); + file.open(QIODevice::ReadOnly); + + QXmlSchemaValidator validator(schema); + if (validator.validate(&file, QUrl::fromLocalFile(file.fileName()))) + qDebug() << "instance document is valid"; + else + qDebug() << "instance document is invalid"; + } +//! [3] +} + int main(int argc, char **argv) { QCoreApplication app(argc, argv); @@ -132,6 +154,7 @@ int main(int argc, char **argv) validator.validateFromUrl(); validator.validateFromFile(); validator.validateFromData(); + validator.validateComplete(); return 0; } diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index ec370ca..c6dc9b2 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -58,6 +58,11 @@ that can be used further for validation of XML instance documents via \l{QXmlSchemaValidator}. + The following example shows how to load a XML Schema file from the network + and test whether it is a valid schema document: + + \snippet doc/src/snippets/qxmlschema/main.cpp 0 + \sa QXmlSchemaValidator, {xmlpatterns/schema}{XML Schema Validation Example} */ diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index dc8e55d..d5596c5 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -63,6 +63,12 @@ The QXmlSchemaValidator class loads, parses an XML instance document and validates it against a W3C XML Schema that has been compiled with \l{QXmlSchema}. + The following example shows how to load a XML Schema from a local + file, check whether it is a valid schema document and use it for validation + of an XML instance document: + + \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 3 + \sa QXmlSchema, {xmlpatterns/schema}{XML Schema Validation Example} */ @@ -110,7 +116,7 @@ void QXmlSchemaValidator::setSchema(const QXmlSchema &schema) Validates the XML instance document read from \a data with the given \a documentUri against the schema. - Returns \c true if the XML instance document is valid according the + Returns \c true if the XML instance document is valid according to the schema, \c false otherwise. Example: @@ -130,7 +136,7 @@ bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentU /*! Validates the XML instance document read from \a source against the schema. - Returns \c true if the XML instance document is valid according the + Returns \c true if the XML instance document is valid according to the schema, \c false otherwise. Example: @@ -155,7 +161,7 @@ bool QXmlSchemaValidator::validate(const QUrl &source) const Validates the XML instance document read from \a source with the given \a documentUri against the schema. - Returns \c true if the XML instance document is valid according the + Returns \c true if the XML instance document is valid according to the schema, \c false otherwise. Example: -- cgit v0.12 From ffd6bc0351c96c8a3828bd7376f2b6bda317cd71 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 3 Jun 2009 18:23:20 +0200 Subject: Remove the sorting cache from the QGraphicsScene and move it to the BSP. Now the QGraphicsScene has no idea how works the index. So we can improve it separatly, add new ones and benchmarks existing ones. --- src/gui/graphicsview/graphicsview.pri | 1 + src/gui/graphicsview/qgraphicsitem.cpp | 22 +- src/gui/graphicsview/qgraphicsitem.h | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 200 +------ src/gui/graphicsview/qgraphicsscene.h | 2 +- src/gui/graphicsview/qgraphicsscene_p.h | 19 - .../graphicsview/qgraphicsscenebsptreeindex_p.cpp | 614 ++++++++++++++------- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 51 +- .../graphicsview/qgraphicsscenebsptreeindex_p_p.h | 140 +++++ src/gui/graphicsview/qgraphicssceneindex.cpp | 28 +- src/gui/graphicsview/qgraphicssceneindex.h | 9 +- src/gui/graphicsview/qgraphicssceneindex_p.h | 3 +- src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 2 +- src/gui/graphicsview/qgraphicsview.cpp | 11 +- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 5 + tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 5 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 8 +- 17 files changed, 642 insertions(+), 479 deletions(-) create mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index cc57892..a4a79e8 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -7,6 +7,7 @@ HEADERS += \ graphicsview/qgraphicsscene.h \ graphicsview/qgraphicsscene_p.h \ graphicsview/qgraphicsscenebsptreeindex_p.h \ + graphicsview/qgraphicsscenebsptreeindex_p_p.h \ graphicsview/qgraphicsscene_bsp_p.h \ graphicsview/qgraphicsscenelinearindex_p.h \ graphicsview/qgraphicssceneindex.h \ diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index fc5895c..ee32724 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -537,6 +537,7 @@ #include "qgraphicsview.h" #include "qgraphicswidget.h" #include "qgraphicsproxywidget.h" +#include "qgraphicsscenebsptreeindex_p_p.h" #include #include #include @@ -888,12 +889,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, bool de } } - if (scene) { - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - scene->d_func()->invalidateSortCache(); - } - // Resolve opacity. updateEffectiveOpacity(); @@ -905,6 +900,11 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, bool de // Deliver post-change notification q->itemChange(QGraphicsItem::ItemParentHasChanged, newParentVariant); + + if (scene) { + // Deliver the change to the index + scene->d_func()->index->itemChanged(q, QGraphicsItem::ItemParentHasChanged, newParentVariant); + } } /*! @@ -3528,11 +3528,9 @@ void QGraphicsItem::setZValue(qreal z) d_ptr->z = newZ; d_ptr->fullUpdateHelper(); - if (d_ptr->scene) { - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - d_ptr->scene->d_func()->invalidateSortCache(); - } + //Z Value has changed, we have to notify the index. + if (d_ptr->scene) + d_ptr->scene->d_func()->index->itemChanged(this, ItemZValueChange, z); itemChange(ItemZValueHasChanged, newZVariant); } @@ -3991,7 +3989,7 @@ bool QGraphicsItem::isObscuredBy(const QGraphicsItem *item) const { if (!item) return false; - return QGraphicsScenePrivate::closestItemFirst_withoutCache(item, this) + return QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(item, this) && qt_QGraphicsItem_isObscured(this, item, boundingRect()); } diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index e244c13..7874033 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -435,6 +435,7 @@ private: friend class QGraphicsSceneIndex; friend class QGraphicsSceneIndexPrivate; friend class QGraphicsSceneBspTreeIndex; + friend class QGraphicsSceneBspTreeIndexPrivate; friend class ::tst_QGraphicsItem; friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *); friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0172a23..4734e74 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -218,6 +218,7 @@ #include "qgraphicswidget.h" #include "qgraphicswidget_p.h" #include "qgraphicssceneindex.h" +#include "qgraphicsscenebsptreeindex_p_p.h" #include #include @@ -291,8 +292,6 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() allItemsIgnoreHoverEvents(true), allItemsUseDefaultCursor(true), painterStateProtection(true), - sortCacheEnabled(false), - updatingSortCache(false), style(0) { } @@ -1073,175 +1072,6 @@ QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item) return 0; } -void QGraphicsScenePrivate::invalidateSortCache() -{ - Q_Q(QGraphicsScene); - if (!sortCacheEnabled || updatingSortCache) - return; - - updatingSortCache = true; - QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection); -} - -/*! - \internal - - Should not be exported, but we can't change that now. - ### Qt 5: Remove symbol / make static -*/ -inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - // Return true if sibling item1 is on top of item2. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; - bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; - bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; - if (f1 != f2) return f2; - qreal z1 = d1->z; - qreal z2 = d2->z; - return z1 != z2 ? z1 > z2 : d1->siblingIndex > d2->siblingIndex; -} - -/*! - \internal - - Should not be exported, but we can't change that now. -*/ -inline bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - return QGraphicsScenePrivate::closestItemFirst_withoutCache(item1, item2); -} - -/*! - Returns true if \a item1 is on top of \a item2. - - \internal -*/ -bool QGraphicsScenePrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - // Siblings? Just check their z-values. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; - if (d1->parent == d2->parent) - return qt_closestLeaf(item1, item2); - - // Find common ancestor, and each item's ancestor closest to the common - // ancestor. - int item1Depth = d1->depth; - int item2Depth = d2->depth; - const QGraphicsItem *p = item1; - const QGraphicsItem *t1 = item1; - while (item1Depth > item2Depth && (p = p->d_ptr->parent)) { - if (p == item2) { - // item2 is one of item1's ancestors; item1 is on top - return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); - } - t1 = p; - --item1Depth; - } - p = item2; - const QGraphicsItem *t2 = item2; - while (item2Depth > item1Depth && (p = p->d_ptr->parent)) { - if (p == item1) { - // item1 is one of item2's ancestors; item1 is not on top - return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); - } - t2 = p; - --item2Depth; - } - - // item1Ancestor is now at the same level as item2Ancestor, but not the same. - const QGraphicsItem *a1 = t1; - const QGraphicsItem *a2 = t2; - while (a1) { - const QGraphicsItem *p1 = a1; - const QGraphicsItem *p2 = a2; - a1 = a1->parentItem(); - a2 = a2->parentItem(); - if (a1 && a1 == a2) - return qt_closestLeaf(p1, p2); - } - - // No common ancestor? Then just compare the items' toplevels directly. - return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem()); -} - -/*! - Returns true if \a item2 is on top of \a item1. - - \internal -*/ -bool QGraphicsScenePrivate::closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - return closestItemFirst_withoutCache(item2, item1); -} - -void QGraphicsScenePrivate::climbTree(QGraphicsItem *item, int *stackingOrder) -{ - if (!item->d_ptr->children.isEmpty()) { - QList childList = item->d_ptr->children; - qSort(childList.begin(), childList.end(), qt_closestLeaf); - for (int i = 0; i < childList.size(); ++i) { - QGraphicsItem *item = childList.at(i); - if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent)) - climbTree(childList.at(i), stackingOrder); - } - item->d_ptr->globalStackingOrder = (*stackingOrder)++; - for (int i = 0; i < childList.size(); ++i) { - QGraphicsItem *item = childList.at(i); - if (item->flags() & QGraphicsItem::ItemStacksBehindParent) - climbTree(childList.at(i), stackingOrder); - } - } else { - item->d_ptr->globalStackingOrder = (*stackingOrder)++; - } -} - -void QGraphicsScenePrivate::_q_updateSortCache() -{ - //### FIXME - QGraphicsSceneBspTreeIndex *tree = qobject_cast(index); - if (tree) { - tree->_q_updateIndex(); - } - - if (!sortCacheEnabled || !updatingSortCache) - return; - - updatingSortCache = false; - int stackingOrder = 0; - - QList topLevels; - - for (int i = 0; i < index->items().count(); ++i) { - QGraphicsItem *item = index->items().at(i); - if (item && item->parentItem() == 0) - topLevels << item; - } - - qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); - for (int i = 0; i < topLevels.size(); ++i) - climbTree(topLevels.at(i), &stackingOrder); -} - -void QGraphicsScenePrivate::sortItems(QList *itemList, Qt::SortOrder order, - bool sortCacheEnabled) -{ - if (sortCacheEnabled) { - if (order == Qt::AscendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); - } else if (order == Qt::DescendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemLast_withCache); - } - } else { - if (order == Qt::AscendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); - } else if (order == Qt::DescendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); - } - } -} - /*! \internal @@ -1707,15 +1537,25 @@ void QGraphicsScene::setBspTreeDepth(int depth) bool QGraphicsScene::isSortCacheEnabled() const { Q_D(const QGraphicsScene); - return d->sortCacheEnabled; + QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); + if (!bspTree) { + qWarning("QGraphicsScene::isSortCacheEnabled: can not apply if indexing method is not BSP"); + return false; + } + return bspTree->d_func()->sortCacheEnabled; } void QGraphicsScene::setSortCacheEnabled(bool enabled) { Q_D(QGraphicsScene); - if (enabled == d->sortCacheEnabled) + QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); + if (!bspTree) { + qWarning("QGraphicsScene::isSortCacheEnabled: can not apply if indexing method is not BSP"); return; - if ((d->sortCacheEnabled = enabled)) - d->invalidateSortCache(); + } + if (enabled == bspTree->d_func()->sortCacheEnabled) + return; + if ((bspTree->d_func()->sortCacheEnabled = enabled)) + bspTree->d_func()->invalidateSortCache(); } /*! @@ -1910,8 +1750,6 @@ QList QGraphicsScene::collidingItems(const QGraphicsItem *item, if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode)) tmp << itemInVicinity; } - //### remove me - d->sortItems(&tmp, Qt::AscendingOrder, d->sortCacheEnabled); return tmp; } @@ -2211,10 +2049,6 @@ void QGraphicsScene::addItem(QGraphicsItem *item) return; } - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - d->invalidateSortCache(); - // Detach this item from its parent if the parent's scene is different // from this scene. if (QGraphicsItem *itemParent = item->parentItem()) { @@ -2232,10 +2066,6 @@ void QGraphicsScene::addItem(QGraphicsItem *item) if (!item->d_ptr->parent) d->registerTopLevelItem(item); - // Update the scene's sort cache settings. - item->d_ptr->globalStackingOrder = -1; - d->invalidateSortCache(); - // Add to list of items that require an update. We cannot assume that the // item is fully constructed, so calling item->update() can lead to a pure // virtual function call to boundingRect(). diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 5d70087..702813c 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -290,7 +290,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_removeItemLater(QGraphicsItem *item)) Q_PRIVATE_SLOT(d_func(), void _q_updateLater()) Q_PRIVATE_SLOT(d_func(), void _q_polishItems()) - Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache()) Q_PRIVATE_SLOT(d_func(), void _q_resetDirtyItems()) friend class QGraphicsItem; friend class QGraphicsItemPrivate; @@ -301,6 +300,7 @@ private: friend class QGraphicsSceneIndex; friend class QGraphicsSceneIndexPrivate; friend class QGraphicsSceneBspTreeIndex; + friend class QGraphicsSceneBspTreeIndexPrivate; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers) diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index a035159..d2a5cdb 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -187,25 +187,6 @@ public: void sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent); void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent); QGraphicsWidget *windowForItem(const QGraphicsItem *item) const; - bool sortCacheEnabled; - bool updatingSortCache; - void invalidateSortCache(); - static void climbTree(QGraphicsItem *item, int *stackingOrder); - void _q_updateSortCache(); - - static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); - static bool closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); - - static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) - { - return item1->d_ptr->globalStackingOrder < item2->d_ptr->globalStackingOrder; - } - static inline bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) - { - return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder; - } - - static void sortItems(QList *itemList, Qt::SortOrder order, bool cached); void drawItemHelper(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp index f8f1f56..19aa9d5 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp @@ -39,9 +39,15 @@ ** ****************************************************************************/ + static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; #include "qgraphicsscenebsptreeindex_p.h" + +#ifndef QT_NO_GRAPHICSVIEW + +#include "qgraphicsscenebsptreeindex_p_p.h" +#include "qgraphicssceneindex_p.h" #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" @@ -49,51 +55,365 @@ static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; #include -QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) - : QGraphicsSceneIndex(scene), +QT_BEGIN_NAMESPACE + +static inline int intmaxlog(int n) +{ + return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0); +} + +/*! + Constructs a private scene index. +*/ +QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene) + : scene(scene), bspTreeDepth(0), indexTimerId(0), restartIndexTimer(false), regenerateIndex(true), lastItemCount(0), - purgePending(false) + purgePending(false), + sortCacheEnabled(false), + updatingSortCache(false) +{ +} + + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() { + Q_Q(QGraphicsSceneBspTreeIndex); + if (!indexTimerId) + return; + QGraphicsScenePrivate * scenePrivate = q->scene()->d_func(); + q->killTimer(indexTimerId); + indexTimerId = 0; + + purgeRemovedItems(); + + // Add unindexedItems to indexedItems + QRectF unindexedItemsBoundingRect; + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + unindexedItemsBoundingRect |= item->sceneBoundingRect(); + if (!freeItemIndexes.isEmpty()) { + int freeIndex = freeItemIndexes.takeFirst(); + item->d_func()->index = freeIndex; + indexedItems[freeIndex] = item; + } else { + item->d_func()->index = indexedItems.size(); + indexedItems << item; + } + } + } + + // Update growing scene rect. + QRectF oldGrowingItemsBoundingRect = scenePrivate->growingItemsBoundingRect; + scenePrivate->growingItemsBoundingRect |= unindexedItemsBoundingRect; + + // Determine whether we should regenerate the BSP tree. + if (bspTreeDepth == 0) { + int oldDepth = intmaxlog(lastItemCount); + bspTreeDepth = intmaxlog(indexedItems.size()); + static const int slack = 100; + if (bsp.leafCount() == 0 || (oldDepth != bspTreeDepth && qAbs(lastItemCount - indexedItems.size()) > slack)) { + // ### Crude algorithm. + regenerateIndex = true; + } + } + + // Regenerate the tree. + if (regenerateIndex) { + regenerateIndex = false; + bsp.initialize(q->scene()->sceneRect(), bspTreeDepth); + unindexedItems = indexedItems; + lastItemCount = indexedItems.size(); + q->scene()->update(); + + // Take this opportunity to reset our largest-item counter for + // untransformable items. When the items are inserted into the BSP + // tree, we'll get an accurate calculation. + scenePrivate->largestUntransformableItem = QRectF(); + } + + // Insert all unindexed items into the tree. + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + QRectF rect = item->sceneBoundingRect(); + if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) + continue; + + bsp.insertItem(item, rect); + + // If the item ignores view transformations, update our + // largest-item-counter to ensure that the view can accurately + // discover untransformable items when drawing. + if (item->d_ptr->itemIsUntransformable()) { + QGraphicsItem *topmostUntransformable = item; + while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags + & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { + topmostUntransformable = topmostUntransformable->parentItem(); + } + // ### Verify that this is the correct largest untransformable rectangle. + scenePrivate->largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); + } + } + } + unindexedItems.clear(); + + // Notify scene rect changes. + if (!scenePrivate->hasSceneRect && scenePrivate->growingItemsBoundingRect != oldGrowingItemsBoundingRect) + emit q->scene()->sceneRectChanged(scenePrivate->growingItemsBoundingRect); } -QRectF QGraphicsSceneBspTreeIndex::indexedRect() + +/*! + \internal + + Removes stale pointers from all data structures. +*/ +void QGraphicsSceneBspTreeIndexPrivate::purgeRemovedItems() +{ + Q_Q(QGraphicsSceneBspTreeIndex); + if (!purgePending && removedItems.isEmpty()) + return; + + // Remove stale items from the BSP tree. + bsp.removeItems(removedItems.toSet()); + // Purge this list. + removedItems.clear(); + freeItemIndexes.clear(); + for (int i = 0; i < indexedItems.size(); ++i) { + if (!indexedItems.at(i)) + freeItemIndexes << i; + } + purgePending = false; + + // No locality info for the items; update the whole scene. + q->scene()->update(); +} + +/*! + \internal + + Starts or restarts the timer used for reindexing unindexed items. +*/ +void QGraphicsSceneBspTreeIndexPrivate::startIndexTimer() +{ + Q_Q(QGraphicsSceneBspTreeIndex); + if (indexTimerId) { + restartIndexTimer = true; + } else { + indexTimerId = q->startTimer(QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); + } +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::resetIndex() +{ + purgeRemovedItems(); + for (int i = 0; i < indexedItems.size(); ++i) { + if (QGraphicsItem *item = indexedItems.at(i)) { + item->d_ptr->index = -1; + unindexedItems << item; + } + } + indexedItems.clear(); + freeItemIndexes.clear(); + regenerateIndex = true; + startIndexTimer(); +} + +void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stackingOrder) { + if (!item->d_ptr->children.isEmpty()) { + QList childList = item->d_ptr->children; + qSort(childList.begin(), childList.end(), qt_closestLeaf); + for (int i = 0; i < childList.size(); ++i) { + QGraphicsItem *item = childList.at(i); + if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent)) + climbTree(childList.at(i), stackingOrder); + } + item->d_ptr->globalStackingOrder = (*stackingOrder)++; + for (int i = 0; i < childList.size(); ++i) { + QGraphicsItem *item = childList.at(i); + if (item->flags() & QGraphicsItem::ItemStacksBehindParent) + climbTree(childList.at(i), stackingOrder); + } + } else { + item->d_ptr->globalStackingOrder = (*stackingOrder)++; + } +} + +void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() +{ + Q_Q(QGraphicsSceneBspTreeIndex); _q_updateIndex(); + + if (!sortCacheEnabled || !updatingSortCache) + return; + + updatingSortCache = false; + int stackingOrder = 0; + + QList topLevels; + + for (int i = 0; i < q->items().count(); ++i) { + QGraphicsItem *item = q->items().at(i); + if (item && item->parentItem() == 0) + topLevels << item; + } + + qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); + for (int i = 0; i < topLevels.size(); ++i) + climbTree(topLevels.at(i), &stackingOrder); +} + +void QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache() +{ + Q_Q(QGraphicsSceneBspTreeIndex); + if (!sortCacheEnabled || updatingSortCache) + return; + + updatingSortCache = true; + QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection); +} + +/*! + Returns true if \a item1 is on top of \a item2. + + \internal +*/ +bool QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + // Siblings? Just check their z-values. + const QGraphicsItemPrivate *d1 = item1->d_ptr; + const QGraphicsItemPrivate *d2 = item2->d_ptr; + if (d1->parent == d2->parent) + return qt_closestLeaf(item1, item2); + + // Find common ancestor, and each item's ancestor closest to the common + // ancestor. + int item1Depth = d1->depth; + int item2Depth = d2->depth; + const QGraphicsItem *p = item1; + const QGraphicsItem *t1 = item1; + while (item1Depth > item2Depth && (p = p->d_ptr->parent)) { + if (p == item2) { + // item2 is one of item1's ancestors; item1 is on top + return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); + } + t1 = p; + --item1Depth; + } + p = item2; + const QGraphicsItem *t2 = item2; + while (item2Depth > item1Depth && (p = p->d_ptr->parent)) { + if (p == item1) { + // item1 is one of item2's ancestors; item1 is not on top + return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); + } + t2 = p; + --item2Depth; + } + + // item1Ancestor is now at the same level as item2Ancestor, but not the same. + const QGraphicsItem *a1 = t1; + const QGraphicsItem *a2 = t2; + while (a1) { + const QGraphicsItem *p1 = a1; + const QGraphicsItem *p2 = a2; + a1 = a1->parentItem(); + a2 = a2->parentItem(); + if (a1 && a1 == a2) + return qt_closestLeaf(p1, p2); + } + + // No common ancestor? Then just compare the items' toplevels directly. + return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem()); +} + +/*! + Returns true if \a item2 is on top of \a item1. + + \internal +*/ +bool QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + return closestItemFirst_withoutCache(item2, item1); +} + +void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemList, Qt::SortOrder order, + bool sortCacheEnabled) +{ + if (sortCacheEnabled) { + if (order == Qt::AscendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); + } else if (order == Qt::DescendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemLast_withCache); + } + } else { + if (order == Qt::AscendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); + } else if (order == Qt::DescendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); + } + } +} + +QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) + : QGraphicsSceneIndex(*new QGraphicsSceneBspTreeIndexPrivate(scene), scene) +{ + +} + +QRectF QGraphicsSceneBspTreeIndex::indexedRect() const +{ + Q_D(const QGraphicsSceneBspTreeIndex); + const_cast(d)->_q_updateIndex(); return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; } void QGraphicsSceneBspTreeIndex::clear() { - bsp.clear(); - lastItemCount = 0; - freeItemIndexes.clear(); - m_indexedItems.clear(); - unindexedItems.clear(); + Q_D(QGraphicsSceneBspTreeIndex); + d->bsp.clear(); + d->lastItemCount = 0; + d->freeItemIndexes.clear(); + d->indexedItems.clear(); + d->unindexedItems.clear(); } void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) { + Q_D(QGraphicsSceneBspTreeIndex); // Prevent reusing a recently deleted pointer: purge all removed items // from our lists. - purgeRemovedItems(); + d->purgeRemovedItems(); + + // Invalidate any sort caching; arrival of a new item means we need to + // resort. + // Update the scene's sort cache settings. + item->d_ptr->globalStackingOrder = -1; + d->invalidateSortCache(); // Indexing requires sceneBoundingRect(), but because \a item might // not be completely constructed at this point, we need to store it in // a temporary list and schedule an indexing for later. - unindexedItems << item; + d->unindexedItems << item; item->d_func()->index = -1; - startIndexTimer(); + d->startIndexTimer(); } /*! \internal */ -void QGraphicsSceneBspTreeIndex::addToIndex(QGraphicsItem *item) +void QGraphicsSceneBspTreeIndexPrivate::addToIndex(QGraphicsItem *item) { if (item->d_func()->index != -1) { bsp.insertItem(item, item->sceneBoundingRect()); @@ -109,37 +429,47 @@ void QGraphicsSceneBspTreeIndex::addToIndex(QGraphicsItem *item) void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) { + Q_D(QGraphicsSceneBspTreeIndex); // Note: This will access item's sceneBoundingRect(), which (as this is // C++) is why we cannot call removeItem() from QGraphicsItem's // destructor. - removeFromIndex(item); + d->removeFromIndex(item); + + // Invalidate any sort caching; arrival of a new item means we need to + // resort. + d->invalidateSortCache(); // Remove from our item lists. int index = item->d_func()->index; if (index != -1) { - freeItemIndexes << index; - m_indexedItems[index] = 0; + d->freeItemIndexes << index; + d->indexedItems[index] = 0; } else { - unindexedItems.removeAll(item); + d->unindexedItems.removeAll(item); } } void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) { + Q_D(QGraphicsSceneBspTreeIndex); + // Invalidate any sort caching; arrival of a new item means we need to + // resort. + d->invalidateSortCache(); + int index = item->d_func()->index; if (index != -1) { // Important: The index is useless until purgeRemovedItems() is // called. - m_indexedItems[index] = (QGraphicsItem *)0; - if (!purgePending) { - purgePending = true; + d->indexedItems[index] = (QGraphicsItem *)0; + if (!d->purgePending) { + d->purgePending = true; scene()->update(); } - removedItems << item; + d->removedItems << item; } else { // Recently added items are purged immediately. unindexedItems() never // contains stale items. - unindexedItems.removeAll(item); + d->unindexedItems.removeAll(item); scene()->update(); } } @@ -147,7 +477,7 @@ void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) /*! \internal */ -void QGraphicsSceneBspTreeIndex::removeFromIndex(QGraphicsItem *item) +void QGraphicsSceneBspTreeIndexPrivate::removeFromIndex(QGraphicsItem *item) { if (item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { // ### remove from child index only if applicable @@ -157,7 +487,7 @@ void QGraphicsSceneBspTreeIndex::removeFromIndex(QGraphicsItem *item) if (index != -1) { bsp.removeItem(item, item->sceneBoundingRect()); freeItemIndexes << index; - m_indexedItems[index] = 0; + indexedItems[index] = 0; item->d_func()->index = -1; unindexedItems << item; @@ -170,21 +500,23 @@ void QGraphicsSceneBspTreeIndex::removeFromIndex(QGraphicsItem *item) void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) { + Q_D(QGraphicsSceneBspTreeIndex); // Note: This will access item's sceneBoundingRect(), which (as this is // C++) is why we cannot call removeItem() from QGraphicsItem's // destructor. - removeFromIndex(const_cast(item)); + d->removeFromIndex(const_cast(item)); } QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { - const_cast(this)->purgeRemovedItems(); - scene()->d_func()->_q_updateSortCache(); + Q_D(const QGraphicsSceneBspTreeIndex); + const_cast(d)->purgeRemovedItems(); + const_cast(d)->_q_updateSortCache(); - QList rectItems = bsp.items(rect); + QList rectItems = d->bsp.items(rect); // Fill in with any unindexed items - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { + for (int i = 0; i < d->unindexedItems.size(); ++i) { + if (QGraphicsItem *item = d->unindexedItems.at(i)) { if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { QRectF boundingRect = item->sceneBoundingRect(); if (QRectF_intersects(boundingRect, rect)) { @@ -199,57 +531,83 @@ QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &r for (int i = 0; i < rectItems.size(); ++i) rectItems.at(i)->d_func()->itemDiscovered = 0; + d->sortItems(&rectItems, order, d->sortCacheEnabled); + return rectItems; } -QList QGraphicsSceneBspTreeIndex::items() const +QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) const { - const_cast(this)->purgeRemovedItems(); + Q_D(const QGraphicsSceneBspTreeIndex); + const_cast(d)->purgeRemovedItems(); + QList itemList; // If freeItemIndexes is empty, we know there are no holes in indexedItems and // unindexedItems. - if (freeItemIndexes.isEmpty()) { - if (unindexedItems.isEmpty()) - return m_indexedItems; - return m_indexedItems + unindexedItems; - } - - // Rebuild the list of items to avoid holes. ### We could also just - // compress the item lists at this point. - QList itemList; - foreach (QGraphicsItem *item, m_indexedItems + unindexedItems) { - if (item) - itemList << item; + if (d->freeItemIndexes.isEmpty()) { + if (d->unindexedItems.isEmpty()) { + itemList = d->indexedItems; + } else { + itemList = d->indexedItems + d->unindexedItems; + } + } else { + // Rebuild the list of items to avoid holes. ### We could also just + // compress the item lists at this point. + foreach (QGraphicsItem *item, d->indexedItems + d->unindexedItems) { + if (item) + itemList << item; + } } + //We sort descending order + d->sortItems(&itemList, order, d->sortCacheEnabled); return itemList; } int QGraphicsSceneBspTreeIndex::bspDepth() { - return bspTreeDepth; + Q_D(const QGraphicsSceneBspTreeIndex); + return d->bspTreeDepth; } void QGraphicsSceneBspTreeIndex::setBspDepth(int depth) { - bspTreeDepth = depth; - resetIndex(); + Q_D(QGraphicsSceneBspTreeIndex); + d->bspTreeDepth = depth; + d->resetIndex(); } void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) { - m_sceneRect = rect; - resetIndex(); + Q_D(QGraphicsSceneBspTreeIndex); + d->sceneRect = rect; + d->resetIndex(); +} + +void QGraphicsSceneBspTreeIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) +{ + Q_D(QGraphicsSceneBspTreeIndex); + switch (change) { + case QGraphicsItem::ItemZValueChange: + case QGraphicsItem::ItemParentChange: { + d->invalidateSortCache(); + break; + } + default: + break; + } + return QGraphicsSceneIndex::itemChanged(item, change, value); } bool QGraphicsSceneBspTreeIndex::event(QEvent *event) { + Q_D(QGraphicsSceneBspTreeIndex); switch (event->type()) { case QEvent::Timer: - if (indexTimerId && static_cast(event)->timerId() == indexTimerId) { - if (restartIndexTimer) { - restartIndexTimer = false; + if (d->indexTimerId && static_cast(event)->timerId() == d->indexTimerId) { + if (d->restartIndexTimer) { + d->restartIndexTimer = false; } else { // this call will kill the timer - _q_updateIndex(); + d->_q_updateIndex(); } } // Fallthrough intended - support timers in subclasses. @@ -259,153 +617,9 @@ bool QGraphicsSceneBspTreeIndex::event(QEvent *event) return true; } -static inline int intmaxlog(int n) -{ - return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0); -} +QT_END_NAMESPACE -/*! - \internal -*/ -void QGraphicsSceneBspTreeIndex::_q_updateIndex() -{ - if (!indexTimerId) - return; +#include "moc_qgraphicsscenebsptreeindex_p.cpp" - killTimer(indexTimerId); - indexTimerId = 0; +#endif // QT_NO_GRAPHICSVIEW - purgeRemovedItems(); - - // Add unindexedItems to indexedItems - QRectF unindexedItemsBoundingRect; - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - unindexedItemsBoundingRect |= item->sceneBoundingRect(); - if (!freeItemIndexes.isEmpty()) { - int freeIndex = freeItemIndexes.takeFirst(); - item->d_func()->index = freeIndex; - m_indexedItems[freeIndex] = item; - } else { - item->d_func()->index = m_indexedItems.size(); - m_indexedItems << item; - } - } - } - - // Update growing scene rect. - QRectF oldGrowingItemsBoundingRect = scene()->d_func()->growingItemsBoundingRect; - scene()->d_func()->growingItemsBoundingRect |= unindexedItemsBoundingRect; - - // Determine whether we should regenerate the BSP tree. - if (bspTreeDepth == 0) { - int oldDepth = intmaxlog(lastItemCount); - bspTreeDepth = intmaxlog(m_indexedItems.size()); - static const int slack = 100; - if (bsp.leafCount() == 0 || (oldDepth != bspTreeDepth && qAbs(lastItemCount - m_indexedItems.size()) > slack)) { - // ### Crude algorithm. - regenerateIndex = true; - } - } - - // Regenerate the tree. - if (regenerateIndex) { - regenerateIndex = false; - bsp.initialize(scene()->sceneRect(), bspTreeDepth); - unindexedItems = m_indexedItems; - lastItemCount = m_indexedItems.size(); - scene()->update(); - - // Take this opportunity to reset our largest-item counter for - // untransformable items. When the items are inserted into the BSP - // tree, we'll get an accurate calculation. - scene()->d_func()->largestUntransformableItem = QRectF(); - } - - // Insert all unindexed items into the tree. - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - QRectF rect = item->sceneBoundingRect(); - if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - continue; - - bsp.insertItem(item, rect); - - // If the item ignores view transformations, update our - // largest-item-counter to ensure that the view can accurately - // discover untransformable items when drawing. - if (item->d_ptr->itemIsUntransformable()) { - QGraphicsItem *topmostUntransformable = item; - while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags - & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { - topmostUntransformable = topmostUntransformable->parentItem(); - } - // ### Verify that this is the correct largest untransformable rectangle. - scene()->d_func()->largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); - } - } - } - unindexedItems.clear(); - - // Notify scene rect changes. - if (!scene()->d_func()->hasSceneRect && scene()->d_func()->growingItemsBoundingRect != oldGrowingItemsBoundingRect) - emit scene()->sceneRectChanged(scene()->d_func()->growingItemsBoundingRect); -} - - -/*! - \internal - - Removes stale pointers from all data structures. -*/ -void QGraphicsSceneBspTreeIndex::purgeRemovedItems() -{ - if (!purgePending && removedItems.isEmpty()) - return; - - // Remove stale items from the BSP tree. - bsp.removeItems(removedItems.toSet()); - // Purge this list. - removedItems.clear(); - freeItemIndexes.clear(); - for (int i = 0; i < m_indexedItems.size(); ++i) { - if (!m_indexedItems.at(i)) - freeItemIndexes << i; - } - purgePending = false; - - // No locality info for the items; update the whole scene. - scene()->update(); -} - -/*! - \internal - - Starts or restarts the timer used for reindexing unindexed items. -*/ -void QGraphicsSceneBspTreeIndex::startIndexTimer() -{ - if (indexTimerId) { - restartIndexTimer = true; - } else { - indexTimerId = startTimer(QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); - } -} - -/*! - \internal -*/ -void QGraphicsSceneBspTreeIndex::resetIndex() -{ - purgeRemovedItems(); - for (int i = 0; i < m_indexedItems.size(); ++i) { - if (QGraphicsItem *item = m_indexedItems.at(i)) { - item->d_ptr->index = -1; - unindexedItems << item; - } - } - m_indexedItems.clear(); - freeItemIndexes.clear(); - regenerateIndex = true; - startIndexTimer(); -} diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 7a6ea0b..b1ea977 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -56,56 +56,41 @@ QT_BEGIN_NAMESPACE #include "qgraphicsscene_bsp_p.h" +class QGraphicsSceneBspTreeIndexPrivate; class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex { Q_OBJECT public: QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); - QRectF indexedRect(); - - void clear(); - - void addItem(QGraphicsItem *item); - void removeItem(QGraphicsItem *item); - void deleteItem(QGraphicsItem *item); - void prepareBoundingRectChange(const QGraphicsItem *item); + QRectF indexedRect() const; QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; - QList items() const; + QList items(Qt::SortOrder order = Qt::AscendingOrder) const; int bspDepth(); void setBspDepth(int depth); protected: bool event(QEvent *event); - void sceneRectChanged(const QRectF &rect); + void clear(); + + void addItem(QGraphicsItem *item); + void removeItem(QGraphicsItem *item); + void deleteItem(QGraphicsItem *item); + void prepareBoundingRectChange(const QGraphicsItem *item); -public slots : - void _q_updateIndex(); + void sceneRectChanged(const QRectF &rect); + void itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); private : - QGraphicsSceneBspTree bsp; - QRectF m_sceneRect; - int bspTreeDepth; - int indexTimerId; - bool restartIndexTimer; - bool regenerateIndex; - int lastItemCount; - - QList m_indexedItems; - QList unindexedItems; - QList freeItemIndexes; - - bool purgePending; - QList removedItems; - void purgeRemovedItems(); - - void startIndexTimer(); - void resetIndex(); - - void addToIndex(QGraphicsItem *item); - void removeFromIndex(QGraphicsItem *item); + Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex) + Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex) + Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache()) + Q_PRIVATE_SLOT(d_func(), void _q_updateIndex()) + + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h new file mode 100644 index 0000000..2df5fbc --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENEBSPTREEINDEX_P_P_H +#define QGRAPHICSSCENEBSPTREEINDEX_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qgraphicsscenebsptreeindex_p.h" + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +#include +#include + +QT_BEGIN_NAMESPACE + +class QGraphicsScene; + +class QGraphicsSceneBspTreeIndexPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QGraphicsSceneBspTreeIndex) +public: + QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene); + + QGraphicsScene *scene; + QGraphicsSceneBspTree bsp; + QRectF sceneRect; + int bspTreeDepth; + int indexTimerId; + bool restartIndexTimer; + bool regenerateIndex; + int lastItemCount; + + QList indexedItems; + QList unindexedItems; + QList freeItemIndexes; + + bool purgePending; + QList removedItems; + void purgeRemovedItems(); + + void _q_updateIndex(); + void startIndexTimer(); + void resetIndex(); + + void addToIndex(QGraphicsItem *item); + void removeFromIndex(QGraphicsItem *item); + + void _q_updateSortCache(); + bool sortCacheEnabled; + bool updatingSortCache; + void invalidateSortCache(); + + static void climbTree(QGraphicsItem *item, int *stackingOrder); + static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); + static bool closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); + + static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) + { + return item1->d_ptr->globalStackingOrder < item2->d_ptr->globalStackingOrder; + } + static inline bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) + { + return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder; + } + + static void sortItems(QList *itemList, Qt::SortOrder order, bool cached); +}; + + +/*! + \internal +*/ +inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + // Return true if sibling item1 is on top of item2. + const QGraphicsItemPrivate *d1 = item1->d_ptr; + const QGraphicsItemPrivate *d2 = item2->d_ptr; + bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; + bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; + if (f1 != f2) return f2; + qreal z1 = d1->z; + qreal z2 = d2->z; + return z1 != z2 ? z1 > z2 : d1->siblingIndex > d2->siblingIndex; +} + +QT_END_NAMESPACE + +#endif // QGRAPHICSSCENEBSPTREEINDEX_P_P_H + +#endif + diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index d0d6081..eeee74e 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -41,6 +41,7 @@ #include "qgraphicssceneindex.h" #include "qgraphicssceneindex_p.h" +#include "qgraphicsscenebsptreeindex_p_p.h" #include "qgraphicsscene.h" #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" @@ -282,6 +283,14 @@ QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene) } /*! + \internal +*/ +QGraphicsSceneIndex::QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene) + : QObject(dd, scene) +{ +} + +/*! Destroys the scene index. */ QGraphicsSceneIndex::~QGraphicsSceneIndex() @@ -301,7 +310,7 @@ QGraphicsScene* QGraphicsSceneIndex::scene() const /*! Returns the indexed area for the index */ -QRectF QGraphicsSceneIndex::indexedRect() +QRectF QGraphicsSceneIndex::indexedRect() const { Q_D(const QGraphicsSceneIndex); return d->scene->d_func()->sceneRect; @@ -351,8 +360,9 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe d->childItems_helper(&items, item, xinv.map(pos)); } } - - d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); + //### Needed but it should be handle differently + if (order != Qt::SortOrder(-1)) + QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); return items; } @@ -415,9 +425,9 @@ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe } } } - + //### Needed but it should be handle differently if (order != Qt::SortOrder(-1)) - d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); + QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); return items; } @@ -474,9 +484,9 @@ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt:: d->childItems_helper(&items, item, xinv.map(polygon), mode); } } - + //### Needed but it should be handle differently if (order != Qt::SortOrder(-1)) - d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); + QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); return items; } QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const @@ -525,9 +535,9 @@ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt:: d->childItems_helper(&items, item, xinv.map(path), mode); } } - + //### Needed but it should be handle differently if (order != Qt::SortOrder(-1)) - d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled); + QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); return items; } diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index 11d9aae..084a623 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -71,9 +71,9 @@ public: QGraphicsScene *scene() const; - virtual QRectF indexedRect(); + virtual QRectF indexedRect() const; - virtual QList items() const = 0; + virtual QList items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; virtual QList items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; virtual QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; @@ -91,10 +91,15 @@ protected: virtual void prepareBoundingRectChange(const QGraphicsItem *item); virtual void sceneRectChanged(const QRectF &rect); + QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene); + friend class QGraphicsScene; friend class QGraphicsScenePrivate; friend class QGraphicsItem; + friend class QGraphicsItemPrivate; + friend class QGraphicsSceneBspTreeIndex; private: + Q_DISABLE_COPY(QGraphicsSceneIndex) Q_DECLARE_PRIVATE(QGraphicsSceneIndex) }; diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index f2cdca3..2014693 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -58,6 +58,7 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW #include +#include QT_BEGIN_NAMESPACE @@ -86,7 +87,7 @@ public: const QPainterPath &path, Qt::ItemSelectionMode mode) const; - QGraphicsScene *scene; + QGraphicsScene *scene; }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h index dc45a17..3057b4a 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -105,7 +105,7 @@ public: return result; } - QList items() const { + QList items(Qt::SortOrder order = Qt::AscendingOrder) const { return m_items; } }; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 91f97a1..e8330a9 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1056,7 +1056,7 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg *allItems = true; // All items are guaranteed within the exposed region, don't bother using the index. - QList itemList(scene->items()); + QList itemList(scene->d_func()->index->items(Qt::DescendingOrder)); int i = 0; while (i < itemList.size()) { const QGraphicsItem *item = itemList.at(i); @@ -1069,9 +1069,6 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg else ++i; } - - // Sort the items. - QGraphicsScenePrivate::sortItems(&itemList, Qt::DescendingOrder, scene->d_func()->sortCacheEnabled); return itemList; } @@ -2134,7 +2131,7 @@ QList QGraphicsViewPrivate::itemsInArea(const QPainterPath &pat // Then find the minimal list of items that are inside \a path, and // convert it to a set. - QList regularCandidates = scene->items(q->mapToScene(path), mode); + QList regularCandidates = scene->items(q->mapToScene(path), mode, order, q->transform()); QSet candSet = QSet::fromList(regularCandidates); QTransform viewMatrix = q->viewportTransform(); @@ -2161,10 +2158,6 @@ QList QGraphicsViewPrivate::itemsInArea(const QPainterPath &pat } ++it; } - - // ### Insertion sort would be faster. - if (order != Qt::SortOrder(-1)) - QGraphicsScenePrivate::sortItems(&result, order, scene->d_func()->sortCacheEnabled); return result; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 8afdeb4..c83134f 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -4685,6 +4685,11 @@ void tst_QGraphicsItem::itemClipsChildrenToShape() scene.render(&painter); painter.end(); + QGraphicsView view(&scene); + view.show(); + + QTest::qWait(5000); + QCOMPARE(image.pixel(16, 16), QColor(255, 0, 0).rgba()); QCOMPARE(image.pixel(32, 32), QColor(0, 0, 255).rgba()); QCOMPARE(image.pixel(50, 50), QColor(0, 255, 0).rgba()); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index eb117ab..dd997c7 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -379,8 +379,7 @@ void tst_QGraphicsScene::items() for (int x = minX; x < maxX; x += 100) items << scene.addRect(QRectF(0, 0, 10, 10)); } - - QCOMPARE(scene.items(), items); + QCOMPARE(scene.items().size(), items.size()); scene.itemAt(0, 0); // trigger indexing scene.removeItem(items.at(5)); @@ -397,7 +396,7 @@ void tst_QGraphicsScene::items() QVERIFY(!l2->sceneBoundingRect().intersects(l1->sceneBoundingRect())); QList items; items<rect().center()); - QTest::qWait(100); + QTest::qWait(250); for (int size = 200; size <= 400; size += 25) { view.resize(size, size); @@ -2122,7 +2122,7 @@ void tst_QGraphicsView::resizeAnchor() QVERIFY(qAbs(newCenter.x() - center.x()) < slack); QVERIFY(qAbs(newCenter.y() - center.y()) < slack); } - QTest::qWait(100); + QTest::qWait(250); } } } @@ -2925,7 +2925,7 @@ void tst_QGraphicsView::task245469_itemsAtPointWithClip() QTest::qWait(100); QList itemsAtCenter = view.items(view.viewport()->rect().center()); - QCOMPARE(itemsAtCenter, (QList() << child << parent)); + QCOMPARE(itemsAtCenter, (QList() << parent << child)); QPolygonF p = view.mapToScene(QRect(view.viewport()->rect().center(), QSize(1, 1))); QList itemsAtCenter2 = scene.items(p); -- cgit v0.12 From cea8678e5fca8b33bbd5da057282888bc260a5c9 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 4 Jun 2009 16:46:36 +0200 Subject: Fix doc and auto-test regression. --- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 4734e74..d811ade 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1586,7 +1586,7 @@ QList QGraphicsScene::items() const /*! Returns all visible items at position \a pos in the scene. The items are - listed in descending Z order (i.e., the first item in the list is the + listed in descending stacking order (i.e., the first item in the list is the top-most item, and the last item is the bottom-most item). \sa itemAt() diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 447de34..696a42d 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2925,7 +2925,7 @@ void tst_QGraphicsView::task245469_itemsAtPointWithClip() QTest::qWait(100); QList itemsAtCenter = view.items(view.viewport()->rect().center()); - QCOMPARE(itemsAtCenter, (QList() << parent << child)); + QCOMPARE(itemsAtCenter, (QList() << child << parent)); QPolygonF p = view.mapToScene(QRect(view.viewport()->rect().center(), QSize(1, 1))); QList itemsAtCenter2 = scene.items(p); -- cgit v0.12 From 3d9d7d10c2c6a4aed4650572bc9f3c8bd5b899b5 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 11 Jun 2009 17:05:32 +0200 Subject: Kill one items_helper + one childItem helper and use the new recursive approach. --- src/gui/graphicsview/qgraphicsscene.cpp | 5 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 232 ++++++++++++--------------- src/gui/graphicsview/qgraphicssceneindex_p.h | 7 +- 3 files changed, 110 insertions(+), 134 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 33232af..0a1cd2b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1734,10 +1734,7 @@ QList QGraphicsScene::items(const QPointF &pos) const QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode) const { Q_D(const QGraphicsScene); - QList itemList; - //###d->index->items(rect, mode, Qt::AscendingOrder); - d->recursive_items_helper(0, rect, &itemList, QTransform(), QTransform(), mode, Qt::AscendingOrder); - return itemList; + return d->index->items(rect, mode, Qt::AscendingOrder); } /*! diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 6895911..954cef3 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -57,57 +57,121 @@ QGraphicsSceneIndexPrivate::QGraphicsSceneIndexPrivate(QGraphicsScene *scene) : { } -void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPointF &pos) const +void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRectF rect, + QList *items, + const QTransform &parentTransform, + const QTransform &viewTransform, + Qt::ItemSelectionMode mode, Qt::SortOrder order, + qreal parentOpacity) const { - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - // ### is this needed? - if (parentClip && !parent->boundingRect().contains(pos)) - return; + // Calculate opacity. + qreal opacity; + if (item) { + if (!item->d_ptr->visible) + return; + QGraphicsItem *p = item->d_ptr->parent; + bool itemIgnoresParentOpacity = item->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity; + bool parentDoesntPropagateOpacity = (p && (p->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren)); + if (!itemIgnoresParentOpacity && !parentDoesntPropagateOpacity) { + opacity = parentOpacity * item->opacity(); + } else { + opacity = item->d_ptr->opacity; + } + if (opacity == 0.0 && !(item->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren)) + return; + } else { + opacity = parentOpacity; + } - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible()) - continue; + // Calculate the full transform for this item. + QTransform transform = parentTransform; + bool keep = false; + if (item) { + item->d_ptr->combineTransformFromParent(&transform, &viewTransform); + + // ### This does not take the clip into account. + QRectF brect = item->boundingRect(); + _q_adjustRect(&brect); + + keep = true; + if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) + keep = rect.contains(transform.mapRect(brect)) && rect != brect; + else + keep = rect.intersects(transform.mapRect(brect)); + + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath rectPath; + rectPath.addRect(rect); + keep = scene->d_func()->itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); + } + } - // Skip invisible items and all their children. - if (item->d_ptr->isInvisible()) - continue; + bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); + bool dontProcessItem = !item || !keep; + bool dontProcessChildren = item && dontProcessItem && childClip; + + // Find and sort children. + QList &children = item ? item->d_ptr->children : const_cast(scene->d_func())->topLevelItems; + if (!dontProcessChildren) { + if (item && item->d_ptr->needSortChildren) { + item->d_ptr->needSortChildren = 0; + qStableSort(children.begin(), children.end(), qt_notclosestLeaf); + } else if (!item && scene->d_func()->needSortTopLevelItems) { + const_cast(scene->d_func())->needSortTopLevelItems = false; + qStableSort(children.begin(), children.end(), qt_notclosestLeaf); + } + } - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - if (item->contains(item->mapFromParent(pos))) { - items->append(item); - keep = true; - } + childClip &= !dontProcessChildren & !children.isEmpty(); + + // Clip. + if (childClip) + rect &= transform.map(item->shape()).controlPointRect(); + + // Process children behind + int i = 0; + if (!dontProcessChildren) { + for (i = 0; i < children.size(); ++i) { + QGraphicsItem *child = children.at(i); + if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) + break; + recursive_items_helper(child, rect, items, transform, viewTransform, + mode, order, opacity); } + } - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) - // Recurse into children. - childItems_helper(items, item, item->mapFromParent(pos)); + // Process item + if (!dontProcessItem) + items->append(item); + + // Process children in front + if (!dontProcessChildren) { + for (; i < children.size(); ++i) + recursive_items_helper(children.at(i), rect, items, transform, viewTransform, + mode, order, opacity); } -} + if (!item && order == Qt::AscendingOrder) { + int n = items->size(); + for (int i = 0; i < n / 2; ++i) { + QGraphicsItem *tmp = (*items)[n - i - 1]; + (*items)[n - i - 1] = (*items)[i]; + (*items)[i] = tmp; + } + } +} void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, const QGraphicsItem *parent, - const QRectF &rect, - Qt::ItemSelectionMode mode) const + const QPointF &pos) const { bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); if (parentClip && parent->d_ptr->isClippedAway()) return; - QRectF adjustedRect(rect); - _q_adjustRect(&adjustedRect); - QRectF r = !parentClip ? adjustedRect : adjustedRect.intersected(adjustedItemBoundingRect(parent)); - if (r.isEmpty()) + // ### is this needed? + if (parentClip && !parent->boundingRect().contains(pos)) return; - QPainterPath path; QList &children = parent->d_ptr->children; for (int i = 0; i < children.size(); ++i) { QGraphicsItem *item = children.at(i); @@ -120,45 +184,18 @@ void QGraphicsSceneIndexPrivate::childItems_helper(QList *items bool keep = false; if (!item->d_ptr->isClippedAway()) { - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - QRectF mbr = item->mapRectToParent(br); - if (mode >= Qt::ContainsItemBoundingRect) { - // Rect intersects/contains item's bounding rect - if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) - || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(br))) { - items->append(item); - keep = true; - } - } else { - // Rect intersects/contains item's shape - if (QRectF_intersects(rect, mbr)) { - if (path == QPainterPath()) - path.addRect(rect); - if (scene->d_func()->itemCollidesWithPath(item, item->mapFromParent(path), mode)) { - items->append(item); - keep = true; - } - } + if (item->contains(item->mapFromParent(pos))) { + items->append(item); + keep = true; } } - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { + if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) // Recurse into children. - if (!item->d_ptr->transformData || item->d_ptr->transformData->computedFullTransform().type() <= QTransform::TxScale) { - // Rect - childItems_helper(items, item, item->mapRectFromParent(rect), mode); - } else { - // Polygon - childItems_helper(items, item, item->mapFromParent(rect), mode); - } - } + childItems_helper(items, item, item->mapFromParent(pos)); } } - void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, const QGraphicsItem *parent, const QPolygonF &polygon, @@ -369,66 +406,9 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); - QList items; - - QPainterPath path; - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - QRectF adjustedRect(rect); - _q_adjustRect(&adjustedRect); - foreach (QGraphicsItem *item, estimateItems(adjustedRect, order, deviceTransform)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Rect intersects/contains item's bounding rect - QRectF mbr = x.mapRect(br); - if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) - || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(mbr))) { - items << item; - keep = true; - } - } else { - // Rect intersects/contains item's shape - if (QRectF_intersects(adjustedRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (path.isEmpty()) - path.addRect(rect); - if (d->scene->d_func()->itemCollidesWithPath(item, xinv.map(path), mode)) { - items << item; - keep = true; - } - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - // Recurse into children that clip children. - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (x.type() <= QTransform::TxScale) { - // Rect - d->childItems_helper(&items, item, xinv.mapRect(rect), mode); - } else { - // Polygon - d->childItems_helper(&items, item, xinv.map(rect), mode); - } - } - } - } - //### Needed but it should be handle differently - if (order != Qt::SortOrder(-1)) - QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); - return items; + QList itemList; + d->recursive_items_helper(0, rect, &itemList, QTransform(), deviceTransform, mode, order); + return itemList; } QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index 2014693..3a2cb27 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -70,16 +70,15 @@ class QGraphicsSceneIndexPrivate : public QObjectPrivate public: QGraphicsSceneIndexPrivate(QGraphicsScene *scene); + void recursive_items_helper(QGraphicsItem *item, QRectF rect, QList *items, + const QTransform &parentTransform, const QTransform &viewTransform, + Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const; void childItems_helper(QList *items, const QGraphicsItem *parent, const QPointF &pos) const; void childItems_helper(QList *items, const QGraphicsItem *parent, - const QRectF &rect, - Qt::ItemSelectionMode mode) const; - void childItems_helper(QList *items, - const QGraphicsItem *parent, const QPolygonF &polygon, Qt::ItemSelectionMode mode) const; void childItems_helper(QList *items, -- cgit v0.12 From da70cf2876cee57299dbeebb86c4c3881e3df721 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 15 Jun 2009 20:50:26 +0200 Subject: Kill items_helper and child_items_helper for ever. We have now on function recusrsive_item_helper that doing the job. To resolve different use cases we use concept of interceptors for QRectF, QPointF QPolygonF and QPainterPath. --- src/gui/graphicsview/qgraphicsscene.cpp | 5 + src/gui/graphicsview/qgraphicsscene_p.h | 2 + .../graphicsview/qgraphicsscenebsptreeindex_p.cpp | 3 +- .../graphicsview/qgraphicsscenebsptreeindex_p_p.h | 5 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 408 ++++++--------------- src/gui/graphicsview/qgraphicssceneindex_p.h | 36 +- 6 files changed, 140 insertions(+), 319 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0a1cd2b..eb06186 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -312,6 +312,11 @@ void QGraphicsScenePrivate::init() q->update(); } +QGraphicsScenePrivate *QGraphicsScenePrivate::get(QGraphicsScene *q) +{ + return q->d_func(); +} + void QGraphicsScenePrivate::_q_emitUpdated() { Q_Q(QGraphicsScene); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index afdba7e..c63e121 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -85,6 +85,8 @@ public: QGraphicsScenePrivate(); void init(); + static QGraphicsScenePrivate *get(QGraphicsScene *q); + quint32 changedSignalMask; QGraphicsScene::ItemIndexMethod indexMethod; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp index 97d0500..acadcbd 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp @@ -64,7 +64,7 @@ static inline int intmaxlog(int n) Constructs a private scene index. */ QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene) - : scene(scene), + : QGraphicsSceneIndexPrivate(scene), bspTreeDepth(0), indexTimerId(0), restartIndexTimer(false), @@ -175,7 +175,6 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() */ void QGraphicsSceneBspTreeIndexPrivate::purgeRemovedItems() { - Q_Q(QGraphicsSceneBspTreeIndex); if (!purgePending && removedItems.isEmpty()) return; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h index 098b278..30f6e26 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h @@ -57,7 +57,7 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW -#include +#include #include QT_BEGIN_NAMESPACE @@ -66,13 +66,12 @@ static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; class QGraphicsScene; -class QGraphicsSceneBspTreeIndexPrivate : public QObjectPrivate +class QGraphicsSceneBspTreeIndexPrivate : public QGraphicsSceneIndexPrivate { Q_DECLARE_PUBLIC(QGraphicsSceneBspTreeIndex) public: QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene); - QGraphicsScene *scene; QGraphicsSceneBspTree bsp; QRectF sceneRect; int bspTreeDepth; diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 954cef3..8d18806 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -50,14 +50,88 @@ QT_BEGIN_NAMESPACE +class QGraphicsSceneIndexRectIntersector : public QGraphicsSceneIndexIntersector +{ +public: + QGraphicsSceneIndexRectIntersector(QGraphicsScene *scene) : QGraphicsSceneIndexIntersector(scene) {} + bool intersect(const QRectF &brect) const + { + bool keep = true; + if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) + keep = rect.contains(transform.mapRect(brect)) && rect != brect; + else + keep = rect.intersects(transform.mapRect(brect)); + + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath rectPath; + rectPath.addRect(rect); + keep = QGraphicsScenePrivate::get(scene)->itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); + } + return keep; + } +}; + +class QGraphicsSceneIndexPointIntersector : public QGraphicsSceneIndexIntersector +{ +public: + QGraphicsSceneIndexPointIntersector(QGraphicsScene *scene) : QGraphicsSceneIndexIntersector(scene) {} + bool intersect(const QRectF &brect) const + { + bool keep = false; + if (rect.intersects(transform.mapRect(brect))) + if (item->contains(transform.inverted().map(pos))) + keep = true; + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath rectPath; + rectPath.addRect(rect); + keep = QGraphicsScenePrivate::get(scene)->itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); + } + return keep; + } + QPointF pos; +}; + +class QGraphicsSceneIndexPathIntersector : public QGraphicsSceneIndexIntersector +{ +public: + QGraphicsSceneIndexPathIntersector(QGraphicsScene *scene) : QGraphicsSceneIndexIntersector(scene) {} + bool intersect(const QRectF &brect) const + { + bool keep = true; + if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) + keep = rect.contains(transform.mapRect(brect)) && rect != brect; + else + keep = rect.intersects(transform.mapRect(brect)); + + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + keep = QGraphicsScenePrivate::get(scene)->itemCollidesWithPath(item, transform.inverted().map(path), mode); + } + return keep; + } + QPainterPath path; +}; + /*! Constructs a private scene index. */ QGraphicsSceneIndexPrivate::QGraphicsSceneIndexPrivate(QGraphicsScene *scene) : scene(scene) { + pointIntersector = new QGraphicsSceneIndexPointIntersector(scene); + rectIntersector = new QGraphicsSceneIndexRectIntersector(scene); + pathIntersector = new QGraphicsSceneIndexPathIntersector(scene); +} + +/*! + Destructor of private scene index. +*/ +QGraphicsSceneIndexPrivate::~QGraphicsSceneIndexPrivate() +{ + delete pointIntersector; + delete rectIntersector; + delete pathIntersector; } -void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRectF rect, +void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGraphicsSceneIndexIntersector *intersector, QList *items, const QTransform &parentTransform, const QTransform &viewTransform, @@ -93,17 +167,10 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe QRectF brect = item->boundingRect(); _q_adjustRect(&brect); - keep = true; - if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) - keep = rect.contains(transform.mapRect(brect)) && rect != brect; - else - keep = rect.intersects(transform.mapRect(brect)); - - if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { - QPainterPath rectPath; - rectPath.addRect(rect); - keep = scene->d_func()->itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); - } + //We fill the intersector with needed informations + intersector->transform = transform; + intersector->item = item; + keep = intersector->intersect(brect); } bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); @@ -126,7 +193,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe // Clip. if (childClip) - rect &= transform.map(item->shape()).controlPointRect(); + intersector->rect &= transform.map(item->shape()).controlPointRect(); // Process children behind int i = 0; @@ -135,7 +202,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe QGraphicsItem *child = children.at(i); if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) break; - recursive_items_helper(child, rect, items, transform, viewTransform, + recursive_items_helper(child, intersector, items, transform, viewTransform, mode, order, opacity); } } @@ -147,7 +214,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe // Process children in front if (!dontProcessChildren) { for (; i < children.size(); ++i) - recursive_items_helper(children.at(i), rect, items, transform, viewTransform, + recursive_items_helper(children.at(i), intersector, items, transform, viewTransform, mode, order, opacity); } @@ -161,156 +228,6 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe } } -void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPointF &pos) const -{ - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - // ### is this needed? - if (parentClip && !parent->boundingRect().contains(pos)) - return; - - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible()) - continue; - - // Skip invisible items and all their children. - if (item->d_ptr->isInvisible()) - continue; - - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - if (item->contains(item->mapFromParent(pos))) { - items->append(item); - keep = true; - } - } - - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) - // Recurse into children. - childItems_helper(items, item, item->mapFromParent(pos)); - } -} - -void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPolygonF &polygon, - Qt::ItemSelectionMode mode) const -{ - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - QRectF polyRect(polygon.boundingRect()); - _q_adjustRect(&polyRect); - QRectF r = !parentClip ? polyRect : polyRect.intersected(adjustedItemBoundingRect(parent)); - if (r.isEmpty()) - return; - - QPainterPath path; - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible()) - continue; - - // Skip invisible items. - if (item->d_ptr->isInvisible()) - continue; - - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Polygon contains/intersects item's bounding rect - if (path == QPainterPath()) - path.addPolygon(polygon); - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { - items->append(item); - keep = true; - } - } else { - // Polygon contains/intersects item's shape - if (QRectF_intersects(polyRect, item->mapRectToParent(br))) { - if (path == QPainterPath()) - path.addPolygon(polygon); - if (scene->d_func()->itemCollidesWithPath(item, item->mapFromParent(path), mode)) { - items->append(item); - keep = true; - } - } - } - } - - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { - // Recurse into children that clip children. - childItems_helper(items, item, item->mapFromParent(polygon), mode); - } - } -} - -void QGraphicsSceneIndexPrivate::childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPainterPath &path, - Qt::ItemSelectionMode mode) const -{ - bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - if (parentClip && parent->d_ptr->isClippedAway()) - return; - QRectF pathRect(path.boundingRect()); - _q_adjustRect(&pathRect); - QRectF r = !parentClip ? pathRect : pathRect.intersected(adjustedItemBoundingRect(parent)); - if (r.isEmpty()) - return; - - QList &children = parent->d_ptr->children; - for (int i = 0; i < children.size(); ++i) { - QGraphicsItem *item = children.at(i); - if (item->d_ptr->transformData && !item->d_ptr->transformData->computedFullTransform().isInvertible()) - continue; - - // Skip invisible items. - if (item->d_ptr->isInvisible()) - continue; - - bool keep = false; - if (!item->d_ptr->isClippedAway()) { - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Polygon contains/intersects item's bounding rect - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { - items->append(item); - keep = true; - } - } else { - // Path contains/intersects item's shape - if (QRectF_intersects(pathRect, item->mapRectToParent(br))) { - if (scene->d_func()->itemCollidesWithPath(item, item->mapFromParent(path), mode)) { - items->append(item); - keep = true; - } - } - } - } - - if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { - // Recurse into children that clip children. - childItems_helper(items, item, item->mapFromParent(path), mode); - } - } -} - /*! Constructs an abstract scene index. */ @@ -363,162 +280,50 @@ QRectF QGraphicsSceneIndex::indexedRect() const QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); - QList items; - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - QRectF adjustedRect = QRectF(pos, QSize(1,1)); - foreach (QGraphicsItem *item, estimateItems(adjustedRect, order, deviceTransform)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - // Rect intersects/contains item's shape - if (QRectF_intersects(adjustedRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (item->contains(xinv.map(pos))) { - items << item; - keep = true; - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - // Recurse into children that clip children. - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) - d->childItems_helper(&items, item, xinv.map(pos)); - } - } - //### Needed but it should be handle differently - if (order != Qt::SortOrder(-1)) - QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); - return items; + QList itemList; + d->pointIntersector->mode = mode; + d->pointIntersector->rect = QRectF(pos, QSize(1,1)); + d->pointIntersector->pos = pos; + d->recursive_items_helper(0, d->pointIntersector, &itemList, QTransform(), deviceTransform, mode, order); + return itemList; } QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); QList itemList; - d->recursive_items_helper(0, rect, &itemList, QTransform(), deviceTransform, mode, order); + d->rectIntersector->mode = mode; + d->rectIntersector->rect = rect; + d->recursive_items_helper(0, d->rectIntersector, &itemList, QTransform(), deviceTransform, mode, order); return itemList; } QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); - QList items; - + QList itemList; QRectF polyRect(polygon.boundingRect()); _q_adjustRect(&polyRect); + d->pathIntersector->mode = mode; + d->pathIntersector->rect = polyRect; QPainterPath path; - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - foreach (QGraphicsItem *item, estimateItems(polyRect, order, deviceTransform)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Polygon contains/intersects item's bounding rect - if (path == QPainterPath()) - path.addPolygon(polygon); - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) { - items << item; - keep = true; - } - } else { - // Polygon contains/intersects item's shape - if (QRectF_intersects(polyRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (path == QPainterPath()) - path.addPolygon(polygon); - if (d->scene->d_func()->itemCollidesWithPath(item, xinv.map(path), mode)) { - items << item; - keep = true; - } - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - // Recurse into children that clip children. - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) - d->childItems_helper(&items, item, xinv.map(polygon), mode); - } - } - //### Needed but it should be handle differently - if (order != Qt::SortOrder(-1)) - QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); - return items; + path.addPolygon(polygon); + d->pathIntersector->path = path; + d->recursive_items_helper(0, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); + return itemList; } + QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); - QList items; + QList itemList; QRectF pathRect(path.controlPointRect()); _q_adjustRect(&pathRect); - - // The index returns a rough estimate of what items are inside the rect. - // Refine it by iterating through all returned items. - foreach (QGraphicsItem *item, estimateItems(pathRect, order, deviceTransform)) { - // Find the item's scene transform in a clever way. - QTransform x = item->sceneTransform(); - bool keep = false; - - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - const QRectF br(adjustedItemBoundingRect(item)); - if (mode >= Qt::ContainsItemBoundingRect) { - // Path contains/intersects item's bounding rect - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) { - items << item; - keep = true; - } - } else { - // Path contains/intersects item's shape - if (QRectF_intersects(pathRect, x.mapRect(br))) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - if (d->scene->d_func()->itemCollidesWithPath(item, xinv.map(path), mode)) { - items << item; - keep = true; - } - } - } - } - - if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) - d->childItems_helper(&items, item, xinv.map(path), mode); - } - } - //### Needed but it should be handle differently - if (order != Qt::SortOrder(-1)) - QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false); - return items; + d->pathIntersector->mode = mode; + d->pathIntersector->rect = pathRect; + d->pathIntersector->path = path; + d->recursive_items_helper(0, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); + return itemList; } /*! @@ -592,6 +397,8 @@ void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item) */ void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value) { + //Q_UNUSED(item); + //Q_UNUSED(value); } /*! @@ -601,6 +408,7 @@ void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem:: */ void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) { + //Q_UNUSED(item); } /*! diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index 3a2cb27..d0d181b 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -63,30 +63,38 @@ QT_BEGIN_NAMESPACE class QGraphicsScene; +class QGraphicsSceneIndexIntersector; +class QGraphicsSceneIndexRectIntersector; +class QGraphicsSceneIndexPointIntersector; +class QGraphicsSceneIndexPathIntersector; class QGraphicsSceneIndexPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGraphicsSceneIndex) public: QGraphicsSceneIndexPrivate(QGraphicsScene *scene); + ~QGraphicsSceneIndexPrivate(); - void recursive_items_helper(QGraphicsItem *item, QRectF rect, QList *items, + void recursive_items_helper(QGraphicsItem *item, QGraphicsSceneIndexIntersector *intersector, QList *items, const QTransform &parentTransform, const QTransform &viewTransform, Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const; - - void childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPointF &pos) const; - void childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPolygonF &polygon, - Qt::ItemSelectionMode mode) const; - void childItems_helper(QList *items, - const QGraphicsItem *parent, - const QPainterPath &path, - Qt::ItemSelectionMode mode) const; - QGraphicsScene *scene; + QGraphicsSceneIndexPointIntersector *pointIntersector; + QGraphicsSceneIndexRectIntersector *rectIntersector; + QGraphicsSceneIndexPathIntersector *pathIntersector; +}; + +class QGraphicsSceneIndexIntersector +{ +public: + QGraphicsSceneIndexIntersector(QGraphicsScene *scene) : scene(scene) { } + virtual ~QGraphicsSceneIndexIntersector() { } + virtual bool intersect(const QRectF &rect) const = 0; + Qt::ItemSelectionMode mode; + QGraphicsItem *item; + QGraphicsScene *scene; + QRectF rect; + QTransform transform; }; QT_END_NAMESPACE -- cgit v0.12 From 3dce31e5eb0fac43d445fb9664f1b68f4cd4c11f Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 16 Jun 2009 10:26:34 +0200 Subject: Warnings -- --- src/gui/graphicsview/qgraphicssceneindex.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 8d18806..3c4efe7 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -395,10 +395,11 @@ void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item) \sa GraphicsItemChange */ -void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value) +void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) { - //Q_UNUSED(item); - //Q_UNUSED(value); + Q_UNUSED(item); + Q_UNUSED(change); + Q_UNUSED(value); } /*! @@ -408,7 +409,7 @@ void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem:: */ void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) { - //Q_UNUSED(item); + Q_UNUSED(item); } /*! @@ -418,6 +419,7 @@ void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) */ void QGraphicsSceneIndex::sceneRectChanged(const QRectF &rect) { + Q_UNUSED(rect); } QT_END_NAMESPACE -- cgit v0.12 From 2ceb72068fbb9157a058a1788863b68a12d25646 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 16 Jun 2009 11:41:35 +0200 Subject: Fix all documentation warnings. --- src/gui/graphicsview/qgraphicsitem.h | 2 - src/gui/graphicsview/qgraphicsscene.cpp | 50 +++++++++---- src/gui/graphicsview/qgraphicssceneindex.cpp | 106 ++++++++++++++++++++++----- 3 files changed, 125 insertions(+), 33 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 6194249..56a4a3b 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -418,8 +418,6 @@ protected: virtual void setExtension(Extension extension, const QVariant &variant); virtual QVariant extension(const QVariant &variant) const; - bool operator<(const QGraphicsItem *other) const; - protected: QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 6e08a76..0729a9d 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -201,6 +201,8 @@ however, is done in constant time. This approach is ideal for dynamic scenes, where many items are added, moved or removed continuously. + \omitvalue CustomIndex + \sa setItemIndexMethod(), bspTreeDepth */ @@ -312,6 +314,9 @@ void QGraphicsScenePrivate::init() q->update(); } +/*! + \internal +*/ QGraphicsScenePrivate *QGraphicsScenePrivate::get(QGraphicsScene *q) { return q->d_func(); @@ -454,11 +459,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) markDirty(item, QRectF(), false, false, false, false, /*removingItemFromScene=*/true); if (item->d_ptr->inDestructor) { - // Can potentially call item->boundingRect() (virtual function), that's why - // we only can call this function if the item is not in its destructor. + // The item is actually in its destructor, we call the special method in the index. index->deleteItem(item); } else { - // Remove it from the index properly + // Can potentially call item->boundingRect() (virtual function), that's why + // we only can call this function if the item is not in its destructor. index->removeItem(item); } @@ -1569,6 +1574,13 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) d->indexMethod = method; } +/*! + \brief the item indexing method. + This method allow to apply an indexing algorithm \a index to the scene, to speed up + item discovery functions like items() and itemAt(). + + \sa sceneIndex(), QGraphicsSceneIndex +*/ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) { Q_D(QGraphicsScene); @@ -1583,6 +1595,11 @@ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) } } +/*! + This method return the current indexing algorithm of the scene. + + \sa setSceneIndex(), QGraphicsSceneIndex +*/ QGraphicsSceneIndex* QGraphicsScene::sceneIndex() const { Q_D(const QGraphicsScene); @@ -1784,10 +1801,13 @@ QList QGraphicsScene::items(const QPainterPath &path, Qt::ItemS } /*! - Returns all visible items at position \a pos in the scene. + Returns all visible items that, depending on \a mode, are at the specified \a pos + and return a list sorted using \a order. The default value for \a mode is Qt::IntersectsItemShape; all items whose - exact shape intersects with or is contained by \a path are returned. + exact shape intersects with \a pos are returned. + + \a deviceTransform is the transformation apply to the view. \sa itemAt() */ @@ -1798,15 +1818,15 @@ QList QGraphicsScene::items(const QPointF &pos, Qt::ItemSelecti } /*! - \fn QList QGraphicsScene::items(const QRectF &rectangle, Qt::SortOrder order, const QTransform &deviceTransform) const - \overload Returns all visible items that, depending on \a mode, are either inside or - intersect with the specified \a rectangle. + intersect with the specified \a rect and return a list sorted using \a order. The default value for \a mode is Qt::IntersectsItemShape; all items whose - exact shape intersects with or is contained by \a rectangle are returned. + exact shape intersects with or is contained by \a rect are returned. + + \a deviceTransform is the transformation apply to the view. \sa itemAt() */ @@ -1820,11 +1840,13 @@ QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti \overload Returns all visible items that, depending on \a mode, are either inside or - intersect with the polygon \a polygon. + intersect with the specified \a polygon and return a list sorted using \a order. The default value for \a mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by \a polygon are returned. + \a deviceTransform is the transformation apply to the view. + \sa itemAt() */ QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const @@ -1834,14 +1856,16 @@ QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS } /*! - \overload + \overload - Returns all visible items that, depending on \a path, are either inside or - intersect with the path \a path. + Returns all visible items that, depending on \a mode, are either inside or + intersect with the specified \a path and return a list sorted using \a order. The default value for \a mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by \a path are returned. + \a deviceTransform is the transformation apply to the view. + \sa itemAt() */ QList QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 3c4efe7..b713452 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -38,6 +38,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +/*! + \class QGraphicsSceneIndex + \brief The QGraphicsSceneIndex class provides a base class to implement + a custom indexing algorithm for discovering items in QGraphicsScene. + \since 4.6 + \ingroup multimedia + \ingroup graphicsview-api + \mainclass + + The QGraphicsSceneIndex class provides a base class to implement + a custom indexing algorithm for discovering items in QGraphicsScene. You + need to subclass it and reimplement addItem, removeItem, estimateItems + and items in order to have an functional indexing. + + \sa QGraphicsScene, QGraphicsView +*/ #include "qgraphicssceneindex.h" #include "qgraphicssceneindex_p.h" @@ -229,7 +245,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGr } /*! - Constructs an abstract scene index. + Constructs an abstract scene index for a given \a scene. */ QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene) : QObject(*new QGraphicsSceneIndexPrivate(scene), scene) @@ -271,12 +287,17 @@ QRectF QGraphicsSceneIndex::indexedRect() const } /*! - \fn QList items() const = 0 + \fn QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const - This pure virtual function return the list of items that are actually in the index. + Returns all visible items that, depending on \a mode, are at the specified \a pos + and return a list sorted using \a order. -*/ + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with \a pos are returned. + + \a deviceTransform is the transformation apply to the view. +*/ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); @@ -288,6 +309,20 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe return itemList; } +/*! + \fn QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const + + \overload + + Returns all visible items that, depending on \a mode, are either inside or + intersect with the specified \a rect and return a list sorted using \a order. + + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with or is contained by \a rect are returned. + + \a deviceTransform is the transformation apply to the view. + +*/ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); @@ -298,6 +333,20 @@ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe return itemList; } +/*! + \fn QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const + + \overload + + Returns all visible items that, depending on \a mode, are either inside or + intersect with the specified \a polygon and return a list sorted using \a order. + + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with or is contained by \a polygon are returned. + + \a deviceTransform is the transformation apply to the view. + +*/ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); @@ -313,6 +362,20 @@ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt:: return itemList; } +/*! + \fn QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const + + \overload + + Returns all visible items that, depending on \a mode, are either inside or + intersect with the specified \a path and return a list sorted using \a order. + + The default value for \a mode is Qt::IntersectsItemShape; all items whose + exact shape intersects with or is contained by \a path are returned. + + \a deviceTransform is the transformation apply to the view. + +*/ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); @@ -327,8 +390,9 @@ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt:: } /*! - This pure virtual function return an estimation of items at position \a pos. - + This virtual function return an estimation of items at position \a point. + This method return a list sorted using \a order. + \a deviceTransform is the transformation apply to the view. */ QList QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order, const QTransform &deviceTransform) const { @@ -336,12 +400,18 @@ QList QGraphicsSceneIndex::estimateItems(const QPointF &point, } /*! - \fn virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const = 0 + \fn virtual QList QGraphicsSceneIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const = 0 This pure virtual function return an estimation of items in the \a rect. + This method return a list sorted using \a order. + \a deviceTransform is the transformation apply to the view. */ +/*! + \fn virtual QList QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; + This pure virtual function all items in the index and sort them using \a order. +*/ /*! This virtual function removes all items in the scene index. @@ -353,23 +423,23 @@ void QGraphicsSceneIndex::clear() } /*! - \fn virtual void addItem(QGraphicsItem *item) = 0 + \fn virtual void QGraphicsSceneIndex::addItem(QGraphicsItem *item) = 0 - This pure virtual function inserts an item to the scene index. + This pure virtual function inserts an \a item to the scene index. \sa removeItem(), deleteItem() */ /*! - \fn virtual void removeItem(QGraphicsItem *item) = 0 + \fn virtual void QGraphicsSceneIndex::removeItem(QGraphicsItem *item) = 0 - This pure virtual function removes an item to the scene index. + This pure virtual function removes an \a item to the scene index. \sa addItem(), deleteItem() */ /*! - This method is called when an item has been deleted. + This method is called when an \a item has been deleted. The default implementation call removeItem. Be carefull, if your implementation of removeItem use pure virtual method of QGraphicsItem like boundingRect(), then you should reimplement @@ -384,7 +454,7 @@ void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item) /*! This virtual function is called by QGraphicsItem to notify the index - that some part of the item's state changes. By reimplementing this + that some part of the \a item 's state changes. By reimplementing this function, your can react to a change, and in some cases, (depending on \a change,) adjustments in the index can be made. @@ -393,7 +463,7 @@ void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item) The default implementation does nothing. - \sa GraphicsItemChange + \sa QGraphicsItem::GraphicsItemChange */ void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) { @@ -403,9 +473,9 @@ void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem:: } /*! - Notify the index for a geometry change of an item. + Notify the index for a geometry change of an \a item. - \sa QGraphicsItem::prepareGeometryChange + \sa QGraphicsItem::prepareGeometryChange() */ void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) { @@ -414,8 +484,8 @@ void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) /*! This virtual function is called when the scene changes its bounding - rectangle. - \sa QGraphicsScene::sceneRect + rectangle. \a rect is the new value of the scene rectangle. + \sa QGraphicsScene::sceneRect() */ void QGraphicsSceneIndex::sceneRectChanged(const QRectF &rect) { -- cgit v0.12 From 0fa15d71015adfd8895ef41a082fb9479bf4bb3d Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 16 Jun 2009 13:45:36 +0200 Subject: Remove old legacy and fix documentation. --- src/gui/graphicsview/graphicsview.pri | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 12 +- src/gui/graphicsview/qgraphicsscene_p.h | 4 +- .../graphicsview/qgraphicsscenebsptreeindex_p.cpp | 145 ++++++++++++++++++++- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 5 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 27 ++++ src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 37 +++--- 7 files changed, 198 insertions(+), 33 deletions(-) diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index 9dc4112..a4d142a 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -18,6 +18,7 @@ SOURCES += graphicsview/qgraphicsitem.cpp \ graphicsview/qgraphicsscene.cpp \ graphicsview/qgraphicsscene_bsp.cpp \ graphicsview/qgraphicsscenebsptreeindex_p.cpp \ + graphicsview/qgraphicsscenelinearindex.cpp \ graphicsview/qgraphicssceneindex.cpp \ graphicsview/qgraphicssceneevent.cpp \ graphicsview/qgraphicsview.cpp diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0729a9d..328ab4c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -271,9 +271,8 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph QGraphicsScenePrivate::QGraphicsScenePrivate() : changedSignalMask(0), indexMethod(QGraphicsScene::BspTreeIndex), - bspTreeDepth(0), - lastItemCount(0), index(0), + lastItemCount(0), hasSceneRect(false), updateAll(false), calledEmitUpdated(false), @@ -1642,14 +1641,11 @@ int QGraphicsScene::bspTreeDepth() const { Q_D(const QGraphicsScene); QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); - return bspTree ? bspTree->bspDepth() : 0; + return bspTree ? bspTree->bspTreeDepth() : 0; } void QGraphicsScene::setBspTreeDepth(int depth) { Q_D(QGraphicsScene); - if (d->bspTreeDepth == depth) - return; - if (depth < 0) { qWarning("QGraphicsScene::setBspTreeDepth: invalid depth %d ignored; must be >= 0", depth); return; @@ -1660,8 +1656,10 @@ void QGraphicsScene::setBspTreeDepth(int depth) qWarning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); return; } + if (bspTree->bspTreeDepth() == depth) + return; - bspTree->setBspDepth(depth); + bspTree->setBspTreeDepth(depth); } /*! diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index c63e121..db401ef 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -90,12 +90,10 @@ public: quint32 changedSignalMask; QGraphicsScene::ItemIndexMethod indexMethod; - int bspTreeDepth; + QGraphicsSceneIndex *index; int lastItemCount; - QGraphicsSceneIndex *index; - QRectF sceneRect; bool hasSceneRect; QRectF growingItemsBoundingRect; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp index acadcbd..b19248a 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp @@ -39,6 +39,40 @@ ** ****************************************************************************/ +/*! + \class QGraphicsSceneBspTreeIndex + \brief The QGraphicsSceneBspTreeIndex class provides an implementation of + a BSP indexing algorithm for discovering items in QGraphicsScene. + \since 4.6 + \ingroup multimedia + \ingroup graphicsview-api + \mainclass + + QGraphicsSceneBspTreeIndex index use a BSP(Binary Space Partitioning) + implementation to discover items quickly. This implementation is + very efficient for static scene. It has a depth that you can set. + The depth directly affects performance and memory usage; the latter + growing exponentially with the depth of the tree. With an optimal tree + depth, the index can instantly determine the locality of items, even + for scenes with thousands or millions of items. This also greatly improves + rendering performance. + + By default, the value is 0, in which case Qt will guess a reasonable + default depth based on the size, location and number of items in the + scene. If these parameters change frequently, however, you may experience + slowdowns as the index retunes the depth internally. You can avoid + potential slowdowns by fixating the tree depth through setting this + property. + + The depth of the tree and the size of the scene rectangle decide the + granularity of the scene's partitioning. The size of each scene segment is + determined by the following algorithm: + + The BSP tree has an optimal size when each segment contains between 0 and + 10 items. + + \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex +*/ #include "qgraphicsscenebsptreeindex_p.h" @@ -61,7 +95,7 @@ static inline int intmaxlog(int n) } /*! - Constructs a private scene index. + Constructs a private scene bsp index. */ QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene) : QGraphicsSceneIndexPrivate(scene), @@ -78,6 +112,11 @@ QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsSc /*! + This method will update the BSP index by removing the items from the temporary + unindexed list and add them in the indexedItems list. This will also + update the growingItemsBoundingRect if needed. This will update the BSP + implementation as well. + \internal */ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() @@ -223,6 +262,9 @@ void QGraphicsSceneBspTreeIndexPrivate::resetIndex() startIndexTimer(); } +/*! + \internal +*/ void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stackingOrder) { if (!item->d_ptr->children.isEmpty()) { @@ -244,6 +286,9 @@ void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stac } } +/*! + \internal +*/ void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() { Q_Q(QGraphicsSceneBspTreeIndex); @@ -268,6 +313,9 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() climbTree(topLevels.at(i), &stackingOrder); } +/*! + \internal +*/ void QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache() { Q_Q(QGraphicsSceneBspTreeIndex); @@ -342,6 +390,11 @@ bool QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withoutCache(const QGrap return closestItemFirst_withoutCache(item2, item1); } +/*! + Sort a list of \a itemList in a specific \a order and use the cache if requested. + + \internal +*/ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemList, Qt::SortOrder order, bool sortCacheEnabled) { @@ -360,12 +413,19 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemLi } } +/*! + Constructs a BSP scene index for the given \a scene. +*/ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) : QGraphicsSceneIndex(*new QGraphicsSceneBspTreeIndexPrivate(scene), scene) { } +/*! + \reimp + Return the rect indexed by the BSP index. +*/ QRectF QGraphicsSceneBspTreeIndex::indexedRect() const { Q_D(const QGraphicsSceneBspTreeIndex); @@ -373,6 +433,10 @@ QRectF QGraphicsSceneBspTreeIndex::indexedRect() const return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; } +/*! + \reimp + Clear the all the BSP index. +*/ void QGraphicsSceneBspTreeIndex::clear() { Q_D(QGraphicsSceneBspTreeIndex); @@ -383,6 +447,9 @@ void QGraphicsSceneBspTreeIndex::clear() d->unindexedItems.clear(); } +/*! + Add the \a item into the BSP index. +*/ void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); @@ -405,6 +472,7 @@ void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) } /*! + This really add the item in the BSP. \internal */ void QGraphicsSceneBspTreeIndexPrivate::addToIndex(QGraphicsItem *item) @@ -421,6 +489,9 @@ void QGraphicsSceneBspTreeIndexPrivate::addToIndex(QGraphicsItem *item) } } +/*! + Remove the \a item from the BSP index. +*/ void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); @@ -443,6 +514,10 @@ void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) } } +/*! + \reimp + Delete the \a item from the BSP index (without accessing its boundingRect). +*/ void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); @@ -469,6 +544,7 @@ void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) } /*! + Really remove the item from the BSP \internal */ void QGraphicsSceneBspTreeIndexPrivate::removeFromIndex(QGraphicsItem *item) @@ -492,6 +568,10 @@ void QGraphicsSceneBspTreeIndexPrivate::removeFromIndex(QGraphicsItem *item) startIndexTimer(); } +/*! + \reimp + Update the BSP when the \a item 's bounding rect has changed. +*/ void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); @@ -501,6 +581,13 @@ void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem * d->removeFromIndex(const_cast(item)); } +/*! + Returns an estimation visible items that are either inside or + intersect with the specified \a rect and return a list sorted using \a order. + + \a deviceTransform is the transformation apply to the view. + +*/ QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneBspTreeIndex); @@ -530,6 +617,12 @@ QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &r return rectItems; } + +/*! + \fn QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const; + + Return all items in the BSP index and sort them using \a order. +*/ QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) const { Q_D(const QGraphicsSceneBspTreeIndex); @@ -558,19 +651,52 @@ QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) co return itemList; } -int QGraphicsSceneBspTreeIndex::bspDepth() +/*! + \property QGraphicsSceneBspTreeIndex::bspTreeDepth + \brief the depth of the BSP index tree + \since 4.6 + + This value determines the depth of BSP tree. The depth + directly affects performance and memory usage; the latter + growing exponentially with the depth of the tree. With an optimal tree + depth, the index can instantly determine the locality of items, even + for scenes with thousands or millions of items. This also greatly improves + rendering performance. + + By default, the value is 0, in which case Qt will guess a reasonable + default depth based on the size, location and number of items in the + scene. If these parameters change frequently, however, you may experience + slowdowns as the index retunes the depth internally. You can avoid + potential slowdowns by fixating the tree depth through setting this + property. + + The depth of the tree and the size of the scene rectangle decide the + granularity of the scene's partitioning. The size of each scene segment is + determined by the following algorithm: + + The BSP tree has an optimal size when each segment contains between 0 and + 10 items. + +*/ +int QGraphicsSceneBspTreeIndex::bspTreeDepth() { Q_D(const QGraphicsSceneBspTreeIndex); return d->bspTreeDepth; } -void QGraphicsSceneBspTreeIndex::setBspDepth(int depth) +void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth) { Q_D(QGraphicsSceneBspTreeIndex); d->bspTreeDepth = depth; d->resetIndex(); } +/*! + \reimp + + This method react to the \a rect change of the scene and + reset the BSP tree index. +*/ void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) { Q_D(QGraphicsSceneBspTreeIndex); @@ -578,6 +704,13 @@ void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) d->resetIndex(); } +/*! + \reimp + + This method react to the \a change of the \a item and use the \a value to + update the BSP tree if necessary. + +*/ void QGraphicsSceneBspTreeIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) { Q_D(QGraphicsSceneBspTreeIndex); @@ -592,7 +725,13 @@ void QGraphicsSceneBspTreeIndex::itemChanged(const QGraphicsItem *item, QGraphic } return QGraphicsSceneIndex::itemChanged(item, change, value); } +/*! + \reimp + Used to catch the timer event. + + \internal +*/ bool QGraphicsSceneBspTreeIndex::event(QEvent *event) { Q_D(QGraphicsSceneBspTreeIndex); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index b1ea977..40b8f0b 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -60,6 +60,7 @@ class QGraphicsSceneBspTreeIndexPrivate; class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex { Q_OBJECT + Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) public: QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); QRectF indexedRect() const; @@ -68,8 +69,8 @@ public: QList items(Qt::SortOrder order = Qt::AscendingOrder) const; - int bspDepth(); - void setBspDepth(int depth); + int bspTreeDepth(); + void setBspTreeDepth(int depth); protected: bool event(QEvent *event); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index b713452..05ec28b 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -147,6 +147,9 @@ QGraphicsSceneIndexPrivate::~QGraphicsSceneIndexPrivate() delete pathIntersector; } +/*! + \internal +*/ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGraphicsSceneIndexIntersector *intersector, QList *items, const QTransform &parentTransform, @@ -297,6 +300,12 @@ QRectF QGraphicsSceneIndex::indexedRect() const \a deviceTransform is the transformation apply to the view. + This method use the estimation of the index (estimateItems) and refine + the list to get an exact result. If you want to implement your own + refinement algorithm you can reimplement this method. + + \sa estimateItems() + */ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { @@ -322,6 +331,12 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe \a deviceTransform is the transformation apply to the view. + This method use the estimation of the index (estimateItems) and refine + the list to get an exact result. If you want to implement your own + refinement algorithm you can reimplement this method. + + \sa estimateItems() + */ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { @@ -346,6 +361,12 @@ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe \a deviceTransform is the transformation apply to the view. + This method use the estimation of the index (estimateItems) and refine + the list to get an exact result. If you want to implement your own + refinement algorithm you can reimplement this method. + + \sa estimateItems() + */ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { @@ -375,6 +396,12 @@ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt:: \a deviceTransform is the transformation apply to the view. + This method use the estimation of the index (estimateItems) and refine + the list to get an exact result. If you want to implement your own + refinement algorithm you can reimplement this method. + + \sa estimateItems() + */ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h index 3057b4a..d21475c 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -68,23 +68,32 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex { Q_OBJECT -private: - QRectF m_sceneRect; - QList m_items; - public: QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): QGraphicsSceneIndex(scene) { } - virtual void setRect(const QRectF &rect) { - m_sceneRect = rect; + QList items(Qt::SortOrder order = Qt::AscendingOrder) const { + Q_UNUSED(order); + return m_items; + } + + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { + Q_UNUSED(rect); + Q_UNUSED(order); + Q_UNUSED(deviceTransform); + return m_items; } - virtual QRectF rect() const { + virtual QRectF indexedRect() const { return m_sceneRect; } +protected : + void sceneRectChanged(const QRectF &rect) { + m_sceneRect = rect; + } + virtual void clear() { m_items.clear(); } @@ -97,17 +106,9 @@ public: m_items.removeAll(item); } - virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { - QList result; - foreach (QGraphicsItem *item, m_items) - if (item->sceneBoundingRect().intersects(rect)) - result << item; - return result; - } - - QList items(Qt::SortOrder order = Qt::AscendingOrder) const { - return m_items; - } +private: + QRectF m_sceneRect; + QList m_items; }; QT_END_NAMESPACE -- cgit v0.12 From 8dee7b0c5be293f4b8ebafcae6baa052ca92f1d0 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 16 Jun 2009 13:46:43 +0200 Subject: Add missing file. --- src/gui/graphicsview/qgraphicsscenelinearindex.cpp | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/gui/graphicsview/qgraphicsscenelinearindex.cpp diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp new file mode 100644 index 0000000..1c898bc --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp @@ -0,0 +1,70 @@ +#include "qgraphicsscenelinearindex_p.h" + +/*! + \class QGraphicsSceneLinearIndex + \brief The QGraphicsSceneLinearIndex class provides an implementation of + a linear indexing algorithm for discovering items in QGraphicsScene. + \since 4.6 + \ingroup multimedia + \ingroup graphicsview-api + \mainclass + + QGraphicsSceneLinearIndex index is default linear implementation to discover items. + It basically store all items in a list and return them to the scene. + + \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex, QGraphicsSceneBspTreeIndex +*/ + +/*! + \fn QGraphicsSceneLinearIndex::QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): + + Construct a linear index for the given \a scene. +*/ + +/*! + \fn QList QGraphicsSceneLinearIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const; + + Return all items in the index and sort them using \a order. +*/ + + +/*! + \fn virtual QList QGraphicsSceneLinearIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; + + Returns an estimation visible items that are either inside or + intersect with the specified \a rect and return a list sorted using \a order. + + \a deviceTransform is the transformation apply to the view. + +*/ + +/*! + \fn QRectF QGraphicsSceneLinearIndex::indexedRect() const; + \reimp + Return the rect indexed by the the index. +*/ + +/*! + \fn void QGraphicsSceneLinearIndex::sceneRectChanged(const QRectF &rect); + \reimp + This method react to the \a rect change of the scene. +*/ + +/*! + \fn void QGraphicsSceneLinearIndex::clear(); + \reimp + Clear the all the BSP index. +*/ + +/*! + \fn virtual void QGraphicsSceneLinearIndex::addItem(QGraphicsItem *item); + + Add the \a item into the index. +*/ + +/*! + \fn virtual void QGraphicsSceneLinearIndex::removeItem(QGraphicsItem *item); + + Add the \a item from the index. +*/ + -- cgit v0.12 From d72727cb7530da54b59c51effa97263512e9238c Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 17 Jun 2009 11:25:36 +0200 Subject: Fix broken auto-test for the index. Since now items() doesn't use the index then the growingboundingrect is not updated if you call right after a delete. It's because the timer is not yet fired (even the processEvent) so you call add, move, remove which will trigger only one update index so the growingboundingrect will never change. --- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 4d786c7..17d290b 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2726,8 +2726,8 @@ void tst_QGraphicsScene::update() qRegisterMetaType >("QList"); QSignalSpy spy(&scene, SIGNAL(changed(QList))); - // When deleted, the item will lazy-remove itself - delete rect; + // We update the scene. + scene.update(); // This function forces a purge, which will post an update signal scene.itemAt(0, 0); -- cgit v0.12 From 8a0e002ccc762ef3edbc3c9ad91b4d6017cb91bb Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 17 Jun 2009 14:15:14 +0200 Subject: Make eveything internal for now but ready to see the light. --- src/gui/graphicsview/graphicsview.pri | 6 +- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 7 +- src/gui/graphicsview/qgraphicsscene_p.h | 1 - .../graphicsview/qgraphicsscenebsptreeindex.cpp | 761 +++++++++++++++++++++ src/gui/graphicsview/qgraphicsscenebsptreeindex.h | 119 ++++ .../graphicsview/qgraphicsscenebsptreeindex_p.cpp | 760 -------------------- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 137 ++-- .../graphicsview/qgraphicsscenebsptreeindex_p_p.h | 150 ---- src/gui/graphicsview/qgraphicssceneindex.cpp | 2 +- src/gui/graphicsview/qgraphicssceneindex.h | 13 +- src/gui/graphicsview/qgraphicsscenelinearindex.cpp | 3 +- src/gui/graphicsview/qgraphicsscenelinearindex.h | 124 ++++ src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 118 ---- 14 files changed, 1122 insertions(+), 1081 deletions(-) create mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp create mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex.h delete mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp delete mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h create mode 100644 src/gui/graphicsview/qgraphicsscenelinearindex.h delete mode 100644 src/gui/graphicsview/qgraphicsscenelinearindex_p.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index a4d142a..5ac1c54 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -5,11 +5,11 @@ HEADERS += graphicsview/qgraphicsitem.h \ graphicsview/qgraphicsscene.h \ graphicsview/qgraphicsscene_p.h \ graphicsview/qgraphicsscene_bsp_p.h \ - graphicsview/qgraphicsscenelinearindex_p.h \ + graphicsview/qgraphicsscenelinearindex.h \ graphicsview/qgraphicssceneindex.h \ graphicsview/qgraphicssceneindex_p.h \ + graphicsview/qgraphicsscenebsptreeindex.h \ graphicsview/qgraphicsscenebsptreeindex_p.h \ - graphicsview/qgraphicsscenebsptreeindex_p_p.h \ graphicsview/qgraphicssceneevent.h \ graphicsview/qgraphicsview_p.h \ graphicsview/qgraphicsview.h @@ -17,7 +17,7 @@ SOURCES += graphicsview/qgraphicsitem.cpp \ graphicsview/qgraphicsitemanimation.cpp \ graphicsview/qgraphicsscene.cpp \ graphicsview/qgraphicsscene_bsp.cpp \ - graphicsview/qgraphicsscenebsptreeindex_p.cpp \ + graphicsview/qgraphicsscenebsptreeindex.cpp \ graphicsview/qgraphicsscenelinearindex.cpp \ graphicsview/qgraphicssceneindex.cpp \ graphicsview/qgraphicssceneevent.cpp \ diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 39ad447..593d7be 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -554,7 +554,7 @@ #include "qgraphicsview.h" #include "qgraphicswidget.h" #include "qgraphicsproxywidget.h" -#include "qgraphicsscenebsptreeindex_p_p.h" +#include "qgraphicsscenebsptreeindex_p.h" #include #include #include diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 5a3028c..a33cb3e 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -220,7 +220,8 @@ #include "qgraphicswidget.h" #include "qgraphicswidget_p.h" #include "qgraphicssceneindex.h" -#include "qgraphicsscenebsptreeindex_p_p.h" +#include "qgraphicsscenebsptreeindex.h" +#include "qgraphicsscenelinearindex.h" #include #include @@ -1574,6 +1575,8 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) } /*! + \internal + \brief the item indexing method. This method allow to apply an indexing algorithm \a index to the scene, to speed up item discovery functions like items() and itemAt(). @@ -1595,6 +1598,8 @@ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) } /*! + \internal + This method return the current indexing algorithm of the scene. \sa setSceneIndex(), QGraphicsSceneIndex diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 72ae158..563e016 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -58,7 +58,6 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW #include "qgraphicsscenebsptreeindex_p.h" -#include "qgraphicsscenelinearindex_p.h" #include "qgraphicssceneindex.h" #include "qgraphicsview.h" #include "qgraphicsitem_p.h" diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp new file mode 100644 index 0000000..76fd218 --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -0,0 +1,761 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QGraphicsSceneBspTreeIndex + \brief The QGraphicsSceneBspTreeIndex class provides an implementation of + a BSP indexing algorithm for discovering items in QGraphicsScene. + \since 4.6 + \ingroup multimedia + \ingroup graphicsview-api + \mainclass + \internal + + QGraphicsSceneBspTreeIndex index use a BSP(Binary Space Partitioning) + implementation to discover items quickly. This implementation is + very efficient for static scene. It has a depth that you can set. + The depth directly affects performance and memory usage; the latter + growing exponentially with the depth of the tree. With an optimal tree + depth, the index can instantly determine the locality of items, even + for scenes with thousands or millions of items. This also greatly improves + rendering performance. + + By default, the value is 0, in which case Qt will guess a reasonable + default depth based on the size, location and number of items in the + scene. If these parameters change frequently, however, you may experience + slowdowns as the index retunes the depth internally. You can avoid + potential slowdowns by fixating the tree depth through setting this + property. + + The depth of the tree and the size of the scene rectangle decide the + granularity of the scene's partitioning. The size of each scene segment is + determined by the following algorithm: + + The BSP tree has an optimal size when each segment contains between 0 and + 10 items. + + \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex +*/ + +#include "qgraphicsscenebsptreeindex.h" + +#ifndef QT_NO_GRAPHICSVIEW + +#include "qgraphicsscenebsptreeindex_p.h" +#include "qgraphicssceneindex_p.h" +#include "qgraphicsitem_p.h" +#include "qgraphicsscene_p.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +static inline int intmaxlog(int n) +{ + return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0); +} + +/*! + Constructs a private scene bsp index. +*/ +QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene) + : QGraphicsSceneIndexPrivate(scene), + bspTreeDepth(0), + indexTimerId(0), + restartIndexTimer(false), + regenerateIndex(true), + lastItemCount(0), + purgePending(false), + sortCacheEnabled(false), + updatingSortCache(false) +{ +} + + +/*! + This method will update the BSP index by removing the items from the temporary + unindexed list and add them in the indexedItems list. This will also + update the growingItemsBoundingRect if needed. This will update the BSP + implementation as well. + + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() +{ + Q_Q(QGraphicsSceneBspTreeIndex); + if (!indexTimerId) + return; + + QGraphicsScenePrivate * scenePrivate = q->scene()->d_func(); + q->killTimer(indexTimerId); + indexTimerId = 0; + + purgeRemovedItems(); + + // Add unindexedItems to indexedItems + QRectF unindexedItemsBoundingRect; + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + unindexedItemsBoundingRect |= item->sceneBoundingRect(); + if (!freeItemIndexes.isEmpty()) { + int freeIndex = freeItemIndexes.takeFirst(); + item->d_func()->index = freeIndex; + indexedItems[freeIndex] = item; + } else { + item->d_func()->index = indexedItems.size(); + indexedItems << item; + } + } + } + + // Update growing scene rect. + QRectF oldGrowingItemsBoundingRect = scenePrivate->growingItemsBoundingRect; + scenePrivate->growingItemsBoundingRect |= unindexedItemsBoundingRect; + + // Determine whether we should regenerate the BSP tree. + if (bspTreeDepth == 0) { + int oldDepth = intmaxlog(lastItemCount); + bspTreeDepth = intmaxlog(indexedItems.size()); + static const int slack = 100; + if (bsp.leafCount() == 0 || (oldDepth != bspTreeDepth && qAbs(lastItemCount - indexedItems.size()) > slack)) { + // ### Crude algorithm. + regenerateIndex = true; + } + } + + // Regenerate the tree. + if (regenerateIndex) { + regenerateIndex = false; + bsp.initialize(q->scene()->sceneRect(), bspTreeDepth); + unindexedItems = indexedItems; + lastItemCount = indexedItems.size(); + q->scene()->update(); + + // Take this opportunity to reset our largest-item counter for + // untransformable items. When the items are inserted into the BSP + // tree, we'll get an accurate calculation. + scenePrivate->largestUntransformableItem = QRectF(); + } + + // Insert all unindexed items into the tree. + for (int i = 0; i < unindexedItems.size(); ++i) { + if (QGraphicsItem *item = unindexedItems.at(i)) { + QRectF rect = item->sceneBoundingRect(); + if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) + continue; + + bsp.insertItem(item, rect); + + // If the item ignores view transformations, update our + // largest-item-counter to ensure that the view can accurately + // discover untransformable items when drawing. + if (item->d_ptr->itemIsUntransformable()) { + QGraphicsItem *topmostUntransformable = item; + while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags + & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { + topmostUntransformable = topmostUntransformable->parentItem(); + } + // ### Verify that this is the correct largest untransformable rectangle. + scenePrivate->largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); + } + } + } + unindexedItems.clear(); + + // Notify scene rect changes. + if (!scenePrivate->hasSceneRect && scenePrivate->growingItemsBoundingRect != oldGrowingItemsBoundingRect) + emit q->scene()->sceneRectChanged(scenePrivate->growingItemsBoundingRect); +} + + +/*! + \internal + + Removes stale pointers from all data structures. +*/ +void QGraphicsSceneBspTreeIndexPrivate::purgeRemovedItems() +{ + if (!purgePending && removedItems.isEmpty()) + return; + + // Remove stale items from the BSP tree. + bsp.removeItems(removedItems); + // Purge this list. + removedItems.clear(); + freeItemIndexes.clear(); + for (int i = 0; i < indexedItems.size(); ++i) { + if (!indexedItems.at(i)) + freeItemIndexes << i; + } + purgePending = false; +} + +/*! + \internal + + Starts or restarts the timer used for reindexing unindexed items. +*/ +void QGraphicsSceneBspTreeIndexPrivate::startIndexTimer(int interval) +{ + Q_Q(QGraphicsSceneBspTreeIndex); + if (indexTimerId) { + restartIndexTimer = true; + } else { + indexTimerId = q->startTimer(interval); + } +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::resetIndex() +{ + purgeRemovedItems(); + for (int i = 0; i < indexedItems.size(); ++i) { + if (QGraphicsItem *item = indexedItems.at(i)) { + item->d_ptr->index = -1; + unindexedItems << item; + } + } + indexedItems.clear(); + freeItemIndexes.clear(); + regenerateIndex = true; + startIndexTimer(); +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stackingOrder) +{ + if (!item->d_ptr->children.isEmpty()) { + QList childList = item->d_ptr->children; + qSort(childList.begin(), childList.end(), qt_closestLeaf); + for (int i = 0; i < childList.size(); ++i) { + QGraphicsItem *item = childList.at(i); + if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent)) + climbTree(childList.at(i), stackingOrder); + } + item->d_ptr->globalStackingOrder = (*stackingOrder)++; + for (int i = 0; i < childList.size(); ++i) { + QGraphicsItem *item = childList.at(i); + if (item->flags() & QGraphicsItem::ItemStacksBehindParent) + climbTree(childList.at(i), stackingOrder); + } + } else { + item->d_ptr->globalStackingOrder = (*stackingOrder)++; + } +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() +{ + Q_Q(QGraphicsSceneBspTreeIndex); + _q_updateIndex(); + + if (!sortCacheEnabled || !updatingSortCache) + return; + + updatingSortCache = false; + int stackingOrder = 0; + + QList topLevels; + + for (int i = 0; i < q->items().count(); ++i) { + QGraphicsItem *item = q->items().at(i); + if (item && item->parentItem() == 0) + topLevels << item; + } + + qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); + for (int i = 0; i < topLevels.size(); ++i) + climbTree(topLevels.at(i), &stackingOrder); +} + +/*! + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache() +{ + Q_Q(QGraphicsSceneBspTreeIndex); + if (!sortCacheEnabled || updatingSortCache) + return; + + updatingSortCache = true; + QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection); +} + +/*! + Returns true if \a item1 is on top of \a item2. + + \internal +*/ +bool QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + // Siblings? Just check their z-values. + const QGraphicsItemPrivate *d1 = item1->d_ptr; + const QGraphicsItemPrivate *d2 = item2->d_ptr; + if (d1->parent == d2->parent) + return qt_closestLeaf(item1, item2); + + // Find common ancestor, and each item's ancestor closest to the common + // ancestor. + int item1Depth = d1->depth; + int item2Depth = d2->depth; + const QGraphicsItem *p = item1; + const QGraphicsItem *t1 = item1; + while (item1Depth > item2Depth && (p = p->d_ptr->parent)) { + if (p == item2) { + // item2 is one of item1's ancestors; item1 is on top + return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); + } + t1 = p; + --item1Depth; + } + p = item2; + const QGraphicsItem *t2 = item2; + while (item2Depth > item1Depth && (p = p->d_ptr->parent)) { + if (p == item1) { + // item1 is one of item2's ancestors; item1 is not on top + return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); + } + t2 = p; + --item2Depth; + } + + // item1Ancestor is now at the same level as item2Ancestor, but not the same. + const QGraphicsItem *a1 = t1; + const QGraphicsItem *a2 = t2; + while (a1) { + const QGraphicsItem *p1 = a1; + const QGraphicsItem *p2 = a2; + a1 = a1->parentItem(); + a2 = a2->parentItem(); + if (a1 && a1 == a2) + return qt_closestLeaf(p1, p2); + } + + // No common ancestor? Then just compare the items' toplevels directly. + return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem()); +} + +/*! + Returns true if \a item2 is on top of \a item1. + + \internal +*/ +bool QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + return closestItemFirst_withoutCache(item2, item1); +} + +/*! + Sort a list of \a itemList in a specific \a order and use the cache if requested. + + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemList, Qt::SortOrder order, + bool sortCacheEnabled) +{ + if (sortCacheEnabled) { + if (order == Qt::AscendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); + } else if (order == Qt::DescendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemLast_withCache); + } + } else { + if (order == Qt::AscendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); + } else if (order == Qt::DescendingOrder) { + qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); + } + } +} + +/*! + Constructs a BSP scene index for the given \a scene. +*/ +QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) + : QGraphicsSceneIndex(*new QGraphicsSceneBspTreeIndexPrivate(scene), scene) +{ + +} + +/*! + \reimp + Return the rect indexed by the BSP index. +*/ +QRectF QGraphicsSceneBspTreeIndex::indexedRect() const +{ + Q_D(const QGraphicsSceneBspTreeIndex); + const_cast(d)->_q_updateIndex(); + return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; +} + +/*! + \reimp + Clear the all the BSP index. +*/ +void QGraphicsSceneBspTreeIndex::clear() +{ + Q_D(QGraphicsSceneBspTreeIndex); + d->bsp.clear(); + d->lastItemCount = 0; + d->freeItemIndexes.clear(); + d->indexedItems.clear(); + d->unindexedItems.clear(); +} + +/*! + Add the \a item into the BSP index. +*/ +void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) +{ + Q_D(QGraphicsSceneBspTreeIndex); + // Prevent reusing a recently deleted pointer: purge all removed items + // from our lists. + d->purgeRemovedItems(); + + // Invalidate any sort caching; arrival of a new item means we need to + // resort. + // Update the scene's sort cache settings. + item->d_ptr->globalStackingOrder = -1; + d->invalidateSortCache(); + + // Indexing requires sceneBoundingRect(), but because \a item might + // not be completely constructed at this point, we need to store it in + // a temporary list and schedule an indexing for later. + d->unindexedItems << item; + item->d_func()->index = -1; + d->startIndexTimer(0); +} + +/*! + This really add the item in the BSP. + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::addToIndex(QGraphicsItem *item) +{ + if (item->d_func()->index != -1) { + bsp.insertItem(item, item->sceneBoundingRect()); + foreach (QGraphicsItem *child, item->children()) + child->addToIndex(); + } else { + // The BSP tree is regenerated if the number of items grows to a + // certain threshold, or if the bounding rect of the graph doubles in + // size. + startIndexTimer(); + } +} + +/*! + Remove the \a item from the BSP index. +*/ +void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) +{ + Q_D(QGraphicsSceneBspTreeIndex); + // Note: This will access item's sceneBoundingRect(), which (as this is + // C++) is why we cannot call removeItem() from QGraphicsItem's + // destructor. + d->removeFromIndex(item); + + // Invalidate any sort caching; arrival of a new item means we need to + // resort. + d->invalidateSortCache(); + + // Remove from our item lists. + int index = item->d_func()->index; + if (index != -1) { + d->freeItemIndexes << index; + d->indexedItems[index] = 0; + } else { + d->unindexedItems.removeAll(item); + } +} + +/*! + \reimp + Delete the \a item from the BSP index (without accessing its boundingRect). +*/ +void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) +{ + Q_D(QGraphicsSceneBspTreeIndex); + // Invalidate any sort caching; arrival of a new item means we need to + // resort. + d->invalidateSortCache(); + + int index = item->d_func()->index; + if (index != -1) { + // Important: The index is useless until purgeRemovedItems() is + // called. + d->indexedItems[index] = (QGraphicsItem *)0; + if (!d->purgePending) { + d->purgePending = true; + scene()->update(); + } + d->removedItems << item; + } else { + // Recently added items are purged immediately. unindexedItems() never + // contains stale items. + d->unindexedItems.removeAll(item); + scene()->update(); + } +} + +/*! + Really remove the item from the BSP + \internal +*/ +void QGraphicsSceneBspTreeIndexPrivate::removeFromIndex(QGraphicsItem *item) +{ + if (item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { + // ### remove from child index only if applicable + return; + } + int index = item->d_func()->index; + if (index != -1) { + bsp.removeItem(item, item->sceneBoundingRect()); + freeItemIndexes << index; + indexedItems[index] = 0; + item->d_func()->index = -1; + unindexedItems << item; + + //prepareGeometryChange will call prepareBoundingRectChange + foreach (QGraphicsItem *child, item->children()) + child->prepareGeometryChange(); + } + startIndexTimer(); +} + +/*! + \reimp + Update the BSP when the \a item 's bounding rect has changed. +*/ +void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) +{ + Q_D(QGraphicsSceneBspTreeIndex); + // Note: This will access item's sceneBoundingRect(), which (as this is + // C++) is why we cannot call removeItem() from QGraphicsItem's + // destructor. + d->removeFromIndex(const_cast(item)); +} + +/*! + Returns an estimation visible items that are either inside or + intersect with the specified \a rect and return a list sorted using \a order. + + \a deviceTransform is the transformation apply to the view. + +*/ +QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const +{ + Q_D(const QGraphicsSceneBspTreeIndex); + const_cast(d)->purgeRemovedItems(); + const_cast(d)->_q_updateSortCache(); + + QList rectItems = d->bsp.items(rect); + // Fill in with any unindexed items + for (int i = 0; i < d->unindexedItems.size(); ++i) { + if (QGraphicsItem *item = d->unindexedItems.at(i)) { + if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { + QRectF boundingRect = item->sceneBoundingRect(); + if (QRectF_intersects(boundingRect, rect)) { + item->d_ptr->itemDiscovered = 1; + rectItems << item; + } + } + } + } + + // Reset the discovered state of all discovered items + for (int i = 0; i < rectItems.size(); ++i) + rectItems.at(i)->d_func()->itemDiscovered = 0; + + d->sortItems(&rectItems, order, d->sortCacheEnabled); + + return rectItems; +} + + +/*! + \fn QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const; + + Return all items in the BSP index and sort them using \a order. +*/ +QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) const +{ + Q_D(const QGraphicsSceneBspTreeIndex); + const_cast(d)->purgeRemovedItems(); + QList itemList; + // If freeItemIndexes is empty, we know there are no holes in indexedItems and + // unindexedItems. + if (d->freeItemIndexes.isEmpty()) { + if (d->unindexedItems.isEmpty()) { + itemList = d->indexedItems; + } else { + itemList = d->indexedItems + d->unindexedItems; + } + } else { + // Rebuild the list of items to avoid holes. ### We could also just + // compress the item lists at this point. + foreach (QGraphicsItem *item, d->indexedItems + d->unindexedItems) { + if (item) + itemList << item; + } + } + if (order != -1) { + //We sort descending order + d->sortItems(&itemList, order, d->sortCacheEnabled); + } + return itemList; +} + +/*! + \property QGraphicsSceneBspTreeIndex::bspTreeDepth + \brief the depth of the BSP index tree + \since 4.6 + + This value determines the depth of BSP tree. The depth + directly affects performance and memory usage; the latter + growing exponentially with the depth of the tree. With an optimal tree + depth, the index can instantly determine the locality of items, even + for scenes with thousands or millions of items. This also greatly improves + rendering performance. + + By default, the value is 0, in which case Qt will guess a reasonable + default depth based on the size, location and number of items in the + scene. If these parameters change frequently, however, you may experience + slowdowns as the index retunes the depth internally. You can avoid + potential slowdowns by fixating the tree depth through setting this + property. + + The depth of the tree and the size of the scene rectangle decide the + granularity of the scene's partitioning. The size of each scene segment is + determined by the following algorithm: + + The BSP tree has an optimal size when each segment contains between 0 and + 10 items. + +*/ +int QGraphicsSceneBspTreeIndex::bspTreeDepth() +{ + Q_D(const QGraphicsSceneBspTreeIndex); + return d->bspTreeDepth; +} + +void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth) +{ + Q_D(QGraphicsSceneBspTreeIndex); + d->bspTreeDepth = depth; + d->resetIndex(); +} + +/*! + \reimp + + This method react to the \a rect change of the scene and + reset the BSP tree index. +*/ +void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) +{ + Q_D(QGraphicsSceneBspTreeIndex); + d->sceneRect = rect; + d->resetIndex(); +} + +/*! + \reimp + + This method react to the \a change of the \a item and use the \a value to + update the BSP tree if necessary. + +*/ +void QGraphicsSceneBspTreeIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) +{ + Q_D(QGraphicsSceneBspTreeIndex); + switch (change) { + case QGraphicsItem::ItemZValueChange: + case QGraphicsItem::ItemParentChange: { + d->invalidateSortCache(); + break; + } + default: + break; + } + return QGraphicsSceneIndex::itemChanged(item, change, value); +} +/*! + \reimp + + Used to catch the timer event. + + \internal +*/ +bool QGraphicsSceneBspTreeIndex::event(QEvent *event) +{ + Q_D(QGraphicsSceneBspTreeIndex); + switch (event->type()) { + case QEvent::Timer: + if (d->indexTimerId && static_cast(event)->timerId() == d->indexTimerId) { + if (d->restartIndexTimer) { + d->restartIndexTimer = false; + } else { + // this call will kill the timer + d->_q_updateIndex(); + } + } + // Fallthrough intended - support timers in subclasses. + default: + return QObject::event(event); + } + return true; +} + +QT_END_NAMESPACE + +#include "moc_qgraphicsscenebsptreeindex.cpp" + +#endif // QT_NO_GRAPHICSVIEW + diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex.h new file mode 100644 index 0000000..0444a30 --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QGRAPHICSBSPTREEINDEX_H +#define QGRAPHICSBSPTREEINDEX_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +#include +#include +#include +#include +#include + +#include "qgraphicsscene_bsp_p.h" + +class QGraphicsSceneBspTreeIndexPrivate; + +class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex +{ + Q_OBJECT + Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) +public: + QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); + QRectF indexedRect() const; + + QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; + + QList items(Qt::SortOrder order = Qt::AscendingOrder) const; + + int bspTreeDepth(); + void setBspTreeDepth(int depth); + +protected: + bool event(QEvent *event); + void clear(); + + void addItem(QGraphicsItem *item); + void removeItem(QGraphicsItem *item); + void deleteItem(QGraphicsItem *item); + void prepareBoundingRectChange(const QGraphicsItem *item); + + void sceneRectChanged(const QRectF &rect); + void itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); + +private : + Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex) + Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex) + Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache()) + Q_PRIVATE_SLOT(d_func(), void _q_updateIndex()) + + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; +}; + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRAPHICSBSPTREEINDEX_H diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp deleted file mode 100644 index b19248a..0000000 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp +++ /dev/null @@ -1,760 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \class QGraphicsSceneBspTreeIndex - \brief The QGraphicsSceneBspTreeIndex class provides an implementation of - a BSP indexing algorithm for discovering items in QGraphicsScene. - \since 4.6 - \ingroup multimedia - \ingroup graphicsview-api - \mainclass - - QGraphicsSceneBspTreeIndex index use a BSP(Binary Space Partitioning) - implementation to discover items quickly. This implementation is - very efficient for static scene. It has a depth that you can set. - The depth directly affects performance and memory usage; the latter - growing exponentially with the depth of the tree. With an optimal tree - depth, the index can instantly determine the locality of items, even - for scenes with thousands or millions of items. This also greatly improves - rendering performance. - - By default, the value is 0, in which case Qt will guess a reasonable - default depth based on the size, location and number of items in the - scene. If these parameters change frequently, however, you may experience - slowdowns as the index retunes the depth internally. You can avoid - potential slowdowns by fixating the tree depth through setting this - property. - - The depth of the tree and the size of the scene rectangle decide the - granularity of the scene's partitioning. The size of each scene segment is - determined by the following algorithm: - - The BSP tree has an optimal size when each segment contains between 0 and - 10 items. - - \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex -*/ - -#include "qgraphicsscenebsptreeindex_p.h" - -#ifndef QT_NO_GRAPHICSVIEW - -#include "qgraphicsscenebsptreeindex_p_p.h" -#include "qgraphicssceneindex_p.h" -#include "qgraphicsitem_p.h" -#include "qgraphicsscene_p.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -static inline int intmaxlog(int n) -{ - return (n > 0 ? qMax(qCeil(qLn(qreal(n)) / qLn(qreal(2))), 5) : 0); -} - -/*! - Constructs a private scene bsp index. -*/ -QGraphicsSceneBspTreeIndexPrivate::QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene) - : QGraphicsSceneIndexPrivate(scene), - bspTreeDepth(0), - indexTimerId(0), - restartIndexTimer(false), - regenerateIndex(true), - lastItemCount(0), - purgePending(false), - sortCacheEnabled(false), - updatingSortCache(false) -{ -} - - -/*! - This method will update the BSP index by removing the items from the temporary - unindexed list and add them in the indexedItems list. This will also - update the growingItemsBoundingRect if needed. This will update the BSP - implementation as well. - - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() -{ - Q_Q(QGraphicsSceneBspTreeIndex); - if (!indexTimerId) - return; - - QGraphicsScenePrivate * scenePrivate = q->scene()->d_func(); - q->killTimer(indexTimerId); - indexTimerId = 0; - - purgeRemovedItems(); - - // Add unindexedItems to indexedItems - QRectF unindexedItemsBoundingRect; - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - unindexedItemsBoundingRect |= item->sceneBoundingRect(); - if (!freeItemIndexes.isEmpty()) { - int freeIndex = freeItemIndexes.takeFirst(); - item->d_func()->index = freeIndex; - indexedItems[freeIndex] = item; - } else { - item->d_func()->index = indexedItems.size(); - indexedItems << item; - } - } - } - - // Update growing scene rect. - QRectF oldGrowingItemsBoundingRect = scenePrivate->growingItemsBoundingRect; - scenePrivate->growingItemsBoundingRect |= unindexedItemsBoundingRect; - - // Determine whether we should regenerate the BSP tree. - if (bspTreeDepth == 0) { - int oldDepth = intmaxlog(lastItemCount); - bspTreeDepth = intmaxlog(indexedItems.size()); - static const int slack = 100; - if (bsp.leafCount() == 0 || (oldDepth != bspTreeDepth && qAbs(lastItemCount - indexedItems.size()) > slack)) { - // ### Crude algorithm. - regenerateIndex = true; - } - } - - // Regenerate the tree. - if (regenerateIndex) { - regenerateIndex = false; - bsp.initialize(q->scene()->sceneRect(), bspTreeDepth); - unindexedItems = indexedItems; - lastItemCount = indexedItems.size(); - q->scene()->update(); - - // Take this opportunity to reset our largest-item counter for - // untransformable items. When the items are inserted into the BSP - // tree, we'll get an accurate calculation. - scenePrivate->largestUntransformableItem = QRectF(); - } - - // Insert all unindexed items into the tree. - for (int i = 0; i < unindexedItems.size(); ++i) { - if (QGraphicsItem *item = unindexedItems.at(i)) { - QRectF rect = item->sceneBoundingRect(); - if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - continue; - - bsp.insertItem(item, rect); - - // If the item ignores view transformations, update our - // largest-item-counter to ensure that the view can accurately - // discover untransformable items when drawing. - if (item->d_ptr->itemIsUntransformable()) { - QGraphicsItem *topmostUntransformable = item; - while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags - & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { - topmostUntransformable = topmostUntransformable->parentItem(); - } - // ### Verify that this is the correct largest untransformable rectangle. - scenePrivate->largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); - } - } - } - unindexedItems.clear(); - - // Notify scene rect changes. - if (!scenePrivate->hasSceneRect && scenePrivate->growingItemsBoundingRect != oldGrowingItemsBoundingRect) - emit q->scene()->sceneRectChanged(scenePrivate->growingItemsBoundingRect); -} - - -/*! - \internal - - Removes stale pointers from all data structures. -*/ -void QGraphicsSceneBspTreeIndexPrivate::purgeRemovedItems() -{ - if (!purgePending && removedItems.isEmpty()) - return; - - // Remove stale items from the BSP tree. - bsp.removeItems(removedItems); - // Purge this list. - removedItems.clear(); - freeItemIndexes.clear(); - for (int i = 0; i < indexedItems.size(); ++i) { - if (!indexedItems.at(i)) - freeItemIndexes << i; - } - purgePending = false; -} - -/*! - \internal - - Starts or restarts the timer used for reindexing unindexed items. -*/ -void QGraphicsSceneBspTreeIndexPrivate::startIndexTimer(int interval) -{ - Q_Q(QGraphicsSceneBspTreeIndex); - if (indexTimerId) { - restartIndexTimer = true; - } else { - indexTimerId = q->startTimer(interval); - } -} - -/*! - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::resetIndex() -{ - purgeRemovedItems(); - for (int i = 0; i < indexedItems.size(); ++i) { - if (QGraphicsItem *item = indexedItems.at(i)) { - item->d_ptr->index = -1; - unindexedItems << item; - } - } - indexedItems.clear(); - freeItemIndexes.clear(); - regenerateIndex = true; - startIndexTimer(); -} - -/*! - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stackingOrder) -{ - if (!item->d_ptr->children.isEmpty()) { - QList childList = item->d_ptr->children; - qSort(childList.begin(), childList.end(), qt_closestLeaf); - for (int i = 0; i < childList.size(); ++i) { - QGraphicsItem *item = childList.at(i); - if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent)) - climbTree(childList.at(i), stackingOrder); - } - item->d_ptr->globalStackingOrder = (*stackingOrder)++; - for (int i = 0; i < childList.size(); ++i) { - QGraphicsItem *item = childList.at(i); - if (item->flags() & QGraphicsItem::ItemStacksBehindParent) - climbTree(childList.at(i), stackingOrder); - } - } else { - item->d_ptr->globalStackingOrder = (*stackingOrder)++; - } -} - -/*! - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() -{ - Q_Q(QGraphicsSceneBspTreeIndex); - _q_updateIndex(); - - if (!sortCacheEnabled || !updatingSortCache) - return; - - updatingSortCache = false; - int stackingOrder = 0; - - QList topLevels; - - for (int i = 0; i < q->items().count(); ++i) { - QGraphicsItem *item = q->items().at(i); - if (item && item->parentItem() == 0) - topLevels << item; - } - - qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); - for (int i = 0; i < topLevels.size(); ++i) - climbTree(topLevels.at(i), &stackingOrder); -} - -/*! - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache() -{ - Q_Q(QGraphicsSceneBspTreeIndex); - if (!sortCacheEnabled || updatingSortCache) - return; - - updatingSortCache = true; - QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection); -} - -/*! - Returns true if \a item1 is on top of \a item2. - - \internal -*/ -bool QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - // Siblings? Just check their z-values. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; - if (d1->parent == d2->parent) - return qt_closestLeaf(item1, item2); - - // Find common ancestor, and each item's ancestor closest to the common - // ancestor. - int item1Depth = d1->depth; - int item2Depth = d2->depth; - const QGraphicsItem *p = item1; - const QGraphicsItem *t1 = item1; - while (item1Depth > item2Depth && (p = p->d_ptr->parent)) { - if (p == item2) { - // item2 is one of item1's ancestors; item1 is on top - return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); - } - t1 = p; - --item1Depth; - } - p = item2; - const QGraphicsItem *t2 = item2; - while (item2Depth > item1Depth && (p = p->d_ptr->parent)) { - if (p == item1) { - // item1 is one of item2's ancestors; item1 is not on top - return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); - } - t2 = p; - --item2Depth; - } - - // item1Ancestor is now at the same level as item2Ancestor, but not the same. - const QGraphicsItem *a1 = t1; - const QGraphicsItem *a2 = t2; - while (a1) { - const QGraphicsItem *p1 = a1; - const QGraphicsItem *p2 = a2; - a1 = a1->parentItem(); - a2 = a2->parentItem(); - if (a1 && a1 == a2) - return qt_closestLeaf(p1, p2); - } - - // No common ancestor? Then just compare the items' toplevels directly. - return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem()); -} - -/*! - Returns true if \a item2 is on top of \a item1. - - \internal -*/ -bool QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - return closestItemFirst_withoutCache(item2, item1); -} - -/*! - Sort a list of \a itemList in a specific \a order and use the cache if requested. - - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemList, Qt::SortOrder order, - bool sortCacheEnabled) -{ - if (sortCacheEnabled) { - if (order == Qt::AscendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); - } else if (order == Qt::DescendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemLast_withCache); - } - } else { - if (order == Qt::AscendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); - } else if (order == Qt::DescendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); - } - } -} - -/*! - Constructs a BSP scene index for the given \a scene. -*/ -QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) - : QGraphicsSceneIndex(*new QGraphicsSceneBspTreeIndexPrivate(scene), scene) -{ - -} - -/*! - \reimp - Return the rect indexed by the BSP index. -*/ -QRectF QGraphicsSceneBspTreeIndex::indexedRect() const -{ - Q_D(const QGraphicsSceneBspTreeIndex); - const_cast(d)->_q_updateIndex(); - return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; -} - -/*! - \reimp - Clear the all the BSP index. -*/ -void QGraphicsSceneBspTreeIndex::clear() -{ - Q_D(QGraphicsSceneBspTreeIndex); - d->bsp.clear(); - d->lastItemCount = 0; - d->freeItemIndexes.clear(); - d->indexedItems.clear(); - d->unindexedItems.clear(); -} - -/*! - Add the \a item into the BSP index. -*/ -void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) -{ - Q_D(QGraphicsSceneBspTreeIndex); - // Prevent reusing a recently deleted pointer: purge all removed items - // from our lists. - d->purgeRemovedItems(); - - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - // Update the scene's sort cache settings. - item->d_ptr->globalStackingOrder = -1; - d->invalidateSortCache(); - - // Indexing requires sceneBoundingRect(), but because \a item might - // not be completely constructed at this point, we need to store it in - // a temporary list and schedule an indexing for later. - d->unindexedItems << item; - item->d_func()->index = -1; - d->startIndexTimer(0); -} - -/*! - This really add the item in the BSP. - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::addToIndex(QGraphicsItem *item) -{ - if (item->d_func()->index != -1) { - bsp.insertItem(item, item->sceneBoundingRect()); - foreach (QGraphicsItem *child, item->children()) - child->addToIndex(); - } else { - // The BSP tree is regenerated if the number of items grows to a - // certain threshold, or if the bounding rect of the graph doubles in - // size. - startIndexTimer(); - } -} - -/*! - Remove the \a item from the BSP index. -*/ -void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) -{ - Q_D(QGraphicsSceneBspTreeIndex); - // Note: This will access item's sceneBoundingRect(), which (as this is - // C++) is why we cannot call removeItem() from QGraphicsItem's - // destructor. - d->removeFromIndex(item); - - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - d->invalidateSortCache(); - - // Remove from our item lists. - int index = item->d_func()->index; - if (index != -1) { - d->freeItemIndexes << index; - d->indexedItems[index] = 0; - } else { - d->unindexedItems.removeAll(item); - } -} - -/*! - \reimp - Delete the \a item from the BSP index (without accessing its boundingRect). -*/ -void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) -{ - Q_D(QGraphicsSceneBspTreeIndex); - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - d->invalidateSortCache(); - - int index = item->d_func()->index; - if (index != -1) { - // Important: The index is useless until purgeRemovedItems() is - // called. - d->indexedItems[index] = (QGraphicsItem *)0; - if (!d->purgePending) { - d->purgePending = true; - scene()->update(); - } - d->removedItems << item; - } else { - // Recently added items are purged immediately. unindexedItems() never - // contains stale items. - d->unindexedItems.removeAll(item); - scene()->update(); - } -} - -/*! - Really remove the item from the BSP - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::removeFromIndex(QGraphicsItem *item) -{ - if (item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { - // ### remove from child index only if applicable - return; - } - int index = item->d_func()->index; - if (index != -1) { - bsp.removeItem(item, item->sceneBoundingRect()); - freeItemIndexes << index; - indexedItems[index] = 0; - item->d_func()->index = -1; - unindexedItems << item; - - //prepareGeometryChange will call prepareBoundingRectChange - foreach (QGraphicsItem *child, item->children()) - child->prepareGeometryChange(); - } - startIndexTimer(); -} - -/*! - \reimp - Update the BSP when the \a item 's bounding rect has changed. -*/ -void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) -{ - Q_D(QGraphicsSceneBspTreeIndex); - // Note: This will access item's sceneBoundingRect(), which (as this is - // C++) is why we cannot call removeItem() from QGraphicsItem's - // destructor. - d->removeFromIndex(const_cast(item)); -} - -/*! - Returns an estimation visible items that are either inside or - intersect with the specified \a rect and return a list sorted using \a order. - - \a deviceTransform is the transformation apply to the view. - -*/ -QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const -{ - Q_D(const QGraphicsSceneBspTreeIndex); - const_cast(d)->purgeRemovedItems(); - const_cast(d)->_q_updateSortCache(); - - QList rectItems = d->bsp.items(rect); - // Fill in with any unindexed items - for (int i = 0; i < d->unindexedItems.size(); ++i) { - if (QGraphicsItem *item = d->unindexedItems.at(i)) { - if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { - QRectF boundingRect = item->sceneBoundingRect(); - if (QRectF_intersects(boundingRect, rect)) { - item->d_ptr->itemDiscovered = 1; - rectItems << item; - } - } - } - } - - // Reset the discovered state of all discovered items - for (int i = 0; i < rectItems.size(); ++i) - rectItems.at(i)->d_func()->itemDiscovered = 0; - - d->sortItems(&rectItems, order, d->sortCacheEnabled); - - return rectItems; -} - - -/*! - \fn QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const; - - Return all items in the BSP index and sort them using \a order. -*/ -QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) const -{ - Q_D(const QGraphicsSceneBspTreeIndex); - const_cast(d)->purgeRemovedItems(); - QList itemList; - // If freeItemIndexes is empty, we know there are no holes in indexedItems and - // unindexedItems. - if (d->freeItemIndexes.isEmpty()) { - if (d->unindexedItems.isEmpty()) { - itemList = d->indexedItems; - } else { - itemList = d->indexedItems + d->unindexedItems; - } - } else { - // Rebuild the list of items to avoid holes. ### We could also just - // compress the item lists at this point. - foreach (QGraphicsItem *item, d->indexedItems + d->unindexedItems) { - if (item) - itemList << item; - } - } - if (order != -1) { - //We sort descending order - d->sortItems(&itemList, order, d->sortCacheEnabled); - } - return itemList; -} - -/*! - \property QGraphicsSceneBspTreeIndex::bspTreeDepth - \brief the depth of the BSP index tree - \since 4.6 - - This value determines the depth of BSP tree. The depth - directly affects performance and memory usage; the latter - growing exponentially with the depth of the tree. With an optimal tree - depth, the index can instantly determine the locality of items, even - for scenes with thousands or millions of items. This also greatly improves - rendering performance. - - By default, the value is 0, in which case Qt will guess a reasonable - default depth based on the size, location and number of items in the - scene. If these parameters change frequently, however, you may experience - slowdowns as the index retunes the depth internally. You can avoid - potential slowdowns by fixating the tree depth through setting this - property. - - The depth of the tree and the size of the scene rectangle decide the - granularity of the scene's partitioning. The size of each scene segment is - determined by the following algorithm: - - The BSP tree has an optimal size when each segment contains between 0 and - 10 items. - -*/ -int QGraphicsSceneBspTreeIndex::bspTreeDepth() -{ - Q_D(const QGraphicsSceneBspTreeIndex); - return d->bspTreeDepth; -} - -void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth) -{ - Q_D(QGraphicsSceneBspTreeIndex); - d->bspTreeDepth = depth; - d->resetIndex(); -} - -/*! - \reimp - - This method react to the \a rect change of the scene and - reset the BSP tree index. -*/ -void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) -{ - Q_D(QGraphicsSceneBspTreeIndex); - d->sceneRect = rect; - d->resetIndex(); -} - -/*! - \reimp - - This method react to the \a change of the \a item and use the \a value to - update the BSP tree if necessary. - -*/ -void QGraphicsSceneBspTreeIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) -{ - Q_D(QGraphicsSceneBspTreeIndex); - switch (change) { - case QGraphicsItem::ItemZValueChange: - case QGraphicsItem::ItemParentChange: { - d->invalidateSortCache(); - break; - } - default: - break; - } - return QGraphicsSceneIndex::itemChanged(item, change, value); -} -/*! - \reimp - - Used to catch the timer event. - - \internal -*/ -bool QGraphicsSceneBspTreeIndex::event(QEvent *event) -{ - Q_D(QGraphicsSceneBspTreeIndex); - switch (event->type()) { - case QEvent::Timer: - if (d->indexTimerId && static_cast(event)->timerId() == d->indexTimerId) { - if (d->restartIndexTimer) { - d->restartIndexTimer = false; - } else { - // this call will kill the timer - d->_q_updateIndex(); - } - } - // Fallthrough intended - support timers in subclasses. - default: - return QObject::event(event); - } - return true; -} - -QT_END_NAMESPACE - -#include "moc_qgraphicsscenebsptreeindex_p.cpp" - -#endif // QT_NO_GRAPHICSVIEW - diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 40b8f0b..6bafbc8 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -39,63 +39,112 @@ ** ****************************************************************************/ -#include - -#ifndef QGRAPHICSBSPTREEINDEX_H -#define QGRAPHICSBSPTREEINDEX_H +#ifndef QGRAPHICSSCENEBSPTREEINDEX_P_H +#define QGRAPHICSSCENEBSPTREEINDEX_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qgraphicsscenebsptreeindex.h" #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW +#include +#include + QT_BEGIN_NAMESPACE -#include -#include -#include -#include -#include +static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; -#include "qgraphicsscene_bsp_p.h" +class QGraphicsScene; -class QGraphicsSceneBspTreeIndexPrivate; -class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex +class QGraphicsSceneBspTreeIndexPrivate : public QGraphicsSceneIndexPrivate { - Q_OBJECT - Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) + Q_DECLARE_PUBLIC(QGraphicsSceneBspTreeIndex) public: - QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); - QRectF indexedRect() const; - - QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; - - QList items(Qt::SortOrder order = Qt::AscendingOrder) const; - - int bspTreeDepth(); - void setBspTreeDepth(int depth); - -protected: - bool event(QEvent *event); - void clear(); - - void addItem(QGraphicsItem *item); - void removeItem(QGraphicsItem *item); - void deleteItem(QGraphicsItem *item); - void prepareBoundingRectChange(const QGraphicsItem *item); + QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene); + + QGraphicsSceneBspTree bsp; + QRectF sceneRect; + int bspTreeDepth; + int indexTimerId; + bool restartIndexTimer; + bool regenerateIndex; + int lastItemCount; + + QList indexedItems; + QList unindexedItems; + QList freeItemIndexes; + + bool purgePending; + QSet removedItems; + void purgeRemovedItems(); + + void _q_updateIndex(); + void startIndexTimer(int interval = QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); + void resetIndex(); + + void addToIndex(QGraphicsItem *item); + void removeFromIndex(QGraphicsItem *item); + + void _q_updateSortCache(); + bool sortCacheEnabled; + bool updatingSortCache; + void invalidateSortCache(); + + static void climbTree(QGraphicsItem *item, int *stackingOrder); + static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); + static bool closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); + + static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) + { + return item1->d_ptr->globalStackingOrder < item2->d_ptr->globalStackingOrder; + } + static inline bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) + { + return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder; + } + + static void sortItems(QList *itemList, Qt::SortOrder order, bool cached); +}; - void sceneRectChanged(const QRectF &rect); - void itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); -private : - Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex) - Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex) - Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache()) - Q_PRIVATE_SLOT(d_func(), void _q_updateIndex()) +/*! + \internal +*/ +inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + // Return true if sibling item1 is on top of item2. + const QGraphicsItemPrivate *d1 = item1->d_ptr; + const QGraphicsItemPrivate *d2 = item2->d_ptr; + bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; + bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; + if (f1 != f2) return f2; + qreal z1 = d1->z; + qreal z2 = d2->z; + return z1 > z2; +} + +/*! + \internal +*/ +static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + return qt_closestLeaf(item2, item1); +} - friend class QGraphicsScene; - friend class QGraphicsScenePrivate; -}; QT_END_NAMESPACE -#endif // QT_NO_GRAPHICSVIEW +#endif // QGRAPHICSSCENEBSPTREEINDEX_P_H + +#endif -#endif // QGRAPHICSBSPTREEINDEX_H diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h deleted file mode 100644 index 30f6e26..0000000 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p_p.h +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSCENEBSPTREEINDEX_P_P_H -#define QGRAPHICSSCENEBSPTREEINDEX_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#include "qgraphicsscenebsptreeindex_p.h" - -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - -#include -#include - -QT_BEGIN_NAMESPACE - -static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; - -class QGraphicsScene; - -class QGraphicsSceneBspTreeIndexPrivate : public QGraphicsSceneIndexPrivate -{ - Q_DECLARE_PUBLIC(QGraphicsSceneBspTreeIndex) -public: - QGraphicsSceneBspTreeIndexPrivate(QGraphicsScene *scene); - - QGraphicsSceneBspTree bsp; - QRectF sceneRect; - int bspTreeDepth; - int indexTimerId; - bool restartIndexTimer; - bool regenerateIndex; - int lastItemCount; - - QList indexedItems; - QList unindexedItems; - QList freeItemIndexes; - - bool purgePending; - QSet removedItems; - void purgeRemovedItems(); - - void _q_updateIndex(); - void startIndexTimer(int interval = QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); - void resetIndex(); - - void addToIndex(QGraphicsItem *item); - void removeFromIndex(QGraphicsItem *item); - - void _q_updateSortCache(); - bool sortCacheEnabled; - bool updatingSortCache; - void invalidateSortCache(); - - static void climbTree(QGraphicsItem *item, int *stackingOrder); - static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); - static bool closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); - - static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) - { - return item1->d_ptr->globalStackingOrder < item2->d_ptr->globalStackingOrder; - } - static inline bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) - { - return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder; - } - - static void sortItems(QList *itemList, Qt::SortOrder order, bool cached); -}; - - -/*! - \internal -*/ -inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - // Return true if sibling item1 is on top of item2. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; - bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; - bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; - if (f1 != f2) return f2; - qreal z1 = d1->z; - qreal z2 = d2->z; - return z1 > z2; -} - -/*! - \internal -*/ -static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - return qt_closestLeaf(item2, item1); -} - - -QT_END_NAMESPACE - -#endif // QGRAPHICSSCENEBSPTREEINDEX_P_P_H - -#endif - diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 05ec28b..966d8fe 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -46,6 +46,7 @@ \ingroup multimedia \ingroup graphicsview-api \mainclass + \internal The QGraphicsSceneIndex class provides a base class to implement a custom indexing algorithm for discovering items in QGraphicsScene. You @@ -57,7 +58,6 @@ #include "qgraphicssceneindex.h" #include "qgraphicssceneindex_p.h" -#include "qgraphicsscenebsptreeindex_p_p.h" #include "qgraphicsscene.h" #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index 084a623..c0e415c 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -42,6 +42,17 @@ #ifndef QGRAPHICSSCENEINDEX_H #define QGRAPHICSSCENEINDEX_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -61,7 +72,7 @@ class QRectF; class QPointF; template class QList; -class Q_GUI_EXPORT QGraphicsSceneIndex: public QObject +class Q_AUTOTEST_EXPORT QGraphicsSceneIndex: public QObject { Q_OBJECT diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp index 1c898bc..5504493 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp @@ -1,4 +1,4 @@ -#include "qgraphicsscenelinearindex_p.h" +#include "qgraphicsscenelinearindex.h" /*! \class QGraphicsSceneLinearIndex @@ -8,6 +8,7 @@ \ingroup multimedia \ingroup graphicsview-api \mainclass + \internal QGraphicsSceneLinearIndex index is default linear implementation to discover items. It basically store all items in a list and return them to the scene. diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.h b/src/gui/graphicsview/qgraphicsscenelinearindex.h new file mode 100644 index 0000000..b793d98 --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENELINEARINDEX_H +#define QGRAPHICSSCENELINEARINDEX_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +#include +#include +#include +#include + +class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex +{ + Q_OBJECT + +public: + QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): QGraphicsSceneIndex(scene) + { + } + + QList items(Qt::SortOrder order = Qt::AscendingOrder) const { + Q_UNUSED(order); + return m_items; + } + + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { + Q_UNUSED(rect); + Q_UNUSED(order); + Q_UNUSED(deviceTransform); + return m_items; + } + + virtual QRectF indexedRect() const { + return m_sceneRect; + } + +protected : + void sceneRectChanged(const QRectF &rect) { + m_sceneRect = rect; + } + + virtual void clear() { + m_items.clear(); + } + + virtual void addItem(QGraphicsItem *item) { + m_items << item; + } + + virtual void removeItem(QGraphicsItem *item) { + m_items.removeAll(item); + } + +private: + QRectF m_sceneRect; + QList m_items; +}; + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRAPHICSSCENELINEARINDEX_H diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h deleted file mode 100644 index d21475c..0000000 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSCENELINEARINDEX_P_H -#define QGRAPHICSSCENELINEARINDEX_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex -{ - Q_OBJECT - -public: - QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): QGraphicsSceneIndex(scene) - { - } - - QList items(Qt::SortOrder order = Qt::AscendingOrder) const { - Q_UNUSED(order); - return m_items; - } - - virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { - Q_UNUSED(rect); - Q_UNUSED(order); - Q_UNUSED(deviceTransform); - return m_items; - } - - virtual QRectF indexedRect() const { - return m_sceneRect; - } - -protected : - void sceneRectChanged(const QRectF &rect) { - m_sceneRect = rect; - } - - virtual void clear() { - m_items.clear(); - } - - virtual void addItem(QGraphicsItem *item) { - m_items << item; - } - - virtual void removeItem(QGraphicsItem *item) { - m_items.removeAll(item); - } - -private: - QRectF m_sceneRect; - QList m_items; -}; - -QT_END_NAMESPACE - -#endif // QT_NO_GRAPHICSVIEW - -#endif // QGRAPHICSSCENELINEARINDEX_P_H -- cgit v0.12 From 5d682567d1acb79b2fa55ae8f005c5dcdc9aacb7 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Wed, 17 Jun 2009 14:27:46 +0200 Subject: API / code review for QGraphicsSceneIndex (internal API). A few minor modifications only, marked some things as ### obsolete, removed the public get/set for the index (it's internal anyway). --- src/gui/graphicsview/qgraphicsitem.h | 48 ++++++------ src/gui/graphicsview/qgraphicsscene.cpp | 90 ++++------------------ src/gui/graphicsview/qgraphicsscene.h | 11 +-- src/gui/graphicsview/qgraphicsscene_p.h | 40 ---------- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 6 +- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 40 ++++++++++ 6 files changed, 86 insertions(+), 149 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index ec16d26..12dcad2 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -141,7 +141,7 @@ public: QGraphicsItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -208,8 +208,8 @@ public: Qt::MouseButtons acceptedMouseButtons() const; void setAcceptedMouseButtons(Qt::MouseButtons buttons); - bool acceptsHoverEvents() const; // obsolete - void setAcceptsHoverEvents(bool enabled); // obsolete + bool acceptsHoverEvents() const; // ### obsolete + void setAcceptsHoverEvents(bool enabled); // ### obsolete bool acceptHoverEvents() const; void setAcceptHoverEvents(bool enabled); @@ -534,7 +534,7 @@ class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem public: QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -564,13 +564,13 @@ class Q_GUI_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem public: QGraphicsPathItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -607,19 +607,19 @@ class Q_GUI_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem public: QGraphicsRectItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -660,19 +660,19 @@ class Q_GUI_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem public: QGraphicsEllipseItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -719,14 +719,14 @@ class Q_GUI_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem public: QGraphicsPolygonItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -766,19 +766,19 @@ class Q_GUI_EXPORT QGraphicsLineItem : public QGraphicsItem public: QGraphicsLineItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -826,13 +826,13 @@ public: QGraphicsPixmapItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -888,13 +888,13 @@ class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject public: QGraphicsTextItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -989,13 +989,13 @@ class Q_GUI_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem public: QGraphicsSimpleTextItem(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); @@ -1035,7 +1035,7 @@ class Q_GUI_EXPORT QGraphicsItemGroup : public QGraphicsItem public: QGraphicsItemGroup(QGraphicsItem *parent = 0 #ifndef Q_QDOC - // obsolete argument + // ### obsolete argument , QGraphicsScene *scene = 0 #endif ); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a33cb3e..dacfc87 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -201,8 +201,6 @@ however, is done in constant time. This approach is ideal for dynamic scenes, where many items are added, moved or removed continuously. - \omitvalue CustomIndex - \sa setItemIndexMethod(), bspTreeDepth */ @@ -1529,85 +1527,19 @@ QGraphicsScene::ItemIndexMethod QGraphicsScene::itemIndexMethod() const Q_D(const QGraphicsScene); return d->indexMethod; } - -// Possibilities -// NoIndex -> CustomIndex : warning -// BspTreeIndex -> CustomIndex : warning -// CustomIndex -> CustomIndex : warning -// NoIndex -> BspTreeIndex : create an empty BSP if necessary -// BspTreeIndex -> BspTreeIndex : nothing -// CustomIndex -> BspTreeIndex : create BSP and transfer items -// NoIndex -> NoIndex : nothing -// BspTreeIndex -> NoIndex : nothing -// CustomIndex -> NoIndex : create BSP tree but do not populate void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) { Q_D(QGraphicsScene); - if (method == CustomIndex) { - qWarning("QGraphicsScene: Invalid index type %d", CustomIndex); + if (d->indexMethod == method) return; - } - if (d->indexMethod == method) { - return; - } - if (d->indexMethod == NoIndex && method == BspTreeIndex) { - QGraphicsSceneBspTreeIndex *tree = qobject_cast(d->index); - if (!tree) { - delete d->index; - d->index = new QGraphicsSceneBspTreeIndex(this); - } - } + d->indexMethod = method; - if (d->indexMethod == CustomIndex && method == BspTreeIndex) { - //We re-add in the new index all items from the old index - QGraphicsSceneIndex *oldIndex = d->index; + delete d->index; + if (method == BspTreeIndex) d->index = new QGraphicsSceneBspTreeIndex(this); - for (int i = 0 ; i < oldIndex->items().size() ; ++ i) - d->index->addItem(oldIndex->items().at(i)); - } - - if (d->indexMethod == CustomIndex && method == NoIndex) { + else d->index = new QGraphicsSceneLinearIndex(this); - } - - d->indexMethod = method; -} - -/*! - \internal - - \brief the item indexing method. - This method allow to apply an indexing algorithm \a index to the scene, to speed up - item discovery functions like items() and itemAt(). - - \sa sceneIndex(), QGraphicsSceneIndex -*/ -void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index) -{ - Q_D(QGraphicsScene); - if (!index) { - qWarning("QGraphicsScene::setSceneIndex: Attempt to insert a null indexer"); - } else { - if (d->indexMethod == BspTreeIndex) { - delete d->index; - } - d->indexMethod = CustomIndex; - d->index = index; - } -} - -/*! - \internal - - This method return the current indexing algorithm of the scene. - - \sa setSceneIndex(), QGraphicsSceneIndex -*/ -QGraphicsSceneIndex* QGraphicsScene::sceneIndex() const -{ - Q_D(const QGraphicsScene); - return d->index; } /*! @@ -1814,7 +1746,8 @@ QList QGraphicsScene::items(const QPainterPath &path, Qt::ItemS \sa itemAt() */ -QList QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsScene); return d->index->items(pos, mode, order, deviceTransform); @@ -1833,7 +1766,8 @@ QList QGraphicsScene::items(const QPointF &pos, Qt::ItemSelecti \sa itemAt() */ -QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsScene); return d->index->items(rect, mode, order, deviceTransform); @@ -1852,7 +1786,8 @@ QList QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti \sa itemAt() */ -QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsScene); return d->index->items(polygon, mode, order, deviceTransform); @@ -1871,7 +1806,8 @@ QList QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS \sa itemAt() */ -QList QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsScene); return d->index->items(path, mode, order, deviceTransform); diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 36374c8..b922be5 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -114,7 +114,6 @@ class Q_GUI_EXPORT QGraphicsScene : public QObject public: enum ItemIndexMethod { BspTreeIndex, - CustomIndex, NoIndex = -1 }; @@ -144,8 +143,6 @@ public: ItemIndexMethod itemIndexMethod() const; void setItemIndexMethod(ItemIndexMethod method); - void setSceneIndex(QGraphicsSceneIndex *index); - QGraphicsSceneIndex* sceneIndex() const; bool isSortCacheEnabled() const; void setSortCacheEnabled(bool enabled); @@ -162,10 +159,10 @@ public: QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - QList items(const QPointF &pos) const; - QList items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; - QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; - QList items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList items(const QPointF &pos) const; // ### obsolete + QList items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete + QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete + QList items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete QList collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; QGraphicsItem *itemAt(const QPointF &pos) const; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 563e016..8e05c00 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -229,46 +229,6 @@ public: QStyleOptionGraphicsItem styleOptionTmp; }; -static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) -{ - qreal xp = s.left(); - qreal yp = s.top(); - qreal w = s.width(); - qreal h = s.height(); - qreal l1 = xp; - qreal r1 = xp; - if (w < 0) - l1 += w; - else - r1 += w; - - qreal l2 = r.left(); - qreal r2 = r.left(); - if (w < 0) - l2 += r.width(); - else - r2 += r.width(); - - if (l1 >= r2 || l2 >= r1) - return false; - - qreal t1 = yp; - qreal b1 = yp; - if (h < 0) - t1 += h; - else - b1 += h; - - qreal t2 = r.top(); - qreal b2 = r.top(); - if (r.height() < 0) - t2 += r.height(); - else - b2 += r.height(); - - return !(t1 >= b2 || t2 >= b1); -} - // QRectF::intersects() returns false always if either the source or target // rectangle's width or height are 0. This works around that problem. static inline void _q_adjustRect(QRectF *rect) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 76fd218..969d3c5 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -589,12 +589,16 @@ void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem * \a deviceTransform is the transformation apply to the view. */ -QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, + const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneBspTreeIndex); const_cast(d)->purgeRemovedItems(); const_cast(d)->_q_updateSortCache(); + // ### Handle items that ignore transformations + Q_UNUSED(deviceTransform); + QList rectItems = d->bsp.items(rect); // Fill in with any unindexed items for (int i = 0; i < d->unindexedItems.size(); ++i) { diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 6bafbc8..b6f782d 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -142,6 +142,46 @@ static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphics } +static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) +{ + qreal xp = s.left(); + qreal yp = s.top(); + qreal w = s.width(); + qreal h = s.height(); + qreal l1 = xp; + qreal r1 = xp; + if (w < 0) + l1 += w; + else + r1 += w; + + qreal l2 = r.left(); + qreal r2 = r.left(); + if (w < 0) + l2 += r.width(); + else + r2 += r.width(); + + if (l1 >= r2 || l2 >= r1) + return false; + + qreal t1 = yp; + qreal b1 = yp; + if (h < 0) + t1 += h; + else + b1 += h; + + qreal t2 = r.top(); + qreal b2 = r.top(); + if (r.height() < 0) + t2 += r.height(); + else + b2 += r.height(); + + return !(t1 >= b2 || t2 >= b1); +} + QT_END_NAMESPACE #endif // QGRAPHICSSCENEBSPTREEINDEX_P_H -- cgit v0.12 From 625dadcc9b88dccebf607b84089ab960740b94f2 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Wed, 17 Jun 2009 14:36:55 +0200 Subject: Don't lose all the items when we switch item index method. Readd the items to the new index. Reviewed-by: Alexis --- src/gui/graphicsview/qgraphicsscene.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index dacfc87..36af30d 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1535,11 +1535,14 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) d->indexMethod = method; + QList oldItems = d->index->items(); delete d->index; if (method == BspTreeIndex) d->index = new QGraphicsSceneBspTreeIndex(this); else d->index = new QGraphicsSceneLinearIndex(this); + for (int i = 0; i < oldItems.size(); ++i) + d->index->addItem(oldItems.at(i)); } /*! -- cgit v0.12 From ac8bf5ec1f99d0e00e3ffefe53306c0d511376bf Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Wed, 17 Jun 2009 14:46:54 +0200 Subject: More cleanups during code review. Reviewed-by: Alexis --- src/gui/graphicsview/qgraphicsscene.cpp | 104 --------------------------- src/gui/graphicsview/qgraphicsscene_p.h | 4 -- src/gui/graphicsview/qgraphicssceneindex.cpp | 54 +++++++++----- src/gui/graphicsview/qgraphicssceneindex.h | 18 +++-- 4 files changed, 47 insertions(+), 133 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 36af30d..380ac20 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1097,110 +1097,6 @@ QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item) return 0; } -void QGraphicsScenePrivate::recursive_items_helper(QGraphicsItem *item, QRectF rect, - QList *items, - const QTransform &parentTransform, - const QTransform &viewTransform, - Qt::ItemSelectionMode mode, Qt::SortOrder order, - qreal parentOpacity) const -{ - // Calculate opacity. - qreal opacity; - if (item) { - if (!item->d_ptr->visible) - return; - QGraphicsItem *p = item->d_ptr->parent; - bool itemIgnoresParentOpacity = item->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity; - bool parentDoesntPropagateOpacity = (p && (p->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren)); - if (!itemIgnoresParentOpacity && !parentDoesntPropagateOpacity) { - opacity = parentOpacity * item->opacity(); - } else { - opacity = item->d_ptr->opacity; - } - if (opacity == 0.0 && !(item->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren)) - return; - } else { - opacity = parentOpacity; - } - - // Calculate the full transform for this item. - QTransform transform = parentTransform; - bool keep = false; - if (item) { - item->d_ptr->combineTransformFromParent(&transform, &viewTransform); - - // ### This does not take the clip into account. - QRectF brect = item->boundingRect(); - _q_adjustRect(&brect); - - keep = true; - if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) - keep = rect.contains(transform.mapRect(brect)) && rect != brect; - else - keep = rect.intersects(transform.mapRect(brect)); - - if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { - QPainterPath rectPath; - rectPath.addRect(rect); - keep = itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); - } - } - - bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); - bool dontProcessItem = !item || !keep; - bool dontProcessChildren = item && dontProcessItem && childClip; - - // Find and sort children. - QList &children = item ? item->d_ptr->children : const_cast(this)->topLevelItems; - if (!dontProcessChildren) { - if (item && item->d_ptr->needSortChildren) { - item->d_ptr->needSortChildren = 0; - qStableSort(children.begin(), children.end(), qt_notclosestLeaf); - } else if (!item && needSortTopLevelItems) { - const_cast(this)->needSortTopLevelItems = false; - qStableSort(children.begin(), children.end(), qt_notclosestLeaf); - } - } - - childClip &= !dontProcessChildren & !children.isEmpty(); - - // Clip. - if (childClip) - rect &= transform.map(item->shape()).controlPointRect(); - - // Process children behind - int i = 0; - if (!dontProcessChildren) { - for (i = 0; i < children.size(); ++i) { - QGraphicsItem *child = children.at(i); - if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) - break; - recursive_items_helper(child, rect, items, transform, viewTransform, - mode, order, opacity); - } - } - - // Process item - if (!dontProcessItem) - items->append(item); - - // Process children in front - if (!dontProcessChildren) { - for (; i < children.size(); ++i) - recursive_items_helper(children.at(i), rect, items, transform, viewTransform, - mode, order, opacity); - } - - if (!item && order == Qt::AscendingOrder) { - int n = items->size(); - for (int i = 0; i < n / 2; ++i) { - QGraphicsItem *tmp = (*items)[n - i - 1]; - (*items)[n - i - 1] = (*items)[i]; - (*items)[i] = tmp; - } - } -} - /*! \internal diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 8e05c00..538ff3f 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -188,10 +188,6 @@ public: void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent); QGraphicsWidget *windowForItem(const QGraphicsItem *item) const; - void recursive_items_helper(QGraphicsItem *item, QRectF rect, QList *items, - const QTransform &parentTransform, const QTransform &viewTransform, - Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const; - void drawItemHelper(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, bool painterStateProtection); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 966d8fe..4ca1c02 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -119,9 +119,8 @@ public: else keep = rect.intersects(transform.mapRect(brect)); - if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) keep = QGraphicsScenePrivate::get(scene)->itemCollidesWithPath(item, transform.inverted().map(path), mode); - } return keep; } QPainterPath path; @@ -290,24 +289,27 @@ QRectF QGraphicsSceneIndex::indexedRect() const } /*! - \fn QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const + \fn QList QGraphicsSceneIndex::items(const QPointF &pos, + Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform + &deviceTransform) const - Returns all visible items that, depending on \a mode, are at the specified \a pos - and return a list sorted using \a order. + Returns all visible items that, depending on \a mode, are at the specified + \a pos and return a list sorted using \a order. The default value for \a mode is Qt::IntersectsItemShape; all items whose exact shape intersects with \a pos are returned. \a deviceTransform is the transformation apply to the view. - This method use the estimation of the index (estimateItems) and refine - the list to get an exact result. If you want to implement your own - refinement algorithm you can reimplement this method. + This method use the estimation of the index (estimateItems) and refine the + list to get an exact result. If you want to implement your own refinement + algorithm you can reimplement this method. \sa estimateItems() */ -QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); QList itemList; @@ -319,7 +321,9 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe } /*! - \fn QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const + \fn QList QGraphicsSceneIndex::items(const QRectF &rect, + Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform + &deviceTransform) const \overload @@ -338,7 +342,8 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe \sa estimateItems() */ -QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); QList itemList; @@ -349,7 +354,9 @@ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe } /*! - \fn QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const + \fn QList QGraphicsSceneIndex::items(const QPolygonF + &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const + QTransform &deviceTransform) const \overload @@ -368,7 +375,8 @@ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe \sa estimateItems() */ -QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); QList itemList; @@ -384,7 +392,9 @@ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt:: } /*! - \fn QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const + \fn QList QGraphicsSceneIndex::items(const QPainterPath + &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform + &deviceTransform) const \overload @@ -403,7 +413,8 @@ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt:: \sa estimateItems() */ -QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); QList itemList; @@ -421,13 +432,16 @@ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt:: This method return a list sorted using \a order. \a deviceTransform is the transformation apply to the view. */ -QList QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order, const QTransform &deviceTransform) const +QList QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order, + const QTransform &deviceTransform) const { return estimateItems(QRectF(point, QSize(1,1)), order, deviceTransform); } /*! - \fn virtual QList QGraphicsSceneIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const = 0 + \fn virtual QList + QGraphicsSceneIndex::estimateItems(const QRectF &rect, Qt::SortOrder + order, const QTransform &deviceTransform) const = 0 This pure virtual function return an estimation of items in the \a rect. This method return a list sorted using \a order. @@ -436,8 +450,10 @@ QList QGraphicsSceneIndex::estimateItems(const QPointF &point, */ /*! - \fn virtual QList QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; - This pure virtual function all items in the index and sort them using \a order. + \fn virtual QList + QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const + = 0; This pure virtual function all items in the index and sort them using + \a order. */ /*! diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index c0e415c..ddce9d4 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -85,12 +85,18 @@ public: virtual QRectF indexedRect() const; virtual QList items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; - virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList estimateItems(const QPointF &point, Qt::SortOrder order, const QTransform &deviceTransform) const; - virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const = 0; + virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QRectF &rect, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList estimateItems(const QPointF &point, + Qt::SortOrder order, const QTransform &deviceTransform) const; + virtual QList estimateItems(const QRectF &rect, + Qt::SortOrder order, const QTransform &deviceTransform) const = 0; protected: virtual void clear(); -- cgit v0.12 From 0d839e3655d985920aff81882bd444605d97c21c Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 18 Jun 2009 14:28:29 +0200 Subject: Changes after first round of code reviewing. This change removes all code that handles ItemIgnoresTransformations from QGraphicsView, and changes the APIs of the scene index intersectors. Reviewed-by: Alexis --- src/gui/graphicsview/qgraphicsitem.cpp | 33 ++-- src/gui/graphicsview/qgraphicsitem_p.h | 9 + src/gui/graphicsview/qgraphicsscene.cpp | 141 ++++++-------- src/gui/graphicsview/qgraphicsscene.h | 17 +- src/gui/graphicsview/qgraphicsscene_p.h | 4 +- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 96 +++++---- src/gui/graphicsview/qgraphicsscenebsptreeindex.h | 2 +- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 5 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 216 ++++++++++++++------- src/gui/graphicsview/qgraphicssceneindex.h | 2 +- src/gui/graphicsview/qgraphicssceneindex_p.h | 19 +- src/gui/graphicsview/qgraphicsview.cpp | 161 ++++----------- src/gui/graphicsview/qgraphicsview_p.h | 7 +- 13 files changed, 368 insertions(+), 344 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 593d7be..75683d8 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -857,6 +857,11 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) if (newParent == parent) return; + if (scene) { + // Deliver the change to the index + scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParentVariant); + } + if (QGraphicsWidget *w = isWidget ? static_cast(q) : q->parentWidget()) { // Update the child focus chain; when reparenting a widget that has a // focus child, ensure that that focus child clears its focus child @@ -951,11 +956,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) // Deliver post-change notification q->itemChange(QGraphicsItem::ItemParentHasChanged, newParentVariant); - if (scene) { - // Deliver the change to the index - scene->d_func()->index->itemChanged(q, QGraphicsItem::ItemParentHasChanged, newParentVariant); - } - if (isObject) emit static_cast(q)->parentChanged(); } @@ -1426,6 +1426,8 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) flags = GraphicsItemFlags(itemChange(ItemFlagsChange, quint32(flags)).toUInt()); if (quint32(d_ptr->flags) == quint32(flags)) return; + if (d_ptr->scene) + d_ptr->scene->d_func()->index->itemChange(this, ItemFlagsChange, quint32(flags)); // Flags that alter the geometry of the item (or its children). const quint32 geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations); @@ -3577,17 +3579,20 @@ void QGraphicsItem::setZValue(qreal z) qreal newZ = qreal(newZVariant.toDouble()); if (newZ == d_ptr->z) return; + + if (d_ptr->scene) { + // Z Value has changed, we have to notify the index. + d_ptr->scene->d_func()->index->itemChange(this, ItemZValueChange, newZVariant); + } + d_ptr->z = newZ; if (d_ptr->parent) d_ptr->parent->d_ptr->needSortChildren = 1; else if (d_ptr->scene) d_ptr->scene->d_func()->needSortTopLevelItems = 1; - if (d_ptr->scene) { + if (d_ptr->scene) d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true); - //Z Value has changed, we have to notify the index. - d_ptr->scene->d_func()->index->itemChanged(this, ItemZValueChange, z); - } itemChange(ItemZValueHasChanged, newZVariant); @@ -9655,17 +9660,11 @@ QDebug operator<<(QDebug debug, QGraphicsItem *item) return debug; } - QStringList flags; - if (item->isVisible()) flags << QLatin1String("isVisible"); - if (item->isEnabled()) flags << QLatin1String("isEnabled"); - if (item->isSelected()) flags << QLatin1String("isSelected"); - if (item->hasFocus()) flags << QLatin1String("HasFocus"); - debug << "QGraphicsItem(this =" << ((void*)item) << ", parent =" << ((void*)item->parentItem()) << ", pos =" << item->pos() - << ", z =" << item->zValue() << ", flags = {" - << flags.join(QLatin1String("|")) << " })"; + << ", z =" << item->zValue() << ", flags = " + << item->flags() << ")"; return debug; } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 9c1ee4f..1c95a62 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -158,6 +158,15 @@ public: inline virtual ~QGraphicsItemPrivate() { } + static const QGraphicsItemPrivate *get(const QGraphicsItem *item) + { + return item->d_ptr; + } + static QGraphicsItemPrivate *get(QGraphicsItem *item) + { + return item->d_ptr; + } + void updateAncestorFlag(QGraphicsItem::GraphicsItemFlag childFlag, AncestorFlag flag = NoFlag, bool enabled = false, bool root = true); void setIsMemberOfGroup(bool enabled); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 380ac20..55f0f20 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -774,41 +774,8 @@ QList QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre { Q_Q(const QGraphicsScene); QGraphicsView *view = widget ? qobject_cast(widget->parentWidget()) : 0; - QList items; - if (view) - items = view->items(view->viewport()->mapFromGlobal(screenPos)); - else - items = q->items(scenePos); - return items; -} - -/*! - \internal - - Checks if item collides with the path and mode, but also checks that if it - doesn't collide, maybe its frame rect will. -*/ -bool QGraphicsScenePrivate::itemCollidesWithPath(QGraphicsItem *item, - const QPainterPath &path, - Qt::ItemSelectionMode mode) -{ - if (item->collidesWithPath(path, mode)) - return true; - if (item->isWidget()) { - // Check if this is a window, and if its frame rect collides. - QGraphicsWidget *widget = static_cast(item); - if (widget->isWindow()) { - QRectF frameRect = widget->windowFrameRect(); - QPainterPath framePath; - framePath.addRect(frameRect); - bool intersects = path.intersects(frameRect); - if (mode == Qt::IntersectsItemShape || mode == Qt::IntersectsItemBoundingRect) - return intersects || path.contains(frameRect.topLeft()) - || framePath.contains(path.elementAt(0)); - return !intersects && path.contains(frameRect.topLeft()); - } - } - return false; + return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, + view ? view->viewportTransform() : QTransform()); } /*! @@ -820,7 +787,7 @@ void QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(QGraphicsSceneMouse if (event->buttons() & i) { mouseGrabberButtonDownPos.insert(Qt::MouseButton(i), mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(), - event->widget())); + event->widget())); mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos()); mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos()); } @@ -1282,6 +1249,8 @@ QGraphicsScene::~QGraphicsScene() QRectF QGraphicsScene::sceneRect() const { Q_D(const QGraphicsScene); + /// ### Remove? The growing items bounding rect might be managed + // by the scene. return d->index->indexedRect(); } void QGraphicsScene::setSceneRect(const QRectF &rect) @@ -1332,6 +1301,8 @@ void QGraphicsScene::setSceneRect(const QRectF &rect) void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRectF &source, Qt::AspectRatioMode aspectRatioMode) { + // ### Switch to using the recursive rendering algorithm instead. + // Default source rect = scene rect QRectF sourceRect = source; if (sourceRect.isNull()) @@ -1431,14 +1402,16 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) d->indexMethod = method; - QList oldItems = d->index->items(); + QList oldItems = d->index->items(Qt::AscendingOrder); delete d->index; if (method == BspTreeIndex) d->index = new QGraphicsSceneBspTreeIndex(this); else d->index = new QGraphicsSceneLinearIndex(this); - for (int i = 0; i < oldItems.size(); ++i) + for (int i = oldItems.size() - 1; i >= 0; --i) d->index->addItem(oldItems.at(i)); + + d->index->sceneRectChanged(d->sceneRect); } /*! @@ -1476,7 +1449,7 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) int QGraphicsScene::bspTreeDepth() const { Q_D(const QGraphicsScene); - QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); + QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); return bspTree ? bspTree->bspTreeDepth() : 0; } void QGraphicsScene::setBspTreeDepth(int depth) @@ -1487,14 +1460,11 @@ void QGraphicsScene::setBspTreeDepth(int depth) return; } - QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); + QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); if (!bspTree) { qWarning("QGraphicsScene::setBspTreeDepth: can not apply if indexing method is not BSP"); return; } - if (bspTree->bspTreeDepth() == depth) - return; - bspTree->setBspTreeDepth(depth); } @@ -1502,37 +1472,21 @@ void QGraphicsScene::setBspTreeDepth(int depth) \property QGraphicsScene::sortCacheEnabled \brief whether sort caching is enabled \since 4.5 + \obsolete - When enabled, this property adds a cache that speeds up sorting and - transformations for scenes with deep hierarchies (i.e., items with many - levels of descendents), at the cost of using more memory (approx. 100 more - bytes of memory per item). - - Items that are not part of a deep hierarchy suffer no penalty from this - cache. + Since Qt 4.6, this property has no effect. */ bool QGraphicsScene::isSortCacheEnabled() const { Q_D(const QGraphicsScene); - QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); - if (!bspTree) { - qWarning("QGraphicsScene::isSortCacheEnabled: can not apply if indexing method is not BSP"); - return false; - } - return bspTree->d_func()->sortCacheEnabled; + return d->sortCacheEnabled; } void QGraphicsScene::setSortCacheEnabled(bool enabled) { Q_D(QGraphicsScene); - QGraphicsSceneBspTreeIndex *bspTree = qobject_cast(d->index); - if (!bspTree) { - qWarning("QGraphicsScene::isSortCacheEnabled: can not apply if indexing method is not BSP"); + if (d->sortCacheEnabled == enabled) return; - } - if (enabled == bspTree->d_func()->sortCacheEnabled) - return; - if ((bspTree->d_func()->sortCacheEnabled = enabled)) - bspTree->d_func()->invalidateSortCache(); + d->sortCacheEnabled = enabled; } /*! @@ -1544,6 +1498,7 @@ void QGraphicsScene::setSortCacheEnabled(bool enabled) */ QRectF QGraphicsScene::itemsBoundingRect() const { + // Does not take untransformable items into account. QRectF boundingRect; foreach (QGraphicsItem *item, items()) boundingRect |= item->sceneBoundingRect(); @@ -1558,7 +1513,19 @@ QRectF QGraphicsScene::itemsBoundingRect() const QList QGraphicsScene::items() const { Q_D(const QGraphicsScene); - return d->index->items(); + return d->index->items(Qt::AscendingOrder); +} + +/*! + Returns an ordered list of all items on the scene. \a order decides the + sorting. + + \sa addItem(), removeItem() +*/ +QList QGraphicsScene::items(Qt::SortOrder order) const +{ + Q_D(const QGraphicsScene); + return d->index->items(order); } /*! @@ -1732,6 +1699,7 @@ QList QGraphicsScene::collidingItems(const QGraphicsItem *item, return QList(); } + // Does not support ItemIgnoresTransformations. QList tmp; foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder, QTransform())) { if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode)) @@ -1756,6 +1724,13 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &pos) const return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); } +QGraphicsItem *QGraphicsScene::itemAt(const QPointF &pos, const QTransform &deviceTransform) const +{ + QList itemsAtPoint = items(pos, Qt::IntersectsItemShape, + Qt::AscendingOrder, deviceTransform); + return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); +} + /*! \fn QGraphicsScene::itemAt(qreal x, qreal y) const \overload @@ -1831,6 +1806,21 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path) */ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode) { + setSelectionArea(path, Qt::IntersectsItemShape, QTransform()); +} + +/*! + \overload + \since 4.3 + + Sets the selection area to \a path using \a mode to determine if items are + included in the selection area. + + \sa clearSelection(), selectionArea() +*/ +void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, + const QTransform &deviceTransform) +{ Q_D(QGraphicsScene); // Note: with boolean path operations, we can improve performance here @@ -1846,7 +1836,7 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectio bool changed = false; // Set all items in path to selected. - foreach (QGraphicsItem *item, items(path, mode)) { + foreach (QGraphicsItem *item, items(path, mode, Qt::AscendingOrder, deviceTransform)) { if (item->flags() & QGraphicsItem::ItemIsSelectable) { if (!item->isSelected()) changed = true; @@ -1904,7 +1894,10 @@ void QGraphicsScene::clear() { Q_D(QGraphicsScene); QList items = d->index->items(); +#if 1 QList toDelete; + // ### As the item list is already in ascending order, + // the items should be deleted in topological order. // Recursive descent delete for (int i = 0; i < items.size(); ++i) { if (QGraphicsItem *item = items.at(i)) { @@ -1912,11 +1905,13 @@ void QGraphicsScene::clear() toDelete << item; } } - //We delete all top level items + // We delete all top level items qDeleteAll(toDelete); +#else + qDeleteAll(items); +#endif d->lastItemCount = 0; d->index->clear(); - d->largestUntransformableItem = QRectF(); d->allItemsIgnoreHoverEvents = true; d->allItemsUseDefaultCursor = true; } @@ -4129,16 +4124,6 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * children = &this->topLevelItems; } else { QRectF sceneRect = viewTransform.inverted().mapRect(QRectF(exposedRegion->boundingRect().adjusted(-1, -1, 1, 1))); - if (!largestUntransformableItem.isEmpty()) { - // ### Nuke this when we move the indexing code into a separate - // class. All the largestUntransformableItem code should then go - // away, and the estimate function should return untransformable - // items as well. - QRectF untr = largestUntransformableItem; - QRectF ltri = viewTransform.inverted().mapRect(untr); - ltri.adjust(-untr.width(), -untr.height(), untr.width(), untr.height()); - sceneRect.adjust(-ltri.width(), -ltri.height(), ltri.width(), ltri.height()); - } tmp = index->estimateItems(sceneRect, Qt::DescendingOrder, viewTransform); QList tli; diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index b922be5..421adbd 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -153,6 +153,7 @@ public: QRectF itemsBoundingRect() const; QList items() const; + QList items(Qt::SortOrder order) const; // ### Qt 5: unify QList items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; QList items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; @@ -165,17 +166,25 @@ public: QList items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete QList collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; - QGraphicsItem *itemAt(const QPointF &pos) const; + + QGraphicsItem *itemAt(const QPointF &pos) const; // ### obsolete + QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const; inline QList items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const - { return items(QRectF(x, y, w, h), mode); } - inline QGraphicsItem *itemAt(qreal x, qreal y) const + { return items(QRectF(x, y, w, h), mode); } // ### obsolete + inline QList items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, + const QTransform &deviceTransform = QTransform()) const + { return items(QRectF(x, y, w, h), mode, order, deviceTransform); } + inline QGraphicsItem *itemAt(qreal x, qreal y) const // ### obsolete { return itemAt(QPointF(x, y)); } + inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const + { return itemAt(QPointF(x, y), deviceTransform); } QList selectedItems() const; QPainterPath selectionArea() const; void setSelectionArea(const QPainterPath &path); - void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode); + void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode); + void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, const QTransform &deviceTransform); QGraphicsItemGroup *createItemGroup(const QList &items); void destroyItemGroup(QGraphicsItemGroup *group); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 538ff3f..a081e04 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -96,7 +96,6 @@ public: QRectF sceneRect; bool hasSceneRect; QRectF growingItemsBoundingRect; - QRectF largestUntransformableItem; void _q_emitUpdated(); QList updatedRects; @@ -162,7 +161,6 @@ public: QList itemsAtPosition(const QPoint &screenPos, const QPointF &scenePos, QWidget *widget) const; - static bool itemCollidesWithPath(QGraphicsItem *item, const QPainterPath &path, Qt::ItemSelectionMode mode); void storeMouseButtonsForMouseGrabber(QGraphicsSceneMouseEvent *event); QList views; @@ -188,6 +186,8 @@ public: void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent); QGraphicsWidget *windowForItem(const QGraphicsItem *item) const; + bool sortCacheEnabled; // for compatibility + void drawItemHelper(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, bool painterStateProtection); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 969d3c5..40cafa6 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -170,11 +170,6 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() unindexedItems = indexedItems; lastItemCount = indexedItems.size(); q->scene()->update(); - - // Take this opportunity to reset our largest-item counter for - // untransformable items. When the items are inserted into the BSP - // tree, we'll get an accurate calculation. - scenePrivate->largestUntransformableItem = QRectF(); } // Insert all unindexed items into the tree. @@ -185,19 +180,6 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() continue; bsp.insertItem(item, rect); - - // If the item ignores view transformations, update our - // largest-item-counter to ensure that the view can accurately - // discover untransformable items when drawing. - if (item->d_ptr->itemIsUntransformable()) { - QGraphicsItem *topmostUntransformable = item; - while (topmostUntransformable && (topmostUntransformable->d_ptr->ancestorFlags - & QGraphicsItemPrivate::AncestorIgnoresTransformations)) { - topmostUntransformable = topmostUntransformable->parentItem(); - } - // ### Verify that this is the correct largest untransformable rectangle. - scenePrivate->largestUntransformableItem |= item->mapToItem(topmostUntransformable, item->boundingRect()).boundingRect(); - } } } unindexedItems.clear(); @@ -467,17 +449,23 @@ void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) // Indexing requires sceneBoundingRect(), but because \a item might // not be completely constructed at this point, we need to store it in // a temporary list and schedule an indexing for later. - d->unindexedItems << item; - item->d_func()->index = -1; - d->startIndexTimer(0); + item->d_ptr->index = -1; + if (item->d_ptr->itemIsUntransformable()) { + d->untransformableItems << item; + } else { + d->unindexedItems << item; + d->startIndexTimer(0); + } } /*! This really add the item in the BSP. \internal */ -void QGraphicsSceneBspTreeIndexPrivate::addToIndex(QGraphicsItem *item) +void QGraphicsSceneBspTreeIndexPrivate::addToBspTree(QGraphicsItem *item) { + if (item->d_ptr->itemIsUntransformable()) + return; if (item->d_func()->index != -1) { bsp.insertItem(item, item->sceneBoundingRect()); foreach (QGraphicsItem *child, item->children()) @@ -496,10 +484,11 @@ void QGraphicsSceneBspTreeIndexPrivate::addToIndex(QGraphicsItem *item) void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); + // Note: This will access item's sceneBoundingRect(), which (as this is // C++) is why we cannot call removeItem() from QGraphicsItem's // destructor. - d->removeFromIndex(item); + d->removeFromBspTree(item); // Invalidate any sort caching; arrival of a new item means we need to // resort. @@ -511,7 +500,10 @@ void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) d->freeItemIndexes << index; d->indexedItems[index] = 0; } else { - d->unindexedItems.removeAll(item); + if (item->d_ptr->itemIsUntransformable()) + d->untransformableItems.removeOne(item); + else + d->unindexedItems.removeOne(item); } } @@ -539,7 +531,10 @@ void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) } else { // Recently added items are purged immediately. unindexedItems() never // contains stale items. - d->unindexedItems.removeAll(item); + if (item->d_ptr->itemIsUntransformable()) + d->untransformableItems.removeOne(item); + else + d->unindexedItems.removeOne(item); scene()->update(); } } @@ -548,8 +543,11 @@ void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) Really remove the item from the BSP \internal */ -void QGraphicsSceneBspTreeIndexPrivate::removeFromIndex(QGraphicsItem *item) +void QGraphicsSceneBspTreeIndexPrivate::removeFromBspTree(QGraphicsItem *item) { + if (item->d_ptr->itemIsUntransformable()) + return; + if (item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { // ### remove from child index only if applicable return; @@ -579,7 +577,7 @@ void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem * // Note: This will access item's sceneBoundingRect(), which (as this is // C++) is why we cannot call removeItem() from QGraphicsItem's // destructor. - d->removeFromIndex(const_cast(item)); + d->removeFromBspTree(const_cast(item)); } /*! @@ -633,7 +631,8 @@ QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) co Q_D(const QGraphicsSceneBspTreeIndex); const_cast(d)->purgeRemovedItems(); QList itemList; - // If freeItemIndexes is empty, we know there are no holes in indexedItems and + + // If freeItemIndexes is empty, we know there are no holes in indexedItems and // unindexedItems. if (d->freeItemIndexes.isEmpty()) { if (d->unindexedItems.isEmpty()) { @@ -649,6 +648,7 @@ QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) co itemList << item; } } + itemList += d->untransformableItems; if (order != -1) { //We sort descending order d->sortItems(&itemList, order, d->sortCacheEnabled); @@ -692,6 +692,8 @@ int QGraphicsSceneBspTreeIndex::bspTreeDepth() void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth) { Q_D(QGraphicsSceneBspTreeIndex); + if (d->bspTreeDepth == depth) + return; d->bspTreeDepth = depth; d->resetIndex(); } @@ -716,19 +718,41 @@ void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) update the BSP tree if necessary. */ -void QGraphicsSceneBspTreeIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) +void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) { Q_D(QGraphicsSceneBspTreeIndex); switch (change) { - case QGraphicsItem::ItemZValueChange: - case QGraphicsItem::ItemParentChange: { - d->invalidateSortCache(); - break; + case QGraphicsItem::ItemFlagsChange: { + // Handle ItemIgnoresTransformations + bool ignoredTransform = item->flags() & QGraphicsItem::ItemIgnoresTransformations; + bool willIgnoreTransform = value.toUInt() & QGraphicsItem::ItemIgnoresTransformations; + if (ignoredTransform != willIgnoreTransform) { + QGraphicsItem *thatItem = const_cast(item); + removeItem(thatItem); + addItem(thatItem); } - default: - break; + break; + } + case QGraphicsItem::ItemZValueChange: + d->invalidateSortCache(); + break; + case QGraphicsItem::ItemParentChange: { + d->invalidateSortCache(); + // Handle ItemIgnoresTransformations + QGraphicsItem *newParent = qVariantValue(value); + bool ignoredTransform = item->d_ptr->itemIsUntransformable(); + bool willIgnoreTransform = (item->flags() & QGraphicsItem::ItemIgnoresTransformations) || (newParent && newParent->d_ptr->itemIsUntransformable()); + if (ignoredTransform != willIgnoreTransform) { + QGraphicsItem *thatItem = const_cast(item); + removeItem(thatItem); + addItem(thatItem); + } + break; + } + default: + break; } - return QGraphicsSceneIndex::itemChanged(item, change, value); + return QGraphicsSceneIndex::itemChange(item, change, value); } /*! \reimp diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex.h index 0444a30..504ea8b 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.h @@ -98,7 +98,7 @@ protected: void prepareBoundingRectChange(const QGraphicsItem *item); void sceneRectChanged(const QRectF &rect); - void itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); + void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); private : Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index b6f782d..ed12fac 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -82,6 +82,7 @@ public: QList indexedItems; QList unindexedItems; + QList untransformableItems; QList freeItemIndexes; bool purgePending; @@ -92,8 +93,8 @@ public: void startIndexTimer(int interval = QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); void resetIndex(); - void addToIndex(QGraphicsItem *item); - void removeFromIndex(QGraphicsItem *item); + void addToBspTree(QGraphicsItem *item); + void removeFromBspTree(QGraphicsItem *item); void _q_updateSortCache(); bool sortCacheEnabled; diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 4ca1c02..eb3abc1 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -61,6 +61,7 @@ #include "qgraphicsscene.h" #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" +#include "qgraphicswidget.h" #ifndef QT_NO_GRAPHICSVIEW @@ -69,61 +70,118 @@ QT_BEGIN_NAMESPACE class QGraphicsSceneIndexRectIntersector : public QGraphicsSceneIndexIntersector { public: - QGraphicsSceneIndexRectIntersector(QGraphicsScene *scene) : QGraphicsSceneIndexIntersector(scene) {} - bool intersect(const QRectF &brect) const + bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, + const QTransform &transform, const QTransform &deviceTransform) const { + QRectF brect = item->boundingRect(); + _q_adjustRect(&brect); + + // ### Add test for this (without making things slower?) + Q_UNUSED(exposeRect); + bool keep = true; - if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) - keep = rect.contains(transform.mapRect(brect)) && rect != brect; - else - keep = rect.intersects(transform.mapRect(brect)); - - if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { - QPainterPath rectPath; - rectPath.addRect(rect); - keep = QGraphicsScenePrivate::get(scene)->itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); + if (QGraphicsItemPrivate::get(item)->itemIsUntransformable()) { + // Untransformable items; map the scene rect to item coordinates. + QRectF itemRect = (deviceTransform * transform.inverted()).mapRect(sceneRect); + if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) + keep = itemRect.contains(brect) && itemRect != brect; + else + keep = itemRect.intersects(brect); + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath itemPath; + itemPath.addRect(itemRect); + keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); + } + } else { + if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) + keep = sceneRect.contains(transform.mapRect(brect)) && sceneRect != brect; + else + keep = sceneRect.intersects(transform.mapRect(brect)); + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath rectPath; + rectPath.addRect(sceneRect); + keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); + } } return keep; } + + QRectF sceneRect; }; class QGraphicsSceneIndexPointIntersector : public QGraphicsSceneIndexIntersector { public: - QGraphicsSceneIndexPointIntersector(QGraphicsScene *scene) : QGraphicsSceneIndexIntersector(scene) {} - bool intersect(const QRectF &brect) const + bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, + const QTransform &transform, const QTransform &deviceTransform) const { + QRectF brect = item->boundingRect(); + _q_adjustRect(&brect); + + // ### Add test for this (without making things slower?) + Q_UNUSED(exposeRect); + bool keep = false; - if (rect.intersects(transform.mapRect(brect))) - if (item->contains(transform.inverted().map(pos))) - keep = true; - if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { - QPainterPath rectPath; - rectPath.addRect(rect); - keep = QGraphicsScenePrivate::get(scene)->itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); + if (QGraphicsItemPrivate::get(item)->itemIsUntransformable()) { + // Untransformable items; map the scene point to item coordinates. + QPointF itemPoint = (deviceTransform * transform.inverted()).map(scenePoint); + keep = brect.contains(itemPoint); + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath pointPath; + pointPath.addRect(QRectF(itemPoint, QSizeF(1, 1))); + keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, pointPath, mode); + } + } else { + QRectF sceneBrect = transform.mapRect(brect); + keep = sceneBrect.contains(scenePoint); + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath pointPath; + pointPath.addRect(QRectF(transform.inverted().map(scenePoint), QSizeF(1, 1))); + keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, pointPath, mode); + } } return keep; } - QPointF pos; + + QPointF scenePoint; }; class QGraphicsSceneIndexPathIntersector : public QGraphicsSceneIndexIntersector { public: - QGraphicsSceneIndexPathIntersector(QGraphicsScene *scene) : QGraphicsSceneIndexIntersector(scene) {} - bool intersect(const QRectF &brect) const + bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, + const QTransform &transform, const QTransform &deviceTransform) const { - bool keep = true; - if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) - keep = rect.contains(transform.mapRect(brect)) && rect != brect; - else - keep = rect.intersects(transform.mapRect(brect)); + QRectF brect = item->boundingRect(); + _q_adjustRect(&brect); + + // ### Add test for this (without making things slower?) + Q_UNUSED(exposeRect); - if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) - keep = QGraphicsScenePrivate::get(scene)->itemCollidesWithPath(item, transform.inverted().map(path), mode); + bool keep = true; + if (QGraphicsItemPrivate::get(item)->itemIsUntransformable()) { + // Untransformable items; map the scene rect to item coordinates. + QPainterPath itemPath = (deviceTransform * transform.inverted()).map(scenePath); + if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) + keep = itemPath.contains(brect); + else + keep = itemPath.intersects(brect); + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) + keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); + } else { + if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) + keep = scenePath.contains(transform.mapRect(brect)); + else + keep = scenePath.intersects(transform.mapRect(brect)); + if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { + QPainterPath itemPath = transform.inverted().map(scenePath); + keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); + } + } return keep; } - QPainterPath path; + + QPainterPath scenePath; }; /*! @@ -131,9 +189,9 @@ public: */ QGraphicsSceneIndexPrivate::QGraphicsSceneIndexPrivate(QGraphicsScene *scene) : scene(scene) { - pointIntersector = new QGraphicsSceneIndexPointIntersector(scene); - rectIntersector = new QGraphicsSceneIndexRectIntersector(scene); - pathIntersector = new QGraphicsSceneIndexPathIntersector(scene); + pointIntersector = new QGraphicsSceneIndexPointIntersector; + rectIntersector = new QGraphicsSceneIndexRectIntersector; + pathIntersector = new QGraphicsSceneIndexPathIntersector; } /*! @@ -148,19 +206,50 @@ QGraphicsSceneIndexPrivate::~QGraphicsSceneIndexPrivate() /*! \internal + + Checks if item collides with the path and mode, but also checks that if it + doesn't collide, maybe its frame rect will. +*/ +bool QGraphicsSceneIndexPrivate::itemCollidesWithPath(const QGraphicsItem *item, + const QPainterPath &path, + Qt::ItemSelectionMode mode) +{ + if (item->collidesWithPath(path, mode)) + return true; + if (item->isWidget()) { + // Check if this is a window, and if its frame rect collides. + const QGraphicsWidget *widget = static_cast(item); + if (widget->isWindow()) { + QRectF frameRect = widget->windowFrameRect(); + QPainterPath framePath; + framePath.addRect(frameRect); + bool intersects = path.intersects(frameRect); + if (mode == Qt::IntersectsItemShape || mode == Qt::IntersectsItemBoundingRect) + return intersects || path.contains(frameRect.topLeft()) + || framePath.contains(path.elementAt(0)); + return !intersects && path.contains(frameRect.topLeft()); + } + } + return false; +} + +/*! + \internal */ -void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGraphicsSceneIndexIntersector *intersector, - QList *items, - const QTransform &parentTransform, - const QTransform &viewTransform, - Qt::ItemSelectionMode mode, Qt::SortOrder order, - qreal parentOpacity) const +void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRectF exposeRect, + QGraphicsSceneIndexIntersector *intersector, + QList *items, + const QTransform &parentTransform, + const QTransform &viewTransform, + Qt::ItemSelectionMode mode, Qt::SortOrder order, + qreal parentOpacity) const { // Calculate opacity. qreal opacity; if (item) { if (!item->d_ptr->visible) return; + QGraphicsItem *p = item->d_ptr->parent; bool itemIgnoresParentOpacity = item->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity; bool parentDoesntPropagateOpacity = (p && (p->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren)); @@ -186,9 +275,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGr _q_adjustRect(&brect); //We fill the intersector with needed informations - intersector->transform = transform; - intersector->item = item; - keep = intersector->intersect(brect); + keep = intersector->intersect(item, exposeRect, mode, transform, viewTransform); } bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); @@ -211,7 +298,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGr // Clip. if (childClip) - intersector->rect &= transform.map(item->shape()).controlPointRect(); + exposeRect &= transform.map(item->shape()).controlPointRect(); // Process children behind int i = 0; @@ -220,7 +307,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGr QGraphicsItem *child = children.at(i); if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) break; - recursive_items_helper(child, intersector, items, transform, viewTransform, + recursive_items_helper(child, exposeRect, intersector, items, transform, viewTransform, mode, order, opacity); } } @@ -232,7 +319,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QGr // Process children in front if (!dontProcessChildren) { for (; i < children.size(); ++i) - recursive_items_helper(children.at(i), intersector, items, transform, viewTransform, + recursive_items_helper(children.at(i), exposeRect, intersector, items, transform, viewTransform, mode, order, opacity); } @@ -311,12 +398,12 @@ QRectF QGraphicsSceneIndex::indexedRect() const QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const { + Q_D(const QGraphicsSceneIndex); QList itemList; - d->pointIntersector->mode = mode; - d->pointIntersector->rect = QRectF(pos, QSize(1,1)); - d->pointIntersector->pos = pos; - d->recursive_items_helper(0, d->pointIntersector, &itemList, QTransform(), deviceTransform, mode, order); + d->pointIntersector->scenePoint = pos; + d->recursive_items_helper(0, QRectF(pos, QSizeF(1, 1)), d->pointIntersector, &itemList, + QTransform(), deviceTransform, mode, order); return itemList; } @@ -346,10 +433,11 @@ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe Qt::SortOrder order, const QTransform &deviceTransform) const { Q_D(const QGraphicsSceneIndex); + QRectF exposeRect = rect; + _q_adjustRect(&exposeRect); QList itemList; - d->rectIntersector->mode = mode; - d->rectIntersector->rect = rect; - d->recursive_items_helper(0, d->rectIntersector, &itemList, QTransform(), deviceTransform, mode, order); + d->rectIntersector->sceneRect = rect; + d->recursive_items_helper(0, exposeRect, d->rectIntersector, &itemList, QTransform(), deviceTransform, mode, order); return itemList; } @@ -380,14 +468,12 @@ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt:: { Q_D(const QGraphicsSceneIndex); QList itemList; - QRectF polyRect(polygon.boundingRect()); - _q_adjustRect(&polyRect); - d->pathIntersector->mode = mode; - d->pathIntersector->rect = polyRect; + QRectF exposeRect = polygon.boundingRect(); + _q_adjustRect(&exposeRect); QPainterPath path; path.addPolygon(polygon); - d->pathIntersector->path = path; - d->recursive_items_helper(0, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); + d->pathIntersector->scenePath = path; + d->recursive_items_helper(0, exposeRect, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); return itemList; } @@ -418,12 +504,10 @@ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt:: { Q_D(const QGraphicsSceneIndex); QList itemList; - QRectF pathRect(path.controlPointRect()); - _q_adjustRect(&pathRect); - d->pathIntersector->mode = mode; - d->pathIntersector->rect = pathRect; - d->pathIntersector->path = path; - d->recursive_items_helper(0, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); + QRectF exposeRect = path.controlPointRect(); + _q_adjustRect(&exposeRect); + d->pathIntersector->scenePath = path; + d->recursive_items_helper(0, exposeRect, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); return itemList; } @@ -508,7 +592,7 @@ void QGraphicsSceneIndex::deleteItem(QGraphicsItem *item) \sa QGraphicsItem::GraphicsItemChange */ -void QGraphicsSceneIndex::itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) +void QGraphicsSceneIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value) { Q_UNUSED(item); Q_UNUSED(change); diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h index ddce9d4..25ece04 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ b/src/gui/graphicsview/qgraphicssceneindex.h @@ -104,7 +104,7 @@ protected: virtual void removeItem(QGraphicsItem *item) = 0; virtual void deleteItem(QGraphicsItem *item); - virtual void itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); + virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); virtual void prepareBoundingRectChange(const QGraphicsItem *item); virtual void sceneRectChanged(const QRectF &rect); diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index d0d181b..576ee98 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -75,9 +75,12 @@ public: QGraphicsSceneIndexPrivate(QGraphicsScene *scene); ~QGraphicsSceneIndexPrivate(); - void recursive_items_helper(QGraphicsItem *item, QGraphicsSceneIndexIntersector *intersector, QList *items, - const QTransform &parentTransform, const QTransform &viewTransform, - Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const; + static bool itemCollidesWithPath(const QGraphicsItem *item, const QPainterPath &path, Qt::ItemSelectionMode mode); + + void recursive_items_helper(QGraphicsItem *item, QRectF exposeRect, + QGraphicsSceneIndexIntersector *intersector, QList *items, + const QTransform &parentTransform, const QTransform &viewTransform, + Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const; QGraphicsScene *scene; QGraphicsSceneIndexPointIntersector *pointIntersector; QGraphicsSceneIndexRectIntersector *rectIntersector; @@ -87,14 +90,10 @@ public: class QGraphicsSceneIndexIntersector { public: - QGraphicsSceneIndexIntersector(QGraphicsScene *scene) : scene(scene) { } + QGraphicsSceneIndexIntersector() { } virtual ~QGraphicsSceneIndexIntersector() { } - virtual bool intersect(const QRectF &rect) const = 0; - Qt::ItemSelectionMode mode; - QGraphicsItem *item; - QGraphicsScene *scene; - QRectF rect; - QTransform transform; + virtual bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, + const QTransform &transform, const QTransform &deviceTransform) const = 0; }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 8c40878..a1e6d9c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -914,44 +914,32 @@ extern QPainterPath qt_regionToPath(const QRegion ®ion); is at risk of painting 1 pixel outside the bounding rect. Therefore we must search for items with an adjustment of (-1, -1, 1, 1). */ -QList QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems) const +QList QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems, + const QTransform &viewTransform) const { Q_Q(const QGraphicsView); // Step 1) If all items are contained within the expose region, then - // return a list of all visible items. + // return a list of all visible items. ### the scene's growing bounding + // rect does not take into account untransformable items. const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 1, 1)) .boundingRect(); if (exposedRegionSceneBounds.contains(scene->d_func()->growingItemsBoundingRect)) { Q_ASSERT(allItems); *allItems = true; - // All items are guaranteed within the exposed region, don't bother using the index. - QList itemList(scene->d_func()->index->items(Qt::DescendingOrder)); - int i = 0; - while (i < itemList.size()) { - const QGraphicsItem *item = itemList.at(i); - // But we only want to include items that are visible - // The following check is basically the same as item->d_ptr->isInvisible(), except - // that we don't check whether the item clips children to shape or propagates its - // opacity (we loop through all items, so those checks are wrong in this context). - if (!item->isVisible() || item->d_ptr->isClippedAway() || item->d_ptr->isFullyTransparent()) - itemList.removeAt(i); - else - ++i; - } - return itemList; + // All items are guaranteed within the exposed region. + return scene->items(Qt::DescendingOrder); } // Step 2) If the expose region is a simple rect and the view is only // translated or scaled, search for items using // QGraphicsScene::items(QRectF). - bool simpleRectLookup = (scene->d_func()->largestUntransformableItem.isNull() - && exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale); + bool simpleRectLookup = exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale; if (simpleRectLookup) { - return scene->d_func()->index->items(exposedRegionSceneBounds, - Qt::IntersectsItemBoundingRect, - Qt::DescendingOrder); + return scene->items(exposedRegionSceneBounds, + Qt::IntersectsItemBoundingRect, + Qt::DescendingOrder, viewTransform); } // If the region is complex or the view has a complex transform, adjust @@ -961,16 +949,9 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg foreach (const QRect &r, exposedRegion.rects()) adjustedRegion += r.adjusted(-1, -1, 1, 1); - const QPainterPath exposedPath(qt_regionToPath(adjustedRegion)); - if (scene->d_func()->largestUntransformableItem.isNull()) { - const QPainterPath exposedScenePath(q->mapToScene(exposedPath)); - return scene->d_func()->index->items(exposedScenePath, - Qt::IntersectsItemBoundingRect, - Qt::DescendingOrder); - } - - // NB! Path must be in viewport coordinates. - return itemsInArea(exposedPath, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder); + const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); + return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, + Qt::DescendingOrder, viewTransform); } /*! @@ -1875,6 +1856,8 @@ void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode asp void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect &source, Qt::AspectRatioMode aspectRatioMode) { + // ### Switch to using the recursive rendering algorithm instead. + Q_D(QGraphicsView); if (!d->scene || !(painter && painter->isActive())) return; @@ -1972,67 +1955,6 @@ QList QGraphicsView::items() const } /*! - Returns all items in the area \a path, which is in viewport coordinates, - also taking untransformable items into consideration. This function is - considerably slower than just checking the scene directly. There is - certainly room for improvement. -*/ -QList QGraphicsViewPrivate::itemsInArea(const QPainterPath &path, - Qt::ItemSelectionMode mode, - Qt::SortOrder order) const -{ - Q_Q(const QGraphicsView); - - // Determine the size of the largest untransformable subtree of children - // mapped to scene coordinates. - QRectF untr = scene->d_func()->largestUntransformableItem; - QRectF ltri = matrix.inverted().mapRect(untr); - ltri.adjust(-untr.width(), -untr.height(), untr.width(), untr.height()); - - QRectF rect = path.controlPointRect(); - - // Find all possible items in the relevant area. - // ### Improve this algorithm; it might be searching a too large area. - QRectF adjustedRect = q->mapToScene(rect.adjusted(-1, -1, 1, 1).toRect()).boundingRect(); - adjustedRect.adjust(-ltri.width(), -ltri.height(), ltri.width(), ltri.height()); - - // First build a (potentially large) list of all items in the vicinity - // that might be untransformable. - QList allCandidates = scene->d_func()->index->estimateItems(adjustedRect, order, q->transform()); - - // Then find the minimal list of items that are inside \a path, and - // convert it to a set. - QList regularCandidates = scene->items(q->mapToScene(path), mode, order, q->transform()); - QSet candSet = QSet::fromList(regularCandidates); - - QTransform viewMatrix = q->viewportTransform(); - - QList result; - - //### this will disapear - - // Run through all candidates and keep all items that are in candSet, or - // are untransformable and collide with \a path. ### We can improve this - // algorithm. - QList::Iterator it = allCandidates.begin(); - while (it != allCandidates.end()) { - QGraphicsItem *item = *it; - if (item->d_ptr->itemIsUntransformable()) { - // Check if this untransformable item collides with the - // original selection rect. - QTransform itemTransform = item->deviceTransform(viewMatrix); - if (QGraphicsScenePrivate::itemCollidesWithPath(item, itemTransform.inverted().map(path), mode)) - result << item; - } else { - if (candSet.contains(item)) - result << item; - } - ++it; - } - return result; -} - -/*! Returns a list of all the items at the position \a pos in the view. The items are listed in descending Z order (i.e., the first item in the list is the top-most item, and the last item is the bottom-most item). \a pos @@ -2051,17 +1973,22 @@ QList QGraphicsView::items(const QPoint &pos) const Q_D(const QGraphicsView); if (!d->scene) return QList(); - if (d->scene->d_func()->largestUntransformableItem.isNull()) { - if ((d->identityMatrix || d->matrix.type() <= QTransform::TxScale)) { - QTransform xinv = viewportTransform().inverted(); - return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1))); - } - return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1)); + // ### Unify these two, and use the items(QPointF) version in + // QGraphicsScene instead. The scene items function could use the viewport + // transform to map the point to a rect/polygon. + if ((d->identityMatrix || d->matrix.type() <= QTransform::TxScale)) { + // Use the rect version + QTransform xinv = viewportTransform().inverted(); + return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), + Qt::IntersectsItemShape, + Qt::AscendingOrder, + viewportTransform()); } - - QPainterPath path; - path.addRect(QRectF(pos.x(), pos.y(), 1, 1)); - return d->itemsInArea(path); + // Use the polygon version + return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), + Qt::IntersectsItemShape, + Qt::AscendingOrder, + viewportTransform()); } /*! @@ -2088,12 +2015,7 @@ QList QGraphicsView::items(const QRect &rect, Qt::ItemSelection Q_D(const QGraphicsView); if (!d->scene) return QList(); - if (d->scene->d_func()->largestUntransformableItem.isNull()) - return d->scene->items(mapToScene(rect), mode); - - QPainterPath path; - path.addRect(rect); - return d->itemsInArea(path); + return d->scene->items(mapToScene(rect), mode, Qt::AscendingOrder, viewportTransform()); } /*! @@ -2121,13 +2043,7 @@ QList QGraphicsView::items(const QPolygon &polygon, Qt::ItemSel Q_D(const QGraphicsView); if (!d->scene) return QList(); - if (d->scene->d_func()->largestUntransformableItem.isNull()) - return d->scene->items(mapToScene(polygon), mode); - - QPainterPath path; - path.addPolygon(polygon); - path.closeSubpath(); - return d->itemsInArea(path); + return d->scene->items(mapToScene(polygon), mode, Qt::AscendingOrder, viewportTransform()); } /*! @@ -2147,9 +2063,7 @@ QList QGraphicsView::items(const QPainterPath &path, Qt::ItemSe Q_D(const QGraphicsView); if (!d->scene) return QList(); - if (d->scene->d_func()->largestUntransformableItem.isNull()) - return d->scene->items(mapToScene(path), mode); - return d->itemsInArea(path); + return d->scene->items(mapToScene(path), mode, Qt::AscendingOrder, viewportTransform()); } /*! @@ -2168,7 +2082,9 @@ QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const Q_D(const QGraphicsView); if (!d->scene) return 0; - QList itemsAtPos = items(pos); + // ### Use QGraphicsScene::itemAt() instead. + QList itemsAtPos = d->scene->items(pos, Qt::IntersectsItemShape, Qt::AscendingOrder, + viewportTransform()); return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first(); } @@ -3073,7 +2989,8 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event) selectionArea.addPolygon(mapToScene(d->rubberBandRect)); selectionArea.closeSubpath(); if (d->scene) - d->scene->setSelectionArea(selectionArea, d->rubberBandSelectionMode); + d->scene->setSelectionArea(selectionArea, d->rubberBandSelectionMode, + viewportTransform()); return; } } else @@ -3280,7 +3197,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) } else { // Find all exposed items bool allItems = false; - QList itemList = d->findItems(d->exposedRegion, &allItems); + QList itemList = d->findItems(d->exposedRegion, &allItems, viewTransform); if (!itemList.isEmpty()) { // Generate the style options. diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index fac7bf9..760f54e 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -84,10 +84,6 @@ public: qint64 horizontalScroll() const; qint64 verticalScroll() const; - QList itemsInArea(const QPainterPath &path, - Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, - Qt::SortOrder = Qt::AscendingOrder) const; - QPointF mousePressItemPoint; QPointF mousePressScenePoint; QPoint mousePressViewPoint; @@ -176,7 +172,8 @@ public: bool updateSceneSlotReimplementedChecked; QRegion exposedRegion; - QList findItems(const QRegion &exposedRegion, bool *allItems) const; + QList findItems(const QRegion &exposedRegion, bool *allItems, + const QTransform &viewTransform) const; }; QT_END_NAMESPACE -- cgit v0.12 From b8ca90d6ca745915455f044f967a345bab7a910e Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 18 Jun 2009 14:49:24 +0200 Subject: Move QGraphicsSceneIndex into private headers (=> _p.h). We'd like to keep this API private for now. Reviewed-by: Alexis --- src/gui/graphicsview/graphicsview.pri | 57 +++++---- src/gui/graphicsview/qgraphicsscene.cpp | 5 +- src/gui/graphicsview/qgraphicsscene_p.h | 2 +- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 4 +- src/gui/graphicsview/qgraphicsscenebsptreeindex.h | 2 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 5 +- src/gui/graphicsview/qgraphicssceneindex.h | 129 --------------------- src/gui/graphicsview/qgraphicssceneindex_p.h | 79 +++++++++++-- src/gui/graphicsview/qgraphicsscenelinearindex.h | 2 +- 9 files changed, 106 insertions(+), 179 deletions(-) delete mode 100644 src/gui/graphicsview/qgraphicssceneindex.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index 5ac1c54..2d8f37e 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -1,46 +1,43 @@ # Qt graphicsview module -HEADERS += graphicsview/qgraphicsitem.h \ +HEADERS += graphicsview/qgraphicsgridlayout.h \ + graphicsview/qgraphicsitem.h \ graphicsview/qgraphicsitem_p.h \ graphicsview/qgraphicsitemanimation.h \ + graphicsview/qgraphicslayout.h \ + graphicsview/qgraphicslayout_p.h \ + graphicsview/qgraphicslayoutitem.h \ + graphicsview/qgraphicslayoutitem_p.h \ + graphicsview/qgraphicslinearlayout.h \ + graphicsview/qgraphicsproxywidget.h \ graphicsview/qgraphicsscene.h \ - graphicsview/qgraphicsscene_p.h \ graphicsview/qgraphicsscene_bsp_p.h \ - graphicsview/qgraphicsscenelinearindex.h \ - graphicsview/qgraphicssceneindex.h \ - graphicsview/qgraphicssceneindex_p.h \ + graphicsview/qgraphicsscene_p.h \ graphicsview/qgraphicsscenebsptreeindex.h \ graphicsview/qgraphicsscenebsptreeindex_p.h \ graphicsview/qgraphicssceneevent.h \ + graphicsview/qgraphicssceneindex_p.h \ + graphicsview/qgraphicsscenelinearindex.h \ + graphicsview/qgraphicsview.h \ graphicsview/qgraphicsview_p.h \ - graphicsview/qgraphicsview.h -SOURCES += graphicsview/qgraphicsitem.cpp \ - graphicsview/qgraphicsitemanimation.cpp \ - graphicsview/qgraphicsscene.cpp \ - graphicsview/qgraphicsscene_bsp.cpp \ - graphicsview/qgraphicsscenebsptreeindex.cpp \ - graphicsview/qgraphicsscenelinearindex.cpp \ - graphicsview/qgraphicssceneindex.cpp \ - graphicsview/qgraphicssceneevent.cpp \ - graphicsview/qgraphicsview.cpp - - -# Widgets on the canvas -HEADERS += graphicsview/qgraphicslayout.h \ - graphicsview/qgraphicslayout_p.h \ - graphicsview/qgraphicslayoutitem.h \ - graphicsview/qgraphicslayoutitem_p.h \ - graphicsview/qgraphicslinearlayout.h \ graphicsview/qgraphicswidget.h \ graphicsview/qgraphicswidget_p.h \ - graphicsview/qgridlayoutengine_p.h \ - graphicsview/qgraphicsproxywidget.h \ - graphicsview/qgraphicsgridlayout.h -SOURCES += graphicsview/qgraphicslayout.cpp \ + graphicsview/qgridlayoutengine_p.h + +SOURCES += graphicsview/qgraphicsgridlayout.cpp \ + graphicsview/qgraphicsitem.cpp \ + graphicsview/qgraphicsitemanimation.cpp \ + graphicsview/qgraphicslayout.cpp \ graphicsview/qgraphicslayout_p.cpp \ graphicsview/qgraphicslayoutitem.cpp \ graphicsview/qgraphicslinearlayout.cpp \ + graphicsview/qgraphicsproxywidget.cpp \ + graphicsview/qgraphicsscene.cpp \ + graphicsview/qgraphicsscene_bsp.cpp \ + graphicsview/qgraphicsscenebsptreeindex.cpp \ + graphicsview/qgraphicssceneevent.cpp \ + graphicsview/qgraphicssceneindex.cpp \ + graphicsview/qgraphicsscenelinearindex.cpp \ + graphicsview/qgraphicsview.cpp \ graphicsview/qgraphicswidget.cpp \ graphicsview/qgraphicswidget_p.cpp \ - graphicsview/qgridlayoutengine.cpp \ - graphicsview/qgraphicsproxywidget.cpp \ - graphicsview/qgraphicsgridlayout.cpp + graphicsview/qgridlayoutengine.cpp diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 55f0f20..9d224b1 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -217,7 +217,6 @@ #include "qgraphicsview_p.h" #include "qgraphicswidget.h" #include "qgraphicswidget_p.h" -#include "qgraphicssceneindex.h" #include "qgraphicsscenebsptreeindex.h" #include "qgraphicsscenelinearindex.h" @@ -244,6 +243,7 @@ #include #include #include +#include #include #ifdef Q_WS_X11 #include @@ -772,6 +772,7 @@ QList QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre const QPointF &scenePos, QWidget *widget) const { + Q_UNUSED(screenPos); Q_Q(const QGraphicsScene); QGraphicsView *view = widget ? qobject_cast(widget->parentWidget()) : 0; return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, @@ -1806,7 +1807,7 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path) */ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode) { - setSelectionArea(path, Qt::IntersectsItemShape, QTransform()); + setSelectionArea(path, mode, QTransform()); } /*! diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index a081e04..fd25283 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -58,7 +58,6 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW #include "qgraphicsscenebsptreeindex_p.h" -#include "qgraphicssceneindex.h" #include "qgraphicsview.h" #include "qgraphicsitem_p.h" @@ -74,6 +73,7 @@ QT_BEGIN_NAMESPACE +class QGraphicsSceneIndex; class QGraphicsView; class QGraphicsWidget; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 40cafa6..54bf09b 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -80,12 +80,12 @@ #ifndef QT_NO_GRAPHICSVIEW #include "qgraphicsscenebsptreeindex_p.h" -#include "qgraphicssceneindex_p.h" #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" -#include +#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex.h index 504ea8b..f3c77d3 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.h @@ -67,7 +67,7 @@ QT_MODULE(Gui) #include #include #include -#include +#include #include "qgraphicsscene_bsp_p.h" diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index eb3abc1..8d7581f 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -56,12 +56,11 @@ \sa QGraphicsScene, QGraphicsView */ -#include "qgraphicssceneindex.h" -#include "qgraphicssceneindex_p.h" #include "qgraphicsscene.h" #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" #include "qgraphicswidget.h" +#include #ifndef QT_NO_GRAPHICSVIEW @@ -621,6 +620,6 @@ void QGraphicsSceneIndex::sceneRectChanged(const QRectF &rect) QT_END_NAMESPACE -#include "moc_qgraphicssceneindex.cpp" +#include "moc_qgraphicssceneindex_p.cpp" #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h deleted file mode 100644 index 25ece04..0000000 --- a/src/gui/graphicsview/qgraphicssceneindex.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSCENEINDEX_H -#define QGRAPHICSSCENEINDEX_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - -class QGraphicsSceneIndexPrivate; -class QGraphicsScene; -class QRectF; -class QPointF; -template class QList; - -class Q_AUTOTEST_EXPORT QGraphicsSceneIndex: public QObject -{ - Q_OBJECT - -public: - QGraphicsSceneIndex(QGraphicsScene *scene = 0); - virtual ~QGraphicsSceneIndex(); - - QGraphicsScene *scene() const; - - virtual QRectF indexedRect() const; - - virtual QList items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; - virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, - Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList items(const QRectF &rect, Qt::ItemSelectionMode mode, - Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, - Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, - Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList estimateItems(const QPointF &point, - Qt::SortOrder order, const QTransform &deviceTransform) const; - virtual QList estimateItems(const QRectF &rect, - Qt::SortOrder order, const QTransform &deviceTransform) const = 0; - -protected: - virtual void clear(); - virtual void addItem(QGraphicsItem *item) = 0; - virtual void removeItem(QGraphicsItem *item) = 0; - virtual void deleteItem(QGraphicsItem *item); - - virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); - virtual void prepareBoundingRectChange(const QGraphicsItem *item); - virtual void sceneRectChanged(const QRectF &rect); - - QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene); - - friend class QGraphicsScene; - friend class QGraphicsScenePrivate; - friend class QGraphicsItem; - friend class QGraphicsItemPrivate; - friend class QGraphicsSceneBspTreeIndex; -private: - Q_DISABLE_COPY(QGraphicsSceneIndex) - Q_DECLARE_PRIVATE(QGraphicsSceneIndex) -}; - -#endif // QT_NO_GRAPHICSVIEW - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGRAPHICSSCENEINDEX_H diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index 576ee98..85a1140 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSCENEINDEX_P_H -#define QGRAPHICSSCENEINDEX_P_H +#ifndef QGRAPHICSSCENEINDEX_H +#define QGRAPHICSSCENEINDEX_H // // W A R N I N G @@ -53,20 +53,77 @@ // We mean it. // -#include "qgraphicssceneindex.h" - -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - +#include +#include +#include +#include #include -#include + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + class QGraphicsScene; class QGraphicsSceneIndexIntersector; -class QGraphicsSceneIndexRectIntersector; class QGraphicsSceneIndexPointIntersector; +class QGraphicsSceneIndexRectIntersector; class QGraphicsSceneIndexPathIntersector; +class QGraphicsSceneIndexPrivate; +class QPointF; +class QRectF; +template class QList; + +class Q_AUTOTEST_EXPORT QGraphicsSceneIndex : public QObject +{ + Q_OBJECT + +public: + QGraphicsSceneIndex(QGraphicsScene *scene = 0); + virtual ~QGraphicsSceneIndex(); + + QGraphicsScene *scene() const; + + virtual QRectF indexedRect() const; + + virtual QList items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; + virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QRectF &rect, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, + Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + virtual QList estimateItems(const QPointF &point, + Qt::SortOrder order, const QTransform &deviceTransform) const; + virtual QList estimateItems(const QRectF &rect, + Qt::SortOrder order, const QTransform &deviceTransform) const = 0; + +protected: + virtual void clear(); + virtual void addItem(QGraphicsItem *item) = 0; + virtual void removeItem(QGraphicsItem *item) = 0; + virtual void deleteItem(QGraphicsItem *item); + + virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); + virtual void prepareBoundingRectChange(const QGraphicsItem *item); + virtual void sceneRectChanged(const QRectF &rect); + + QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene); + + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; + friend class QGraphicsSceneBspTreeIndex; +private: + Q_DISABLE_COPY(QGraphicsSceneIndex) + Q_DECLARE_PRIVATE(QGraphicsSceneIndex) +}; class QGraphicsSceneIndexPrivate : public QObjectPrivate { @@ -96,8 +153,10 @@ public: const QTransform &transform, const QTransform &deviceTransform) const = 0; }; +#endif // QT_NO_GRAPHICSVIEW + QT_END_NAMESPACE -#endif // QGRAPHICSSCENEINDEX_P_H +QT_END_HEADER -#endif +#endif // QGRAPHICSSCENEINDEX_H diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.h b/src/gui/graphicsview/qgraphicsscenelinearindex.h index b793d98..a5327ef 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.h @@ -65,8 +65,8 @@ QT_MODULE(Gui) #include #include -#include #include +#include class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex { -- cgit v0.12 From d49fd874258c055b54b122a0c1f6f10ee20f11ea Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 18 Jun 2009 14:52:47 +0200 Subject: Move QGraphicsSceneLinearIndex into private headers (=> _p.h). We want to keep this as private API for now. Reviewed-by: Alexis --- src/gui/graphicsview/graphicsview.pri | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- src/gui/graphicsview/qgraphicsscenelinearindex.cpp | 4 +- src/gui/graphicsview/qgraphicsscenelinearindex.h | 124 --------------------- src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 124 +++++++++++++++++++++ 5 files changed, 128 insertions(+), 128 deletions(-) delete mode 100644 src/gui/graphicsview/qgraphicsscenelinearindex.h create mode 100644 src/gui/graphicsview/qgraphicsscenelinearindex_p.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index 2d8f37e..5981ce5 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -16,7 +16,7 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \ graphicsview/qgraphicsscenebsptreeindex_p.h \ graphicsview/qgraphicssceneevent.h \ graphicsview/qgraphicssceneindex_p.h \ - graphicsview/qgraphicsscenelinearindex.h \ + graphicsview/qgraphicsscenelinearindex_p.h \ graphicsview/qgraphicsview.h \ graphicsview/qgraphicsview_p.h \ graphicsview/qgraphicswidget.h \ diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9d224b1..e004917 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -218,7 +218,7 @@ #include "qgraphicswidget.h" #include "qgraphicswidget_p.h" #include "qgraphicsscenebsptreeindex.h" -#include "qgraphicsscenelinearindex.h" +#include #include #include diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp index 5504493..694062b 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp @@ -1,5 +1,3 @@ -#include "qgraphicsscenelinearindex.h" - /*! \class QGraphicsSceneLinearIndex \brief The QGraphicsSceneLinearIndex class provides an implementation of @@ -16,6 +14,8 @@ \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex, QGraphicsSceneBspTreeIndex */ +#include + /*! \fn QGraphicsSceneLinearIndex::QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.h b/src/gui/graphicsview/qgraphicsscenelinearindex.h deleted file mode 100644 index a5327ef..0000000 --- a/src/gui/graphicsview/qgraphicsscenelinearindex.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSCENELINEARINDEX_H -#define QGRAPHICSSCENELINEARINDEX_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - -#include -#include -#include -#include - -class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex -{ - Q_OBJECT - -public: - QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): QGraphicsSceneIndex(scene) - { - } - - QList items(Qt::SortOrder order = Qt::AscendingOrder) const { - Q_UNUSED(order); - return m_items; - } - - virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { - Q_UNUSED(rect); - Q_UNUSED(order); - Q_UNUSED(deviceTransform); - return m_items; - } - - virtual QRectF indexedRect() const { - return m_sceneRect; - } - -protected : - void sceneRectChanged(const QRectF &rect) { - m_sceneRect = rect; - } - - virtual void clear() { - m_items.clear(); - } - - virtual void addItem(QGraphicsItem *item) { - m_items << item; - } - - virtual void removeItem(QGraphicsItem *item) { - m_items.removeAll(item); - } - -private: - QRectF m_sceneRect; - QList m_items; -}; - -#endif // QT_NO_GRAPHICSVIEW - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGRAPHICSSCENELINEARINDEX_H diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h new file mode 100644 index 0000000..a5327ef --- /dev/null +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSCENELINEARINDEX_H +#define QGRAPHICSSCENELINEARINDEX_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW + +#include +#include +#include +#include + +class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex +{ + Q_OBJECT + +public: + QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): QGraphicsSceneIndex(scene) + { + } + + QList items(Qt::SortOrder order = Qt::AscendingOrder) const { + Q_UNUSED(order); + return m_items; + } + + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { + Q_UNUSED(rect); + Q_UNUSED(order); + Q_UNUSED(deviceTransform); + return m_items; + } + + virtual QRectF indexedRect() const { + return m_sceneRect; + } + +protected : + void sceneRectChanged(const QRectF &rect) { + m_sceneRect = rect; + } + + virtual void clear() { + m_items.clear(); + } + + virtual void addItem(QGraphicsItem *item) { + m_items << item; + } + + virtual void removeItem(QGraphicsItem *item) { + m_items.removeAll(item); + } + +private: + QRectF m_sceneRect; + QList m_items; +}; + +#endif // QT_NO_GRAPHICSVIEW + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRAPHICSSCENELINEARINDEX_H -- cgit v0.12 From 734cc7dd63147f80cd4794351b9124f8d6eb88fe Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 18 Jun 2009 14:56:59 +0200 Subject: Move QGraphicsSceneBspTreeIndex into private headers (=> _p.h). We'll keep this as private API for now. Reviewed-by: Alexis --- src/gui/graphicsview/graphicsview.pri | 1 - src/gui/graphicsview/qgraphicsscene.cpp | 2 +- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 10 +- src/gui/graphicsview/qgraphicsscenebsptreeindex.h | 119 --------------------- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 66 ++++++++++-- 5 files changed, 61 insertions(+), 137 deletions(-) delete mode 100644 src/gui/graphicsview/qgraphicsscenebsptreeindex.h diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri index 5981ce5..0c0747e 100644 --- a/src/gui/graphicsview/graphicsview.pri +++ b/src/gui/graphicsview/graphicsview.pri @@ -12,7 +12,6 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \ graphicsview/qgraphicsscene.h \ graphicsview/qgraphicsscene_bsp_p.h \ graphicsview/qgraphicsscene_p.h \ - graphicsview/qgraphicsscenebsptreeindex.h \ graphicsview/qgraphicsscenebsptreeindex_p.h \ graphicsview/qgraphicssceneevent.h \ graphicsview/qgraphicssceneindex_p.h \ diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index e004917..28dd3be 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -217,7 +217,7 @@ #include "qgraphicsview_p.h" #include "qgraphicswidget.h" #include "qgraphicswidget_p.h" -#include "qgraphicsscenebsptreeindex.h" +#include #include #include diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 54bf09b..27b5514 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -75,14 +75,10 @@ \sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex */ -#include "qgraphicsscenebsptreeindex.h" - #ifndef QT_NO_GRAPHICSVIEW -#include "qgraphicsscenebsptreeindex_p.h" -#include "qgraphicsitem_p.h" -#include "qgraphicsscene_p.h" - +#include +#include #include #include @@ -783,7 +779,7 @@ bool QGraphicsSceneBspTreeIndex::event(QEvent *event) QT_END_NAMESPACE -#include "moc_qgraphicsscenebsptreeindex.cpp" +#include "moc_qgraphicsscenebsptreeindex_p.cpp" #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex.h deleted file mode 100644 index f3c77d3..0000000 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QGRAPHICSBSPTREEINDEX_H -#define QGRAPHICSBSPTREEINDEX_H - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW - -#include -#include -#include -#include -#include - -#include "qgraphicsscene_bsp_p.h" - -class QGraphicsSceneBspTreeIndexPrivate; - -class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex -{ - Q_OBJECT - Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) -public: - QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); - QRectF indexedRect() const; - - QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; - - QList items(Qt::SortOrder order = Qt::AscendingOrder) const; - - int bspTreeDepth(); - void setBspTreeDepth(int depth); - -protected: - bool event(QEvent *event); - void clear(); - - void addItem(QGraphicsItem *item); - void removeItem(QGraphicsItem *item); - void deleteItem(QGraphicsItem *item); - void prepareBoundingRectChange(const QGraphicsItem *item); - - void sceneRectChanged(const QRectF &rect); - void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); - -private : - Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex) - Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex) - Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache()) - Q_PRIVATE_SLOT(d_func(), void _q_updateIndex()) - - friend class QGraphicsScene; - friend class QGraphicsScenePrivate; -}; - -#endif // QT_NO_GRAPHICSVIEW - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGRAPHICSBSPTREEINDEX_H diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index ed12fac..1e4234e 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -39,8 +39,7 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSCENEBSPTREEINDEX_P_H -#define QGRAPHICSSCENEBSPTREEINDEX_P_H +#include // // W A R N I N G @@ -53,18 +52,66 @@ // We mean it. // -#include "qgraphicsscenebsptreeindex.h" +#ifndef QGRAPHICSBSPTREEINDEX_H +#define QGRAPHICSBSPTREEINDEX_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW -#include +#include +#include +#include +#include #include - -QT_BEGIN_NAMESPACE +#include +#include static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; class QGraphicsScene; +class QGraphicsSceneBspTreeIndexPrivate; + +class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex +{ + Q_OBJECT + Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) +public: + QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); + QRectF indexedRect() const; + + QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; + + QList items(Qt::SortOrder order = Qt::AscendingOrder) const; + + int bspTreeDepth(); + void setBspTreeDepth(int depth); + +protected: + bool event(QEvent *event); + void clear(); + + void addItem(QGraphicsItem *item); + void removeItem(QGraphicsItem *item); + void deleteItem(QGraphicsItem *item); + void prepareBoundingRectChange(const QGraphicsItem *item); + + void sceneRectChanged(const QRectF &rect); + void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); + +private : + Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex) + Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex) + Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache()) + Q_PRIVATE_SLOT(d_func(), void _q_updateIndex()) + + friend class QGraphicsScene; + friend class QGraphicsScenePrivate; +}; class QGraphicsSceneBspTreeIndexPrivate : public QGraphicsSceneIndexPrivate { @@ -183,9 +230,10 @@ static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) return !(t1 >= b2 || t2 >= b1); } -QT_END_NAMESPACE +#endif // QT_NO_GRAPHICSVIEW -#endif // QGRAPHICSSCENEBSPTREEINDEX_P_H +QT_END_NAMESPACE -#endif +QT_END_HEADER +#endif // QGRAPHICSBSPTREEINDEX_H -- cgit v0.12 From 378b5b603bd269b631bbe108268a683adde11828 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 18 Jun 2009 15:02:05 +0200 Subject: Make the autotests compile again. Reviewed-by: Alexis --- .../tst_qgraphicssceneindex.cpp | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 6b352ab..d10f86d 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -42,11 +42,10 @@ #include #include -#include #include +#include #include - //TESTED_CLASS= //TESTED_FILES= @@ -118,6 +117,7 @@ void tst_QGraphicsSceneIndex::customIndex_data() void tst_QGraphicsSceneIndex::customIndex() { +#if 0 QFETCH(QString, indexMethod); QGraphicsSceneIndex *index = createIndex(indexMethod); @@ -126,6 +126,7 @@ void tst_QGraphicsSceneIndex::customIndex() scene.addRect(0, 0, 30, 40); QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1); +#endif } void tst_QGraphicsSceneIndex::scatteredItems_data() @@ -136,10 +137,14 @@ void tst_QGraphicsSceneIndex::scatteredItems_data() void tst_QGraphicsSceneIndex::scatteredItems() { QFETCH(QString, indexMethod); - QGraphicsSceneIndex *index = createIndex(indexMethod); QGraphicsScene scene; +#if 1 + scene.setItemIndexMethod(indexMethod == "linear" ? QGraphicsScene::NoIndex : QGraphicsScene::BspTreeIndex); +#else + QGraphicsSceneIndex *index = createIndex(indexMethod); scene.setSceneIndex(index); +#endif for (int i = 0; i < 10; ++i) scene.addRect(i*50, i*50, 40, 35); @@ -161,10 +166,14 @@ void tst_QGraphicsSceneIndex::overlappedItems_data() void tst_QGraphicsSceneIndex::overlappedItems() { QFETCH(QString, indexMethod); - QGraphicsSceneIndex *index = createIndex(indexMethod); QGraphicsScene scene; +#if 1 + scene.setItemIndexMethod(indexMethod == "linear" ? QGraphicsScene::NoIndex : QGraphicsScene::BspTreeIndex); +#else + QGraphicsSceneIndex *index = createIndex(indexMethod); scene.setSceneIndex(index); +#endif for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) @@ -191,10 +200,14 @@ void tst_QGraphicsSceneIndex::movingItems_data() void tst_QGraphicsSceneIndex::movingItems() { QFETCH(QString, indexMethod); - QGraphicsSceneIndex *index = createIndex(indexMethod); QGraphicsScene scene; +#if 1 + scene.setItemIndexMethod(indexMethod == "linear" ? QGraphicsScene::NoIndex : QGraphicsScene::BspTreeIndex); +#else + QGraphicsSceneIndex *index = createIndex(indexMethod); scene.setSceneIndex(index); +#endif for (int i = 0; i < 10; ++i) scene.addRect(i*50, i*50, 40, 35); -- cgit v0.12 From a18e5288324aa13da014ee52daffbfc589c87be3 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 18 Jun 2009 17:29:42 +0200 Subject: Fix crash with untransformable items. Be sure that item goes in the correct list if it set its flags to untransformable. Reviewed-by: andreas --- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 43 +++++++++++++++------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 27b5514..72636b8 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -548,14 +548,9 @@ void QGraphicsSceneBspTreeIndexPrivate::removeFromBspTree(QGraphicsItem *item) // ### remove from child index only if applicable return; } - int index = item->d_func()->index; - if (index != -1) { - bsp.removeItem(item, item->sceneBoundingRect()); - freeItemIndexes << index; - indexedItems[index] = 0; - item->d_func()->index = -1; - unindexedItems << item; + if (item->d_func()->index != -1) { + bsp.removeItem(item, item->sceneBoundingRect()); //prepareGeometryChange will call prepareBoundingRectChange foreach (QGraphicsItem *child, item->children()) child->prepareGeometryChange(); @@ -570,10 +565,20 @@ void QGraphicsSceneBspTreeIndexPrivate::removeFromBspTree(QGraphicsItem *item) void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); - // Note: This will access item's sceneBoundingRect(), which (as this is - // C++) is why we cannot call removeItem() from QGraphicsItem's - // destructor. - d->removeFromBspTree(const_cast(item)); + if (!item->d_ptr->itemIsUntransformable()) { + // Note: This will access item's sceneBoundingRect(), which (as this is + // C++) is why we cannot call removeItem() from QGraphicsItem's + // destructor. + QGraphicsItem *thatItem = const_cast(item); + d->removeFromBspTree(thatItem); + int index = item->d_func()->index; + if (index != -1) { + d->freeItemIndexes << index; + d->indexedItems[index] = 0; + thatItem->d_func()->index = -1; + d->unindexedItems << thatItem; + } + } } /*! @@ -725,7 +730,13 @@ void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphics if (ignoredTransform != willIgnoreTransform) { QGraphicsItem *thatItem = const_cast(item); removeItem(thatItem); - addItem(thatItem); + thatItem->d_ptr->index = -1; + if (willIgnoreTransform) { + d->untransformableItems << thatItem; + } else { + d->unindexedItems << thatItem; + d->startIndexTimer(0); + } } break; } @@ -741,7 +752,13 @@ void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphics if (ignoredTransform != willIgnoreTransform) { QGraphicsItem *thatItem = const_cast(item); removeItem(thatItem); - addItem(thatItem); + thatItem->d_ptr->index = -1; + if (willIgnoreTransform) { + d->untransformableItems << thatItem; + } else { + d->unindexedItems << thatItem; + d->startIndexTimer(0); + } } break; } -- cgit v0.12 From 8befd7589456c6fd193676daeba8f0779d88776e Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Mon, 22 Jun 2009 11:32:51 +0200 Subject: Remove unused code / delay in this autotest. --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 1ca6c98..981efeb 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -4710,11 +4710,6 @@ void tst_QGraphicsItem::itemClipsChildrenToShape() scene.render(&painter); painter.end(); - QGraphicsView view(&scene); - view.show(); - - QTest::qWait(5000); - QCOMPARE(image.pixel(16, 16), QColor(255, 0, 0).rgba()); QCOMPARE(image.pixel(32, 32), QColor(0, 0, 255).rgba()); QCOMPARE(image.pixel(50, 50), QColor(0, 255, 0).rgba()); -- cgit v0.12 From 375c4f53e9702aa3273154c0879e3b6dbd2723d6 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Mon, 22 Jun 2009 11:38:17 +0200 Subject: QGraphicsSceneLinearIndex: touch-ups. --- src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 39 +++++++++------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h index a5327ef..88e0e6a 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -73,42 +73,35 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex Q_OBJECT public: - QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0): QGraphicsSceneIndex(scene) - { - } + QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0) : QGraphicsSceneIndex(scene) + { } - QList items(Qt::SortOrder order = Qt::AscendingOrder) const { - Q_UNUSED(order); - return m_items; - } + QList items(Qt::SortOrder order = Qt::AscendingOrder) const + { Q_UNUSED(order); return m_items; } - virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const { + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const + { Q_UNUSED(rect); Q_UNUSED(order); Q_UNUSED(deviceTransform); return m_items; } - virtual QRectF indexedRect() const { - return m_sceneRect; - } + virtual QRectF indexedRect() const + { return m_sceneRect; } protected : - void sceneRectChanged(const QRectF &rect) { - m_sceneRect = rect; - } + void sceneRectChanged(const QRectF &rect) + { m_sceneRect = rect; } - virtual void clear() { - m_items.clear(); - } + virtual void clear() + { m_items.clear(); } - virtual void addItem(QGraphicsItem *item) { - m_items << item; - } + virtual void addItem(QGraphicsItem *item) + { m_items << item; } - virtual void removeItem(QGraphicsItem *item) { - m_items.removeAll(item); - } + virtual void removeItem(QGraphicsItem *item) + { m_items.removeOne(item); } private: QRectF m_sceneRect; -- cgit v0.12 From be79229e9c454764d63262f46f686b3e1721ee2c Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 23 Jun 2009 12:35:31 +0200 Subject: More work on getting autotests to pass. --- src/gui/graphicsview/qgraphicsscene.cpp | 33 ++++++++++++++------ src/gui/graphicsview/qgraphicsscene_p.h | 1 + .../graphicsview/qgraphicsscenebsptreeindex.cpp | 36 +++++----------------- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 3 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 23 +++----------- src/gui/graphicsview/qgraphicssceneindex_p.h | 4 +-- src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 7 ----- src/gui/graphicsview/qgraphicsview.cpp | 16 +++++----- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 28 ++++++++++++++--- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 1 + 10 files changed, 71 insertions(+), 81 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 2f7ae04..6f92629 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -273,6 +273,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() index(0), lastItemCount(0), hasSceneRect(false), + dirtyGrowingItemsBoundingRect(true), updateAll(false), calledEmitUpdated(false), processDirtyItemsEmitted(false), @@ -378,8 +379,9 @@ void QGraphicsScenePrivate::unregisterTopLevelItem(QGraphicsItem *item) */ void QGraphicsScenePrivate::_q_updateLater() { + QRectF null; foreach (QGraphicsItem *item, pendingUpdateItems) - item->update(); + markDirty(item, null); pendingUpdateItems.clear(); } @@ -409,8 +411,11 @@ void QGraphicsScenePrivate::_q_processDirtyItems() const bool wasPendingSceneUpdate = calledEmitUpdated; const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; processDirtyItemsRecursive(0); - if (!hasSceneRect && oldGrowingItemsBoundingRect != growingItemsBoundingRect) + dirtyGrowingItemsBoundingRect = false; + if (oldGrowingItemsBoundingRect != growingItemsBoundingRect) { + index->sceneRectChanged(); emit q_func()->sceneRectChanged(growingItemsBoundingRect); + } if (wasPendingSceneUpdate) return; @@ -1250,9 +1255,18 @@ QGraphicsScene::~QGraphicsScene() QRectF QGraphicsScene::sceneRect() const { Q_D(const QGraphicsScene); - /// ### Remove? The growing items bounding rect might be managed - // by the scene. - return d->index->indexedRect(); + if (!d->hasSceneRect && d->dirtyGrowingItemsBoundingRect) { + // Lazily update the growing items bounding rect + QGraphicsScenePrivate *thatd = const_cast(d); + QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect; + thatd->growingItemsBoundingRect |= itemsBoundingRect(); + thatd->dirtyGrowingItemsBoundingRect = false; + if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect) { + thatd->index->sceneRectChanged(); + emit const_cast(this)->sceneRectChanged(thatd->growingItemsBoundingRect); + } + } + return d->hasSceneRect ? d->sceneRect : d->growingItemsBoundingRect; } void QGraphicsScene::setSceneRect(const QRectF &rect) { @@ -1260,8 +1274,8 @@ void QGraphicsScene::setSceneRect(const QRectF &rect) if (rect != d->sceneRect) { d->hasSceneRect = !rect.isNull(); d->sceneRect = rect; - d->index->sceneRectChanged(rect); - emit sceneRectChanged(rect); + d->index->sceneRectChanged(); + emit sceneRectChanged(d->hasSceneRect ? rect : d->growingItemsBoundingRect); } } @@ -1411,8 +1425,6 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) d->index = new QGraphicsSceneLinearIndex(this); for (int i = oldItems.size() - 1; i >= 0; --i) d->index->addItem(oldItems.at(i)); - - d->index->sceneRectChanged(d->sceneRect); } /*! @@ -2057,6 +2069,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item) if (d->pendingUpdateItems.isEmpty()) QMetaObject::invokeMethod(this, "_q_updateLater", Qt::QueuedConnection); d->pendingUpdateItems << item; + } else { + d->dirtyGrowingItemsBoundingRect = true; } // Disable selectionChanged() for individual items @@ -4235,6 +4249,7 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b bool removingItemFromScene) { Q_ASSERT(item); + dirtyGrowingItemsBoundingRect = true; if (updateAll) return; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index ea65707..8c4b2d2 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -95,6 +95,7 @@ public: QRectF sceneRect; bool hasSceneRect; + bool dirtyGrowingItemsBoundingRect; QRectF growingItemsBoundingRect; void _q_emitUpdated(); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 72636b8..aeee982 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -122,7 +122,6 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() if (!indexTimerId) return; - QGraphicsScenePrivate * scenePrivate = q->scene()->d_func(); q->killTimer(indexTimerId); indexTimerId = 0; @@ -144,10 +143,6 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() } } - // Update growing scene rect. - QRectF oldGrowingItemsBoundingRect = scenePrivate->growingItemsBoundingRect; - scenePrivate->growingItemsBoundingRect |= unindexedItemsBoundingRect; - // Determine whether we should regenerate the BSP tree. if (bspTreeDepth == 0) { int oldDepth = intmaxlog(lastItemCount); @@ -165,7 +160,6 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() bsp.initialize(q->scene()->sceneRect(), bspTreeDepth); unindexedItems = indexedItems; lastItemCount = indexedItems.size(); - q->scene()->update(); } // Insert all unindexed items into the tree. @@ -179,10 +173,6 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() } } unindexedItems.clear(); - - // Notify scene rect changes. - if (!scenePrivate->hasSceneRect && scenePrivate->growingItemsBoundingRect != oldGrowingItemsBoundingRect) - emit q->scene()->sceneRectChanged(scenePrivate->growingItemsBoundingRect); } @@ -248,7 +238,7 @@ void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stac { if (!item->d_ptr->children.isEmpty()) { QList childList = item->d_ptr->children; - qSort(childList.begin(), childList.end(), qt_closestLeaf); + qStableSort(childList.begin(), childList.end(), qt_closestLeaf); for (int i = 0; i < childList.size(); ++i) { QGraphicsItem *item = childList.at(i); if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent)) @@ -287,7 +277,7 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() topLevels << item; } - qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); + qStableSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); for (int i = 0; i < topLevels.size(); ++i) climbTree(topLevels.at(i), &stackingOrder); } @@ -379,15 +369,15 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemLi { if (sortCacheEnabled) { if (order == Qt::AscendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); + qStableSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); } else if (order == Qt::DescendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemLast_withCache); + qStableSort(itemList->begin(), itemList->end(), closestItemLast_withCache); } } else { if (order == Qt::AscendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); + qStableSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); } else if (order == Qt::DescendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); + qStableSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); } } } @@ -403,17 +393,6 @@ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) /*! \reimp - Return the rect indexed by the BSP index. -*/ -QRectF QGraphicsSceneBspTreeIndex::indexedRect() const -{ - Q_D(const QGraphicsSceneBspTreeIndex); - const_cast(d)->_q_updateIndex(); - return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect; -} - -/*! - \reimp Clear the all the BSP index. */ void QGraphicsSceneBspTreeIndex::clear() @@ -705,10 +684,9 @@ void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth) This method react to the \a rect change of the scene and reset the BSP tree index. */ -void QGraphicsSceneBspTreeIndex::sceneRectChanged(const QRectF &rect) +void QGraphicsSceneBspTreeIndex::sceneRectChanged() { Q_D(QGraphicsSceneBspTreeIndex); - d->sceneRect = rect; d->resetIndex(); } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 1e4234e..715b22f 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -82,7 +82,6 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) public: QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); - QRectF indexedRect() const; QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; @@ -100,7 +99,7 @@ protected: void deleteItem(QGraphicsItem *item); void prepareBoundingRectChange(const QGraphicsItem *item); - void sceneRectChanged(const QRectF &rect); + void sceneRectChanged(); void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); private : diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 8d7581f..4eaed2b 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -56,6 +56,7 @@ \sa QGraphicsScene, QGraphicsView */ +#include "qdebug.h" #include "qgraphicsscene.h" #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" @@ -131,14 +132,10 @@ public: keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, pointPath, mode); } } else { - QRectF sceneBrect = transform.mapRect(brect); - keep = sceneBrect.contains(scenePoint); - if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { - QPainterPath pointPath; - pointPath.addRect(QRectF(transform.inverted().map(scenePoint), QSizeF(1, 1))); - keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, pointPath, mode); - } + QRectF sceneBoundingRect = transform.mapRect(brect); + keep = sceneBoundingRect.intersects(QRectF(scenePoint, QSizeF(1, 1))) && item->contains(transform.inverted().map(scenePoint)); } + return keep; } @@ -366,15 +363,6 @@ QGraphicsScene* QGraphicsSceneIndex::scene() const } /*! - Returns the indexed area for the index -*/ -QRectF QGraphicsSceneIndex::indexedRect() const -{ - Q_D(const QGraphicsSceneIndex); - return d->scene->d_func()->sceneRect; -} - -/*! \fn QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const @@ -613,9 +601,8 @@ void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) rectangle. \a rect is the new value of the scene rectangle. \sa QGraphicsScene::sceneRect() */ -void QGraphicsSceneIndex::sceneRectChanged(const QRectF &rect) +void QGraphicsSceneIndex::sceneRectChanged() { - Q_UNUSED(rect); } QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index 85a1140..60e9032 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -87,8 +87,6 @@ public: QGraphicsScene *scene() const; - virtual QRectF indexedRect() const; - virtual QList items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; virtual QList items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; @@ -111,7 +109,7 @@ protected: virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); virtual void prepareBoundingRectChange(const QGraphicsItem *item); - virtual void sceneRectChanged(const QRectF &rect); + virtual void sceneRectChanged(); QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene); diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h index 88e0e6a..9463487 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -87,13 +87,7 @@ public: return m_items; } - virtual QRectF indexedRect() const - { return m_sceneRect; } - protected : - void sceneRectChanged(const QRectF &rect) - { m_sceneRect = rect; } - virtual void clear() { m_items.clear(); } @@ -104,7 +98,6 @@ protected : { m_items.removeOne(item); } private: - QRectF m_sceneRect; QList m_items; }; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index ec1746a..640f85b 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -802,13 +802,15 @@ void QGraphicsViewPrivate::processPendingUpdates() return; } + if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) + dirtyBoundingRect.adjust(-1, -1, 1, 1); + else + dirtyBoundingRect.adjust(-2, -2, 2, 2); + if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) { - if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) - viewport->update(dirtyBoundingRect.adjusted(-1, -1, 1, 1)); - else - viewport->update(dirtyBoundingRect.adjusted(-2, -2, 2, 2)); + viewport->update((dirtyRegion + dirtyBoundingRect).boundingRect()); } else { - viewport->update(dirtyRegion); // Already adjusted in updateRect/Region. + viewport->update(dirtyRegion + dirtyBoundingRect); // Already adjusted in updateRect/Region. } dirtyBoundingRect = QRect(); @@ -2087,9 +2089,7 @@ QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const Q_D(const QGraphicsView); if (!d->scene) return 0; - // ### Use QGraphicsScene::itemAt() instead. - QList itemsAtPos = d->scene->items(pos, Qt::IntersectsItemShape, Qt::AscendingOrder, - viewportTransform()); + QList itemsAtPos = items(pos); return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first(); } diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 1d03ef1..1a7a076 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -271,28 +271,46 @@ void tst_QGraphicsScene::construction() void tst_QGraphicsScene::sceneRect() { QGraphicsScene scene; + QSignalSpy sceneRectChanged(&scene, SIGNAL(sceneRectChanged(QRectF))); QCOMPARE(scene.sceneRect(), QRectF()); + QCOMPARE(sceneRectChanged.count(), 0); QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); - qApp->processEvents(); item->setPos(-5, -5); - qApp->processEvents(); + QCOMPARE(sceneRectChanged.count(), 0); QCOMPARE(scene.itemAt(0, 0), item); QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(sceneRectChanged.count(), 0); + QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10)); + QCOMPARE(sceneRectChanged.count(), 1); + QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); + + item->setPos(0, 0); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 15, 15)); + QCOMPARE(sceneRectChanged.count(), 2); + QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); scene.setSceneRect(-100, -100, 10, 10); + QCOMPARE(sceneRectChanged.count(), 3); + QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); QCOMPARE(scene.itemAt(0, 0), item); QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); + item->setPos(10, 10); + QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); + QCOMPARE(sceneRectChanged.count(), 3); + QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); scene.setSceneRect(QRectF()); - QCOMPARE(scene.itemAt(0, 0), item); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 15, 15)); + QCOMPARE(scene.itemAt(10, 10), item); + QCOMPARE(scene.itemAt(20, 20), (QGraphicsItem *)0); + QCOMPARE(sceneRectChanged.count(), 4); + QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25)); + QCOMPARE(sceneRectChanged.count(), 5); + QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); } void tst_QGraphicsScene::itemIndexMethod() diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index c8c032a..02e4046 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -371,6 +371,7 @@ void tst_QGraphicsView::interactive() QCOMPARE(item->events.size(), 0); QPoint itemPoint = view.mapFromScene(item->scenePos()); + QVERIFY(view.itemAt(itemPoint)); for (int i = 0; i < 100; ++i) { -- cgit v0.12 From d39a62720ba67a0fa6e4e37519d22f14c7b7404e Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 23 Jun 2009 14:35:30 +0200 Subject: Ensure that the BSP index returns all untransformable items. --- src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index aeee982..464fe8e 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -595,6 +595,8 @@ QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &r for (int i = 0; i < rectItems.size(); ++i) rectItems.at(i)->d_func()->itemDiscovered = 0; + rectItems += d->untransformableItems; + d->sortItems(&rectItems, order, d->sortCacheEnabled); return rectItems; -- cgit v0.12 From b0f391ae8f2efc272be852f951403fa8e4a8f561 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 23 Jun 2009 16:57:32 +0200 Subject: Fix tst_QGraphicsItem::collidesWith_item autotest. Avoid unwanted recursion by keeping the sceneRect variable locally. The recursion happens if the call to sceneRect() lazily emits the sceneRectChanged() signal. --- src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 464fe8e..8861c7b 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -157,7 +157,7 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() // Regenerate the tree. if (regenerateIndex) { regenerateIndex = false; - bsp.initialize(q->scene()->sceneRect(), bspTreeDepth); + bsp.initialize(sceneRect, bspTreeDepth); unindexedItems = indexedItems; lastItemCount = indexedItems.size(); } @@ -689,6 +689,7 @@ void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth) void QGraphicsSceneBspTreeIndex::sceneRectChanged() { Q_D(QGraphicsSceneBspTreeIndex); + d->sceneRect = d->scene->sceneRect(); d->resetIndex(); } -- cgit v0.12 From 4fb0f9d8d5275c21b3d16be1170b5e7d2ed77f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 25 Jun 2009 14:36:03 +0200 Subject: Partially revert be79229e The change in processPendingUpdates was completely wrong and broke several auto-tests. --- src/gui/graphicsview/qgraphicsview.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 94547a5..e4decf9 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -802,15 +802,13 @@ void QGraphicsViewPrivate::processPendingUpdates() return; } - if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) - dirtyBoundingRect.adjust(-1, -1, 1, 1); - else - dirtyBoundingRect.adjust(-2, -2, 2, 2); - if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate) { - viewport->update((dirtyRegion + dirtyBoundingRect).boundingRect()); + if (optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) + viewport->update(dirtyBoundingRect.adjusted(-1, -1, 1, 1)); + else + viewport->update(dirtyBoundingRect.adjusted(-2, -2, 2, 2)); } else { - viewport->update(dirtyRegion + dirtyBoundingRect); // Already adjusted in updateRect/Region. + viewport->update(dirtyRegion); // Already adjusted in updateRect/Region. } dirtyBoundingRect = QRect(); -- cgit v0.12 From fe64e44b0dab0152101b4ec17a49305912415016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 25 Jun 2009 14:42:16 +0200 Subject: Stabilize tst_QGraphicsView::moveItemWhileScrolling. --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 02e4046..65e066f 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3093,7 +3093,7 @@ void tst_QGraphicsView::moveItemWhileScrolling() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTest::qWait(100); + QTest::qWait(200); view.lastPaintedRegion = QRegion(); view.horizontalScrollBar()->setValue(view.horizontalScrollBar()->value() + 10); -- cgit v0.12 From 93e3a72f56d4b9ab020c58a2a3fac79be5fe49eb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Jun 2009 16:15:01 +0200 Subject: Doc: Indicated that QCompleter::completionModel() returns a proxy model. Task-number: 256138 Reviewed-by: jasplin --- src/gui/util/qcompleter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 3d25f13..f4adcea 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1582,6 +1582,10 @@ QString QCompleter::currentCompletion() const that contains all the possible matches for the current completion prefix. The completion model is auto-updated to reflect the current completions. + \note The return value of this function is defined to be an QAbstractItemModel + purely for generality. This actual kind of model returned is an instance of an + QAbstractProxyModel subclass. + \sa completionPrefix, model() */ QAbstractItemModel *QCompleter::completionModel() const -- cgit v0.12 From 9dc1fc2d30205bb0bad12df4d3cb061f55f4f3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 25 Jun 2009 16:42:10 +0200 Subject: Compile tst_QGrahicsSceneIndex after be79229e --- .../auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index d10f86d..ac21e20 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -56,8 +56,6 @@ public slots: void initTestCase(); private slots: - void sceneRect_data(); - void sceneRect(); void customIndex_data(); void customIndex(); void scatteredItems_data(); @@ -97,19 +95,6 @@ QGraphicsSceneIndex *tst_QGraphicsSceneIndex::createIndex(const QString &indexMe return index; } -void tst_QGraphicsSceneIndex::sceneRect_data() -{ - common_data(); -} - -void tst_QGraphicsSceneIndex::sceneRect() -{ - QGraphicsScene *scene = new QGraphicsScene(); - QGraphicsSceneIndex *index = new QGraphicsSceneBspTreeIndex(scene); - scene->setSceneRect(QRectF(0, 0, 2000, 2000)); - QCOMPARE(index->indexedRect(), QRectF(0, 0, 2000, 2000)); -} - void tst_QGraphicsSceneIndex::customIndex_data() { common_data(); -- cgit v0.12 From eab949e2ec8f820a54826c1a837c8c8de07814ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 25 Jun 2009 11:31:04 +0200 Subject: Re-factor parts of the QGraphicsSceneBspTreeIndex. This patch adds better support for untransformable items and removes some redundant code. --- src/gui/graphicsview/qgraphicsscene.cpp | 22 +- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 282 +++++++++------------ .../graphicsview/qgraphicsscenebsptreeindex_p.h | 6 +- 3 files changed, 133 insertions(+), 177 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 06a251e..6efede2 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1954,25 +1954,13 @@ void QGraphicsScene::clearSelection() void QGraphicsScene::clear() { Q_D(QGraphicsScene); - QList items = d->index->items(); -#if 1 - QList toDelete; - // ### As the item list is already in ascending order, - // the items should be deleted in topological order. - // Recursive descent delete - for (int i = 0; i < items.size(); ++i) { - if (QGraphicsItem *item = items.at(i)) { - if (!item->parentItem()) - toDelete << item; - } - } - // We delete all top level items - qDeleteAll(toDelete); -#else + // NB! We have to clear the index before deleting items; otherwise the + // index might try to access dangling item pointers. + d->index->clear(); + const QList items = d->topLevelItems; qDeleteAll(items); -#endif + Q_ASSERT(d->topLevelItems.isEmpty()); d->lastItemCount = 0; - d->index->clear(); d->allItemsIgnoreHoverEvents = true; d->allItemsUseDefaultCursor = true; } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 8861c7b..f6994f9 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -128,10 +128,9 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() purgeRemovedItems(); // Add unindexedItems to indexedItems - QRectF unindexedItemsBoundingRect; for (int i = 0; i < unindexedItems.size(); ++i) { if (QGraphicsItem *item = unindexedItems.at(i)) { - unindexedItemsBoundingRect |= item->sceneBoundingRect(); + item->d_ptr->itemDiscovered = 0; if (!freeItemIndexes.isEmpty()) { int freeIndex = freeItemIndexes.takeFirst(); item->d_func()->index = freeIndex; @@ -165,11 +164,14 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() // Insert all unindexed items into the tree. for (int i = 0; i < unindexedItems.size(); ++i) { if (QGraphicsItem *item = unindexedItems.at(i)) { - QRectF rect = item->sceneBoundingRect(); + if (item->d_ptr->itemIsUntransformable()) { + untransformableItems << item; + continue; + } if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) continue; - bsp.insertItem(item, rect); + bsp.insertItem(item, item->sceneBoundingRect()); } } unindexedItems.clear(); @@ -222,11 +224,13 @@ void QGraphicsSceneBspTreeIndexPrivate::resetIndex() for (int i = 0; i < indexedItems.size(); ++i) { if (QGraphicsItem *item = indexedItems.at(i)) { item->d_ptr->index = -1; + item->d_ptr->itemDiscovered = 0; unindexedItems << item; } } indexedItems.clear(); freeItemIndexes.clear(); + untransformableItems.clear(); regenerateIndex = true; startIndexTimer(); } @@ -270,10 +274,10 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() int stackingOrder = 0; QList topLevels; - - for (int i = 0; i < q->items().count(); ++i) { - QGraphicsItem *item = q->items().at(i); - if (item && item->parentItem() == 0) + const QList items = q->items(); + for (int i = 0; i < items.size(); ++i) { + QGraphicsItem *item = items.at(i); + if (item && !item->d_ptr->parent) topLevels << item; } @@ -295,6 +299,79 @@ void QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache() QMetaObject::invokeMethod(q, "_q_updateSortCache", Qt::QueuedConnection); } +void QGraphicsSceneBspTreeIndexPrivate::addItem(QGraphicsItem *item, bool recursive) +{ + if (!item) + return; + + // Prevent reusing a recently deleted pointer: purge all removed item from our lists. + purgeRemovedItems(); + + // Invalidate any sort caching; arrival of a new item means we need to resort. + // Update the scene's sort cache settings. + item->d_ptr->globalStackingOrder = -1; + invalidateSortCache(); + + // Indexing requires sceneBoundingRect(), but because \a item might + // not be completely constructed at this point, we need to store it in + // a temporary list and schedule an indexing for later. + if (item->d_ptr->index == -1) { + Q_ASSERT(!unindexedItems.contains(item)); + unindexedItems << item; + startIndexTimer(0); + } else { + Q_ASSERT(indexedItems.contains(item)); + qWarning("QGraphicsSceneBspTreeIndex::addItem: item has already been added to this BSP"); + } + + if (recursive) { + for (int i = 0; i < item->d_ptr->children.size(); ++i) + addItem(item->d_ptr->children.at(i), recursive); + } +} + +void QGraphicsSceneBspTreeIndexPrivate::removeItem(QGraphicsItem *item, bool recursive, + bool moveToUnindexedItems) +{ + if (!item) + return; + + if (item->d_ptr->index != -1) { + Q_ASSERT(item->d_ptr->index < indexedItems.size()); + Q_ASSERT(indexedItems.at(item->d_ptr->index) == item); + freeItemIndexes << item->d_ptr->index; + indexedItems[item->d_ptr->index] = 0; + item->d_ptr->index = -1; + item->d_ptr->itemDiscovered = 0; + + if (item->d_ptr->itemIsUntransformable()) { + untransformableItems.removeOne(item); + } else if (item->d_ptr->inDestructor) { + // Avoid virtual function calls from the destructor. + purgePending = true; + removedItems << item; + } else if (!item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { + bsp.removeItem(item, item->sceneBoundingRect()); + } + } else { + unindexedItems.removeOne(item); + } + invalidateSortCache(); // ### Only do this when removing from BSP? + + Q_ASSERT(item->d_ptr->index == -1); + Q_ASSERT(!indexedItems.contains(item)); + Q_ASSERT(!unindexedItems.contains(item)); + Q_ASSERT(!untransformableItems.contains(item)); + + if (moveToUnindexedItems) + addItem(item); + + if (recursive) { + for (int i = 0; i < item->d_ptr->children.size(); ++i) + removeItem(item->d_ptr->children.at(i), recursive, moveToUnindexedItems); + } +} + /*! Returns true if \a item1 is on top of \a item2. @@ -401,8 +478,16 @@ void QGraphicsSceneBspTreeIndex::clear() d->bsp.clear(); d->lastItemCount = 0; d->freeItemIndexes.clear(); + for (int i = 0; i < d->indexedItems.size(); ++i) { + // Ensure item bits are reset properly. + if (QGraphicsItem *item = d->indexedItems.at(i)) { + item->d_ptr->index = -1; + item->d_ptr->itemDiscovered = 0; + } + } d->indexedItems.clear(); d->unindexedItems.clear(); + d->untransformableItems.clear(); } /*! @@ -411,46 +496,7 @@ void QGraphicsSceneBspTreeIndex::clear() void QGraphicsSceneBspTreeIndex::addItem(QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); - // Prevent reusing a recently deleted pointer: purge all removed items - // from our lists. - d->purgeRemovedItems(); - - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - // Update the scene's sort cache settings. - item->d_ptr->globalStackingOrder = -1; - d->invalidateSortCache(); - - // Indexing requires sceneBoundingRect(), but because \a item might - // not be completely constructed at this point, we need to store it in - // a temporary list and schedule an indexing for later. - item->d_ptr->index = -1; - if (item->d_ptr->itemIsUntransformable()) { - d->untransformableItems << item; - } else { - d->unindexedItems << item; - d->startIndexTimer(0); - } -} - -/*! - This really add the item in the BSP. - \internal -*/ -void QGraphicsSceneBspTreeIndexPrivate::addToBspTree(QGraphicsItem *item) -{ - if (item->d_ptr->itemIsUntransformable()) - return; - if (item->d_func()->index != -1) { - bsp.insertItem(item, item->sceneBoundingRect()); - foreach (QGraphicsItem *child, item->children()) - child->addToIndex(); - } else { - // The BSP tree is regenerated if the number of items grows to a - // certain threshold, or if the bounding rect of the graph doubles in - // size. - startIndexTimer(); - } + d->addItem(item); } /*! @@ -459,105 +505,28 @@ void QGraphicsSceneBspTreeIndexPrivate::addToBspTree(QGraphicsItem *item) void QGraphicsSceneBspTreeIndex::removeItem(QGraphicsItem *item) { Q_D(QGraphicsSceneBspTreeIndex); - - // Note: This will access item's sceneBoundingRect(), which (as this is - // C++) is why we cannot call removeItem() from QGraphicsItem's - // destructor. - d->removeFromBspTree(item); - - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - d->invalidateSortCache(); - - // Remove from our item lists. - int index = item->d_func()->index; - if (index != -1) { - d->freeItemIndexes << index; - d->indexedItems[index] = 0; - } else { - if (item->d_ptr->itemIsUntransformable()) - d->untransformableItems.removeOne(item); - else - d->unindexedItems.removeOne(item); - } + d->removeItem(item); } /*! \reimp - Delete the \a item from the BSP index (without accessing its boundingRect). -*/ -void QGraphicsSceneBspTreeIndex::deleteItem(QGraphicsItem *item) -{ - Q_D(QGraphicsSceneBspTreeIndex); - // Invalidate any sort caching; arrival of a new item means we need to - // resort. - d->invalidateSortCache(); - - int index = item->d_func()->index; - if (index != -1) { - // Important: The index is useless until purgeRemovedItems() is - // called. - d->indexedItems[index] = (QGraphicsItem *)0; - if (!d->purgePending) { - d->purgePending = true; - scene()->update(); - } - d->removedItems << item; - } else { - // Recently added items are purged immediately. unindexedItems() never - // contains stale items. - if (item->d_ptr->itemIsUntransformable()) - d->untransformableItems.removeOne(item); - else - d->unindexedItems.removeOne(item); - scene()->update(); - } -} - -/*! - Really remove the item from the BSP - \internal + Update the BSP when the \a item 's bounding rect has changed. */ -void QGraphicsSceneBspTreeIndexPrivate::removeFromBspTree(QGraphicsItem *item) +void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) { - if (item->d_ptr->itemIsUntransformable()) + if (!item) return; - if (item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { - // ### remove from child index only if applicable - return; + if (item->d_ptr->index == -1 || item->d_ptr->itemIsUntransformable() + || item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { + return; // Item is not in BSP tree; nothing to do. } - if (item->d_func()->index != -1) { - bsp.removeItem(item, item->sceneBoundingRect()); - //prepareGeometryChange will call prepareBoundingRectChange - foreach (QGraphicsItem *child, item->children()) - child->prepareGeometryChange(); - } - startIndexTimer(); -} - -/*! - \reimp - Update the BSP when the \a item 's bounding rect has changed. -*/ -void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem *item) -{ Q_D(QGraphicsSceneBspTreeIndex); - if (!item->d_ptr->itemIsUntransformable()) { - // Note: This will access item's sceneBoundingRect(), which (as this is - // C++) is why we cannot call removeItem() from QGraphicsItem's - // destructor. - QGraphicsItem *thatItem = const_cast(item); - d->removeFromBspTree(thatItem); - int index = item->d_func()->index; - if (index != -1) { - d->freeItemIndexes << index; - d->indexedItems[index] = 0; - thatItem->d_func()->index = -1; - d->unindexedItems << thatItem; - } - } + QGraphicsItem *thatItem = const_cast(item); + d->removeItem(thatItem, /*recursive=*/false, /*moveToUnindexedItems=*/true); + for (int i = 0; i < item->d_ptr->children.size(); ++i) // ### Do we really need this? + prepareBoundingRectChange(item->d_ptr->children.at(i)); } /*! @@ -706,18 +675,17 @@ void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphics switch (change) { case QGraphicsItem::ItemFlagsChange: { // Handle ItemIgnoresTransformations - bool ignoredTransform = item->flags() & QGraphicsItem::ItemIgnoresTransformations; + bool ignoredTransform = item->d_ptr->flags & QGraphicsItem::ItemIgnoresTransformations; bool willIgnoreTransform = value.toUInt() & QGraphicsItem::ItemIgnoresTransformations; - if (ignoredTransform != willIgnoreTransform) { + bool clipsChildren = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape; + bool willClipChildren = value.toUInt() & QGraphicsItem::ItemClipsChildrenToShape; + if ((ignoredTransform != willIgnoreTransform) || (clipsChildren != willClipChildren)) { QGraphicsItem *thatItem = const_cast(item); - removeItem(thatItem); - thatItem->d_ptr->index = -1; - if (willIgnoreTransform) { - d->untransformableItems << thatItem; - } else { - d->unindexedItems << thatItem; - d->startIndexTimer(0); - } + // Remove item and its descendants from the index and append + // them to the list of unindexed items. Then, when the index + // is updated, they will be put into the bsp-tree or the list + // of untransformable items. + d->removeItem(thatItem, /*recursive=*/true, /*moveToUnidexedItems=*/true); } break; } @@ -729,17 +697,19 @@ void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphics // Handle ItemIgnoresTransformations QGraphicsItem *newParent = qVariantValue(value); bool ignoredTransform = item->d_ptr->itemIsUntransformable(); - bool willIgnoreTransform = (item->flags() & QGraphicsItem::ItemIgnoresTransformations) || (newParent && newParent->d_ptr->itemIsUntransformable()); - if (ignoredTransform != willIgnoreTransform) { + bool willIgnoreTransform = (item->d_ptr->flags & QGraphicsItem::ItemIgnoresTransformations) + || (newParent && newParent->d_ptr->itemIsUntransformable()); + bool ancestorClippedChildren = item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren; + bool ancestorWillClipChildren = newParent + && ((newParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape) + || (newParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)); + if ((ignoredTransform != willIgnoreTransform) || (ancestorClippedChildren != ancestorWillClipChildren)) { QGraphicsItem *thatItem = const_cast(item); - removeItem(thatItem); - thatItem->d_ptr->index = -1; - if (willIgnoreTransform) { - d->untransformableItems << thatItem; - } else { - d->unindexedItems << thatItem; - d->startIndexTimer(0); - } + // Remove item and its descendants from the index and append + // them to the list of unindexed items. Then, when the index + // is updated, they will be put into the bsp-tree or the list + // of untransformable items. + d->removeItem(thatItem, /*recursive=*/true, /*moveToUnidexedItems=*/true); } break; } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 715b22f..f2f958f 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -96,7 +96,6 @@ protected: void addItem(QGraphicsItem *item); void removeItem(QGraphicsItem *item); - void deleteItem(QGraphicsItem *item); void prepareBoundingRectChange(const QGraphicsItem *item); void sceneRectChanged(); @@ -139,13 +138,12 @@ public: void startIndexTimer(int interval = QGRAPHICSSCENE_INDEXTIMER_TIMEOUT); void resetIndex(); - void addToBspTree(QGraphicsItem *item); - void removeFromBspTree(QGraphicsItem *item); - void _q_updateSortCache(); bool sortCacheEnabled; bool updatingSortCache; void invalidateSortCache(); + void addItem(QGraphicsItem *item, bool recursive = false); + void removeItem(QGraphicsItem *item, bool recursive = false, bool moveToUnindexedItems = false); static void climbTree(QGraphicsItem *item, int *stackingOrder); static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); -- cgit v0.12 From 7541247a025bf112716a752bc4d114303f2a77f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 26 Jun 2009 15:54:04 +0200 Subject: Proper handling of scene rect in QGraphicsScene(Index). Reviewed-by: Andreas --- src/gui/graphicsview/qgraphicsitem.cpp | 1 + src/gui/graphicsview/qgraphicsitem_p.h | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 65 +++++++++------------- src/gui/graphicsview/qgraphicsscene.h | 1 - src/gui/graphicsview/qgraphicsscene_p.h | 1 - .../graphicsview/qgraphicsscenebsptreeindex.cpp | 4 +- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 4 +- src/gui/graphicsview/qgraphicssceneindex.cpp | 25 ++++++--- src/gui/graphicsview/qgraphicssceneindex_p.h | 4 +- src/gui/graphicsview/qgraphicsscenelinearindex.cpp | 6 -- 10 files changed, 52 insertions(+), 61 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 7393f00..e9d1076 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -6322,6 +6322,7 @@ void QGraphicsItem::removeFromIndex() void QGraphicsItem::prepareGeometryChange() { if (d_ptr->scene) { + d_ptr->scene->d_func()->dirtyGrowingItemsBoundingRect = true; d_ptr->geometryChanged = 1; d_ptr->paintedViewBoundingRectsNeedRepaint = 1; diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 1dfb140..243582a 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -148,7 +148,7 @@ public: dirtyChildrenBoundingRect(1), paintedViewBoundingRectsNeedRepaint(0), dirtySceneTransform(1), - geometryChanged(0), + geometryChanged(1), inDestructor(0), isObject(0), ignoreVisible(0), diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 6efede2..de6f5c4 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -326,6 +326,16 @@ void QGraphicsScenePrivate::_q_emitUpdated() Q_Q(QGraphicsScene); calledEmitUpdated = false; + if (dirtyGrowingItemsBoundingRect) { + if (!hasSceneRect) { + const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; + growingItemsBoundingRect |= q->itemsBoundingRect(); + if (oldGrowingItemsBoundingRect != growingItemsBoundingRect) + emit q->sceneRectChanged(growingItemsBoundingRect); + } + dirtyGrowingItemsBoundingRect = false; + } + // Ensure all views are connected if anything is connected. This disables // the optimization that items send updates directly to the views, but it // needs to happen in order to keep compatibility with the behavior from @@ -373,20 +383,6 @@ void QGraphicsScenePrivate::unregisterTopLevelItem(QGraphicsItem *item) /*! \internal - - Updates all items in the pending update list. At this point, the list is - unlikely to contain partially constructed items. -*/ -void QGraphicsScenePrivate::_q_updateLater() -{ - QRectF null; - foreach (QGraphicsItem *item, pendingUpdateItems) - markDirty(item, null); - pendingUpdateItems.clear(); -} - -/*! - \internal */ void QGraphicsScenePrivate::_q_polishItems() { @@ -412,10 +408,8 @@ void QGraphicsScenePrivate::_q_processDirtyItems() const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; processDirtyItemsRecursive(0); dirtyGrowingItemsBoundingRect = false; - if (oldGrowingItemsBoundingRect != growingItemsBoundingRect) { - index->sceneRectChanged(); + if (!hasSceneRect && oldGrowingItemsBoundingRect != growingItemsBoundingRect) emit q_func()->sceneRectChanged(growingItemsBoundingRect); - } if (wasPendingSceneUpdate) return; @@ -507,7 +501,6 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) hoverItems.removeAll(item); cachedItemsUnderMouse.removeAll(item); unpolishedItems.removeAll(item); - pendingUpdateItems.removeAll(item); resetDirtyItem(item); //We remove all references of item from the sceneEventFilter arrays @@ -1303,18 +1296,19 @@ QGraphicsScene::~QGraphicsScene() QRectF QGraphicsScene::sceneRect() const { Q_D(const QGraphicsScene); - if (!d->hasSceneRect && d->dirtyGrowingItemsBoundingRect) { + if (d->hasSceneRect) + return d->sceneRect; + + if (d->dirtyGrowingItemsBoundingRect) { // Lazily update the growing items bounding rect QGraphicsScenePrivate *thatd = const_cast(d); QRectF oldGrowingBoundingRect = thatd->growingItemsBoundingRect; thatd->growingItemsBoundingRect |= itemsBoundingRect(); thatd->dirtyGrowingItemsBoundingRect = false; - if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect) { - thatd->index->sceneRectChanged(); + if (oldGrowingBoundingRect != thatd->growingItemsBoundingRect) emit const_cast(this)->sceneRectChanged(thatd->growingItemsBoundingRect); - } } - return d->hasSceneRect ? d->sceneRect : d->growingItemsBoundingRect; + return d->growingItemsBoundingRect; } void QGraphicsScene::setSceneRect(const QRectF &rect) { @@ -1322,7 +1316,6 @@ void QGraphicsScene::setSceneRect(const QRectF &rect) if (rect != d->sceneRect) { d->hasSceneRect = !rect.isNull(); d->sceneRect = rect; - d->index->sceneRectChanged(); emit sceneRectChanged(d->hasSceneRect ? rect : d->growingItemsBoundingRect); } } @@ -2101,13 +2094,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Add to list of items that require an update. We cannot assume that the // item is fully constructed, so calling item->update() can lead to a pure // virtual function call to boundingRect(). - if (!d->updateAll) { - if (d->pendingUpdateItems.isEmpty()) - QMetaObject::invokeMethod(this, "_q_updateLater", Qt::QueuedConnection); - d->pendingUpdateItems << item; - } else { - d->dirtyGrowingItemsBoundingRect = true; - } + d->markDirty(item); + d->dirtyGrowingItemsBoundingRect = true; // Disable selectionChanged() for individual items ++d->selectionChanging; @@ -4245,7 +4233,6 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b bool removingItemFromScene) { Q_ASSERT(item); - dirtyGrowingItemsBoundingRect = true; if (updateAll) return; @@ -4351,6 +4338,13 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool item->d_ptr->dirty = 0; item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; } + + if (item->d_ptr->geometryChanged) { + // Update growingItemsBoundingRect. + if (!hasSceneRect && !itemIsHidden) + growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); + item->d_ptr->geometryChanged = 0; + } } // Process item. @@ -4359,13 +4353,6 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool const bool untransformableItem = item->d_ptr->itemIsUntransformable(); const QRectF itemBoundingRect = adjustedItemBoundingRect(item); - if (item->d_ptr->geometryChanged) { - // Update growingItemsBoundingRect. - if (!hasSceneRect) - growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(itemBoundingRect); - item->d_ptr->geometryChanged = 0; - } - if (useCompatUpdate && !untransformableItem && qFuzzyIsNull(item->boundingRegionGranularity())) { // This block of code is kept for compatibility. Since 4.5, by default // QGraphicsView does not connect the signal and we use the below diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 421adbd..560671a 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -291,7 +291,6 @@ private: Q_DECLARE_PRIVATE(QGraphicsScene) Q_DISABLE_COPY(QGraphicsScene) Q_PRIVATE_SLOT(d_func(), void _q_emitUpdated()) - Q_PRIVATE_SLOT(d_func(), void _q_updateLater()) Q_PRIVATE_SLOT(d_func(), void _q_polishItems()) Q_PRIVATE_SLOT(d_func(), void _q_processDirtyItems()) friend class QGraphicsItem; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 36a7e63..f286a8d 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -107,7 +107,6 @@ public: QPainterPath selectionArea; int selectionChanging; QSet selectedItems; - QList pendingUpdateItems; QList unpolishedItems; QList topLevelItems; bool needSortTopLevelItems; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index f6994f9..3efc742 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -655,10 +655,10 @@ void QGraphicsSceneBspTreeIndex::setBspTreeDepth(int depth) This method react to the \a rect change of the scene and reset the BSP tree index. */ -void QGraphicsSceneBspTreeIndex::sceneRectChanged() +void QGraphicsSceneBspTreeIndex::updateSceneRect(const QRectF &rect) { Q_D(QGraphicsSceneBspTreeIndex); - d->sceneRect = d->scene->sceneRect(); + d->sceneRect = rect; d->resetIndex(); } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index f2f958f..850cc3f 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -90,6 +90,9 @@ public: int bspTreeDepth(); void setBspTreeDepth(int depth); +protected Q_SLOTS: + void updateSceneRect(const QRectF &rect); + protected: bool event(QEvent *event); void clear(); @@ -98,7 +101,6 @@ protected: void removeItem(QGraphicsItem *item); void prepareBoundingRectChange(const QGraphicsItem *item); - void sceneRectChanged(); void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value); private : diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 4eaed2b..88fb6b0 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -335,6 +335,10 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene) : QObject(*new QGraphicsSceneIndexPrivate(scene), scene) { + if (scene) { + connect(scene, SIGNAL(sceneRectChanged(const QRectF&)), + this, SLOT(updateSceneRect(const QRectF&))); + } } /*! @@ -527,6 +531,18 @@ QList QGraphicsSceneIndex::estimateItems(const QPointF &point, \a order. */ + +/*! + Notifies the index that the scene's scene rect has changed. \a rect + is thew new scene rect. + + \sa QGraphicsScene::sceneRect() +*/ +void QGraphicsSceneIndex::updateSceneRect(const QRectF &rect) +{ + Q_UNUSED(rect); +} + /*! This virtual function removes all items in the scene index. */ @@ -596,15 +612,6 @@ void QGraphicsSceneIndex::prepareBoundingRectChange(const QGraphicsItem *item) Q_UNUSED(item); } -/*! - This virtual function is called when the scene changes its bounding - rectangle. \a rect is the new value of the scene rectangle. - \sa QGraphicsScene::sceneRect() -*/ -void QGraphicsSceneIndex::sceneRectChanged() -{ -} - QT_END_NAMESPACE #include "moc_qgraphicssceneindex_p.cpp" diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index 60e9032..dc6a740 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -101,6 +101,9 @@ public: virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const = 0; +protected Q_SLOTS: + virtual void updateSceneRect(const QRectF &rect); + protected: virtual void clear(); virtual void addItem(QGraphicsItem *item) = 0; @@ -109,7 +112,6 @@ protected: virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); virtual void prepareBoundingRectChange(const QGraphicsItem *item); - virtual void sceneRectChanged(); QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene); diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp index 694062b..bc401f2 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp @@ -46,12 +46,6 @@ */ /*! - \fn void QGraphicsSceneLinearIndex::sceneRectChanged(const QRectF &rect); - \reimp - This method react to the \a rect change of the scene. -*/ - -/*! \fn void QGraphicsSceneLinearIndex::clear(); \reimp Clear the all the BSP index. -- cgit v0.12 From eff4c4b4172d1a95b1b5806622b4e7fe43c2b006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 26 Jun 2009 16:32:27 +0200 Subject: Fix broken point item lookup in Graphics View. Done with Andreas. --- src/gui/graphicsview/qgraphicsscene.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index de6f5c4..7c46598 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -770,11 +770,22 @@ QList QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre const QPointF &scenePos, QWidget *widget) const { - Q_UNUSED(screenPos); Q_Q(const QGraphicsScene); QGraphicsView *view = widget ? qobject_cast(widget->parentWidget()) : 0; - return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, - view ? view->viewportTransform() : QTransform()); + if (!view) + return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, QTransform()); + + const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); + if (!view->isTransformed()) + return q->items(pointRect, Qt::IntersectsItemShape, Qt::AscendingOrder); + + const QTransform viewTransform = view->viewportTransform(); + if (viewTransform.type() <= QTransform::TxScale) { + return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, + Qt::AscendingOrder, viewTransform); + } + return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, + Qt::AscendingOrder, viewTransform); } /*! -- cgit v0.12 From e851be3ae78b54cd5b0391436563dcc81c6e8817 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jun 2009 00:28:48 +0200 Subject: Don't crash in libdbus-1 because of invalid parameters. Some QDBusAbstractInterface can have empty paths or service names, for wildcard purposes. If someone tries to make a call using those interfaces, the application crashes. So check for the invalid conditions and don't make the call. If we return 0 here, the message-sending code will generate an error in QDBusConnectionPrivate. Reviewed-by: TrustMe --- src/dbus/qdbusmessage.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 47dd34b..9150295 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -108,8 +108,11 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) //qDebug() << "QDBusMessagePrivate::toDBusMessage" << "message is invalid"; break; case DBUS_MESSAGE_TYPE_METHOD_CALL: - msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), data(d_ptr->path.toUtf8()), - data(d_ptr->interface.toUtf8()), data(d_ptr->name.toUtf8())); + // only interface can be empty + if (d_ptr->service.isEmpty() || d_ptr->path.isEmpty() || d_ptr->name.isEmpty()) + break; + msg = q_dbus_message_new_method_call(d_ptr->service.toUtf8(), d_ptr->path.toUtf8(), + data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8()); break; case DBUS_MESSAGE_TYPE_METHOD_RETURN: msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN); @@ -119,16 +122,22 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) } break; case DBUS_MESSAGE_TYPE_ERROR: + // error name can't be empty + if (d_ptr->name.isEmpty()) + break; msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR); - q_dbus_message_set_error_name(msg, data(d_ptr->name.toUtf8())); + q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8()); if (!d_ptr->localMessage) { q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->reply)); q_dbus_message_set_reply_serial(msg, q_dbus_message_get_serial(d_ptr->reply)); } break; case DBUS_MESSAGE_TYPE_SIGNAL: - msg = q_dbus_message_new_signal(data(d_ptr->path.toUtf8()), data(d_ptr->interface.toUtf8()), - data(d_ptr->name.toUtf8())); + // nothing can be empty here + if (d_ptr->path.isEmpty() || d_ptr->interface.isEmpty() || d_ptr->name.isEmpty()) + break; + msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(), + d_ptr->name.toUtf8()); break; default: Q_ASSERT(false); -- cgit v0.12 From 4efa1ba22825fb9a8be572dbf595cb29a4e4840b Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Mon, 29 Jun 2009 10:59:04 +1000 Subject: bug fix Task-number: 217003 Reviewed-by: Bill King --- src/sql/kernel/qsqlcachedresult.cpp | 5 ++++- tests/auto/qsqlquery/tst_qsqlquery.cpp | 10 ++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/sql/kernel/qsqlcachedresult.cpp b/src/sql/kernel/qsqlcachedresult.cpp index 3cace06..4b094c6 100644 --- a/src/sql/kernel/qsqlcachedresult.cpp +++ b/src/sql/kernel/qsqlcachedresult.cpp @@ -184,8 +184,11 @@ bool QSqlCachedResult::fetch(int i) if (d->rowCacheEnd > 0) setAt(d->cacheCount()); while (at() < i + 1) { - if (!cacheNext()) + if (!cacheNext()) { + if (d->canSeek(i)) + break; return false; + } } setAt(i); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 825db6c..ed19e91 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -175,13 +175,14 @@ private slots: void emptyTableNavigate(); #ifdef NOT_READY_YET - void task_217003_data() { generic_data(); } - void task_217003(); void task_229811(); void task_229811_data() { generic_data(); } void task_234422_data() { generic_data(); } void task_234422(); #endif + void task_217003_data() { generic_data(); } + void task_217003(); + void task_250026_data() { generic_data("QODBC"); } void task_250026(); void task_205701_data() { generic_data("QMYSQL"); } @@ -299,9 +300,8 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) tablenames << qTableName( "qtest_lockedtable" ); -#ifdef NOT_READY_YET tablenames << qTableName( "Planet" ); -#endif + tablenames << qTableName( "task_250026" ); tst_Databases::safeDropTables( db, tablenames ); @@ -2658,7 +2658,6 @@ void tst_QSqlQuery::emptyTableNavigate() } } -#ifdef NOT_READY_YET void tst_QSqlQuery::task_217003() { QFETCH( QString, dbName ); @@ -2685,7 +2684,6 @@ void tst_QSqlQuery::task_217003() QVERIFY_SQL( q, seek( 1 ) ); QCOMPARE( q.value( 0 ).toString(), QString( "Venus" ) ); } -#endif void tst_QSqlQuery::task_250026() { -- cgit v0.12 From b6171cfbe3b1453a2c46f78db0df4819e4e5e54f Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Jun 2009 13:47:24 +0200 Subject: Fix coverity warning Coverity was complaining because we were not checking the return value of find() but instead using the pixmap handle to check the result. This makes the call more consistent Reviewed-by: mgoetz --- src/gui/styles/qgtkstyle.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 218f651..e2dcfba 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -686,11 +686,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, const QString pmKey = QString(QLS("windowframe %0")).arg(option->state); QPixmap pixmap; - QPixmapCache::find(pmKey, pixmap); QRect pmRect(QPoint(0,0), QSize(pmSize, pmSize)); // Only draw through style once - if (pixmap.isNull()) { + if (!QPixmapCache::find(pmKey, pixmap)) { pixmap = QPixmap(pmSize, pmSize); pixmap.fill(Qt::transparent); QPainter pmPainter(&pixmap); -- cgit v0.12 From 29812003b5ae8641773e0f5bd35cf2c82957088b Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 29 Jun 2009 14:21:04 +0200 Subject: Fix autotest failure in QStyle:drawItemPixmap This was basically a problem with shadow builds not being able to access the pixmap. Reviewed-by:eskil --- tests/auto/qstyle/qstyle.pro | 3 +++ tests/auto/qstyle/tst_qstyle.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qstyle/qstyle.pro b/tests/auto/qstyle/qstyle.pro index 71ee2e6..ba0908a 100644 --- a/tests/auto/qstyle/qstyle.pro +++ b/tests/auto/qstyle/qstyle.pro @@ -2,9 +2,12 @@ load(qttest_p4) SOURCES += tst_qstyle.cpp wince*: { + DEFINES += SRCDIR=\\\".\\\" addPixmap.sources = task_25863.png addPixmap.path = . DEPLOYMENT += addPixmap +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index 961af1b..ed70c1d 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -217,7 +217,8 @@ void tst_QStyle::drawItemPixmap() { testWidget->resize(300, 300); testWidget->show(); - QPixmap p("task_25863.png", "PNG"); + + QPixmap p(QString(SRCDIR) + "/task_25863.png", "PNG"); QPixmap actualPix = QPixmap::grabWidget(testWidget); QVERIFY(pixmapsAreEqual(&actualPix,&p)); testWidget->hide(); -- cgit v0.12 From 982f73014771bbfb782d835eb8e6be3b44ff4ddc Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 29 Jun 2009 15:02:20 +0200 Subject: Remove a couple of registry entries when unregistering an ActiveX server These two entries were not removed since the server was an OOP server Reviewed-by: Prasanth --- src/activeqt/control/qaxserver.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index c15cdac..7ac053e 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -351,6 +351,10 @@ HRESULT UpdateRegistry(BOOL bRegister) qAxFactory()->registerClass(*key, &settings); } } else { + if (qAxOutProcServer) { + settings.remove(QLatin1String("/AppID/") + appId + QLatin1String("/.")); + settings.remove(QLatin1String("/AppID/") + module + QLatin1String(".EXE")); + } QStringList keys = qAxFactory()->featureList(); for (QStringList::Iterator key = keys.begin(); key != keys.end(); ++key) { QString className = *key; -- cgit v0.12 From 7fe4f8ff71cf09bbabbd3438ef637fe408a11c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 29 Jun 2009 15:33:30 +0200 Subject: Graphics View: BSP tree cleanup. Ensure the BSP resets the QGraphicsItemPrivate::itemDiscovered bit before returning the list of discovered items. --- src/gui/graphicsview/qgraphicsitem.h | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 7 +++++-- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 11 ++++++++--- src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | 21 ++++++++------------- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 12dcad2..48fb5c3 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -434,6 +434,7 @@ private: friend class QGraphicsScene; friend class QGraphicsScenePrivate; friend class QGraphicsSceneFindItemBspTreeVisitor; + friend class QGraphicsSceneBspTree; friend class QGraphicsView; friend class QGraphicsViewPrivate; friend class QGraphicsWidget; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7c46598..f1e56c1 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1097,8 +1097,11 @@ QList QGraphicsScenePrivate::topLevelItemsInStackingOrder(const QList tmp = index->estimateItems(sceneRect, Qt::SortOrder(-1), viewTransform ? *viewTransform : QTransform()); - for (int i = 0; i < tmp.size(); ++i) - tmp.at(i)->topLevelItem()->d_ptr->itemDiscovered = 1; + for (int i = 0; i < tmp.size(); ++i) { + QGraphicsItem *item = tmp.at(i); + if (!item->d_ptr->parent) + item->d_ptr->itemDiscovered = 1; + } // Sort if the toplevel list is unsorted. if (needSortTopLevelItems) { diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index eaeec54..5858eab 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -148,6 +148,9 @@ QList QGraphicsSceneBspTree::items(const QRectF &rect) const QList tmp; findVisitor->foundItems = &tmp; climbTree(findVisitor, rect); + // Reset discovery bits. + for (int i = 0; i < tmp.size(); ++i) + tmp.at(i)->d_ptr->itemDiscovered = 0; return tmp; } @@ -156,6 +159,9 @@ QList QGraphicsSceneBspTree::items(const QPointF &pos) const QList tmp; findVisitor->foundItems = &tmp; climbTree(findVisitor, pos); + // Reset discovery bits. + for (int i = 0; i < tmp.size(); ++i) + tmp.at(i)->d_ptr->itemDiscovered = 0; return tmp; } @@ -241,7 +247,7 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con return; const Node &node = nodes.at(index); - int childIndex = firstChildIndex(index); + const int childIndex = firstChildIndex(index); switch (node.type) { case Node::Leaf: { @@ -271,7 +277,7 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con return; const Node &node = nodes.at(index); - int childIndex = firstChildIndex(index); + const int childIndex = firstChildIndex(index); switch (node.type) { case Node::Leaf: { @@ -288,7 +294,6 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con } break; case Node::Horizontal: - int childIndex = firstChildIndex(index); if (rect.top() < node.offset) { climbTree(visitor, rect, childIndex); if (rect.bottom() >= node.offset) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 3efc742..44a0082 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -130,7 +130,7 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() // Add unindexedItems to indexedItems for (int i = 0; i < unindexedItems.size(); ++i) { if (QGraphicsItem *item = unindexedItems.at(i)) { - item->d_ptr->itemDiscovered = 0; + Q_ASSERT(!item->d_ptr->itemDiscovered); if (!freeItemIndexes.isEmpty()) { int freeIndex = freeItemIndexes.takeFirst(); item->d_func()->index = freeIndex; @@ -224,7 +224,7 @@ void QGraphicsSceneBspTreeIndexPrivate::resetIndex() for (int i = 0; i < indexedItems.size(); ++i) { if (QGraphicsItem *item = indexedItems.at(i)) { item->d_ptr->index = -1; - item->d_ptr->itemDiscovered = 0; + Q_ASSERT(!item->d_ptr->itemDiscovered); unindexedItems << item; } } @@ -339,10 +339,10 @@ void QGraphicsSceneBspTreeIndexPrivate::removeItem(QGraphicsItem *item, bool rec if (item->d_ptr->index != -1) { Q_ASSERT(item->d_ptr->index < indexedItems.size()); Q_ASSERT(indexedItems.at(item->d_ptr->index) == item); + Q_ASSERT(!item->d_ptr->itemDiscovered); freeItemIndexes << item->d_ptr->index; indexedItems[item->d_ptr->index] = 0; item->d_ptr->index = -1; - item->d_ptr->itemDiscovered = 0; if (item->d_ptr->itemIsUntransformable()) { untransformableItems.removeOne(item); @@ -481,8 +481,8 @@ void QGraphicsSceneBspTreeIndex::clear() for (int i = 0; i < d->indexedItems.size(); ++i) { // Ensure item bits are reset properly. if (QGraphicsItem *item = d->indexedItems.at(i)) { + Q_ASSERT(!item->d_ptr->itemDiscovered); item->d_ptr->index = -1; - item->d_ptr->itemDiscovered = 0; } } d->indexedItems.clear(); @@ -547,25 +547,20 @@ QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &r Q_UNUSED(deviceTransform); QList rectItems = d->bsp.items(rect); + // Fill in with any unindexed items for (int i = 0; i < d->unindexedItems.size(); ++i) { if (QGraphicsItem *item = d->unindexedItems.at(i)) { - if (!item->d_ptr->itemDiscovered && item->d_ptr->visible && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { + if (item->d_ptr->visible + && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { QRectF boundingRect = item->sceneBoundingRect(); - if (QRectF_intersects(boundingRect, rect)) { - item->d_ptr->itemDiscovered = 1; + if (QRectF_intersects(boundingRect, rect)) rectItems << item; - } } } } - // Reset the discovered state of all discovered items - for (int i = 0; i < rectItems.size(); ++i) - rectItems.at(i)->d_func()->itemDiscovered = 0; - rectItems += d->untransformableItems; - d->sortItems(&rectItems, order, d->sortCacheEnabled); return rectItems; -- cgit v0.12 From 4dcb46a3796fbd9baf1ba6dcddcc9944e69e3153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 29 Jun 2009 15:44:11 +0200 Subject: Add lacking parenthesis around bitwise AND operator. This caused a crash in the diagramscene example because "!bits & something" does not have the same meaning as "!(bits & something)", hence item was never removed from the BSP resulting in a stale item pointer. --- src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 44a0082..413c8de 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -350,7 +350,7 @@ void QGraphicsSceneBspTreeIndexPrivate::removeItem(QGraphicsItem *item, bool rec // Avoid virtual function calls from the destructor. purgePending = true; removedItems << item; - } else if (!item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { + } else if (!(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { bsp.removeItem(item, item->sceneBoundingRect()); } } else { @@ -518,7 +518,7 @@ void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem * return; if (item->d_ptr->index == -1 || item->d_ptr->itemIsUntransformable() - || item->d_func()->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { + || (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { return; // Item is not in BSP tree; nothing to do. } -- cgit v0.12 From d8e80403e7e74a2236a7ec1a6d268c786e3042f5 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Mon, 29 Jun 2009 16:03:07 +0200 Subject: Doc: Adding documentation on supported data types in Qt SQL module Created a table showing the use of different data types in relations with different Qt-supported Databases. Also reviewed by Task-number: 182851 Rev-by: Geir Vattekar Rev-by: David Boddie Rev-by: Bill King --- doc/src/qsqldatatype-table.qdoc | 584 ++++++++++++++++++++++++++++++++++++++++ doc/src/qtsql.qdoc | 3 + 2 files changed, 587 insertions(+) create mode 100644 doc/src/qsqldatatype-table.qdoc diff --git a/doc/src/qsqldatatype-table.qdoc b/doc/src/qsqldatatype-table.qdoc new file mode 100644 index 0000000..5ab6413 --- /dev/null +++ b/doc/src/qsqldatatype-table.qdoc @@ -0,0 +1,584 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \module QtSql + + \page qsqldatatype-table.html + + \title QtSql Module - Recommended use of data types + + \section1 Recommended use of types and widgets in Qt supported Databases + + This table shows the recommended data types used when extracting data + from the databases supported in Qt. It is important to note that the + types used in Qt not necessary are valid as input to the specific + database. One example could be that a double would work perfect as + input for floating point records in a database, but not necessary + as output to the database since it would be stored with 64-bit in C++. + + \tableofcontents + + \section2 IBM DB2 data type + + \table + \row + \header IBM DB2 data type + \header SQL Type Description + \header Recommended input (C++ data type and Qt ) + \row + \o SMALLINT + \o 16-bit signed integer + \o typedef qint16 + \row + \o INTEGER + \o 32-bit signed integer + \o typedef qint32 + \row + \o BIGINT + \o 64-bit signed integer + \o typedef qint64 + \row + \o REAL + \o 32-bit Single-precision floating point + \o By default mapping to QString + \row + \o DOUBLE PRECISION + \o 64-bit Double-precision floating point + \o By default mapping to QString + \row + \o FLOAT + \o 64-bit Double-precision floating point + \o By default mapping to QString + \row + \o CHAR + \o Fixed-length, null-terminated character string + \o Mapped to QString + \row + \o VARCHAR + \o Null-terminated varying length string + \o Mapped to QString + \row + \o LONG VARCHAR + \o Not null-terminated varying length character string + \o Mapped to QString + \row + \o BLOB + \o Not null-terminated varying binary string with 4-byte string + length indicator + \o Mapped to QByteArray + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o DATE + \o Null-terminated character string of the following format: + yyyy-mm-dd + \o Mapped to QDate + \row + \o TIME + \o Null-terminated character string of the following format: hh.mm.ss + \o Mapped to QTime + \row + \o TIMESTAMP + \o Null-terminated character string of the following format: yyyy-mm-dd-hh.mm.ss.nnnnnn + \o Mapped to QDateTime + \endtable + + \section2 Borland InterBase data type + + \table + \row + \header Borland InterBase data type + \header SQL Type Description + \header Recommended input (C++ data type/Qt Widget) + \row + \o BOOLEAN + \o Boolean + \o bool + \row + \o TINYINT + \o 8 bit signed integer + \o typedef qint8 + \row + \o SMALLINT + \o 16-bit signed integer + \o typedef qint16 + \row + \o INTEGER + \o 32-bit signed integer + \o typedef qint32 + \row + \o BIGINT LONG + \o 64-bit signed integer + \o typedef qint64 + \row + \o REAL FLOAT + \o 32-bit floating point + \o By default mapping to QString + \row + \o FLOAT + \o 64-bit floating point + \o By default mapping to QString + \row + \o DOUBLE + \o 64-bit floating point + \o By default mapping to QString + \row + \o DOUBLE PRECISION + \o 64-bit Double-precision floating point + \o By default mapping to QString + \row + \o VARCHAR STRING + \o Character string, Unicode + \o Mapped to QString + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o DATE + \o Displays date. Format: 'yyyy-mm-dd' + \o Mapped to QDate + \row + \o TIME + \o Displays time. Format is 'hh:mm:ss' in 24-hour format + \o Mapped to QTime + \row + \o TIMESTAMP + \o Displays a timestamp. Format is 'yyyy-mm-dd hh:mm:ss' + \o Mapped to QDateTime + \endtable + + \section2 MySQL data type + + \table + \row + \header MySQL data type + \header SQL Type Description + \header Recommended input (C++ data type/Qt Widget) + \row + \o TINYINT + \o 8 bit signed integer + \o typedef qint8 + \row + \o TINYINT UNSIGNED + \o 8 bit unsigned integer + \o typedef quint8 + \row + \o SMALLINT + \o 16-bit signed integer + \o typedef qint16 + \row + \o SMALLINT UNSIGNED + \o 16-bit unsigned integer + \o typedef quint16 + \row + \o INT + \o 32-bit signed integer + \o typedef qint32 + \row + \o INT UNSIGNED + \o 32-bit unsigned integer + \o typedef quint32 + \row + \o BIGINT + \o 64-bit signed integer + \o typedef qint64 + \row + \o FLOAT + \o 32-bit Floating Point + \o By default mapping to QString + \row + \o DOUBLE + \o 64-bit Floating Point + \o By default mapping to QString + \row + \o CHAR + \o Character string + \o Mapped to QString + \row + \o VARCHAR + \o Character string + \o Mapped to QString + \row + \o TINYTEXT + \o Character string + \o Mapped to QString + \row + \o TEXT + \o Character string + \o Mapped to QString + \row + \o MEDIUMTEXT + \o Character string + \o Mapped to QString + \row + \o LONGTEXT + \o Character string + \o Mapped to QString + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o all BLOB types + \o BLOB + \o Mapped to QByteArray + \row + \o DATE + \o Date without Time + \o Mapped to QDate + \row + \o DATETIME + \o Date and Time + \o Mapped to QDateTime + \row + \o TIMESTAMP + \o Date and Time + \o Mapped to QDateTime + \row + \o TIME + \o Time + \o Mapped to QTime + \row + \o YEAR + \o Year (int) + \o Mapped to QDateTime + \row + \o ENUM + \o Enumeration of Value Set + \o Mapped to QString + \endtable + + \section2 Oracle Call Interface data type + + \table + \row + \header Oracle Call Interface data type + \header SQL Type Description + \header Recommended input (C++ data type/Qt Widget) + \row + \o NUMBER + \o FLOAT, DOUBLE, PRECISIONc REAL + \o By default mapping to QString + \row + \o NUMBER(38) + \o INTEGER INT SMALLINT + \o typedef qint8/16/32/64 + \row + \o NUMBER(p,s) + \o NUMERIC(p,s) DECIMAL(p,s)a + \o By default mapping to QString + \row + \o NVARCHAR2(n) + \o Character string (NATIONAL CHARACTER VARYING(n) NATIONAL + CHAR VARYING(n) NCHAR VARYING(n)) + \o Mapped to QString + \row + \o NCHAR(n) + \o Character string (NATIONAL CHARACTER(n) NATIONAL CHAR(n) + NCHAR(n)) + \o Mapped to QString + \row + \o CHAR(n) + \o Character string (CHARACTER(n) CHAR(n)) + \o Mapped to QString + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o BLOB + \o A binary large object + \o Mapped to QByteArray + \row + \o TIMESTAMP + \o Year, month, and day values of date, as well as hour, minute, + and second values of time + \o Mapped to QDateTime + \endtable + + \section2 ODBC data type + + \table + \row + \header ODBC data type + \header SQL Type Description + \header Recommended input (C++ data type/Qt Widget) + \row + \o BIT + \o Boolean + \o BOOL + \row + \o TINYINT + \o 8 bit integer + \o typedef qint8 + \row + \o SMALLINT + \o 16-bit signed integer + \o typedef qint16 + \row + \o INTEGER + \o 32-bit signed integer + \o typedef qint32 + \row + \o BIGINT + \o 64-bit signed integer + \o typedef qint64 + \row + \o REAL + \o 32-bit Single-precision floating point + \o By default mapping to QString + \row + \o FLOAT + \o 64-bit Double floating point + \o By default mapping to QString + \row + \o DOUBLE + \o 64-bit Double floating point + \o By default mapping to QString + \row + \o CHAR + \o Character string + \o Mapped to QString + \row + \o VARCHAR + \o Character string + \o Mapped to QString + \row + \o LONGVARCHAR + \o Character string + \o Mapped to QString + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o DATE + \o Character string + \o Mapped to QDate + \row + \o TIME + \o Character Time, Character string + \o Mapped to QTime + \row + \o TIMESTAMP + \o Character Time, Character string + \o Mapped to QDateTime + \endtable + + \section2 PostgreSQL data type + + \table + \row + \header PostgreSQL data type + \header SQL Type Description + \header Recommended input (C++ data type/Qt Widget) + \row + \o BOOLEAN + \o Boolean + \o bool + \row + \o SMALLINT + \o 16-bit signed integer + \o typedef qint16 + \row + \o INTEGER + \o 32-bit signed integer + \o typedef qint32 + \row + \o BIGINT + \o 64-bit signed integer + \o typedef qint64 + \row + \o REAL + \o 32-bit variable-precision floating point + \o By default mapping to QString + \row + \o DOUBLE PRECISION + \o 64-bit variable-precision floating point + \o By default mapping to QString + \row + \o DECIMAL VARIABLE + \o user-specified precision, exact + \o Mapped to QString + \row + \o NUMERIC VARIABLE + \o user-specified precision, exact + \o Mapped to QString + \row + \o VARCHAR + \o variable-length character string + \o Mapped to QString + \row + \o CHARACTER + \o Character string of fixed-length + \o Mapped to QString + \row + \o TEXT + \o Character string of variable-length + \o Mapped to QString + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o TIMESTAMP + \o 8 bytes, both date and time + \o Mapped to QDateTime + \row + \o TIMESTAMP + \o 8 bytes, both date and time, with time zone + \o Mapped to QDateTime + \row + \o DATE + \o 4 bytes, dates only + \o Mapped to QDate + \row + \o TIME + \o 8 bytes, times of day only 00:00:00.00 - 23:59:59.99 + \o Mapped to QTime + \row + \o TIME + \o 12 bytes times of day only, with time zone 00:00:00.00+12 + \o Mapped to QDateTime + \endtable + + \section2 QSQLITE SQLite version 3 data type + + \table + \row + \header QSQLITE SQLite version 3 data type + \header SQL Type Description + \header Recommended input (C++ data type/Qt Widget) + \row + \o NULL + \o NULL value. + \o NULL + \row + \o INTEGER + \o Signed integer, stored in 8, 16, 24, 32, 48, or 64-bits + depending on the magnitude of the value. + \o typedef qint8/16/32/64 + \row + \o REAL + \o 64-bit floating point value. + \o By default mapping to QString + \row + \o TEXT + \o Character string (UTF-8, UTF-16BE or UTF-16-LE). + \o Mapped to QString + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o BLOB + \o The value is a BLOB of data, stored exactly as it was input. + \o Mapped to QByteArray + \endtable + + \section2 Sybase Adaptive Server data type + + \table + \row + \header Sybase Adaptive Server data type + \header SQL Type Description + \header Recommended input (C++ data type/Qt Widget) + \row + \o BINARY + \o Describes a fixed-length binary value up to 255 bytes in size. + \o Mapped to QByteArray + \row + \o CHAR + \o Character String + \o Mapped to QString + \row + \o DATETIME + \o Date and time. Range: 1753-01-01 00:00:00 through + 9999-12-31 23:59:59. + \o Mapped to QDateTime + \row + \o NCHAR + \o Character String of fixed length + \o Mapped to QString + \row + \o NVARACHAR + \o Character String of variable length + \o Mapped to QString + \row + \o VARCHAR + \o Character String of fixed length + \o Mapped to QString + \row + \o CLOB + \o Character large string object + \o Mapped to QString + \row + \o TIMESTAMP + \o A unique number within a database + \o Mapped to QString + \row + \o SMALLDATETIME + \o Date and time. Range: 1900-01-01 00:00 through 2079-12-31 23:59 + \o Mapped to QDateTime + \row + \o UNICHAR + \o Character String of fixed length.(Unicode) + \o Mapped to QString + \row + \o UNIVARCHAR + \o Character String of variable length.(Unicode) + \o Mapped to QString + \row + \o VARBINARY + \o Describes a variable-length binary value up to 255 bytes in size + \o Mapped to QByteArray + \endtable + + \section2 SQLite Version 2 + SQLite V.2 is "typeless". This means that you can store any kind of + data you want in any column of any table, regardless of the declared + data type of that column. We recommend that you map the data to QString. + +*/ diff --git a/doc/src/qtsql.qdoc b/doc/src/qtsql.qdoc index ff58c62..54ea86a 100644 --- a/doc/src/qtsql.qdoc +++ b/doc/src/qtsql.qdoc @@ -212,6 +212,9 @@ QVariant::toString() and QVariant::toInt() to convert variants to QString and \c int. + For an overview of the recommended types used with Qt supported + Databases, please refer to \l {QtSql Module - Recommended use of data types}{this table}. + You can iterate back and forth using QSqlQuery::next(), QSqlQuery::previous(), QSqlQuery::first(), QSqlQuery::last(), and QSqlQuery::seek(). The current row index is returned by -- cgit v0.12 From 150f29a4b3144a59bf49394bbb0eea53eb8a72f6 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 29 Jun 2009 15:58:02 +0200 Subject: Fix crash/artifacts on SuperH Add SuperH to the ever growing list of architectures which can't correctly dereference a short* which is not 16-bit aligned. Turning this into a white-list rather than a black list might make sense at some point, but as QT_ARCH_I386 isn't defined on windows, the white list looks even uglier at the moment. :-) Task-number: 257077 Reviewed-by: TrustMe --- src/gui/painting/qblendfunctions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index f14de93..baea140 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -317,9 +317,9 @@ template void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl, const uchar *src = srcPixels + y * sbpl; const uchar *srcEnd = src + srcOffset; while (src < srcEnd) { -#if defined(QT_ARCH_ARM) || defined(QT_ARCH_POWERPC) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_)) - // non-16-bit aligned memory access is not possible on PowerPC & - // ARM Date: Mon, 29 Jun 2009 15:38:12 +0200 Subject: QNetworkAccessManager stuff: Some fixes for coverity A few "fixes" to make that number go down.. Reviewed-by: Thiago Macieira --- src/network/access/qhttpnetworkconnection.cpp | 10 +++++++--- src/network/access/qhttpnetworkconnection_p.h | 3 ++- src/network/access/qnetworkreplyimpl.cpp | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 4c08794..726b954 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -135,7 +135,9 @@ int QHttpNetworkConnectionPrivate::indexOf(QAbstractSocket *socket) const for (int i = 0; i < channelCount; ++i) if (channels[i].socket == socket) return i; - return -1; + + qFatal("Called with unknown socket object."); + return 0; } bool QHttpNetworkConnectionPrivate::isSocketBusy(QAbstractSocket *socket) const @@ -515,7 +517,7 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN // try to reconnect/resend before sending an error. if (channels[i].reconnectAttempts-- > 0) { resendCurrentRequest(socket); - } else { + } else if (reply) { reply->d_func()->errorString = errorDetail(QNetworkReply::RemoteHostClosedError, socket); emit reply->finishedWithError(QNetworkReply::RemoteHostClosedError, reply->d_func()->errorString); QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); @@ -788,6 +790,7 @@ void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket, Q_ASSERT(socket); int i = indexOf(socket); + if (channels[i].authMehtod != QAuthenticatorPrivate::None) { if (!(channels[i].authMehtod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 401)) { QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].authenticator); @@ -1322,7 +1325,8 @@ void QHttpNetworkConnectionPrivate::_q_encrypted() QAbstractSocket *socket = qobject_cast(q->sender()); if (!socket) return; // ### error - channels[indexOf(socket)].state = IdleState; + int i = indexOf(socket); + channels[i].state = IdleState; sendRequest(socket); } diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 04609cf..feb974c 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -244,7 +244,8 @@ public: #ifndef QT_NO_OPENSSL bool ignoreSSLErrors; #endif - Channel() :state(IdleState), reply(0), written(0), bytesTotal(0), resendCurrent(false), reconnectAttempts(2), + Channel() : socket(0), state(IdleState), reply(0), written(0), bytesTotal(0), resendCurrent(false), + lastStatus(0), pendingEncrypt(false), reconnectAttempts(2), authMehtod(QAuthenticatorPrivate::None), proxyAuthMehtod(QAuthenticatorPrivate::None) #ifndef QT_NO_OPENSSL , ignoreSSLErrors(false) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index d903d03..63a9c2d 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -52,10 +52,12 @@ QT_BEGIN_NAMESPACE inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() - : copyDevice(0), networkCache(0), + : backend(0), outgoingData(0), + copyDevice(0), networkCache(0), cacheEnabled(false), cacheSaveDevice(0), notificationHandlingPaused(false), bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), + httpStatusCode(0), state(Idle) { } @@ -129,7 +131,7 @@ void QNetworkReplyImplPrivate::_q_sourceReadChannelFinished() void QNetworkReplyImplPrivate::_q_copyReadyRead() { Q_Q(QNetworkReplyImpl); - if (!copyDevice && !q->isOpen()) + if (!copyDevice || !q->isOpen()) return; forever { -- cgit v0.12 From 3923d737f911103c5bba6544963833496b2058b1 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Mon, 29 Jun 2009 16:35:51 +0200 Subject: Always turn on shadows for Cocoa. Frameless windows wouldn't get shadows in Cocoa, which they do in Carbon. You can argue over who is more correct, but the fact is they can't be inconsistent. Since Cocoa is the newcomer, I'm bending that. Though it would seem useful to have an ability to provide some developer control over the shadow. At the moment, the only thing we have to ensure is that we always turn on the shadow. Task-number: 254725 Reviewed-by: Denis --- src/gui/kernel/qwidget_mac.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 8f04b89..b9183de 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2173,11 +2173,10 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin if ((popup || type == Qt::Tool || type == Qt::ToolTip) && !q->isModal()) { [windowRef setHidesOnDeactivate:YES]; - [windowRef setHasShadow:YES]; } else { [windowRef setHidesOnDeactivate:NO]; } - + [windowRef setHasShadow:YES]; Q_UNUSED(parentWidget); Q_UNUSED(dialog); -- cgit v0.12 From 02ed2cd9ddf57ee9daadbfc76e6b73dbd4165583 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 29 Jun 2009 17:27:14 +0200 Subject: add Russian to the "'own' languages hack" until task #196275 will be closed Merge-request: 760 Reviewed-by: Oswald Buddenhagen --- tools/linguist/linguist/messageeditor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp index 108ea1d..67fe651 100644 --- a/tools/linguist/linguist/messageeditor.cpp +++ b/tools/linguist/linguist/messageeditor.cpp @@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE // functionality is provided within Qt (see task 196275). static const char * language_strings[] = { + QT_TRANSLATE_NOOP("MessageEditor", "Russian"), QT_TRANSLATE_NOOP("MessageEditor", "German"), QT_TRANSLATE_NOOP("MessageEditor", "Japanese"), QT_TRANSLATE_NOOP("MessageEditor", "French"), -- cgit v0.12 From ccd06993cbb00058c937f28e8aa17dab87b448de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 29 Jun 2009 13:42:43 +0200 Subject: QTemporaryFile: Report the user-provided openMode Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 3 ++- tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 33 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index a735dda..2d2db7d 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -341,6 +341,8 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) Q_D(QFSFileEngine); Q_ASSERT(!isReallyOpen()); + openMode |= QIODevice::ReadWrite; + if (!filePathIsTemplate) return QFSFileEngine::open(openMode); @@ -758,7 +760,6 @@ bool QTemporaryFile::open(OpenMode flags) } } - flags |= QIODevice::ReadWrite; if (QFile::open(flags)) { d->fileName = d->fileEngine->fileName(QAbstractFileEngine::DefaultName); return true; diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index d7c0574..66896a8 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -88,6 +88,7 @@ private slots: void rename(); void renameFdLeak(); void reOpenThroughQFile(); + void keepOpenMode(); public: }; @@ -439,5 +440,37 @@ void tst_QTemporaryFile::reOpenThroughQFile() QCOMPARE(file.readAll(), data); } +void tst_QTemporaryFile::keepOpenMode() +{ + QByteArray data("abcdefghij"); + + { + QTemporaryFile file; + QVERIFY(((QFile &)file).open(QIODevice::WriteOnly)); + QVERIFY(QIODevice::WriteOnly == file.openMode()); + + QCOMPARE(file.write(data), (qint64)data.size()); + file.close(); + + QVERIFY(((QFile &)file).open(QIODevice::ReadOnly)); + QVERIFY(QIODevice::ReadOnly == file.openMode()); + QCOMPARE(file.readAll(), data); + } + + { + QTemporaryFile file; + QVERIFY(file.open()); + QCOMPARE(file.write(data), (qint64)data.size()); + QVERIFY(file.rename("temporary-file.txt")); + + QVERIFY(((QFile &)file).open(QIODevice::ReadOnly)); + QVERIFY(QIODevice::ReadOnly == file.openMode()); + QCOMPARE(file.readAll(), data); + + QVERIFY(((QFile &)file).open(QIODevice::WriteOnly)); + QVERIFY(QIODevice::WriteOnly == file.openMode()); + } +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" -- cgit v0.12 From d5238b2c7d0ac813505d3cba611843361b2f647c Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 29 Jun 2009 11:40:08 -0700 Subject: Remove superfluous call to SetBlittingFlags We already do this in QDirectFBWindowSurface::scroll Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 5deca3c..71e1fde 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -252,7 +252,6 @@ void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) { - surface->SetBlittingFlags(surface, DSBLIT_NOFX); const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); } -- cgit v0.12 From edd75cbae9db9aedb2e040c6bbe6cdadabf6dca5 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 29 Jun 2009 15:26:09 -0700 Subject: Remove unused variables These variables are never used. Reviewed-by: TrustMe --- src/gui/widgets/qabstractspinbox_p.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/widgets/qabstractspinbox_p.h b/src/gui/widgets/qabstractspinbox_p.h index 15f5d97..0d00e04 100644 --- a/src/gui/widgets/qabstractspinbox_p.h +++ b/src/gui/widgets/qabstractspinbox_p.h @@ -135,8 +135,6 @@ public: mutable QValidator::State cachedState; mutable QSize cachedSizeHint, cachedMinimumSizeHint; uint pendingEmit : 1; - uint spindownEnabled : 1; - uint spinupEnabled : 1; uint readOnly : 1; uint wrapping : 1; uint ignoreCursorPositionChanged : 1; -- cgit v0.12 From 6af19da2036e80612386d027e42cec3d7cf4de3b Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Tue, 30 Jun 2009 11:17:49 +1000 Subject: bug fix - case for QVariant::Bool in switch statement was missing Task-number: 215511 Reviewed-by: TrustMe --- src/sql/drivers/odbc/qsql_odbc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index e0aa9b5..2bedf7f 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1439,6 +1439,7 @@ bool QODBCResult::exec() values[i] = QVariant(QDateTime(QDate(dt.year, dt.month, dt.day), QTime(dt.hour, dt.minute, dt.second, dt.fraction / 1000000))); break; } + case QVariant::Bool: case QVariant::Int: case QVariant::UInt: case QVariant::Double: -- cgit v0.12 From 79f63138b49584fc1ee297811b471294ebd83b6b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 30 Jun 2009 13:13:21 +1000 Subject: Remove links to out-of-date class chart. Reviewed-by: Gareth Pethig --- doc/src/classes.qdoc | 3 --- doc/src/index.qdoc | 1 - 2 files changed, 4 deletions(-) diff --git a/doc/src/classes.qdoc b/doc/src/classes.qdoc index 69ca716..dddc96f 100644 --- a/doc/src/classes.qdoc +++ b/doc/src/classes.qdoc @@ -47,9 +47,6 @@ This is a list of all Qt classes excluding the \l{Qt 3 compatibility classes}. For a shorter list that only includes the most frequently used classes, see \l{Qt's Main Classes}. - \omit This is old and dingy now. - and the \l{http://doc.trolltech.com/extras/qt43-class-chart.pdf}{Qt 4.3 Class Chart (PDF)}. - \endomit \generatelist classes diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index bcaa614..a7efd73 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -152,7 +152,6 @@
  • Qt for Embedded Platforms
  • All Overviews and HOWTOs
  • Qt Widget Gallery
  • -
  • Class Chart
  • Qt Global Declarations
  • -- cgit v0.12 From 9b532a999944c70c2e8f57d9156c1887867ad9f1 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Mon, 29 Jun 2009 13:38:13 +0200 Subject: Support the -qtlibinfix parameter already on Unix/Mac The configuration option was not added to the Windows configure. Reviewed-by: hjk --- mkspecs/features/win32/windows.prf | 4 ++-- tools/configure/configureapp.cpp | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/win32/windows.prf b/mkspecs/features/win32/windows.prf index f037c1a..cf81388 100644 --- a/mkspecs/features/win32/windows.prf +++ b/mkspecs/features/win32/windows.prf @@ -6,8 +6,8 @@ contains(TEMPLATE, ".*app"){ qt:for(entryLib, $$list($$unique(QMAKE_LIBS_QT_ENTRY))) { isEqual(entryLib, -lqtmain): { - CONFIG(debug, debug|release): QMAKE_LIBS += $${entryLib}d - else: QMAKE_LIBS += $${entryLib} + CONFIG(debug, debug|release): QMAKE_LIBS += $${entryLib}$${QT_LIBINFIX}d + else: QMAKE_LIBS += $${entryLib}$${QT_LIBINFIX} } else { QMAKE_LIBS += $${entryLib} } diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index b9acdb1..9ee5eef 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -896,6 +896,11 @@ void Configure::parseCmdLine() if(i==argCount) break; qmakeDefines += "QT_NAMESPACE="+configCmdLine.at(i); + } else if( configCmdLine.at(i) == "-qtlibinfix" ) { + ++i; + if(i==argCount) + break; + dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i); } else if( configCmdLine.at(i) == "-D" ) { ++i; if (i==argCount) @@ -1424,8 +1429,8 @@ bool Configure::displayHelp() "[-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n" "[-no-iwmmxt] [-iwmmxt] [-direct3d] [-openssl] [-openssl-linked]\n" "[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform ]\n" - "[-qtnamespace ] [-no-phonon] [-phonon]\n" - "[-no-phonon-backend] [-phonon-backend]\n" + "[-qtnamespace ] [-qtlibinfix ] [-no-phonon]\n" + "[-phonon] [-no-phonon-backend] [-phonon-backend]\n" "[-no-webkit] [-webkit]\n" "[-no-scripttools] [-scripttools]\n" "[-graphicssystem raster|opengl]\n\n", 0, 7); @@ -1516,7 +1521,8 @@ bool Configure::displayHelp() desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' '); #if !defined(EVAL) - desc( "-qtnamespace ", "Wraps all Qt library code in 'namespace name {...}\n"); + desc( "-qtnamespace ", "Wraps all Qt library code in 'namespace name {...}"); + desc( "-qtlibinfix ", "Renames all Qt* libs to Qt*\n"); desc( "-D ", "Add an explicit define to the preprocessor."); desc( "-I ", "Add an explicit include path."); desc( "-L ", "Add an explicit library path."); @@ -2551,7 +2557,10 @@ void Configure::generateCachefile() configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl; if(!dictionary["QMAKE_RPATHDIR"].isEmpty()) - configStream<<"QMAKE_RPATHDIR += "< Date: Mon, 29 Jun 2009 14:44:14 +0200 Subject: New binary --- configure.exe | Bin 856064 -> 856064 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index 9da5c60..df6a6ac 100644 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 8e08d5b8fcceee9a3d156b1e18363f48e19ec79b Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 30 Jun 2009 10:14:00 +0200 Subject: QWidget::adjustSize() sends a spontaneous event - Mac OS X Cocoa The windowDidResize notification now differentiates an internally triggered resize from a user triggered resize. Task-number: 256269 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 7 ++++++- src/gui/kernel/qwidget_mac.mm | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 9b49efc..3905e21 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -132,7 +132,12 @@ static void cleanupCocoaWindowDelegate() qwidget->setAttribute(Qt::WA_PendingResizeEvent, true); } else { QResizeEvent qre(newSize, oldSize); - qt_sendSpontaneousEvent(qwidget, &qre); + if (qwidget->testAttribute(Qt::WA_PendingResizeEvent)) { + qwidget->setAttribute(Qt::WA_PendingResizeEvent, false); + QApplication::sendEvent(qwidget, &qre); + } else { + qt_sendSpontaneousEvent(qwidget, &qre); + } } } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b9183de..1c71fbd 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4069,6 +4069,8 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) setGeometry_sys_helper(x, y, w, h, isMove); } #else + QSize olds = q->size(); + const bool isResize = (olds != QSize(w, h)); NSWindow *window = qt_mac_window_for(q); const QRect &fStrut = frameStrut(); const QRect frameRect(QPoint(x - fStrut.left(), y - fStrut.top()), @@ -4076,7 +4078,10 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) fStrut.top() + fStrut.bottom() + h)); NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1), frameRect.width(), frameRect.height()); - + // The setFrame call will trigger a 'windowDidResize' notification for the corresponding + // NSWindow. The pending flag is set, so that the resize event can be send as non-spontaneous. + if (isResize) + q->setAttribute(Qt::WA_PendingResizeEvent); QPoint currTopLeft = data.crect.topLeft(); if (currTopLeft.x() == x && currTopLeft.y() == y && cocoaFrameRect.size.width != 0 -- cgit v0.12 From 815841491a378237349a5206ac841454629d2628 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Tue, 30 Jun 2009 12:12:20 +0200 Subject: Compile qmake autotest --- tests/auto/qmake/testcompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp index 2f8dae8..38876d0 100644 --- a/tests/auto/qmake/testcompiler.cpp +++ b/tests/auto/qmake/testcompiler.cpp @@ -56,7 +56,7 @@ static QString targetName( BuildType buildMode, const QString& target, const QSt targetName.append(".exe"); break; case Dll: // dll - if (!version.empty()) + if (!version.isEmpty()) targetName.append(version.section(".", 0, 0)); targetName.append(".dll"); break; -- cgit v0.12 From 238a618b5482e0471f46ed71362492be9c4df4a6 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 30 Jun 2009 12:25:47 +0200 Subject: Doc: Fixed links that pointed to removed documentation. Information on issues with the icc compiler has been moved in the docs. Redirected links that still pointed to the old location. Task-number: 257039 Reviewed-by: Morten Engvoldsen --- doc/src/platform-notes.qdoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/src/platform-notes.qdoc b/doc/src/platform-notes.qdoc index 23094e1..8fe8170 100644 --- a/doc/src/platform-notes.qdoc +++ b/doc/src/platform-notes.qdoc @@ -397,7 +397,7 @@ \row \o Apple Mac OS X (32-bit) \o gcc 4.0.1 \row \o Linux (32 and 64-bit) \o gcc 4.1, 4.2, 4.3 \row \o Microsoft Windows \o gcc 3.4.2 (MinGW) (32-bit), MSVC 2003, 2005 (32 and 64-bit), 2008, - \l{Known Issues in %VERSION%}{Intel icc (see note)} + \l{Intel C++ Compiler}{Intel icc (see note)} \endtable Any platform-compiler combinations not listed here should be considered unsupported. @@ -596,8 +596,9 @@ \section1 Intel C++ Compiler - \warning Please see the \l{Known Issues in %VERSION%} page for information - about an issue with this compiler. + Qt supports the Intel C++ compiler on both Windows and Linux. + However, there are a few issues on Linux (see the following + section). \section2 Intel C++ Compiler for Linux -- cgit v0.12 From 4be64775a5b3964e611e7fdb334edd33b1ef6b9b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 30 Jun 2009 13:12:12 +0200 Subject: fix crash in QLocalServer on WinCE when waitForNewConnection times out Reviewed-by: mauricek --- src/network/socket/qlocalserver_tcp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/socket/qlocalserver_tcp.cpp b/src/network/socket/qlocalserver_tcp.cpp index b248f2f..bcf822e 100644 --- a/src/network/socket/qlocalserver_tcp.cpp +++ b/src/network/socket/qlocalserver_tcp.cpp @@ -92,7 +92,7 @@ void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut) { if (pendingConnections.isEmpty()) tcpServer.waitForNewConnection(msec, timedOut); - else + else if (timedOut) *timedOut = false; } -- cgit v0.12 From 548274de342d6b14de57c96c484e02118b858d4a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 30 Jun 2009 13:55:30 +0200 Subject: doc: Fixed several qdoc error reports. --- src/gui/graphicsview/qgraphicswidget.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 0644ce9..86c0b48 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -971,15 +971,18 @@ void QGraphicsWidget::updateGeometry() deliver events related to state changes in the item. Because of this, it is very important that subclasses call the base implementation. - For example, QGraphicsWidget uses ItemVisibleChange to deliver \l Show and - \l Hide events, ItemPositionHasChanged to deliver \l Move events, and - ItemParentChange both to deliver \l ParentChange events, and for managing - the focus chain. + \a change specifies the type of change, and \a value is the new value. + + For example, QGraphicsWidget uses ItemVisibleChange to deliver + \l{QEvent::Show} {Show} and \l{QEvent::Hide}{Hide} events, + ItemPositionHasChanged to deliver \l{QEvent::Move}{Move} events, + and ItemParentChange both to deliver \l{QEvent::ParentChange} + {ParentChange} events, and for managing the focus chain. QGraphicsWidget enables the ItemSendsGeometryChanges flag by default in order to track position changes. - \sa propertyChange() + \sa QGraphicsItem::itemChange() */ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &value) { @@ -1211,7 +1214,8 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) /*! \reimp - QGraphicsWidget handles the following events: + Handles the \a event. QGraphicsWidget handles the following + events: \table \o Event \o Usage \row \o Polish -- cgit v0.12 From 4d8567b85bf14b1515aafc97c035b2dda2c79b2a Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 30 Jun 2009 14:16:07 +0200 Subject: QToolBar: fix coverity warnings I also changed a bit the way the timer for the popup is working --- src/gui/widgets/qtoolbar.cpp | 36 ++++++++++++++---------------------- src/gui/widgets/qtoolbar.h | 1 - src/gui/widgets/qtoolbar_p.h | 8 ++++---- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index b635628..3414b4f 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -70,6 +70,8 @@ #include "qdebug.h" +#define POPUP_TIMER_INTERVAL 500 + QT_BEGIN_NAMESPACE #ifdef Q_WS_MAC @@ -87,14 +89,6 @@ static void qt_mac_updateToolBarButtonHint(QWidget *parentWidget) void QToolBarPrivate::init() { Q_Q(QToolBar); - - waitForPopupTimer = new QTimer(q); - waitForPopupTimer->setSingleShot(false); - waitForPopupTimer->setInterval(500); - QObject::connect(waitForPopupTimer, SIGNAL(timeout()), q, SLOT(_q_waitForPopup())); - - floatable = true; - movable = true; q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); q->setBackgroundRole(QPalette::Button); q->setAttribute(Qt::WA_Hover); @@ -1086,6 +1080,16 @@ bool QToolBar::event(QEvent *event) Q_D(QToolBar); switch (event->type()) { + case QEvent::Timer: + if (d->waitForPopupTimer.timerId() == static_cast(event)->timerId()) { + QWidget *w = QApplication::activePopupWidget(); + if (!waitForPopup(this, w)) { + d->waitForPopupTimer.stop(); + if (!this->underMouse()) + d->layout->setExpanded(false); + } + } + break; case QEvent::Hide: if (!isHidden()) break; @@ -1183,11 +1187,11 @@ bool QToolBar::event(QEvent *event) QWidget *w = QApplication::activePopupWidget(); if (waitForPopup(this, w)) { - d->waitForPopupTimer->start(); + d->waitForPopupTimer.start(POPUP_TIMER_INTERVAL, this); break; } - d->waitForPopupTimer->stop(); + d->waitForPopupTimer.stop(); d->layout->setExpanded(false); break; } @@ -1197,18 +1201,6 @@ bool QToolBar::event(QEvent *event) return QWidget::event(event); } -void QToolBarPrivate::_q_waitForPopup() -{ - Q_Q(QToolBar); - - QWidget *w = QApplication::activePopupWidget(); - if (!waitForPopup(q, w)) { - waitForPopupTimer->stop(); - if (!q->underMouse()) - layout->setExpanded(false); - } -} - /*! Returns a checkable action that can be used to show or hide this toolbar. diff --git a/src/gui/widgets/qtoolbar.h b/src/gui/widgets/qtoolbar.h index 2ab4ffd..07502b3 100644 --- a/src/gui/widgets/qtoolbar.h +++ b/src/gui/widgets/qtoolbar.h @@ -167,7 +167,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) Q_PRIVATE_SLOT(d_func(), void _q_updateIconSize(const QSize &)) Q_PRIVATE_SLOT(d_func(), void _q_updateToolButtonStyle(Qt::ToolButtonStyle)) - Q_PRIVATE_SLOT(d_func(), void _q_waitForPopup()) friend class QMainWindow; friend class QMainWindowLayout; diff --git a/src/gui/widgets/qtoolbar_p.h b/src/gui/widgets/qtoolbar_p.h index b03c460..42ea97f 100644 --- a/src/gui/widgets/qtoolbar_p.h +++ b/src/gui/widgets/qtoolbar_p.h @@ -56,6 +56,7 @@ #include "qtoolbar.h" #include "QtGui/qaction.h" #include "private/qwidget_p.h" +#include QT_BEGIN_NAMESPACE @@ -70,7 +71,7 @@ class QToolBarPrivate : public QWidgetPrivate public: inline QToolBarPrivate() - : explicitIconSize(false), explicitToolButtonStyle(false), movable(false), + : explicitIconSize(false), explicitToolButtonStyle(false), movable(true), floatable(true), allowedAreas(Qt::AllToolBarAreas), orientation(Qt::Horizontal), toolButtonStyle(Qt::ToolButtonIconOnly), layout(0), state(0) @@ -84,16 +85,15 @@ public: void _q_toggleView(bool b); void _q_updateIconSize(const QSize &sz); void _q_updateToolButtonStyle(Qt::ToolButtonStyle style); - void _q_waitForPopup(); bool explicitIconSize; bool explicitToolButtonStyle; bool movable; + bool floatable; Qt::ToolBarAreas allowedAreas; Qt::Orientation orientation; Qt::ToolButtonStyle toolButtonStyle; QSize iconSize; - bool floatable; QAction *toggleViewAction; @@ -125,7 +125,7 @@ public: void unplug(const QRect &r); void plug(const QRect &r); - QTimer *waitForPopupTimer; + QBasicTimer waitForPopupTimer; }; #endif // QT_NO_TOOLBAR -- cgit v0.12 From 1fc1eafc9bc5e8e7e69c04b9fac93d45a74ebfbf Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 30 Jun 2009 14:37:16 +0200 Subject: Doc: About menu on the Mac gets the application name from Info.plist. Task-number: 256818 Reviewed-by: Trenton Schulz --- src/gui/kernel/qaction.cpp | 4 +++- src/gui/widgets/qmenubar.cpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index a7f458f..26baad5 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -249,7 +249,9 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) as described in the QMenuBar documentation. \value ApplicationSpecificRole This action should be put in the application menu with an application specific role \value AboutQtRole This action matches handles the "About Qt" menu item. - \value AboutRole This action should be placed where the "About" menu item is in the application menu. + \value AboutRole This action should be placed where the "About" menu item is in the application menu. The text of + the menu item will be set to "About ". The application name is fetched from the + \c{Info.plist} file in the application's bundle (See \l{Deploying an Application on Mac OS X}). \value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu. \value QuitRole This action should be placed where the Quit menu item is in the application menu. */ diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index f58ea50..741916a 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -661,8 +661,9 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \header \i String matches \i Placement \i Notes \row \i about.* \i Application Menu | About - \i If this entry is not found no About item will appear in - the Application Menu + \i The application name is fetched from the \c {Info.plist} file + (see note below). If this entry is not found no About item + will appear in the Application Menu. \row \i config, options, setup, settings or preferences \i Application Menu | Preferences \i If this entry is not found the Settings item will be disabled -- cgit v0.12 From 951ee7c2995b4f5c1a61c72c8f53ff40a3a0b2d4 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 30 Jun 2009 14:52:13 +0200 Subject: QDockArea: remove coverity warning --- src/gui/widgets/qdockarealayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 9828413..f245d64 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -2074,7 +2074,7 @@ void QDockAreaLayoutInfo::updateTabBar() const QDockAreaLayoutInfo *that = const_cast(this); - if (tabBar == 0) { + if (that->tabBar == 0) { that->tabBar = mainWindowLayout()->getTabBar(); that->tabBar->setShape(static_cast(tabBarShape)); that->tabBar->setDrawBase(true); -- cgit v0.12 From 6ee3fb750377eeedf161d96fef02c5fa336810e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 30 Jun 2009 13:00:32 +0200 Subject: More re-factoring of QGraphicsSceneIndex. Mostly re-factoring of QGraphicsSceneIndexPrivate::recursive_items_helper so it can re-use code from the scene (topLevelItemsInStackingOrder). That also means we'll use the bsp tree in case of NoIndex instead of always looping through the top-levels. This function is now almost identical to QGraphicsScenePrivate::drawSubtreeRecursive, so it might be worth looking into how we can abstract it even more and have one common recursive function. --- src/gui/graphicsview/qgraphicsscene.cpp | 20 +--- src/gui/graphicsview/qgraphicsscene_p.h | 11 +- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 12 +-- src/gui/graphicsview/qgraphicssceneindex.cpp | 115 ++++++++------------- src/gui/graphicsview/qgraphicssceneindex_p.h | 34 ++++-- 5 files changed, 89 insertions(+), 103 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index f1e56c1..faacf4d 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -217,8 +217,9 @@ #include "qgraphicsview_p.h" #include "qgraphicswidget.h" #include "qgraphicswidget_p.h" -#include -#include +#include "qgraphicssceneindex_p.h" +#include "qgraphicsscenebsptreeindex_p.h" +#include "qgraphicsscenelinearindex_p.h" #include #include @@ -243,7 +244,6 @@ #include #include #include -#include #include #ifdef Q_WS_X11 #include @@ -1075,9 +1075,9 @@ QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item) } QList QGraphicsScenePrivate::topLevelItemsInStackingOrder(const QTransform *const viewTransform, - QRegion *exposedRegion) + const QRectF &sceneRect) { - if (indexMethod == QGraphicsScene::NoIndex || !exposedRegion) { + if (indexMethod == QGraphicsScene::NoIndex || sceneRect.isNull()) { if (needSortTopLevelItems) { needSortTopLevelItems = false; qStableSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf); @@ -1085,16 +1085,6 @@ QList QGraphicsScenePrivate::topLevelItemsInStackingOrder(const return topLevelItems; } - const QRectF exposedRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); - QRectF sceneRect; - QTransform invertedViewTransform(Qt::Uninitialized); - if (!viewTransform) { - sceneRect = exposedRect; - } else { - invertedViewTransform = viewTransform->inverted(); - sceneRect = invertedViewTransform.mapRect(exposedRect); - } - QList tmp = index->estimateItems(sceneRect, Qt::SortOrder(-1), viewTransform ? *viewTransform : QTransform()); for (int i = 0; i < tmp.size(); ++i) { diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index f286a8d..b3d7535 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -57,7 +57,6 @@ #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW -#include "qgraphicsscenebsptreeindex_p.h" #include "qgraphicsview.h" #include "qgraphicsitem_p.h" @@ -187,7 +186,7 @@ public: QGraphicsWidget *windowForItem(const QGraphicsItem *item) const; bool sortCacheEnabled; // for compatibility - QList topLevelItemsInStackingOrder(const QTransform *const, QRegion *); + QList topLevelItemsInStackingOrder(const QTransform *const, const QRectF&); void drawItemHelper(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, @@ -196,7 +195,13 @@ public: inline void drawItems(QPainter *painter, const QTransform *const viewTransform, QRegion *exposedRegion, QWidget *widget) { - const QList tli = topLevelItemsInStackingOrder(viewTransform, exposedRegion); + QRectF exposedSceneRect; + if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) { + exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); + if (viewTransform) + exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); + } + const QList tli = topLevelItemsInStackingOrder(viewTransform, exposedSceneRect); for (int i = 0; i < tli.size(); ++i) drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); return; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 850cc3f..90cc8c3 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -39,8 +39,6 @@ ** ****************************************************************************/ -#include - // // W A R N I N G // ------------- @@ -63,13 +61,13 @@ QT_MODULE(Gui) #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW +#include "qgraphicssceneindex_p.h" +#include "qgraphicsitem_p.h" +#include "qgraphicsscene_bsp_p.h" + +#include #include #include -#include -#include -#include -#include -#include static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 88fb6b0..a42dc54 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -61,7 +61,8 @@ #include "qgraphicsitem_p.h" #include "qgraphicsscene_p.h" #include "qgraphicswidget.h" -#include +#include "qgraphicssceneindex_p.h" +#include "qgraphicsscenebsptreeindex_p.h" #ifndef QT_NO_GRAPHICSVIEW @@ -240,91 +241,64 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity) const { - // Calculate opacity. - qreal opacity; - if (item) { - if (!item->d_ptr->visible) - return; + Q_ASSERT(item); + if (!item->d_ptr->visible) + return; - QGraphicsItem *p = item->d_ptr->parent; - bool itemIgnoresParentOpacity = item->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity; - bool parentDoesntPropagateOpacity = (p && (p->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren)); - if (!itemIgnoresParentOpacity && !parentDoesntPropagateOpacity) { - opacity = parentOpacity * item->opacity(); - } else { - opacity = item->d_ptr->opacity; - } - if (opacity == 0.0 && !(item->d_ptr->flags & QGraphicsItem::ItemDoesntPropagateOpacityToChildren)) - return; - } else { - opacity = parentOpacity; - } + const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); + const bool itemIsFullyTransparent = (opacity < 0.0001); + const bool itemHasChildren = !item->d_ptr->children.isEmpty(); + if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) + return; // Calculate the full transform for this item. - QTransform transform = parentTransform; - bool keep = false; - if (item) { - item->d_ptr->combineTransformFromParent(&transform, &viewTransform); - - // ### This does not take the clip into account. - QRectF brect = item->boundingRect(); - _q_adjustRect(&brect); - - //We fill the intersector with needed informations - keep = intersector->intersect(item, exposeRect, mode, transform, viewTransform); - } - - bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); - bool dontProcessItem = !item || !keep; - bool dontProcessChildren = item && dontProcessItem && childClip; + QTransform transform(parentTransform); + item->d_ptr->combineTransformFromParent(&transform, &viewTransform); + + const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); + bool processItem = !itemIsFullyTransparent; + if (processItem) { + processItem = intersector->intersect(item, exposeRect, mode, transform, viewTransform); + if (!processItem && (!itemHasChildren || itemClipsChildrenToShape)) + return; + } // else we know for sure this item has children we must process. - // Find and sort children. - QList &children = item ? item->d_ptr->children : const_cast(scene->d_func())->topLevelItems; - if (!dontProcessChildren) { - if (item && item->d_ptr->needSortChildren) { + int i = 0; + if (itemHasChildren) { + // Sort children. + if (item->d_ptr->needSortChildren) { item->d_ptr->needSortChildren = 0; - qStableSort(children.begin(), children.end(), qt_notclosestLeaf); - } else if (!item && scene->d_func()->needSortTopLevelItems) { - const_cast(scene->d_func())->needSortTopLevelItems = false; - qStableSort(children.begin(), children.end(), qt_notclosestLeaf); + qStableSort(item->d_ptr->children.begin(), item->d_ptr->children.end(), qt_notclosestLeaf); } - } - - childClip &= !dontProcessChildren & !children.isEmpty(); - // Clip. - if (childClip) - exposeRect &= transform.map(item->shape()).controlPointRect(); + // Clip to shape. + if (itemClipsChildrenToShape) + exposeRect &= transform.map(item->shape()).controlPointRect(); - // Process children behind - int i = 0; - if (!dontProcessChildren) { - for (i = 0; i < children.size(); ++i) { - QGraphicsItem *child = children.at(i); + // Process children behind + for (i = 0; i < item->d_ptr->children.size(); ++i) { + QGraphicsItem *child = item->d_ptr->children.at(i); if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) break; + if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) + continue; recursive_items_helper(child, exposeRect, intersector, items, transform, viewTransform, mode, order, opacity); } } // Process item - if (!dontProcessItem) + if (processItem) items->append(item); // Process children in front - if (!dontProcessChildren) { - for (; i < children.size(); ++i) - recursive_items_helper(children.at(i), exposeRect, intersector, items, transform, viewTransform, + if (itemHasChildren) { + for (; i < item->d_ptr->children.size(); ++i) { + QGraphicsItem *child = item->d_ptr->children.at(i); + if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) + continue; + recursive_items_helper(child, exposeRect, intersector, items, transform, viewTransform, mode, order, opacity); - } - - if (!item && order == Qt::AscendingOrder) { - int n = items->size(); - for (int i = 0; i < n / 2; ++i) { - QGraphicsItem *tmp = (*items)[n - i - 1]; - (*items)[n - i - 1] = (*items)[i]; - (*items)[i] = tmp; } } } @@ -393,8 +367,7 @@ QList QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe Q_D(const QGraphicsSceneIndex); QList itemList; d->pointIntersector->scenePoint = pos; - d->recursive_items_helper(0, QRectF(pos, QSizeF(1, 1)), d->pointIntersector, &itemList, - QTransform(), deviceTransform, mode, order); + d->items_helper(QRectF(pos, QSizeF(1, 1)), d->pointIntersector, &itemList, deviceTransform, mode, order); return itemList; } @@ -428,7 +401,7 @@ QList QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe _q_adjustRect(&exposeRect); QList itemList; d->rectIntersector->sceneRect = rect; - d->recursive_items_helper(0, exposeRect, d->rectIntersector, &itemList, QTransform(), deviceTransform, mode, order); + d->items_helper(exposeRect, d->rectIntersector, &itemList, deviceTransform, mode, order); return itemList; } @@ -464,7 +437,7 @@ QList QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt:: QPainterPath path; path.addPolygon(polygon); d->pathIntersector->scenePath = path; - d->recursive_items_helper(0, exposeRect, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); + d->items_helper(exposeRect, d->pathIntersector, &itemList, deviceTransform, mode, order); return itemList; } @@ -498,7 +471,7 @@ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt:: QRectF exposeRect = path.controlPointRect(); _q_adjustRect(&exposeRect); d->pathIntersector->scenePath = path; - d->recursive_items_helper(0, exposeRect, d->pathIntersector, &itemList, QTransform(), deviceTransform, mode, order); + d->items_helper(exposeRect, d->pathIntersector, &itemList, deviceTransform, mode, order); return itemList; } diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index dc6a740..122d7ae 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -53,11 +53,13 @@ // We mean it. // +#include "qgraphicsscene_p.h" +#include "qgraphicsscene.h" +#include + #include #include #include -#include -#include QT_BEGIN_HEADER @@ -67,7 +69,6 @@ QT_MODULE(Gui) #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW -class QGraphicsScene; class QGraphicsSceneIndexIntersector; class QGraphicsSceneIndexPointIntersector; class QGraphicsSceneIndexRectIntersector; @@ -138,12 +139,31 @@ public: QGraphicsSceneIndexIntersector *intersector, QList *items, const QTransform &parentTransform, const QTransform &viewTransform, Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const; - QGraphicsScene *scene; - QGraphicsSceneIndexPointIntersector *pointIntersector; - QGraphicsSceneIndexRectIntersector *rectIntersector; - QGraphicsSceneIndexPathIntersector *pathIntersector; + inline void items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector *intersector, + QList *items, const QTransform &viewTransform, + Qt::ItemSelectionMode mode, Qt::SortOrder order) const; + + QGraphicsScene *scene; + QGraphicsSceneIndexPointIntersector *pointIntersector; + QGraphicsSceneIndexRectIntersector *rectIntersector; + QGraphicsSceneIndexPathIntersector *pathIntersector; }; +inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector *intersector, + QList *items, const QTransform &viewTransform, + Qt::ItemSelectionMode mode, Qt::SortOrder order) const +{ + const QList tli = scene->d_func()->topLevelItemsInStackingOrder(&viewTransform, rect); + const QTransform identity; + for (int i = 0; i < tli.size(); ++i) + recursive_items_helper(tli.at(i), rect, intersector, items, identity, viewTransform, mode, order); + if (order == Qt::AscendingOrder) { + const int n = items->size(); + for (int i = 0; i < n / 2; ++i) + items->swap(i, n - i - 1); + } +} + class QGraphicsSceneIndexIntersector { public: -- cgit v0.12 From 79ea2c5956f0200fc8754f82b83ca8433c11008a Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 30 Jun 2009 15:16:41 +0200 Subject: Doc: Fixed a doc bug in QPlainTextEdit class description. Task-number: 256762 Reviewed-by: TrustMe --- src/gui/widgets/qplaintextedit.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 465b377..7c077df 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -999,14 +999,13 @@ void QPlainTextEditPrivate::ensureViewportLayouted() QPlainText uses very much the same technology and concepts as QTextEdit, but is optimized for plain text handling. - QPlainTextEdit works on paragraphs and characters. A paragraph is a - formatted string which is word-wrapped to fit into the width of + QPlainTextEdit works on paragraphs and characters. A paragraph is + a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signifies a paragraph. A document consists of zero or more - paragraphs. The words in the paragraph are aligned in accordance - with the paragraph's alignment. Paragraphs are separated by hard - line breaks. Each character within a paragraph has its own - attributes, for example, font and color. + paragraphs. Paragraphs are separated by hard line breaks. Each + character within a paragraph has its own attributes, for example, + font and color. The shape of the mouse cursor on a QPlainTextEdit is Qt::IBeamCursor by default. It can be changed through the @@ -1148,7 +1147,8 @@ void QPlainTextEditPrivate::ensureViewportLayouted() \sa QTextDocument, QTextCursor, {Application Example}, - {Syntax Highlighter Example}, {Rich Text Processing} + {Code Editor Example}, {Syntax Highlighter Example}, + {Rich Text Processing} */ -- cgit v0.12 From 771a6a8fd6a31905859a40b729eac872efb20285 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 30 Jun 2009 15:19:10 +0200 Subject: Linguist: defers the creation of the QPrinter On windows, if your default printer is not reachable it would take a lot of time to fail to construct the print engine. During that time the UI would be frozen on the splash screen. Reviewed-by: ossi --- tools/linguist/linguist/mainwindow.cpp | 22 ++++++++++++++++------ tools/linguist/linguist/mainwindow.h | 6 ++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 2b1df39..bb79b19 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -82,6 +82,7 @@ #include #include #include +#include #include #include #include @@ -257,6 +258,7 @@ bool FocusWatcher::eventFilter(QObject *, QEvent *event) MainWindow::MainWindow() : QMainWindow(0, Qt::Window), m_assistantProcess(0), + m_printer(0), m_findMatchCase(Qt::CaseInsensitive), m_findIgnoreAccelerators(true), m_findWhere(DataModel::NoLocation), @@ -503,6 +505,7 @@ MainWindow::~MainWindow() qDeleteAll(m_phraseBooks); delete m_dataModel; delete m_statistics; + delete m_printer; } void MainWindow::modelCountChanged() @@ -870,15 +873,22 @@ void MainWindow::releaseAll() releaseInternal(i); } +QPrinter *MainWindow::printer() +{ + if (!m_printer) + m_printer = new QPrinter; + return m_printer; +} + void MainWindow::print() { int pageNum = 0; - QPrintDialog dlg(&m_printer, this); + QPrintDialog dlg(printer(), this); if (dlg.exec()) { QApplication::setOverrideCursor(Qt::WaitCursor); - m_printer.setDocName(m_dataModel->condensedSrcFileNames(true)); + printer()->setDocName(m_dataModel->condensedSrcFileNames(true)); statusBar()->showMessage(tr("Printing...")); - PrintOut pout(&m_printer); + PrintOut pout(printer()); for (int i = 0; i < m_dataModel->contextCount(); ++i) { MultiContextItem *mc = m_dataModel->multiContextItem(i); @@ -1229,11 +1239,11 @@ void MainWindow::printPhraseBook(QAction *action) int pageNum = 0; - QPrintDialog dlg(&m_printer, this); + QPrintDialog dlg(printer(), this); if (dlg.exec()) { - m_printer.setDocName(phraseBook->fileName()); + printer()->setDocName(phraseBook->fileName()); statusBar()->showMessage(tr("Printing...")); - PrintOut pout(&m_printer); + PrintOut pout(printer()); pout.setRule(PrintOut::ThinRule); foreach (const Phrase *p, phraseBook->phrases()) { pout.setGuide(p->source()); diff --git a/tools/linguist/linguist/mainwindow.h b/tools/linguist/linguist/mainwindow.h index 167dfe4..3dedcb5 100644 --- a/tools/linguist/linguist/mainwindow.h +++ b/tools/linguist/linguist/mainwindow.h @@ -51,7 +51,6 @@ #include #include -#include QT_BEGIN_NAMESPACE @@ -60,6 +59,7 @@ class QAction; class QDialog; class QLabel; class QMenu; +class QPrinter; class QProcess; class QIcon; class QSortFilterProxyModel; @@ -200,6 +200,8 @@ private: void releaseInternal(int model); void saveInternal(int model); + QPrinter *printer(); + // FIXME: move to DataModel void updateDanger(const MultiDataIndex &index, bool verbose); @@ -226,7 +228,7 @@ private: QList > > m_phraseDict; QList m_phraseBooks; QMap m_phraseBookMenu[3]; - QPrinter m_printer; + QPrinter *m_printer; FindDialog *m_findDialog; QString m_findText; -- cgit v0.12 From 99bea47fd9b868fb22f175943c11ecb05b51f07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 30 Jun 2009 15:54:19 +0200 Subject: Fix broken tst_QGraphicsView::embeddedViews. This test has been broken after 32f32ee3e752a6cc03505ddaa48d2849eaedc2a6, but the test continued to pass because another bug, which is fixed by 6ee3fb750377eeedf161d96fef02c5fa336810e9. The transform should be exactly the same in both cases. --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 65e066f..6db8f27 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2989,14 +2989,7 @@ void tst_QGraphicsView::embeddedViews() v2->QWidget::render(&actual); QTransform b = item->transform; -#ifdef Q_WS_MAC - // We don't use shared painter on the Mac, so the - // transform should be exactly the same. QVERIFY(a == b); -#else - QVERIFY(a != b); -#endif - delete v1; } -- cgit v0.12 From 6c3412bf598c2bcf8863c08e16d7a80b119ff116 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 30 Jun 2009 15:58:58 +0200 Subject: add basic tests for QVariant/QObject qtscript integration Some of the more advanced tests will fail for non-obvious reasons if these basic assumptions don't hold. --- tests/auto/qscriptqobject/tst_qscriptqobject.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp index d8db7b7..14d3283 100644 --- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp +++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp @@ -736,6 +736,8 @@ void tst_QScriptExtQObject::getSetStaticProperty() // test that we do value conversion if necessary when setting properties { QScriptValue br = m_engine->evaluate("myObject.brushProperty"); + QVERIFY(br.isVariant()); + QVERIFY(!br.strictlyEquals(m_engine->evaluate("myObject.brushProperty"))); QCOMPARE(qscriptvalue_cast(br), m_myObject->brushProperty()); QCOMPARE(qscriptvalue_cast(br), m_myObject->brushProperty().color()); @@ -838,6 +840,14 @@ void tst_QScriptExtQObject::getSetStaticProperty() mobj.setProperty("intProperty", m_engine->newFunction(getSetProperty), QScriptValue::PropertyGetter | QScriptValue::PropertySetter); } + + // method properties are persistent + { + QScriptValue slot = m_engine->evaluate("myObject.mySlot"); + QVERIFY(slot.isFunction()); + QScriptValue sameSlot = m_engine->evaluate("myObject.mySlot"); + QVERIFY(sameSlot.strictlyEquals(slot)); + } } void tst_QScriptExtQObject::getSetDynamicProperty() -- cgit v0.12 From 3a00930fe167e6db5588d9e93d429486f9591bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 30 Jun 2009 16:15:28 +0200 Subject: More BSP tree index cleanup. Ensure the index of indexed items are reset to -1. Makes tst_QGraphicsScene::itemIndexMethod happy. (this test passed before we actually started using the BSP from the items() functions, see 6ee3fb750377eeedf161d96fef02c5fa336810e9) --- src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | 12 ++++++++++++ src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 413c8de..ff9a3da 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -468,6 +468,18 @@ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene) } +QGraphicsSceneBspTreeIndex::~QGraphicsSceneBspTreeIndex() +{ + Q_D(QGraphicsSceneBspTreeIndex); + for (int i = 0; i < d->indexedItems.size(); ++i) { + // Ensure item bits are reset properly. + if (QGraphicsItem *item = d->indexedItems.at(i)) { + Q_ASSERT(!item->d_ptr->itemDiscovered); + item->d_ptr->index = -1; + } + } +} + /*! \reimp Clear the all the BSP index. diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 90cc8c3..7b431e6 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -80,6 +80,7 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) public: QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); + ~QGraphicsSceneBspTreeIndex(); QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; -- cgit v0.12 From 53ef0b0f8b1227cff6ce4c9e2a91a6fbc7e7ee3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 30 Jun 2009 16:19:25 +0200 Subject: Make QGraphicsSceneIndex::clear() less nasty. --- src/gui/graphicsview/qgraphicssceneindex.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index a42dc54..2f2f05e 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -521,8 +521,9 @@ void QGraphicsSceneIndex::updateSceneRect(const QRectF &rect) */ void QGraphicsSceneIndex::clear() { - for (int i = 0 ; i < items().size(); ++i) - removeItem(items().at(i)); + const QList allItems = items(); + for (int i = 0 ; i < allItems.size(); ++i) + removeItem(allItems.at(i)); } /*! -- cgit v0.12 From 3687425e541bd5f78c7baf63cfa5b1ba4d9ad29e Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Tue, 30 Jun 2009 16:52:11 +0200 Subject: Doc - some minor fixes on the sentences Reviewed-By: TrustMe --- doc/src/tutorials/addressbook.qdoc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index 2f6cec2..23dabb3 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -697,10 +697,11 @@ \snippet tutorials/addressbook/part5/finddialog.h FindDialog header - We define a public function, \c getFindText() for use by classes that - instantiate \c FindDialog, which allows them to obtain the text - entered by the user. A public slot, \c findClicked(), is defined to - handle the search string when the user clicks the \gui Find button. + We define a public function, \c getFindText(), to be used by classes that + instantiate \c FindDialog. This function allows these classes to obtain the + search string entered by the user. A public slot, \c findClicked(), is also + defined to handle the search string when the user clicks the \gui Find + button. Lastly, we define the private variables, \c findButton, \c lineEdit and \c findText, corresponding to the \gui Find button, the line edit @@ -715,15 +716,15 @@ \snippet tutorials/addressbook/part5/finddialog.cpp constructor - We set the layout and window title, as well as connect the signals - to their respective slots. Notice that \c{findButton}'s - \l{QPushButton::clicked()}{clicked()} signal is connected to to - \c findClicked() and \l{QDialog::accept()}{accept()}. The - \l{QDialog::accept()}{accept()} slot provided by QDialog hides - the dialog and sets the result code to \l{QDialog::}{Accepted}. - We use this function to help \c{AddressBook}'s \c findContact() function - know when the \c FindDialog object has been closed. This will be - further explained when discussing the \c findContact() function. + We set the layout and window title, as well as connect the signals to their + respective slots. Notice that \c{findButton}'s \l{QPushButton::clicked()} + {clicked()} signal is connected to to \c findClicked() and + \l{QDialog::accept()}{accept()}. The \l{QDialog::accept()}{accept()} slot + provided by QDialog hides the dialog and sets the result code to + \l{QDialog::}{Accepted}. We use this function to help \c{AddressBook}'s + \c findContact() function know when the \c FindDialog object has been + closed. We will explain this logic in further detail when discussing the + \c findContact() function. \image addressbook-tutorial-part5-signals-and-slots.png -- cgit v0.12 From 5d40eff80123b2739987fbf7fc720b0c6ad91226 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 30 Jun 2009 17:04:36 +0200 Subject: Doc: Said which formats we support for a QIODevice driven MediaSource Task-number: 253902 Reviewed-by: Thierry Bastian --- doc/src/phonon-api.qdoc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/src/phonon-api.qdoc b/doc/src/phonon-api.qdoc index 9d49c3f..66314de 100644 --- a/doc/src/phonon-api.qdoc +++ b/doc/src/phonon-api.qdoc @@ -1114,6 +1114,11 @@ \note Sequential devices can also be used, but MediaObject::isSeekable() will return false as a result. + \warning On Windows, we only support \l{QIODevice}s containing the + \c avi, \c mp3, or \c mpg formats. Use the constructor that takes + a file name to open files (the Qt backend does not use a QFile + internally). + \sa setAutoDelete() */ @@ -1863,7 +1868,7 @@ \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 14 - \sa currentSource() + \sa currentSource(), MediaSource */ /*! -- cgit v0.12 From 11ee32888b1b2370c70708e1385c26dc3a0a367c Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 30 Jun 2009 17:07:16 +0200 Subject: Fix Toolbars in unified toolbar looking bad Carbon w/Fullscreen changes There was a bug in the Carbon code when an item went in full-screen, than out with a unified toolbar. In those cases the toolbars would end up getting but into the mainwindow area. The reason this was happening was that we were calling transferChildren() after we had set up our toolbar. This cause problems because we end up pulling the QToolbars right out of the unified toolbar. The easiest way to solve this is to just update the status on it again. This should solve any issues. I also added some logic to avoid calling this too many times in that one case. Luckily, this seems to only affect Carbon. Task-number: 254462 Reviewed-by: Jens Bache-Wiig --- src/gui/kernel/qwidget_mac.mm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 1c71fbd..ec9a049 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2730,10 +2730,15 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) createWinId(); if (q->isWindow()) { #ifndef QT_MAC_USE_COCOA - if (QMainWindowLayout *mwl = qobject_cast(q->layout())) { - mwl->updateHIToolBarStatus(); + // We do this down below for wasCreated, so avoid doing this twice + // (only for performance, it gets called a lot anyway). + if (!wasCreated) { + if (QMainWindowLayout *mwl = qobject_cast(q->layout())) { + mwl->updateHIToolBarStatus(); + } } #else + // Simply transfer our toolbar over. Everything should stay put, unlike in Carbon. if (oldToolbar && !(f & Qt::FramelessWindowHint)) { OSWindowRef newWindow = qt_mac_window_for(q); [newWindow setToolbar:oldToolbar]; @@ -2748,6 +2753,16 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) if (wasCreated) { transferChildren(); +#ifndef QT_MAC_USE_COCOA + // If we were a unified window, We just transfered our toolbars out of the unified toolbar. + // So redo the status one more time. It apparently is not an issue with Cocoa. + if (q->isWindow()) { + if (QMainWindowLayout *mwl = qobject_cast(q->layout())) { + mwl->updateHIToolBarStatus(); + } + } +#endif + if (topData && (!topData->caption.isEmpty() || !topData->filePath.isEmpty())) setWindowTitle_helper(q->windowTitle()); -- cgit v0.12 From cd796aa6dcdf83fa50ced56a9885835fda851a09 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Jun 2009 16:17:56 +0200 Subject: integrate linguist tool autotests into the qt testsuite Task-number: 218935 --- tests/auto/auto.pro | 1 + tests/auto/linguist/lconvert/data/codec-cp1252.ts | 28 ++ tests/auto/linguist/lconvert/data/codec-utf8.ts | 28 ++ tests/auto/linguist/lconvert/data/dual-encoding.ts | 11 + .../auto/linguist/lconvert/data/endless-po-loop.ts | 16 ++ tests/auto/linguist/lconvert/data/makeplurals.sh | 43 +++ tests/auto/linguist/lconvert/data/msgid.ts | 27 ++ tests/auto/linguist/lconvert/data/plurals-cn.ts | 17 ++ tests/auto/linguist/lconvert/data/plurals-de.ts | 18 ++ tests/auto/linguist/lconvert/data/relative.ts | 74 +++++ tests/auto/linguist/lconvert/data/singular.po | 42 +++ .../linguist/lconvert/data/test-broken-utf8.po | 9 + .../linguist/lconvert/data/test-broken-utf8.po.out | 9 + .../lconvert/data/test-developer-comment.po | 23 ++ .../linguist/lconvert/data/test-empty-comment.po | 24 ++ tests/auto/linguist/lconvert/data/test-escapes.po | 11 + .../linguist/lconvert/data/test-escapes.po.out | 13 + tests/auto/linguist/lconvert/data/test-kde-ctxt.po | 25 ++ .../auto/linguist/lconvert/data/test-kde-fuzzy.po | 31 +++ .../linguist/lconvert/data/test-kde-multiline.po | 32 +++ .../linguist/lconvert/data/test-kde-plurals.po | 27 ++ tests/auto/linguist/lconvert/data/test-slurp.po | 19 ++ .../auto/linguist/lconvert/data/test-slurp.po.out | 19 ++ .../lconvert/data/test-translator-comment.po | 41 +++ tests/auto/linguist/lconvert/data/test1-cn.po | 67 +++++ tests/auto/linguist/lconvert/data/test1-de.po | 75 ++++++ tests/auto/linguist/lconvert/data/test11.ts | 32 +++ tests/auto/linguist/lconvert/data/test20.ts | 150 +++++++++++ tests/auto/linguist/lconvert/data/variants.ts | 24 ++ tests/auto/linguist/lconvert/data/wrapping.po | 58 ++++ tests/auto/linguist/lconvert/lconvert.pro | 8 + tests/auto/linguist/lconvert/tst_lconvert.cpp | 300 +++++++++++++++++++++ tests/auto/linguist/linguist.pro | 2 + tests/auto/linguist/lrelease/lrelease.pro | 5 + .../auto/linguist/lrelease/testdata/compressed.ts | 46 ++++ tests/auto/linguist/lrelease/testdata/dupes.errors | 4 + tests/auto/linguist/lrelease/testdata/dupes.ts | 25 ++ .../linguist/lrelease/testdata/mixedcodecs-ts11.ts | 18 ++ .../linguist/lrelease/testdata/mixedcodecs-ts20.ts | 18 ++ tests/auto/linguist/lrelease/testdata/translate.ts | 136 ++++++++++ tests/auto/linguist/lrelease/tst_lrelease.cpp | 163 +++++++++++ tests/auto/linguist/lupdate/lupdate.pro | 7 + .../lupdate/testdata/good/backslashes/lupdatecmd | 3 + .../lupdate/testdata/good/backslashes/project.pro | 19 ++ .../testdata/good/backslashes/project.ts.result | 13 + .../lupdate/testdata/good/backslashes/src/main.cpp | 15 ++ .../lupdate/testdata/good/codecforsrc/main.cpp | 18 ++ .../lupdate/testdata/good/codecforsrc/project.pro | 20 ++ .../testdata/good/codecforsrc/project.ts.result | 20 ++ .../lupdate/testdata/good/codecfortr/main.cpp | 24 ++ .../lupdate/testdata/good/codecfortr/project.pro | 19 ++ .../testdata/good/codecfortr/project.ts.result | 13 + .../lupdate/testdata/good/codecfortr1/main.cpp | 20 ++ .../lupdate/testdata/good/codecfortr1/project.pro | 15 ++ .../testdata/good/codecfortr1/project.ts.result | 28 ++ .../lupdate/testdata/good/codecfortr2/main.cpp | 20 ++ .../lupdate/testdata/good/codecfortr2/project.pro | 16 ++ .../testdata/good/codecfortr2/project.ts.result | 28 ++ .../testdata/good/lacksqobject/expectedoutput.txt | 4 + .../lupdate/testdata/good/lacksqobject/main.cpp | 47 ++++ .../lupdate/testdata/good/lacksqobject/project.pro | 12 + .../testdata/good/lacksqobject/project.ts.result | 40 +++ .../lupdate/testdata/good/merge_ordering/foo.cpp | 28 ++ .../testdata/good/merge_ordering/lupdatecmd | 5 + .../testdata/good/merge_ordering/project.pro | 14 + .../testdata/good/merge_ordering/project.ts.before | 74 +++++ .../testdata/good/merge_ordering/project.ts.result | 82 ++++++ .../testdata/good/merge_versions/project.pro | 14 + .../testdata/good/merge_versions/project.ts.before | 14 + .../testdata/good/merge_versions/project.ts.result | 15 ++ .../testdata/good/merge_versions/project.ui | 44 +++ .../testdata/good/merge_whitespace/main.cpp | 23 ++ .../testdata/good/merge_whitespace/project.pro | 14 + .../good/merge_whitespace/project.ts.before | 70 +++++ .../good/merge_whitespace/project.ts.result | 71 +++++ .../lupdate/testdata/good/mergecpp/finddialog.cpp | 25 ++ .../lupdate/testdata/good/mergecpp/project.pro | 14 + .../testdata/good/mergecpp/project.ts.before | 48 ++++ .../testdata/good/mergecpp/project.ts.result | 49 ++++ .../good/mergecpp_noobsolete/finddialog.cpp | 123 +++++++++ .../testdata/good/mergecpp_noobsolete/lupdatecmd | 5 + .../testdata/good/mergecpp_noobsolete/project.pro | 14 + .../good/mergecpp_noobsolete/project.ts.before | 31 +++ .../good/mergecpp_noobsolete/project.ts.result | 27 ++ .../testdata/good/mergecpp_obsolete/finddialog.cpp | 146 ++++++++++ .../testdata/good/mergecpp_obsolete/project.pro | 14 + .../good/mergecpp_obsolete/project.ts.before | 26 ++ .../good/mergecpp_obsolete/project.ts.result | 31 +++ .../lupdate/testdata/good/mergeui/project.pro | 14 + .../testdata/good/mergeui/project.ts.before | 22 ++ .../testdata/good/mergeui/project.ts.result | 23 ++ .../lupdate/testdata/good/mergeui/project.ui | 47 ++++ .../testdata/good/mergeui_obsolete/project.pro | 14 + .../good/mergeui_obsolete/project.ts.before | 16 ++ .../good/mergeui_obsolete/project.ts.result | 22 ++ .../testdata/good/mergeui_obsolete/project.ui | 26 ++ .../good/multiple_locations/finddialog.cpp | 7 + .../testdata/good/multiple_locations/main.cpp | 13 + .../testdata/good/multiple_locations/project.pro | 13 + .../good/multiple_locations/project.ts.result | 17 ++ .../lupdate/testdata/good/namespaces/main.cpp | 97 +++++++ .../lupdate/testdata/good/namespaces/project.pro | 12 + .../testdata/good/namespaces/project.ts.result | 82 ++++++ .../testdata/good/parse_special_chars/main.cpp | 18 ++ .../testdata/good/parse_special_chars/project.pro | 12 + .../good/parse_special_chars/project.ts.result | 17 ++ .../lupdate/testdata/good/parsecontexts/main.cpp | 229 ++++++++++++++++ .../testdata/good/parsecontexts/project.pro | 12 + .../testdata/good/parsecontexts/project.ts.result | 192 +++++++++++++ .../lupdate/testdata/good/parsecpp/finddialog.cpp | 156 +++++++++++ .../lupdate/testdata/good/parsecpp/main.cpp | 158 +++++++++++ .../lupdate/testdata/good/parsecpp/project.pro | 13 + .../testdata/good/parsecpp/project.ts.result | 271 +++++++++++++++++++ .../lupdate/testdata/good/parsejava/main.java | 54 ++++ .../lupdate/testdata/good/parsejava/project.pro | 12 + .../testdata/good/parsejava/project.ts.result | 115 ++++++++ .../lupdate/testdata/good/parseui/project.pro | 13 + .../testdata/good/parseui/project.ts.result | 17 ++ .../lupdate/testdata/good/parseui/project.ui | 44 +++ .../linguist/lupdate/testdata/good/prefix/main.cpp | 17 ++ .../lupdate/testdata/good/prefix/project.pro | 12 + .../lupdate/testdata/good/prefix/project.ts.result | 23 ++ .../lupdate/testdata/good/preprocess/main.cpp | 37 +++ .../lupdate/testdata/good/preprocess/project.pro | 12 + .../testdata/good/preprocess/project.ts.result | 35 +++ .../lupdate/testdata/good/proparsing/main.cpp | 9 + .../lupdate/testdata/good/proparsing/main_mac.cpp | 10 + .../lupdate/testdata/good/proparsing/main_unix.cpp | 10 + .../lupdate/testdata/good/proparsing/main_win.cpp | 10 + .../lupdate/testdata/good/proparsing/project.pro | 40 +++ .../testdata/good/proparsing/project.ts.result | 64 +++++ .../vpaths/dependpath/main_dependpath.cpp | 10 + .../testdata/good/proparsing/wildcard/main1.cpp | 9 + .../testdata/good/proparsing/wildcard/mainfile.cpp | 9 + .../lupdate/testdata/good/proparsing/wildcard1.cpp | 9 + .../testdata/good/proparsing/wildcard99.cpp | 9 + .../linguist/lupdate/testdata/good/proparsing2/a | 4 + .../lupdate/testdata/good/proparsing2/a.cpp | 4 + .../linguist/lupdate/testdata/good/proparsing2/b | 4 + .../lupdate/testdata/good/proparsing2/b.cpp | 4 + .../linguist/lupdate/testdata/good/proparsing2/e | 4 + .../lupdate/testdata/good/proparsing2/f/g.cpp | 4 + .../lupdate/testdata/good/proparsing2/files-cc.txt | 1 + .../lupdate/testdata/good/proparsing2/project.pro | 42 +++ .../testdata/good/proparsing2/project.ts.result | 62 +++++ .../lupdate/testdata/good/proparsing2/spaces/z | 4 + .../testdata/good/proparsing2/variable_with_spaces | 4 + .../lupdate/testdata/good/proparsing2/with | 4 + .../linguist/lupdate/testdata/good/proparsing2/x/d | 4 + .../lupdate/testdata/good/proparsing2/x/variable | 4 + .../testdata/good/proparsingpri/common/common.pri | 1 + .../testdata/good/proparsingpri/common/main.cpp | 9 + .../testdata/good/proparsingpri/common/main.pri | 5 + .../testdata/good/proparsingpri/mac/mac.pri | 5 + .../testdata/good/proparsingpri/mac/main_mac.cpp | 10 + .../testdata/good/proparsingpri/project.pro | 16 ++ .../testdata/good/proparsingpri/project.ts.result | 37 +++ .../good/proparsingpri/relativity/relativity.cpp | 9 + .../good/proparsingpri/relativity/relativity.pri | 3 + .../good/proparsingpri/relativity/sub/sub.pri | 1 + .../good/proparsingpri/relativity/sub2/sub2.pri | 2 + .../testdata/good/proparsingpri/unix/main_unix.cpp | 10 + .../testdata/good/proparsingpri/unix/unix.pri | 5 + .../testdata/good/proparsingpri/win/main_win.cpp | 10 + .../testdata/good/proparsingpri/win/win.pri | 5 + .../testdata/good/proparsingsubdirs/project.pro | 3 + .../good/proparsingsubdirs/project.ts.result | 13 + .../testdata/good/proparsingsubdirs/sub1/main.cpp | 9 + .../testdata/good/proparsingsubdirs/sub1/sub1.pro | 12 + .../testdata/good/proparsingsubs/common/common.pro | 5 + .../testdata/good/proparsingsubs/common/main.cpp | 9 + .../testdata/good/proparsingsubs/mac/mac.pro | 5 + .../testdata/good/proparsingsubs/mac/main_mac.cpp | 10 + .../testdata/good/proparsingsubs/project.pro | 7 + .../testdata/good/proparsingsubs/project.ts.result | 31 +++ .../good/proparsingsubs/unix/main_unix.cpp | 10 + .../testdata/good/proparsingsubs/unix/unix.pro | 5 + .../testdata/good/proparsingsubs/win/main_win.cpp | 10 + .../testdata/good/proparsingsubs/win/win.pro | 5 + .../testdata/good/textsimilarity/project.pro | 14 + .../testdata/good/textsimilarity/project.ts.before | 16 ++ .../testdata/good/textsimilarity/project.ts.result | 22 ++ .../testdata/good/textsimilarity/project.ui | 26 ++ .../linguist/lupdate/testdata/output_ts/lupdatecmd | 5 + .../lupdate/testdata/output_ts/project.ts.result | 12 + .../output_ts/toplevel/library/tools/main.cpp | 9 + .../output_ts/toplevel/library/tools/tools.pro | 12 + .../toplevel/library/tools/translations/readme.txt | 2 + .../lupdate/testdata/recursivescan/bar.ts.result | 27 ++ .../lupdate/testdata/recursivescan/foo.ts.result | 115 ++++++++ .../lupdate/testdata/recursivescan/main.cpp | 22 ++ .../lupdate/testdata/recursivescan/project.ui | 44 +++ .../testdata/recursivescan/sub/filetypes/main.c++ | 8 + .../testdata/recursivescan/sub/filetypes/main.cpp | 8 + .../testdata/recursivescan/sub/filetypes/main.cxx | 8 + .../testdata/recursivescan/sub/finddialog.cpp | 143 ++++++++++ tests/auto/linguist/lupdate/testlupdate.cpp | 116 ++++++++ tests/auto/linguist/lupdate/testlupdate.h | 46 ++++ tests/auto/linguist/lupdate/tst_lupdate.cpp | 277 +++++++++++++++++++ tests/auto/tests.xml | 6 + 200 files changed, 6573 insertions(+) create mode 100644 tests/auto/linguist/lconvert/data/codec-cp1252.ts create mode 100644 tests/auto/linguist/lconvert/data/codec-utf8.ts create mode 100644 tests/auto/linguist/lconvert/data/dual-encoding.ts create mode 100644 tests/auto/linguist/lconvert/data/endless-po-loop.ts create mode 100755 tests/auto/linguist/lconvert/data/makeplurals.sh create mode 100644 tests/auto/linguist/lconvert/data/msgid.ts create mode 100644 tests/auto/linguist/lconvert/data/plurals-cn.ts create mode 100644 tests/auto/linguist/lconvert/data/plurals-de.ts create mode 100644 tests/auto/linguist/lconvert/data/relative.ts create mode 100644 tests/auto/linguist/lconvert/data/singular.po create mode 100644 tests/auto/linguist/lconvert/data/test-broken-utf8.po create mode 100644 tests/auto/linguist/lconvert/data/test-broken-utf8.po.out create mode 100644 tests/auto/linguist/lconvert/data/test-developer-comment.po create mode 100644 tests/auto/linguist/lconvert/data/test-empty-comment.po create mode 100644 tests/auto/linguist/lconvert/data/test-escapes.po create mode 100644 tests/auto/linguist/lconvert/data/test-escapes.po.out create mode 100644 tests/auto/linguist/lconvert/data/test-kde-ctxt.po create mode 100644 tests/auto/linguist/lconvert/data/test-kde-fuzzy.po create mode 100644 tests/auto/linguist/lconvert/data/test-kde-multiline.po create mode 100644 tests/auto/linguist/lconvert/data/test-kde-plurals.po create mode 100644 tests/auto/linguist/lconvert/data/test-slurp.po create mode 100644 tests/auto/linguist/lconvert/data/test-slurp.po.out create mode 100644 tests/auto/linguist/lconvert/data/test-translator-comment.po create mode 100644 tests/auto/linguist/lconvert/data/test1-cn.po create mode 100644 tests/auto/linguist/lconvert/data/test1-de.po create mode 100644 tests/auto/linguist/lconvert/data/test11.ts create mode 100644 tests/auto/linguist/lconvert/data/test20.ts create mode 100644 tests/auto/linguist/lconvert/data/variants.ts create mode 100644 tests/auto/linguist/lconvert/data/wrapping.po create mode 100644 tests/auto/linguist/lconvert/lconvert.pro create mode 100644 tests/auto/linguist/lconvert/tst_lconvert.cpp create mode 100644 tests/auto/linguist/linguist.pro create mode 100644 tests/auto/linguist/lrelease/lrelease.pro create mode 100644 tests/auto/linguist/lrelease/testdata/compressed.ts create mode 100644 tests/auto/linguist/lrelease/testdata/dupes.errors create mode 100644 tests/auto/linguist/lrelease/testdata/dupes.ts create mode 100644 tests/auto/linguist/lrelease/testdata/mixedcodecs-ts11.ts create mode 100644 tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts create mode 100644 tests/auto/linguist/lrelease/testdata/translate.ts create mode 100644 tests/auto/linguist/lrelease/tst_lrelease.cpp create mode 100644 tests/auto/linguist/lupdate/lupdate.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt create mode 100644 tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui create mode 100644 tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsejava/main.java create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsejava/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseui/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseui/project.ui create mode 100644 tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/prefix/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/preprocess/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/a create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/b create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/e create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/files-cc.txt create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/with create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/common.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/mac.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub/sub.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub2/sub2.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/unix.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/win.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before create mode 100644 tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui create mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro create mode 100644 tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/project.ui create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx create mode 100644 tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp create mode 100644 tests/auto/linguist/lupdate/testlupdate.cpp create mode 100644 tests/auto/linguist/lupdate/testlupdate.h create mode 100644 tests/auto/linguist/lupdate/tst_lupdate.cpp diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index a215daa..fd887fd 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -10,6 +10,7 @@ SUBDIRS += _networkselftest \ compile \ compilerwarnings \ exceptionsafety \ + linguist \ macgui \ macplist \ mediaobject \ diff --git a/tests/auto/linguist/lconvert/data/codec-cp1252.ts b/tests/auto/linguist/lconvert/data/codec-cp1252.ts new file mode 100644 index 0000000..5ffa2f3 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/codec-cp1252.ts @@ -0,0 +1,28 @@ + + + +windows-1252 + + FooBar + + + random ascii only + + + + + this contains an umlaut ü &uuml; + + + + + random ascii only in utf8 + + + + + umlaut ü &uuml; in utf8 + + + + diff --git a/tests/auto/linguist/lconvert/data/codec-utf8.ts b/tests/auto/linguist/lconvert/data/codec-utf8.ts new file mode 100644 index 0000000..0ebdbfd --- /dev/null +++ b/tests/auto/linguist/lconvert/data/codec-utf8.ts @@ -0,0 +1,28 @@ + + + +UTF-8 + + FooBar + + + random ascii only + + + + + this contains an umlaut ü &uuml; + + + + + random ascii only in utf8 + + + + + umlaut ü &uuml; in utf8 + + + + diff --git a/tests/auto/linguist/lconvert/data/dual-encoding.ts b/tests/auto/linguist/lconvert/data/dual-encoding.ts new file mode 100644 index 0000000..5023a04 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/dual-encoding.ts @@ -0,0 +1,11 @@ + + + + + + + Mühsam + tedious + + + diff --git a/tests/auto/linguist/lconvert/data/endless-po-loop.ts b/tests/auto/linguist/lconvert/data/endless-po-loop.ts new file mode 100644 index 0000000..6212fbd --- /dev/null +++ b/tests/auto/linguist/lconvert/data/endless-po-loop.ts @@ -0,0 +1,16 @@ + + + + + Assistant + + This is some text which introduces the DonauDampfSchifffahrtsKapitaensMuetzeMitKomischenUltraViolettenFransenUndEinemKnopf + + + + + %n document(s) found. + + + + diff --git a/tests/auto/linguist/lconvert/data/makeplurals.sh b/tests/auto/linguist/lconvert/data/makeplurals.sh new file mode 100755 index 0000000..2e0f375 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/makeplurals.sh @@ -0,0 +1,43 @@ +#! /bin/bash + +function makeit2() +{ + for ((i = 0; i < (1 << $1); i++)); do + echo + test -n "$3" && echo "$3" + echo "msgid \"singular $2 $i\"" + echo "msgid_plural \"plural $2 $i\"" + for ((j = 0; j < $1; j++)); do + tr= + if test $((i & (1 << j))) = 0; then + tr="translated $2 $i $j" + fi + echo "msgstr[$j] \"$tr\"" + done + done +} + +function makeit() +{ + { + cat < ${OUTDIR}plural-$1.po +} + +OUTDIR=$1 +makeit 1 zh_CN +makeit 2 de_DE +makeit 3 pl_PL diff --git a/tests/auto/linguist/lconvert/data/msgid.ts b/tests/auto/linguist/lconvert/data/msgid.ts new file mode 100644 index 0000000..ab65845 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/msgid.ts @@ -0,0 +1,27 @@ + + + + + Dialog2 + + %n files + + + + + + %n cars + + + + + + Age: %1 + + + + func3 + + + + diff --git a/tests/auto/linguist/lconvert/data/plurals-cn.ts b/tests/auto/linguist/lconvert/data/plurals-cn.ts new file mode 100644 index 0000000..966ec77 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/plurals-cn.ts @@ -0,0 +1,17 @@ + + + + + Assistant + + Source + Translation + + + %n document(s) found. + + 1 Dokument gefunden. + + + + diff --git a/tests/auto/linguist/lconvert/data/plurals-de.ts b/tests/auto/linguist/lconvert/data/plurals-de.ts new file mode 100644 index 0000000..6cbadff --- /dev/null +++ b/tests/auto/linguist/lconvert/data/plurals-de.ts @@ -0,0 +1,18 @@ + + + + + Assistant + + Not plural + Kein plural + + + %n document(s) found. + + 1 Dokument gefunden. + %n Dokumente gefunden. + + + + diff --git a/tests/auto/linguist/lconvert/data/relative.ts b/tests/auto/linguist/lconvert/data/relative.ts new file mode 100644 index 0000000..b8eaaca --- /dev/null +++ b/tests/auto/linguist/lconvert/data/relative.ts @@ -0,0 +1,74 @@ + + + + + Foo + + + This is the first entry. + + + + + And a second one on the same line. + + + + + This tr is new. + + + + + + This one moved in from another file. + + + + + Just as this one. + + + + + + Another alien. + + + + + They are coming! + + + + + They are everywhere! + + + + + An earthling again. + + + + + This is from the bottom, too. + + + + + Third string from the bottom. + + + + + Fourth one! + + + + + This string did move from the bottom. + + + + diff --git a/tests/auto/linguist/lconvert/data/singular.po b/tests/auto/linguist/lconvert/data/singular.po new file mode 100644 index 0000000..a0d4019 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/singular.po @@ -0,0 +1,42 @@ +msgid "" +msgstr "" + +msgid "untranslated one" +msgstr "translated" + +#, fuzzy +#| msgid "old untranslated" +msgid "untranslated two" +msgstr "translated" + +#, fuzzy +#| msgid "old untranslated" +msgid "untranslated two b" +msgstr "" + +#, fuzzy +#| msgid "old untranslated" +#| msgid_plural "old untranslated plural" +msgid "untranslated three" +msgstr "translated" + +#, fuzzy +#| msgid "old untranslated" +#| msgid_plural "old untranslated plural" +msgid "untranslated three b" +msgstr "" + +#, fuzzy +#| msgid_plural "old untranslated only plural" +msgid "untranslated four" +msgstr "translated" + +#, fuzzy +#| msgid_plural "old untranslated only plural" +msgid "untranslated four b" +msgstr "" + +#, fuzzy +#| msgctxt "old context" +msgid "untranslated five" +msgstr "translated" diff --git a/tests/auto/linguist/lconvert/data/test-broken-utf8.po b/tests/auto/linguist/lconvert/data/test-broken-utf8.po new file mode 100644 index 0000000..20b58a0 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-broken-utf8.po @@ -0,0 +1,9 @@ +# no comment +msgid "" +msgstr "" + +msgid "this works" +msgstr "das geht: ä" + +msgid "this is broken" +msgstr "das ist kaputt: Ãi" diff --git a/tests/auto/linguist/lconvert/data/test-broken-utf8.po.out b/tests/auto/linguist/lconvert/data/test-broken-utf8.po.out new file mode 100644 index 0000000..c00fd19 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-broken-utf8.po.out @@ -0,0 +1,9 @@ +# no comment +msgid "" +msgstr "" + +msgid "this works" +msgstr "das geht: ä" + +msgid "this is broken" +msgstr "das ist kaputt: i" diff --git a/tests/auto/linguist/lconvert/data/test-developer-comment.po b/tests/auto/linguist/lconvert/data/test-developer-comment.po new file mode 100644 index 0000000..787f312 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-developer-comment.po @@ -0,0 +1,23 @@ +# translation of kdmgreet.po to zh_CN +# Simp. Chinese Translation for kdmgreet. +# Copyright (C) 2001,2003 Free Software Foundation, Inc. +# Gou Zhuang , 2001. +# Xiong Jiang , 2003. +# Yan Shuangchun , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2008-04-22 16:56+0800\n" +"Last-Translator: Lie_Ex \n" +"Language-Team: zh_CN \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. I'm a clever developer. Right? Uhm ... +msgid "User %u will log in in %t" +msgstr "用户 %u 将在 %t 秒åŽç™»å½•" diff --git a/tests/auto/linguist/lconvert/data/test-empty-comment.po b/tests/auto/linguist/lconvert/data/test-empty-comment.po new file mode 100644 index 0000000..ce74c46 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-empty-comment.po @@ -0,0 +1,24 @@ +# translation of kdmgreet.po to zh_CN +# Simp. Chinese Translation for kdmgreet. +# Copyright (C) 2001,2003 Free Software Foundation, Inc. +# Gou Zhuang , 2001. +# Xiong Jiang , 2003. +# Yan Shuangchun , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2008-04-22 16:56+0800\n" +"Last-Translator: Lie_Ex \n" +"Language-Team: zh_CN \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +# +#: themer/kdmlabel.cpp:236 +msgid "User %u will log in in %t" +msgstr "用户 %u 将在 %t 秒åŽç™»å½•" diff --git a/tests/auto/linguist/lconvert/data/test-escapes.po b/tests/auto/linguist/lconvert/data/test-escapes.po new file mode 100644 index 0000000..059dc58 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-escapes.po @@ -0,0 +1,11 @@ +msgid "" +msgstr "" + +msgid "this comes\non a new line" +msgstr "yup" + +msgid "come to \"quote\" me" +msgstr "sure?" + +msgid "\x1a\45\r\t\v\a\b" +msgstr "yup" diff --git a/tests/auto/linguist/lconvert/data/test-escapes.po.out b/tests/auto/linguist/lconvert/data/test-escapes.po.out new file mode 100644 index 0000000..10eefb2 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-escapes.po.out @@ -0,0 +1,13 @@ +msgid "" +msgstr "" + +msgid "" +"this comes\n" +"on a new line" +msgstr "yup" + +msgid "come to \"quote\" me" +msgstr "sure?" + +msgid "\x1a%\r\t\v\a\b" +msgstr "yup" diff --git a/tests/auto/linguist/lconvert/data/test-kde-ctxt.po b/tests/auto/linguist/lconvert/data/test-kde-ctxt.po new file mode 100644 index 0000000..b510538 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-kde-ctxt.po @@ -0,0 +1,25 @@ +# translation of kdmgreet.po to zh_CN +# Simp. Chinese Translation for kdmgreet. +# Copyright (C) 2001,2003 Free Software Foundation, Inc. +# Gou Zhuang , 2001. +# Xiong Jiang , 2003. +# Yan Shuangchun , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2008-04-22 16:56+0800\n" +"Last-Translator: Lie_Ex \n" +"Language-Team: zh_CN \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: kgdialog.cpp:231 +#, kde-format +msgctxt "session (location)" +msgid "%1 (%2)" +msgstr "%1(%2)" diff --git a/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po b/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po new file mode 100644 index 0000000..b3f6e03 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-kde-fuzzy.po @@ -0,0 +1,31 @@ +# translation of kdmgreet.po to German +# Ãœbersetzung von kdmgreet.po ins Deutsche +# Copyright (C) +# Thomas Diehl , 2002, 2003, 2004. +# Stephan Johach , 2005. +# Thomas Reitelbach , 2005, 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2007-12-06 20:50+0100\n" +"Last-Translator: Thomas Reitelbach \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KAider 0.1\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: kgverify.cpp:459 +#, fuzzy, kde-format +#| msgid "" +#| "Logging in %1 ...\n" +#| "\n" +msgid "" +"Logging in %1...\n" +"\n" +msgstr "" +"%1 wird angemeldet ...\n" +"\n" diff --git a/tests/auto/linguist/lconvert/data/test-kde-multiline.po b/tests/auto/linguist/lconvert/data/test-kde-multiline.po new file mode 100644 index 0000000..0ca714c --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-kde-multiline.po @@ -0,0 +1,32 @@ +# translation of kdmgreet.po to German +# Ãœbersetzung von kdmgreet.po ins Deutsche +# Copyright (C) +# Thomas Diehl , 2002, 2003, 2004. +# Stephan Johach , 2005. +# Thomas Reitelbach , 2005, 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2007-12-06 20:50+0100\n" +"Last-Translator: Thomas Reitelbach \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KAider 0.1\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: kdmshutdown.cpp:706 +#, kde-format +msgid "" +"Owner: %1\n" +"Type: %2%5\n" +"Start: %3\n" +"Timeout: %4" +msgstr "" +"Eigentümer: %1\n" +"Typ: %2%5\n" +"Start: %3\n" +"Zeitlimit: %4" diff --git a/tests/auto/linguist/lconvert/data/test-kde-plurals.po b/tests/auto/linguist/lconvert/data/test-kde-plurals.po new file mode 100644 index 0000000..6c85d74 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-kde-plurals.po @@ -0,0 +1,27 @@ +# translation of kdmgreet.po to German +# Ãœbersetzung von kdmgreet.po ins Deutsche +# Copyright (C) +# Thomas Diehl , 2002, 2003, 2004. +# Stephan Johach , 2005. +# Thomas Reitelbach , 2005, 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2007-12-06 20:50+0100\n" +"Last-Translator: Thomas Reitelbach \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KAider 0.1\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Language: de_DE\n" + +#: kgverify.cpp:505 +#, kde-format +msgid "Your account expires tomorrow." +msgid_plural "Your account expires in %1 days." +msgstr[0] "Ihre Zugangsberechtigung läuft morgen ab." +msgstr[1] "Ihre Zugangsberechtigung läuft in %1 Tagen ab." diff --git a/tests/auto/linguist/lconvert/data/test-slurp.po b/tests/auto/linguist/lconvert/data/test-slurp.po new file mode 100644 index 0000000..67bc239 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-slurp.po @@ -0,0 +1,19 @@ +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" + +msgid "just a line" +msgstr "indeed" + +msgid "" +"another " +"line" +msgstr "certainly" + +msgid "a somewhat longer line that will certainly require re-wrapping, and will be re-wrapped if our algorithm is not completely broken.\n" +"this comes on a new line.\n" +msgstr "whatever ..." + +msgid "bi-""segmented" +msgstr "aye" diff --git a/tests/auto/linguist/lconvert/data/test-slurp.po.out b/tests/auto/linguist/lconvert/data/test-slurp.po.out new file mode 100644 index 0000000..8859a70 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-slurp.po.out @@ -0,0 +1,19 @@ +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" + +msgid "just a line" +msgstr "indeed" + +msgid "another line" +msgstr "certainly" + +msgid "" +"a somewhat longer line that will certainly require re-wrapping, and will be " +"re-wrapped if our algorithm is not completely broken.\n" +"this comes on a new line.\n" +msgstr "whatever ..." + +msgid "bi-segmented" +msgstr "aye" diff --git a/tests/auto/linguist/lconvert/data/test-translator-comment.po b/tests/auto/linguist/lconvert/data/test-translator-comment.po new file mode 100644 index 0000000..bc4df5c --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-translator-comment.po @@ -0,0 +1,41 @@ +# translation of kdmgreet.po to zh_CN +# Simp. Chinese Translation for kdmgreet. +# Copyright (C) 2001,2003 Free Software Foundation, Inc. +# Gou Zhuang , 2001. +# Xiong Jiang , 2003. +# Yan Shuangchun , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2008-04-22 16:56+0800\n" +"Last-Translator: Lie_Ex \n" +"Language-Team: zh_CN \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "no comment" +msgstr "indeed" + +# +msgid "just empty" +msgstr "indeed" + +# +# This is some comment. +# +# This is another comment. +# +msgid "User %u will log in in %t" +msgstr "用户 %u 将在 %t 秒åŽç™»å½•" + +# A fooish bar. +# Hey-ho, sucker. +# +# Babbling gully. +msgid "Foo" +msgstr "Bar" diff --git a/tests/auto/linguist/lconvert/data/test1-cn.po b/tests/auto/linguist/lconvert/data/test1-cn.po new file mode 100644 index 0000000..529eca3 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test1-cn.po @@ -0,0 +1,67 @@ +# translation of kdmgreet.po to zh_CN +# Simp. Chinese Translation for kdmgreet. +# Copyright (C) 2001,2003 Free Software Foundation, Inc. +# Gou Zhuang , 2001. +# Xiong Jiang , 2003. +# Yan Shuangchun , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2008-04-22 16:56+0800\n" +"Last-Translator: Lie_Ex \n" +"Language-Team: zh_CN \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Language: zh_CN\n" + +#: kdmconfig.cpp:147 +msgid "[fix kdmrc]" +msgstr "[ä¿®å¤ kdmrc]" + +#: krootimage.cpp:39 +msgid "Fancy desktop background for kdm" +msgstr "kdm 的梦幻桌é¢èƒŒæ™¯" + +#: kgreeter.cpp:558 +#, kde-format +msgid "" +"Your saved session type '%1' is not valid any more.\n" +"Please select a new one, otherwise 'default' will be used." +msgstr "" +"ä½ ä¿å­˜çš„“%1â€ä¼šè¯ç±»åž‹ä¸å†æœ‰æ•ˆã€‚\n" +"请选择一个新的类型,å¦åˆ™å°†ä½¿ç”¨â€œé»˜è®¤â€ã€‚" + +#: kgdialog.cpp:231 +#, kde-format +msgctxt "session (location)" +msgid "%1 (%2)" +msgstr "%1(%2)" + +#: kgverify.cpp:505 +#, kde-format +msgid "Your account expires tomorrow." +msgid_plural "Your account expires in %1 days." +msgstr[0] "您的账户将于 %1 天åŽè¿‡æœŸã€‚" + +#: kdmshutdown.cpp:510 +#, kde-format +msgctxt "current option in boot loader" +msgid "%1 (current)" +msgstr "%1 (当å‰)" + +#: themer/kdmlabel.cpp:285 +#, no-c-format +msgctxt "date format" +msgid "%a %d %B" +msgstr "%B月%d日,%a" + +#~ msgid "_Suspend" +#~ msgstr "挂起(_S)" + +#~ msgid "Confi_gure" +#~ msgstr "é…ç½®(_G)" diff --git a/tests/auto/linguist/lconvert/data/test1-de.po b/tests/auto/linguist/lconvert/data/test1-de.po new file mode 100644 index 0000000..256b8e9 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test1-de.po @@ -0,0 +1,75 @@ +# translation of kdmgreet.po to German +# translation of kdmgreet.po to +# Ãœbersetzung von kdmgreet.po ins Deutsche +# Copyright (C) +# Thomas Diehl , 2002, 2003, 2004. +# Stephan Johach , 2005. +# Thomas Reitelbach , 2005, 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: kdmgreet\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"POT-Creation-Date: 2008-04-28 18:47+0200\n" +"PO-Revision-Date: 2007-12-06 20:50+0100\n" +"Last-Translator: Thomas Reitelbach \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KAider 0.1\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Language: de_DE\n" + +#: lib/acl.c:107 lib/acl.c:121 lib/acl.c:138 lib/acl.c:165 lib/acl.c:174 +#: src/copy.c:695 src/copy.c:2017 +#, c-format +msgid "preserving permissions for %s" +msgstr "a preservar as permissões de %s" + +#: kdmconfig.cpp:147 +msgid "[fix kdmrc]" +msgstr "[fix kdmrc]" + +#: krootimage.cpp:39 +msgid "Fancy desktop background for kdm" +msgstr "Schicker Arbeitsflächenhintergrund für KDM" + +#: kgreeter.cpp:558 +#, kde-format +msgid "" +"Your saved session type '%1' is not valid any more.\n" +"Please select a new one, otherwise 'default' will be used." +msgstr "" +"Der gespeicherte Sitzungstyp „%1“ ist nicht mehr gültig.\n" +"Bitte wählen Sie einen neuen. Sonst wird die Voreinstellung verwendet." + +#: kgdialog.cpp:231 +#, kde-format +msgctxt "session (location)" +msgid "%1 (%2)" +msgstr "%1 (%2)" + +#: kgverify.cpp:505 +#, kde-format +msgid "Your account expires tomorrow." +msgid_plural "Your account expires in %1 days." +msgstr[0] "Ihre Zugangsberechtigung läuft morgen ab." +msgstr[1] "Ihre Zugangsberechtigung läuft in %1 Tagen ab." + +#: kdmshutdown.cpp:510 +#, kde-format +msgctxt "current option in boot loader" +msgid "%1 (current)" +msgstr "%1 (Aktuelle)" + +#: themer/kdmlabel.cpp:285 +#, no-c-format +msgctxt "date format" +msgid "%a %d %B" +msgstr "%a %d %B" + +#~ msgid "_Suspend" +#~ msgstr "_Ruhezustand" + +#~ msgid "Confi_gure" +#~ msgstr "Ein_richten" diff --git a/tests/auto/linguist/lconvert/data/test11.ts b/tests/auto/linguist/lconvert/data/test11.ts new file mode 100644 index 0000000..aeb46af --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test11.ts @@ -0,0 +1,32 @@ + + + + + FindDialog + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + + Should be obsolete + SHOULD BE OBSOLETE + + + diff --git a/tests/auto/linguist/lconvert/data/test20.ts b/tests/auto/linguist/lconvert/data/test20.ts new file mode 100644 index 0000000..542cdee --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test20.ts @@ -0,0 +1,150 @@ + + + + + Dialog2 + + + %n files + plural form + + + + + + + %n cars + + + + + + + &Find %n cars + + + + + + + Search in %n items? + + + + + + + %1. Search in %n items? + + + + + + + Age: %1 + + + + + There are %n house(s) + Plurals and function call + + + + + + + QTranslator + Simple + + + + + + + QTranslator + Simple with comment + + + + + + + QTranslator + Plural without comment + + + + + + + QTranslator + Plural with comment + + + + + + + func3 + + + + + QApplication + + + QT_LAYOUT_DIRECTION + Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. + + + + + QCoreApplication + + + Plurals, QCoreApplication + %n house(s) + + + + + + + Plurals, QCoreApplication + %n car(s) + + + + + + + Plurals, QCoreApplication + %n horse(s) + + + + + + + TestClass + + + inline function + TestClass + + + + + inline function 2 + TestClass + + + + + static inline function + TestClass + + + + diff --git a/tests/auto/linguist/lconvert/data/variants.ts b/tests/auto/linguist/lconvert/data/variants.ts new file mode 100644 index 0000000..52bb2d4 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/variants.ts @@ -0,0 +1,24 @@ + + + + + Assistant + + Source + + A really very long translation + Short translation + + + + %n document(s) found. + + 1 Dokument gefunden. + + %n Dokumente gefunden. + %n Dok. gefunden. + + + + + diff --git a/tests/auto/linguist/lconvert/data/wrapping.po b/tests/auto/linguist/lconvert/data/wrapping.po new file mode 100644 index 0000000..39b7fbe --- /dev/null +++ b/tests/auto/linguist/lconvert/data/wrapping.po @@ -0,0 +1,58 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-05-14 14:01+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#, no-wrap +msgid "one two three four five six seven eight nine ten eleven twelve thirteen a 12 foo bar\n" +msgstr "" + +#, no-wrap +msgid "" +"one two three four five six seven eight nine ten eleven twelve thirteen a 13 foo bar\n" +"second line" +msgstr "" + +#: gettxt.c:3 +msgid "" +"one two three four five six seven eight nine ten eleven twelve thirteen a 14 " +"foo bar\n" +msgstr "" + +#: gettxt.c:4 +msgid "" +"one two three four five six seven eight nine ten eleven twelve thirteen a " +"15\n" +msgstr "" + +#: gettxt.c:5 +msgid "" +"one two three four five six seven eight nine ten eleven twelve thirteen a " +"123 foo bar\n" +msgstr "" + +#: gettxt.c:6 +msgid "one two three four five six seven eight nine ten eleven twelve thirteen" +msgstr "" + +#: gettxt.c:7 +msgid "" +"one two three four five six seven eight nine ten eleven twelve th1rt33n\n" +msgstr "" + +#: gettxt.c:8 +msgid "one two three four five six\n" +msgstr "" diff --git a/tests/auto/linguist/lconvert/lconvert.pro b/tests/auto/linguist/lconvert/lconvert.pro new file mode 100644 index 0000000..517dacd --- /dev/null +++ b/tests/auto/linguist/lconvert/lconvert.pro @@ -0,0 +1,8 @@ +CONFIG += qttest_p4 + +TARGET = tst_lconvert + +#HEADERS += testlupdate.h +SOURCES += tst_lconvert.cpp +# testlupdate.cpp + diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp new file mode 100644 index 0000000..3df2a19 --- /dev/null +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -0,0 +1,300 @@ +#include +#include + +class tst_lconvert : public QObject +{ + Q_OBJECT + +public: + tst_lconvert() : dataDir("data/") {} + +private slots: + void initTestCase(); + void readverifies_data(); + void readverifies(); + void converts_data(); + void converts(); + void roundtrips_data(); + void roundtrips(); +#if 0 + void chains_data(); + void chains(); +#endif + +private: + void doWait(QProcess *cvt, int stage); + void doCompare(QIODevice *actual, const QString &expectedFn); + void verifyReadFail(const QString &fn); + // args can be empty or have one element less than stations + void convertChain(const QString &inFileName, const QString &outFileName, + const QStringList &stations, const QList &args); + void convertRoundtrip(const QString &fileName, const QStringList &stations, + const QList &args); + + QString dataDir; +}; + +void tst_lconvert::initTestCase() +{ + if (!QFile::exists(QLatin1String("data/plural-1.po"))) + QProcess::execute(QLatin1String("data/makeplurals.sh"), QStringList() << QLatin1String("data/")); + QVERIFY(QFile::exists(QLatin1String("data/plural-1.po"))); +} + +void tst_lconvert::doWait(QProcess *cvt, int stage) +{ + if (QTest::currentTestFailed()) { + cvt->kill(); + cvt->waitForFinished(); + } else { + QVERIFY2(cvt->waitForFinished(3000), + qPrintable(QString("Process %1 hung").arg(stage))); + QVERIFY2(cvt->exitStatus() == QProcess::NormalExit, + qPrintable(QString("Process %1 crashed").arg(stage))); + QVERIFY2(cvt->exitCode() == 0, + qPrintable(QString("Process %1 exited with status %2. Errors:\n%3") + .arg(stage).arg(cvt->exitCode()) + .arg(QString::fromUtf8(cvt->readAllStandardError())))); + } +} + +void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn) +{ + QList actual = actualDev->readAll().split('\n'); + + QFile file(expectedFn); + QVERIFY(file.open(QIODevice::ReadOnly)); + QList expected = file.readAll().split('\n'); + + int i = 0, ei = expected.size(), gi = actual.size(); + for (; ; i++) { + if (i == gi) { + if (i == ei) + return; + gi = 0; + break; + } else if (i == ei) { + ei = 0; + break; + } else if (actual.at(i) != expected.at(i)) { + while ((ei - 1) >= i && (gi - 1) >= i && actual.at(gi - 1) == expected.at(ei - 1)) + ei--, gi--; + break; + } + } + QByteArray diff; + for (int j = qMax(0, i - 3); j < i; j++) + diff += expected.at(j) + '\n'; + diff += "<<<<<<< got\n"; + for (int j = i; j < gi; j++) { + diff += actual.at(j) + '\n'; + if (j >= i + 5) { + diff += "...\n"; + break; + } + } + diff += "=========\n"; + for (int j = i; j < ei; j++) { + diff += expected.at(j) + '\n'; + if (j >= i + 5) { + diff += "...\n"; + break; + } + } + diff += ">>>>>>> expected\n"; + for (int j = ei; j < qMin(ei + 3, expected.size()); j++) + diff += expected.at(j) + '\n'; + QFAIL(qPrintable("Output for " + expectedFn + " does not meet expectations:\n" + diff)); +} + +void tst_lconvert::verifyReadFail(const QString &fn) +{ + QProcess cvt; + cvt.start("lconvert", QStringList() << (dataDir + fn)); + QVERIFY(cvt.waitForFinished(1000)); + QVERIFY(cvt.exitStatus() == QProcess::NormalExit); + QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input"); +} + +void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outFileName, + const QStringList &stations, const QList &argList) +{ + QList cvts; + + QString fileName = dataDir + _inFileName; + QString outFileName = dataDir + _outFileName; + + for (int i = 0; i < stations.size() - 1; i++) { + QProcess *cvt = new QProcess(this); + if (cvts.isEmpty()) + cvt->setStandardInputFile(fileName); + else + cvts.last()->setStandardOutputProcess(cvt); + cvts.append(cvt); + } + for (int i = 0; i < stations.size() - 1; i++) { + QStringList args; + if (!argList.isEmpty()) + args += argList[i]; + args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1]; + cvts.at(i)->start("lconvert", args); + } + int st = 0; + foreach (QProcess *cvt, cvts) + doWait(cvt, ++st); + + if (!QTest::currentTestFailed()) + doCompare(cvts.last(), outFileName); + + qDeleteAll(cvts); +} + +void tst_lconvert::convertRoundtrip(const QString &_fileName, const QStringList &stations, + const QList &argList) +{ + convertChain(_fileName, _fileName, stations, argList); +} + +void tst_lconvert::readverifies_data() +{ + QTest::addColumn("fileName"); + QTest::addColumn("format"); + + QTest::newRow("empty comment") << "test-empty-comment.po" << "po"; + QTest::newRow("translator comment") << "test-translator-comment.po" << "po"; + QTest::newRow("developer comment") << "test-developer-comment.po" << "po"; + QTest::newRow("kde context") << "test-kde-ctxt.po" << "po"; + QTest::newRow("kde fuzzy") << "test-kde-fuzzy.po" << "po"; + QTest::newRow("kde plurals") << "test-kde-plurals.po" << "po"; + QTest::newRow("kde multiline") << "test-kde-multiline.po" << "po"; + QTest::newRow("po linewrapping") << "wrapping.po" << "po"; + QTest::newRow("relative locations") << "relative.ts" << "ts"; + QTest::newRow("message ids") << "msgid.ts" << "ts"; + QTest::newRow("length variants") << "variants.ts" << "ts"; +} + +void tst_lconvert::readverifies() +{ + QFETCH(QString, fileName); + QFETCH(QString, format); + + convertRoundtrip(fileName, QStringList() << format << format, QList()); +} + +void tst_lconvert::converts_data() +{ + QTest::addColumn("inFileName"); + QTest::addColumn("outFileName"); + QTest::addColumn("format"); + + QTest::newRow("broken utf8") << "test-broken-utf8.po" << "test-broken-utf8.po.out" << "po"; + QTest::newRow("line joins") << "test-slurp.po" << "test-slurp.po.out" << "po"; + QTest::newRow("escapes") << "test-escapes.po" << "test-escapes.po.out" << "po"; +} + +void tst_lconvert::converts() +{ + QFETCH(QString, inFileName); + QFETCH(QString, outFileName); + QFETCH(QString, format); + + QString outFileNameFq = dataDir + outFileName; + + QProcess cvt; + cvt.start("lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format); + doWait(&cvt, 0); + if (QTest::currentTestFailed()) + return; + + doCompare(&cvt, outFileNameFq); +} + +Q_DECLARE_METATYPE(QList); + +#if 0 +void tst_lconvert::chains_data() +{ + QTest::addColumn("inFileName"); + QTest::addColumn("outFileName"); + QTest::addColumn("stations"); + QTest::addColumn >("args"); + +} + +void tst_lconvert::chains() +{ + QFETCH(QString, inFileName); + QFETCH(QString, outFileName); + QFETCH(QStringList, stations); + QFETCH(QList, args); + + convertChain(inFileName, outFileName, stations, args); +} +#endif + +void tst_lconvert::roundtrips_data() +{ + QTest::addColumn("fileName"); + QTest::addColumn("stations"); + QTest::addColumn >("args"); + + QStringList poTsPo; poTsPo << "po" << "ts" << "po"; + QStringList poXlfPo; poXlfPo << "po" << "xlf" << "po"; + QStringList tsTs11Ts; tsTs11Ts << "ts" << "ts11" << "ts"; + QStringList tsPoTs; tsPoTs << "ts" << "po" << "ts"; + QStringList ts11PoTs11; ts11PoTs11 << "ts11" << "po" << "ts11"; + QStringList tsXlfTs; tsXlfTs << "ts" << "xlf" << "ts"; + QStringList tsQmTs; tsQmTs << "ts" << "qm" << "ts"; + + QList noArgs; + QList filterPoArgs; filterPoArgs << QStringList() << (QStringList() << "-drop-tag" << "po:*"); + QList outDeArgs; outDeArgs << QStringList() << (QStringList() << "-target-language" << "de"); + QList outCnArgs; outCnArgs << QStringList() << (QStringList() << "-target-language" << "cn"); + + QTest::newRow("po-ts-po (translator comment)") << "test-translator-comment.po" << poTsPo << noArgs; + QTest::newRow("po-xliff-po (translator comment)") << "test-translator-comment.po" << poXlfPo << noArgs; + QTest::newRow("po-ts-po (developer comment)") << "test-developer-comment.po" << poTsPo << noArgs; + QTest::newRow("po-xliff-po (developer comment)") << "test-developer-comment.po" << poXlfPo << noArgs; + + QTest::newRow("ts11-po-ts11") << "test11.ts" << ts11PoTs11 << filterPoArgs; + QTest::newRow("ts20-po-ts20") << "test20.ts" << tsPoTs << filterPoArgs; + QTest::newRow("po-ts-po (de)") << "test1-de.po" << poTsPo << noArgs; + QTest::newRow("po-ts-po (cn)") << "test1-cn.po" << poTsPo << noArgs; + QTest::newRow("po-xliff-po (de)") << "test1-de.po" << poXlfPo << noArgs; + QTest::newRow("po-xliff-po (cn)") << "test1-cn.po" << poXlfPo << noArgs; + + QTest::newRow("po-ts-po (singular)") << "singular.po" << poTsPo << noArgs; + QTest::newRow("po-ts-po (plural-1)") << "plural-1.po" << poTsPo << noArgs; + QTest::newRow("po-ts-po (plural-2)") << "plural-2.po" << poTsPo << noArgs; + QTest::newRow("po-ts-po (plural-3)") << "plural-3.po" << poTsPo << noArgs; + QTest::newRow("po-xliff-po (singular)") << "singular.po" << poXlfPo << noArgs; + QTest::newRow("po-xliff-po (plural-1)") << "plural-1.po" << poXlfPo << noArgs; + QTest::newRow("po-xliff-po (plural-2)") << "plural-2.po" << poXlfPo << noArgs; + QTest::newRow("po-xliff-po (plural-3)") << "plural-3.po" << poXlfPo << noArgs; + + QTest::newRow("ts20-ts11-ts20 (utf8)") << "codec-utf8.ts" << tsTs11Ts << noArgs; + QTest::newRow("ts20-ts11-ts20 (cp1252)") << "codec-cp1252.ts" << tsTs11Ts << noArgs; + QTest::newRow("ts20-ts11-ts20 (dual-encoding)") << "dual-encoding.ts" << tsTs11Ts << noArgs; + + QTest::newRow("ts-qm-ts (dual-encoding)") << "dual-encoding.ts" << tsQmTs << noArgs; + QTest::newRow("ts-qm-ts (plurals-de)") << "plurals-de.ts" << tsQmTs << outDeArgs; + QTest::newRow("ts-qm-ts (plurals-cn)") << "plurals-cn.ts" << tsQmTs << outCnArgs; + QTest::newRow("ts-qm-ts (variants)") << "variants.ts" << tsQmTs << outDeArgs; + QTest::newRow("ts-po-ts (msgid)") << "msgid.ts" << tsPoTs << noArgs; + QTest::newRow("ts-xliff-ts (msgid)") << "msgid.ts" << tsXlfTs << noArgs; + + QTest::newRow("ts-po-ts (endless loop)") << "endless-po-loop.ts" << tsPoTs << noArgs; +} + +void tst_lconvert::roundtrips() +{ + QFETCH(QString, fileName); + QFETCH(QStringList, stations); + QFETCH(QList, args); + + convertRoundtrip(fileName, stations, args); +} + +QTEST_APPLESS_MAIN(tst_lconvert) + +#include "tst_lconvert.moc" diff --git a/tests/auto/linguist/linguist.pro b/tests/auto/linguist/linguist.pro new file mode 100644 index 0000000..90e2d36 --- /dev/null +++ b/tests/auto/linguist/linguist.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = lrelease lconvert lupdate diff --git a/tests/auto/linguist/lrelease/lrelease.pro b/tests/auto/linguist/lrelease/lrelease.pro new file mode 100644 index 0000000..8006042 --- /dev/null +++ b/tests/auto/linguist/lrelease/lrelease.pro @@ -0,0 +1,5 @@ +CONFIG += qttest_p4 +CONFIG -= gui +TARGET = tst_lrelease + +SOURCES += tst_lrelease.cpp diff --git a/tests/auto/linguist/lrelease/testdata/compressed.ts b/tests/auto/linguist/lrelease/testdata/compressed.ts new file mode 100644 index 0000000..9579269 --- /dev/null +++ b/tests/auto/linguist/lrelease/testdata/compressed.ts @@ -0,0 +1,46 @@ + + + + + Context1 + + Foo + in first context + + + + Context2 + + Bar + in second context + + + + Action1 + + + Component Name + translation in first context + + + Fooish bar + the bar is fooish + + + + Action2 + + + Component Name + translation in second context + + + + Action3 + + + Component Name + translation in third context + + + diff --git a/tests/auto/linguist/lrelease/testdata/dupes.errors b/tests/auto/linguist/lrelease/testdata/dupes.errors new file mode 100644 index 0000000..74fcbbb --- /dev/null +++ b/tests/auto/linguist/lrelease/testdata/dupes.errors @@ -0,0 +1,4 @@ +Warning: dropping duplicate messages in 'testdata/dupes\.qm': + +\* Context: FindDialog +\* Source: Text not found diff --git a/tests/auto/linguist/lrelease/testdata/dupes.ts b/tests/auto/linguist/lrelease/testdata/dupes.ts new file mode 100644 index 0000000..ec368c3 --- /dev/null +++ b/tests/auto/linguist/lrelease/testdata/dupes.ts @@ -0,0 +1,25 @@ + + + + + FindDialog + + Search reached start of the document + + + + + Search reached start of the document + + + + + Text not found + + + + Text not found + + + + diff --git a/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts11.ts b/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts11.ts new file mode 100644 index 0000000..991f354 --- /dev/null +++ b/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts11.ts @@ -0,0 +1,18 @@ + + + +windows-1252 + + FooBar + + + this contains an umlaut ü &uuml; + random stuff with umlaut + + + + umlaut ü &uuml; in utf8 + more random stuff with umlaut + + + diff --git a/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts b/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts new file mode 100644 index 0000000..8bb56d4 --- /dev/null +++ b/tests/auto/linguist/lrelease/testdata/mixedcodecs-ts20.ts @@ -0,0 +1,18 @@ + + + +windows-1252 + + FooBar + + + this contains an umlaut ü &uuml; + random stuff with umlaut + + + + umlaut ü &uuml; in utf8 + more random stuff with umlaut + + + diff --git a/tests/auto/linguist/lrelease/testdata/translate.ts b/tests/auto/linguist/lrelease/testdata/translate.ts new file mode 100644 index 0000000..ad3015d --- /dev/null +++ b/tests/auto/linguist/lrelease/testdata/translate.ts @@ -0,0 +1,136 @@ + + + + + + + + Test + AAAA + Empty context + + + + CubeForm + + + Test + BBBB + + + + QObject + + + +newline at the start + +NEWLINE AT THE START + + + + newline at the end + + NEWLINE AT THE END + + + + + newline and space at the end + + NEWLINE AND SPACE AT THE END + + + + + space and newline at the end + + SPACE AND NEWLINE AT THE END + + + + + tab at the start and newline at the end + + TAB AT THE START AND NEWLINE AT THE END + + + + + +newline and tab at the start + +NEWLINE AND TAB AT THE START + + + + space and tab at the start + SPACE AND TAB AT THE START + + + + space first + + + + + string that does not exist + + + + + Plurals + + + There are %n houses + + There is %n house + There are %n houses + + + + + tst_lrelease + + + There are %n cars + More Plurals + + There is %n car + There are %n cars + + + + Completely random string + + Super-lange Uebersetzung mit Schikanen + Mittlere Uebersetung + Kurze Uebers. + + + + + no_en + + + Kjør Kåre, kjære + Drive Kåre, dear + + + + en_no + + + Drive Kåre, dear + Kjør Kåre, kjære + + + + en_ch + + + Chinese symbol: + Chinese symbol:簟 + + + diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp new file mode 100644 index 0000000..6f65dbc --- /dev/null +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include + +#include + +class tst_lrelease : public QObject +{ + Q_OBJECT +private: + +private slots: + void translate(); + void mixedcodecs(); + void compressed(); + void dupes(); + +private: + void doCompare(const QStringList &actual, const QString &expectedFn); +}; + +void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedFn) +{ + QFile file(expectedFn); + QVERIFY(file.open(QIODevice::ReadOnly)); + QStringList expected = QString(file.readAll()).trimmed().remove('\r').split('\n'); + + int i = 0, ei = expected.size(), gi = actual.size(); + for (; ; i++) { + if (i == gi) { + if (i == ei) + return; + gi = 0; + break; + } else if (i == ei) { + ei = 0; + break; + } else if (!QRegExp(expected.at(i)).exactMatch(actual.at(i))) { + while ((ei - 1) >= i && (gi - 1) >= i && + (QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)))) + ei--, gi--; + break; + } + } + QByteArray diff; + for (int j = qMax(0, i - 3); j < i; j++) + diff += expected.at(j) + '\n'; + diff += "<<<<<<< got\n"; + for (int j = i; j < gi; j++) { + diff += actual.at(j) + '\n'; + if (j >= i + 5) { + diff += "...\n"; + break; + } + } + diff += "=========\n"; + for (int j = i; j < ei; j++) { + diff += expected.at(j) + '\n'; + if (j >= i + 5) { + diff += "...\n"; + break; + } + } + diff += ">>>>>>> expected\n"; + for (int j = ei; j < qMin(ei + 3, expected.size()); j++) + diff += expected.at(j) + '\n'; + QFAIL(qPrintable("Output for " + expectedFn + " does not meet expectations:\n" + diff)); +} + +void tst_lrelease::translate() +{ + QVERIFY(!QProcess::execute("lrelease testdata/translate.ts")); + + QTranslator translator; + QVERIFY(translator.load("testdata/translate.qm")); + qApp->installTranslator(&translator); + + QCOMPARE(QObject::tr("\nnewline at the start"), QString("\nNEWLINE AT THE START")); + QCOMPARE(QObject::tr("newline at the end\n"), QString("NEWLINE AT THE END\n")); + QCOMPARE(QObject::tr("newline and space at the end\n "), QString("NEWLINE AND SPACE AT THE END\n ")); + QCOMPARE(QObject::tr("space and newline at the end \n"), QString("SPACE AND NEWLINE AT THE END \n")); + QCOMPARE(QObject::tr("\ttab at the start and newline at the end\n"), QString("\tTAB AT THE START AND NEWLINE AT THE END\n")); + QCOMPARE(QObject::tr("\n\tnewline and tab at the start"), QString("\n\tNEWLINE AND TAB AT THE START")); + QCOMPARE(QObject::tr(" \tspace and tab at the start"), QString(" \tSPACE AND TAB AT THE START")); + QCOMPARE(QObject::tr(" string that does not exist"), QString(" string that does not exist")); + + QCOMPARE(QCoreApplication::translate("CubeForm", "Test"), QString::fromAscii("BBBB")); + QCOMPARE(QCoreApplication::translate("", "Test", "Empty context"), QString("AAAA")); + + // Test plurals + QString txed = QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 0); + QCOMPARE(QString::fromAscii("[%1]").arg(txed), QString("[There are 0 houses]")); + QCOMPARE(QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 1), QString("There is 1 house")); + QCOMPARE(QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 2), QString("There are 2 houses")); + QCOMPARE(QCoreApplication::translate("Plurals", "There are %n houses", 0, QCoreApplication::UnicodeUTF8, 3), QString("There are 3 houses")); + + + // More plurals + QCOMPARE(tr("There are %n cars", "More Plurals", 0) , QString("There are 0 cars")); + QCOMPARE(tr("There are %n cars", "More Plurals", 1) , QString("There is 1 car")); + QCOMPARE(tr("There are %n cars", "More Plurals", 2) , QString("There are 2 cars")); + QCOMPARE(tr("There are %n cars", "More Plurals", 3) , QString("There are 3 cars")); + + + QCOMPARE(QCoreApplication::translate("no_en", "Kj\370r K\345re, kj\346re"), QString::fromAscii("Drive K\345re, dear")); + QCOMPARE(QCoreApplication::translate("en_no", "Drive K\345re, dear"), QString::fromAscii("Kj\370r K\345re, kj\346re")); + QCOMPARE(QCoreApplication::translate("en_ch", "Chinese symbol:"), QString::fromAscii("Chinese symbol:%1").arg(QChar(0x7c1f))); + +// printf("halo\r\nhallo"); + // QCOMPARE(tr("This\r\nwill fail"), QString("THIS\nWILL FAIL")); // \r\n = 0d 0a + + QCOMPARE(tr("Completely random string"), + QString::fromLatin1("Super-lange Uebersetzung mit Schikanen\x9c" + "Mittlere Uebersetung\x9c" + "Kurze Uebers.")); + + qApp->removeTranslator(&translator); +} + +void tst_lrelease::mixedcodecs() +{ + QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts11.ts")); + QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts20.ts")); + QVERIFY(!QProcess::execute("cmp testdata/mixedcodecs-ts11.qm testdata/mixedcodecs-ts20.qm")); + QTranslator translator; + QVERIFY(translator.load("testdata/mixedcodecs-ts11.qm")); + qApp->installTranslator(&translator); + + QCOMPARE(QCoreApplication::translate("FooBar", "this contains an umlaut \xfc ü"), + QString::fromAscii("random stuff with umlaut")); + QCOMPARE(QCoreApplication::translate("FooBar", "umlaut \xc3\xbc ü in utf8"), + QString::fromAscii("more random stuff with umlaut")); +} + +void tst_lrelease::compressed() +{ + QVERIFY(!QProcess::execute("lrelease -compress testdata/compressed.ts")); + + QTranslator translator; + QVERIFY(translator.load("testdata/compressed.qm")); + qApp->installTranslator(&translator); + + QCOMPARE(QCoreApplication::translate("Context1", "Foo"), QString::fromAscii("in first context")); + QCOMPARE(QCoreApplication::translate("Context2", "Bar"), QString::fromAscii("in second context")); + + QCOMPARE(QCoreApplication::translate("Action1", "Component Name"), QString::fromAscii("translation in first context")); + QCOMPARE(QCoreApplication::translate("Action2", "Component Name"), QString::fromAscii("translation in second context")); + QCOMPARE(QCoreApplication::translate("Action3", "Component Name"), QString::fromAscii("translation in third context")); + +} + +void tst_lrelease::dupes() +{ + QProcess proc; + proc.start("lrelease testdata/dupes.ts"); + QVERIFY(proc.waitForFinished()); + QVERIFY(proc.exitStatus() == QProcess::NormalExit); + doCompare(QString(proc.readAllStandardError()).trimmed().remove('\r').split('\n'), "testdata/dupes.errors"); +} + +QTEST_MAIN(tst_lrelease) +#include "tst_lrelease.moc" diff --git a/tests/auto/linguist/lupdate/lupdate.pro b/tests/auto/linguist/lupdate/lupdate.pro new file mode 100644 index 0000000..19259dc --- /dev/null +++ b/tests/auto/linguist/lupdate/lupdate.pro @@ -0,0 +1,7 @@ +CONFIG += qttest_p4 + +TARGET = tst_lupdate + +HEADERS += testlupdate.h +SOURCES += tst_lupdate.cpp testlupdate.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd new file mode 100644 index 0000000..9b83a04 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/lupdatecmd @@ -0,0 +1,3 @@ +# Add the command that lupdate should run here. If it can't find anything it will default to +TRANSLATION: ts\project.ts +lupdate -silent project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro new file mode 100644 index 0000000..3584c89 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -0,0 +1,19 @@ +###################################################################### +# Automatically generated by qmake (2.01a) ma 22. jan 10:10:16 2007 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += src\main.cpp + +TRANSLATIONS = ts\project.ts + + +!exists(ts) { + win32: system(md ts) + else: system(mkdir ts) +} diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result new file mode 100644 index 0000000..151a18e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result @@ -0,0 +1,13 @@ + + + + + QApplication + + + QT_LAYOUT_DIRECTION + Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp b/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp new file mode 100644 index 0000000..348a6be --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/src/main.cpp @@ -0,0 +1,15 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! +// +// +// +// + +QString qt_detectRTLLanguage() +{ + return QApplication::tr("QT_LAYOUT_DIRECTION", + "Translate this string to the string 'LTR' in left-to-right" + " languages or to 'RTL' in right-to-left languages (such as Hebrew" + " and Arabic) to get proper widget layout.") == QLatin1String("RTL"); +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp new file mode 100644 index 0000000..2573fbb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp @@ -0,0 +1,18 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + QApplication a(argc, argv); + QWidget w; + QLabel label1(QObject::tr("abc", "ascii"), &w); + QLabel label2(QObject::tr("æøå", "utf-8"), &w); + +// I would expect the following to work !? +// QLabel label3(QObject::trUtf8("F\374r \310lise", "trUtf8"), &w); + + w.show(); + return a.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro new file mode 100644 index 0000000..848ebda --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.pro @@ -0,0 +1,20 @@ +TEMPLATE = app +TARGET += +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp + +TRANSLATIONS = project.ts +CONFIG+= console + +CODECFORTR = utf-8 +CODECFORSRC = utf-8 + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result new file mode 100644 index 0000000..e746c7e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result @@ -0,0 +1,20 @@ + + + +UTF-8 + + QObject + + + abc + ascii + + + + + æøå + utf-8 + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp new file mode 100644 index 0000000..79b0503 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + QApplication a(argc, argv); + QTranslator trans(0); + + trans.load("t1_en", "."); + + a.installTranslator(&trans); + QWidget w; +/* + QLabel label1(QObject::tr("\33"), &w); + QLabel label2(QObject::tr("\32"), &w); + QLabel label3(QObject::tr("\176"), &w); +*/ + QLabel label4(QObject::tr("\301"), &w); + + w.show(); + return a.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro new file mode 100644 index 0000000..81273ee --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET += +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp + +TRANSLATIONS = project.ts +CONFIG+= console + +CODECFORTR = CP1251 + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result new file mode 100644 index 0000000..9a082ef --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result @@ -0,0 +1,13 @@ + + + +windows-1251 + + QObject + + + à + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp new file mode 100644 index 0000000..91af165 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp @@ -0,0 +1,20 @@ +#include + +class FooBar : QObject +{ + Q_OBJECT + +public: + void doFoo() + { + tr("random ascii only"); + tr("this contains an umlaut ü ü"); + trUtf8("random ascii only in utf8"); + trUtf8("umlaut \xfc ü in utf8"); + } +}; + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro new file mode 100644 index 0000000..1d5b071 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.pro @@ -0,0 +1,15 @@ +TEMPLATE = app + +SOURCES += main.cpp + +TRANSLATIONS = project.ts +CONFIG += console + +CODECFORTR = CP1252 + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result new file mode 100644 index 0000000..5ffa2f3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result @@ -0,0 +1,28 @@ + + + +windows-1252 + + FooBar + + + random ascii only + + + + + this contains an umlaut ü &uuml; + + + + + random ascii only in utf8 + + + + + umlaut ü &uuml; in utf8 + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp new file mode 100644 index 0000000..91af165 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp @@ -0,0 +1,20 @@ +#include + +class FooBar : QObject +{ + Q_OBJECT + +public: + void doFoo() + { + tr("random ascii only"); + tr("this contains an umlaut ü ü"); + trUtf8("random ascii only in utf8"); + trUtf8("umlaut \xfc ü in utf8"); + } +}; + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro new file mode 100644 index 0000000..f4975f2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.pro @@ -0,0 +1,16 @@ +TEMPLATE = app + +SOURCES += main.cpp + +TRANSLATIONS = project.ts +CONFIG += console + +CODECFORSRC = CP1252 +CODECFORTR = UTF-8 + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result new file mode 100644 index 0000000..0ebdbfd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result @@ -0,0 +1,28 @@ + + + +UTF-8 + + FooBar + + + random ascii only + + + + + this contains an umlaut ü &uuml; + + + + + random ascii only in utf8 + + + + + umlaut ü &uuml; in utf8 + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt new file mode 100644 index 0000000..8a0bd11 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt @@ -0,0 +1,4 @@ +.*/lupdate/testdata/good/lacksqobject/main.cpp:17: Class 'B' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:26: Class 'C' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:37: Class 'nsB::B' lacks Q_OBJECT macro +.*/lupdate/testdata/good/lacksqobject/main.cpp:45: Class 'nsB::C' lacks Q_OBJECT macro diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp new file mode 100644 index 0000000..05fcd79 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/main.cpp @@ -0,0 +1,47 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +#include + + +// +// Test 'lacks Q_OBJECT' reporting on namespace scopes +// + +class B : public QObject { + //Q_OBJECT + void foo(); +}; + +void B::foo() { + tr("Bla", "::B"); +} + + +class C : public QObject { + //Q_OBJECT + void foo() { + tr("Bla", "::C"); + } +}; + + +namespace nsB { + + class B : public QObject { + //Q_OBJECT + void foo(); + }; + + void B::foo() { + tr("Bla", "nsB::B"); + } + + class C : public QObject { + //Q_OBJECT + void foo() { + tr("Bla", "nsB::C"); + } + }; +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro new file mode 100644 index 0000000..7547a8d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES = main.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.ts.result new file mode 100644 index 0000000..bab0881 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/project.ts.result @@ -0,0 +1,40 @@ + + + + + B + + + Bla + ::B + + + + + C + + + Bla + ::C + + + + + nsB::B + + + Bla + nsB::B + + + + + nsB::C + + + Bla + nsB::C + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp new file mode 100644 index 0000000..af8534d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp @@ -0,0 +1,28 @@ + +// The first line in this file should always be empty, its part of the test!! +class Foo : public QObject +{ + Q_OBJECT +public: + Foo(); +}; + +Foo::Foo(MainWindow *parent) + : QObject(parent) +{ + tr("This is the first entry."); + tr("A second message."); tr("And a second one on the same line."); + tr("This string did move from the bottom."); + tr("This tr is new."); + tr("This one moved in from another file."); + tr("Now again one which is just where it was."); + + tr("Just as this one."); + tr("Another alien."); + tr("This is from the bottom, too."); + tr("Third string from the bottom."); + tr("Fourth one!"); + tr("They are coming!"); + tr("They are everywhere!"); + tr("An earthling again."); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd new file mode 100644 index 0000000..91a4800 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/lupdatecmd @@ -0,0 +1,5 @@ +# Add the command that lupdate should run here. If it can't find anything it will default to +# 'lupdate project.pro -ts project.ts' + +# lupdate project.pro +lupdate -silent -locations relative project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro new file mode 100644 index 0000000..e79456f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += foo.cpp + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.before new file mode 100644 index 0000000..d70193f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.before @@ -0,0 +1,74 @@ + + + + Bar + + + Another alien. + + + + + They are coming! + + + + + They are everywhere! + + + + + This one moved in from another file. + + + + + Foo + + + This is the first entry. + + + + + A second message. + + + + + Now again one which is just where it was. + + + + + Just as this one. + + + + + An earthling again. + + + + + This is from the bottom, too. + + + + + Third string from the bottom. + + + + + Fourth one! + + + + + This string did move from the bottom. + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.result new file mode 100644 index 0000000..2027efd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_ordering/project.ts.result @@ -0,0 +1,82 @@ + + + + + Foo + + + This is the first entry. + + + + + A second message. + + + + + And a second one on the same line. + + + + + This tr is new. + + + + + This one moved in from another file. + + + + + Now again one which is just where it was. + + + + + Just as this one. + + + + + Another alien. + + + + + They are coming! + + + + + They are everywhere! + + + + + An earthling again. + + + + + This is from the bottom, too. + + + + + Third string from the bottom. + + + + + Fourth one! + + + + + This string did move from the bottom. + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro new file mode 100644 index 0000000..6c704c2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +FORMS += project.ui + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.before new file mode 100644 index 0000000..fdc2a99 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.before @@ -0,0 +1,14 @@ + + + + FindDialog + + Qt Assistant - Finn text + + + + Finn tekst + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result new file mode 100644 index 0000000..f9d26df --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ts.result @@ -0,0 +1,15 @@ + + + + + FindDialog + + Qt Assistant - Finn text + + + + Finn tekst + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui new file mode 100644 index 0000000..7adb650 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_versions/project.ui @@ -0,0 +1,44 @@ + + + ********************************************************************* +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +********************************************************************* + + FindDialog + + + + 0 + 0 + 400 + 172 + + + + Qt Assistant - Finn text + + + Finn tekst + + + + comboFind + checkWords + checkCase + radioForward + radioBackward + findButton + closeButton + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp new file mode 100644 index 0000000..e058da0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/main.cpp @@ -0,0 +1,23 @@ +#include +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QTranslator translator; + translator.load("whitespace"); + app.installTranslator(&translator); + + QObject::tr("\nnewline at the start"); + QObject::tr("newline at the end\n"); + QObject::tr("newline and space at the end\n "); + QObject::tr("space and newline at the end \n"); + QObject::tr("\tTab at the start and newline at the end\n"); + QObject::tr("\n\tnewline and tab at the start"); + QObject::tr(" \tspace and tab at the start"); + QObject::tr(" space_first"); + QObject::tr("space_last "); + QObject::tr("carriage return and line feed last\r\n"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro new file mode 100644 index 0000000..f4faf2f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES = main.cpp + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before new file mode 100644 index 0000000..3acae3e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before @@ -0,0 +1,70 @@ + + + + QObject + + + +newline at the start + +NEWLINE AT THE START + + + + newline at the end + + NEWLINE AT THE END + + + + + newline and space at the end + + NEWLINE AND SPACE AT THE END + + + + + space and newline at the end + + SPACE AND NEWLINE AT THE END + + + + + Tab at the start and newline at the end + + TAB AT THE START AND NEWLINE AT THE END + + + + + +newline and tab at the start + +NEWLINE AND TAB AT THE START + + + + space and tab at the start + SPACE AND TAB AT THE START + + + + space_first + SPACE_FIRST + + + + space_last + SPACE_LAST + + + + carriage return and line feed last + + CARRIAGE RETURN AND LINE FEED LAST + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result new file mode 100644 index 0000000..6d6b469 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result @@ -0,0 +1,71 @@ + + + + + QObject + + + +newline at the start + +NEWLINE AT THE START + + + + newline at the end + + NEWLINE AT THE END + + + + + newline and space at the end + + NEWLINE AND SPACE AT THE END + + + + + space and newline at the end + + SPACE AND NEWLINE AT THE END + + + + + Tab at the start and newline at the end + + TAB AT THE START AND NEWLINE AT THE END + + + + + + newline and tab at the start + + NEWLINE AND TAB AT THE START + + + + space and tab at the start + SPACE AND TAB AT THE START + + + + space_first + SPACE_FIRST + + + + space_last + SPACE_LAST + + + + carriage return and line feed last + + CARRIAGE RETURN AND LINE FEED LAST + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp new file mode 100644 index 0000000..7edb923 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp @@ -0,0 +1,25 @@ + +// The first line in this file should always be empty, its part of the test!! +class FindDialog : public QDialog +{ + Q_OBJECT +public: + FindDialog(MainWindow *parent); + void reset(); +}; + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + QString trans = tr("Enter the text you want to find."); + trans = tr("Search reached end of the document"); + trans = tr("Search reached start of the document"); + trans = tr( "Text not found" ); +} + +void FindDialog::reset() +{ + tr("%n item(s)", "merge from singular to plural form", 4); + tr("%n item(s)", "merge from a finished singular form to an unfinished plural form", 4); +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro new file mode 100644 index 0000000..e988c0a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before new file mode 100644 index 0000000..474444f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before @@ -0,0 +1,48 @@ + + + + FindDialog + + + magic context comment + random translator comment + + + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + + %n item(s) + merge from singular to plural form + + + + + + + %n item(s) + merge from a finished singular form to an unfinished plural form + + + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result new file mode 100644 index 0000000..152b568 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result @@ -0,0 +1,49 @@ + + + + + FindDialog + + + magic context comment + random translator comment + + + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + + %n item(s) + merge from singular to plural form + + + + + + + %n item(s) + merge from a finished singular form to an unfinished plural form + + + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp new file mode 100644 index 0000000..f587618 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include +#include +#include +#include +#include +#include + +CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) + : QStandardItemModel(rows, columns, parent) +{} +QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const +{ + if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) + flags |= Qt::MatchCaseSensitive; + + return QStandardItemModel::match(start, role, value, hits, flags); +} + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + contentsWidget = new QWidget(this); + ui.setupUi(contentsWidget); + ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); + + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + l->addWidget(contentsWidget); + + lastBrowser = 0; + onceFound = false; + findExpr.clear(); + + sb = new QStatusBar(this); + l->addWidget(sb); + + sb->showMessage(tr("Enter the text you want to find.")); + + connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); + connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +FindDialog::~FindDialog() +{ +} + +void FindDialog::findButtonClicked() +{ + doFind(ui.radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + QTextBrowser *browser = static_cast(mainWindow()->browsers()->currentBrowser()); + sb->clearMessage(); + + if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) + onceFound = false; + findExpr = ui.comboFind->currentText(); + + QTextDocument::FindFlags flags = 0; + + if (ui.checkCase->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + + if (ui.checkWords->isChecked()) + flags |= QTextDocument::FindWholeWords; + + QTextCursor c = browser->textCursor(); + if (!c.hasSelection()) { + if (forward) + c.movePosition(QTextCursor::Start); + else + c.movePosition(QTextCursor::End); + + browser->setTextCursor(c); + } + + QTextDocument::FindFlags options; + if (forward == false) + flags |= QTextDocument::FindBackward; + + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } else { + browser->setTextCursor(found); + } + onceFound |= !found.isNull(); + lastBrowser = browser; +} + +bool FindDialog::hasFindExpression() const +{ + // statusMessage(tr( "Should be obsolete" )); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd new file mode 100644 index 0000000..d200143 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/lupdatecmd @@ -0,0 +1,5 @@ +# Add the command that lupdate should run here. If it can't find anything it will default to +# 'lupdate project.pro -ts project.ts' + +# lupdate project.pro +lupdate -silent -noobsolete project.pro diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro new file mode 100644 index 0000000..e988c0a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before new file mode 100644 index 0000000..12e30b5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before @@ -0,0 +1,31 @@ + + + + FindDialog + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + + Should be obsolete + SHOULD BE OBSOLETE + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result new file mode 100644 index 0000000..21d1ca0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result @@ -0,0 +1,27 @@ + + + + + FindDialog + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp new file mode 100644 index 0000000..e23d129 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include +#include +#include +#include +#include +#include + +CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) + : QStandardItemModel(rows, columns, parent) +{} +QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const +{ + if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) + flags |= Qt::MatchCaseSensitive; + + return QStandardItemModel::match(start, role, value, hits, flags); +} + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + contentsWidget = new QWidget(this); + ui.setupUi(contentsWidget); + ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); + + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + l->addWidget(contentsWidget); + + lastBrowser = 0; + onceFound = false; + findExpr.clear(); + + sb = new QStatusBar(this); + l->addWidget(sb); + + + // Move it to another line and change the text, + // then lupdate should add this one as a new one, and mark the old one as obsolete. + sb->showMessage(tr("Enter the text you want to find.")); + + connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); + connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +FindDialog::~FindDialog() +{ +} + +void FindDialog::findButtonClicked() +{ + doFind(ui.radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + QTextBrowser *browser = static_cast(mainWindow()->browsers()->currentBrowser()); + sb->clearMessage(); + + if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) + onceFound = false; + findExpr = ui.comboFind->currentText(); + + QTextDocument::FindFlags flags = 0; + + if (ui.checkCase->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + + if (ui.checkWords->isChecked()) + flags |= QTextDocument::FindWholeWords; + + QTextCursor c = browser->textCursor(); + if (!c.hasSelection()) { + if (forward) + c.movePosition(QTextCursor::Start); + else + c.movePosition(QTextCursor::End); + + browser->setTextCursor(c); + } + + QTextDocument::FindFlags options; + if (forward == false) + flags |= QTextDocument::FindBackward; + + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } else { + browser->setTextCursor(found); + } + onceFound |= !found.isNull(); + lastBrowser = browser; +} + +bool FindDialog::hasFindExpression() const +{ + return !findExpr.isEmpty(); +} + +void FindDialog::statusMessage(const QString &message) +{ + if (isVisible()) + sb->showMessage(message); + else + static_cast(parent())->statusBar()->showMessage(message, 2000); +} + +MainWindow *FindDialog::mainWindow() const +{ + return static_cast(parentWidget()); +} + +void FindDialog::reset() +{ + ui.comboFind->setFocus(); + ui.comboFind->lineEdit()->setSelection( + 0, ui.comboFind->lineEdit()->text().length()); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro new file mode 100644 index 0000000..e988c0a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += finddialog.cpp + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before new file mode 100644 index 0000000..271cc39 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before @@ -0,0 +1,26 @@ + + + + FindDialog + + + Enter the text you are looking for. + Skriv inn teksten du soker etter + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result new file mode 100644 index 0000000..b7074fe --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result @@ -0,0 +1,31 @@ + + + + + FindDialog + + Enter the text you are looking for. + Skriv inn teksten du soker etter + + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro new file mode 100644 index 0000000..28ba291 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +FORMS += project.ui + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before new file mode 100644 index 0000000..e297784 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before @@ -0,0 +1,22 @@ + + + + FindDialog + + + Qt Assistant - Find text + + Qt Assistant - Finn tekst + + + + 300px + 300px + + + + 400px + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result new file mode 100644 index 0000000..b21f583 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result @@ -0,0 +1,23 @@ + + + + + FindDialog + + + Qt Assistant - Find Text + Qt Assistant - Find text + Qt Assistant - Finn tekst + + + + 300px + 300px + + + + 401 pixels + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui new file mode 100644 index 0000000..c10545d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ui @@ -0,0 +1,47 @@ + + + ********************************************************************* +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +********************************************************************* + + FindDialog + + + + 0 + 0 + 400 + 172 + + + + Qt Assistant - Find Text + + + 300px + + + 401 pixels + + + + comboFind + checkWords + checkCase + radioForward + radioBackward + findButton + closeButton + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro new file mode 100644 index 0000000..28ba291 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +FORMS += project.ui + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before new file mode 100644 index 0000000..f06c22c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before @@ -0,0 +1,16 @@ + + + + FindDialog + + + Test similarity + Test likhet (test1) + + + + Similarity should have kicked in here! + Test likhet (test2) + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result new file mode 100644 index 0000000..d65110a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result @@ -0,0 +1,22 @@ + + + + + FindDialog + + Test similarity + Test likhet (test1) + + + + This should not be considered to be more or less equal to the corresponding one in the ts file. + + + + + Here, similarity should kick in! + Similarity should have kicked in here! + Test likhet (test2) + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui new file mode 100644 index 0000000..0d0defd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui @@ -0,0 +1,26 @@ + + + + + + FindDialog + + + + This should not be considered to be more or less equal to the corresponding one in the ts file. + + + Here, similarity should kick in! + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp new file mode 100644 index 0000000..c3881d3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/finddialog.cpp @@ -0,0 +1,7 @@ + +QT_TRANSLATE_NOOP("context", "just a message") + + + +//: This is one comment +QT_TRANSLATE_NOOP("context", "just a message") diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp new file mode 100644 index 0000000..71d9085 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/main.cpp @@ -0,0 +1,13 @@ + + + + +//: This is a comment, too. +QT_TRANSLATE_NOOP("context", "just a message") + + + + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro new file mode 100644 index 0000000..4582705 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp +SOURCES += finddialog.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result new file mode 100644 index 0000000..dd013fa --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/multiple_locations/project.ts.result @@ -0,0 +1,17 @@ + + + + + context + + + + + just a message + This is one comment +---------- +This is a comment, too. + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp new file mode 100644 index 0000000..9f5a98c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp @@ -0,0 +1,97 @@ +#include + +class Class : public QObject +{ + Q_OBJECT + + class SubClass + { + void f() + { + tr("nested class context"); + } + }; + + void f() + { + tr("just class context"); + } +}; + +namespace Outer { + +class Class : public QObject { Q_OBJECT }; + +namespace Middle1 { + +class Class : public QObject { Q_OBJECT }; + +namespace Inner1 { + +class Class : public QObject { Q_OBJECT }; + +} + +namespace I = Inner1; + +class Something; +class Different; + +} + +namespace Middle2 { + +class Class : public QObject { Q_OBJECT }; + +namespace Inner2 { + +class Class : public QObject { Q_OBJECT }; + +namespace IO = Middle2; + +} + +namespace I = Inner2; + +} + +namespace MI = Middle1::Inner1; + +namespace O = ::Outer; + +class Middle1::Different : QObject { +Q_OBJECT + void f() { + tr("different namespaced class def"); + } +}; + +} + +namespace O = Outer; +namespace OM = Outer::Middle1; +namespace OMI = Outer::Middle1::I; + +int main() +{ + Class::tr("outestmost class"); + Outer::Class::tr("outer class"); + Outer::MI::Class::tr("innermost one"); + OMI::Class::tr("innermost two"); + O::Middle1::I::Class::tr("innermost three"); + O::Middle2::I::Class::tr("innermost three b"); + OM::I::Class::tr("innermost four"); + return 0; +} + +class OM::Something : QObject { +Q_OBJECT + void f() { + tr("namespaced class def"); + } + void g() { + tr("namespaced class def 2"); + } +}; + +#include "main.moc" diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro new file mode 100644 index 0000000..56d472c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result new file mode 100644 index 0000000..d1193d3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result @@ -0,0 +1,82 @@ + + + + + Class + + + nested class context + + + + + just class context + + + + + outestmost class + + + + + Outer::Class + + + outer class + + + + + Outer::Middle1::Different + + + different namespaced class def + + + + + Outer::Middle1::Inner1::Class + + + innermost one + + + + + innermost two + + + + + innermost three + + + + + innermost four + + + + + Outer::Middle1::Something + + + namespaced class def + + + + + namespaced class def 2 + + + + + Outer::Middle2::Inner2::Class + + + innermost three b + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp new file mode 100644 index 0000000..72a1590 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/main.cpp @@ -0,0 +1,18 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +class Dialog2 : public QDialog +{ + Q_OBJECT + void func(); + +}; + +void Dialog2::func() +{ + tr("cat\351gorie"); + + tr("F\374r \310lise") +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro new file mode 100644 index 0000000..cb18ea4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.ts.result new file mode 100644 index 0000000..a49b47a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parse_special_chars/project.ts.result @@ -0,0 +1,17 @@ + + + + + Dialog2 + + + catégorie + + + + + Für Èlise + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp new file mode 100644 index 0000000..65eeed5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/main.cpp @@ -0,0 +1,229 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! +#include +#include + +// +// Test namespace scoping +// + +class D : public QObject { + Q_OBJECT + public: + QString foo() { + return tr("test", "D"); + } + +}; + +namespace A { + + class C : public QObject { + Q_OBJECT + public: + void foo(); + }; + + void C::foo() { + tr("Bla", "A::C"); + } + + void goo() { + C::tr("Bla", "A::C"); // Is identical to the previous tr(), (same context, sourcetext and comment, + // so it should not add another entry to the list of messages) + } + + void goo2() { + C::tr("Bla 2", "A::C"); //Should be in the same namespace as the previous tr() + } + +} + + +namespace X { + + class D : public QObject { + Q_OBJECT + public: + + }; + + class E : public QObject { + Q_OBJECT + public: + void foo() { D::tr("foo", "D"); } // Note that this is X::D from 440 on + }; + + + namespace Y { + class E : public QObject { + Q_OBJECT + + }; + + class C : public QObject { + Q_OBJECT + void foo(); + }; + + void C::foo() { + tr("Bla", "X::Y::C"); + } + + void goo() { + D::tr("Bla", "X::D"); //This should be assigned to the X::D context + } + + void goo2() { + E::tr("Bla", "X::Y::E"); //This should be assigned to the X::Y::E context + Y::E::tr("Bla", "X::Y::E"); //This should be assigned to the X::Y::E context + } + + }; // namespace Y + + class F : public QObject { + Q_OBJECT + inline void inlinefunc() { + tr("inline function", "X::F"); + } + }; +} // namespace X + +namespace ico { + namespace foo { + class A : public QObject { + A(); + }; + + A::A() { + tr("myfoo", "ico::foo::A"); + QObject::tr("task 161186", "QObject"); + } + } +} + +namespace AA { +class C {}; +} + +/** + * the context of a message should not be affected by any inherited classes + * + * Keep this disabled for now, but at a long-term range it should work. + */ +namespace Gui { + class MainWindow : public QMainWindow, + public AA::C + { + Q_OBJECT +public: + MainWindow() + { + tr("More bla", "Gui::MainWindow"); + } + + }; +} //namespace Gui + + +namespace A1 { + class AB : public QObject { + Q_OBJECT + public: + + friend class OtherClass; + + QString inlineFuncAfterFriendDeclaration() const { + return tr("inlineFuncAfterFriendDeclaration", "A1::AB"); + } + }; + class B : AB { + Q_OBJECT + public: + QString foo() const { return tr("foo", "A1::B"); } + }; + + // This is valid C++ too.... + class V : virtual AB { + Q_OBJECT + public: + QString bar() const { return tr("bar", "A1::V"); } + }; + + class W : virtual public AB { + Q_OBJECT + public: + QString baz() const { return tr("baz", "A1::W"); } + }; +} + +class ForwardDecl; + + +class B1 : public QObject { +}; + +class C1 : public QObject { +}; + +namespace A1 { + +class B2 : public QObject { +}; + +} + +void func1() +{ + B1::tr("test TRANSLATOR comment (1)", "B1"); + +} + +using namespace A1; +/* + TRANSLATOR A1::B2 +*/ +void func2() +{ + B2::tr("test TRANSLATOR comment (2)", "A1::B2"); + C1::tr("test TRANSLATOR comment (3)", "C1"); +} + +void func3() +{ + B2::tr("test TRANSLATOR comment (4)", "A1::B2"); +} + +/* + TRANSLATOR B2 + This is a comment to the translator. +*/ +void func4() +{ + B2::tr("test TRANSLATOR comment (5)", "A1::B2"); +} + +namespace A1 { +namespace B3 { +class C2 : public QObject { +QString foo(); +}; +} +} + +namespace D1 = A1::B3; +using namespace D1; + +// TRANSLATOR A1::B3::C2 +QString C2::foo() +{ + return tr("test TRANSLATOR comment (6)", "A1::B3::C2"); // 4.4 screws up +} + + + +int main(int /*argc*/, char ** /*argv*/) { + return 0; +} + +#include "main.moc" diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro new file mode 100644 index 0000000..7547a8d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES = main.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result new file mode 100644 index 0000000..04bb3ae --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result @@ -0,0 +1,192 @@ + + + + + A1::AB + + + inlineFuncAfterFriendDeclaration + A1::AB + + + + + A1::B + + + foo + A1::B + + + + + A1::B2 + + + test TRANSLATOR comment (2) + A1::B2 + + + + + test TRANSLATOR comment (4) + A1::B2 + + + + + test TRANSLATOR comment (5) + A1::B2 + + + + + A1::B3::C2 + + + test TRANSLATOR comment (6) + A1::B3::C2 + + + + + A1::V + + + bar + A1::V + + + + + A1::W + + + baz + A1::W + + + + + A::C + + + + Bla + A::C + + + + + Bla 2 + A::C + + + + + B1 + + + test TRANSLATOR comment (1) + B1 + + + + + B2 + + + + This is a comment to the translator. + + + + + C1 + + + test TRANSLATOR comment (3) + C1 + + + + + D + + + test + D + + + + + Gui::MainWindow + + + More bla + Gui::MainWindow + + + + + QObject + + + task 161186 + QObject + + + + + X::D + + + foo + D + + + + + Bla + X::D + + + + + X::F + + + inline function + X::F + + + + + X::Y::C + + + Bla + X::Y::C + + + + + X::Y::E + + + + Bla + X::Y::E + + + + + ico::foo::A + + + myfoo + ico::foo::A + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp new file mode 100644 index 0000000..454c173 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include +#include +#include +#include +#include +#include + +CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) + : QStandardItemModel(rows, columns, parent) +{} +QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const +{ + if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) + flags |= Qt::MatchCaseSensitive; + + return QStandardItemModel::match(start, role, value, hits, flags); +} + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + contentsWidget = new QWidget(this); + ui.setupUi(contentsWidget); + ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); + + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + l->addWidget(contentsWidget); + + lastBrowser = 0; + onceFound = false; + findExpr.clear(); + + sb = new QStatusBar(this); + l->addWidget(sb); + + sb->showMessage(tr("Enter the text you are looking for.")); + + connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); + connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +FindDialog::~FindDialog() +{ +} + +void FindDialog::findButtonClicked() +{ + doFind(ui.radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + QTextBrowser *browser = static_cast(mainWindow()->browsers()->currentBrowser()); + sb->clearMessage(); + + if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) + onceFound = false; + findExpr = ui.comboFind->currentText(); + + QTextDocument::FindFlags flags = 0; + + if (ui.checkCase->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + + if (ui.checkWords->isChecked()) + flags |= QTextDocument::FindWholeWords; + + QTextCursor c = browser->textCursor(); + if (!c.hasSelection()) { + if (forward) + c.movePosition(QTextCursor::Start); + else + c.movePosition(QTextCursor::End); + + browser->setTextCursor(c); + } + + QTextDocument::FindFlags options; + if (forward == false) + flags |= QTextDocument::FindBackward; + + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } else { + browser->setTextCursor(found); + } + onceFound |= !found.isNull(); + lastBrowser = browser; +} + +bool FindDialog::hasFindExpression() const +{ + return !findExpr.isEmpty(); +} + +void FindDialog::statusMessage(const QString &message) +{ + if (isVisible()) + sb->showMessage(message); + else + static_cast(parent())->statusBar()->showMessage(message, 2000); +} + +MainWindow *FindDialog::mainWindow() const +{ + return static_cast(parentWidget()); +} + +void FindDialog::reset() +{ + ui.comboFind->setFocus(); + ui.comboFind->lineEdit()->setSelection( + 0, ui.comboFind->lineEdit()->text().length()); + + QString s = QApplication::translate("QCoreApplication", "with comment", "comment"); + QString s = QApplication::translate("QCoreApplication", "empty comment", ""); + QString s = QApplication::translate("QCoreApplication", "null comment", 0); + QString s = tr("null comment"); + + QString s = QApplication::translate("QCoreApplication", "encoding, using QCoreApplication", 0, QCoreApplication::UnicodeUTF8); + QString s = QApplication::translate("QCoreApplication", "encoding, using QApplication", 0, QApplication::UnicodeUTF8); + + QString s = QApplication::translate("KÃ¥ntekst", "encoding, using QApplication", 0, QApplication::UnicodeUTF8); + +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp new file mode 100644 index 0000000..df75baf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -0,0 +1,158 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! +int main(char **argv, int argc) +{ + Size size = QSize(1,1); +} + +QString qt_detectRTLLanguage() +{ + return QApplication::tr("QT_LAYOUT_DIRECTION", + "Translate this string to the string 'LTR' in left-to-right" + " languages or to 'RTL' in right-to-left languages (such as Hebrew" + " and Arabic) to get proper widget layout.") == QLatin1String("RTL"); +} + + +class Dialog2 : public QDialog +{ + Q_OBJECT + void func(); + void func3(); + int getCount() const { return 2; } + +}; + +void Dialog2::func() +{ + int n = getCount(); + tr("%n files", "plural form", n); + tr("%n cars", 0, n); + tr("&Find %n cars", 0, n); + tr("Search in %n items?", 0, n); + tr("%1. Search in %n items?", 0, n); + tr("Age: %1"); + tr("There are %n house(s)", "Plurals and function call", getCount()); + + + + + QCoreApplication::translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", QCoreApplication::UnicodeUTF8, n); + QCoreApplication::translate("Plurals, QCoreApplication", "%n car(s)", "Plurals and literal number", QCoreApplication::UnicodeUTF8, 1); + QCoreApplication::translate("Plurals, QCoreApplication", "%n horse(s)", "Plurals and function call", QCoreApplication::UnicodeUTF8, getCount()); + + + + + + + + + QTranslator trans; + trans.translate("QTranslator", "Simple"); + trans.translate("QTranslator", "Simple", 0); + trans.translate("QTranslator", "Simple with comment", "with comment"); + trans.translate("QTranslator", "Plural without comment", 0, 1); + trans.translate("QTranslator", "Plural with comment", "comment 1", n); + trans.translate("QTranslator", "Plural with comment", "comment 2", getCount()); + + + + + + + + + + + + +} + + + + +/* This is actually a test of how many alternative ways a struct/class can be found in a source file. + * Due to the simple parser in lupdate, it will actually not treat the remaining lines in the define + * as a macro, which is a case the 'Tok_Class' parser block might not consider, and it might loop infinite + * if it just tries to fetch the next token until it gets a '{' or a ';'. Another pitfall is that the + * context of tr("func3") might not be parsed, it won't resume normal evaluation until the '{' after the function + * signature. + * + */ +typedef struct S_ +{ +int a; +} S, *SPtr; +class ForwardDecl; + + +#define FT_DEFINE_SERVICE( name ) \ + typedef struct FT_Service_ ## name ## Rec_ \ + FT_Service_ ## name ## Rec ; \ + typedef struct FT_Service_ ## name ## Rec_ \ + const * FT_Service_ ## name ; \ + struct FT_Service_ ## name ## Rec_ + + +/* removing this comment will break this test */ + +void Dialog2::func3() +{ + tr("func3"); +} + + + + +namespace Gui { class BaseClass {}; } + + +class TestClass : QObject { + Q_OBJECT + + + inline QString inlineFunc1() { + return tr("inline function", "TestClass"); + } + + QString inlineFunc2() { + return tr("inline function 2", "TestClass"); + } + + static inline QString staticInlineFunc() { + return tr("static inline function", "TestClass"); + } + + class NoQObject : public Gui::BaseClass { + public: + inline QString hello() { return QString("hello"); } + + }; + +}; + + +class Testing : QObject { + Q_OBJECT + + inline QString f1() { + //: this is an extra comment for the translator + return tr("extra-commented string"); + return tr("not extra-commented string"); + /*: another extra-comment */ + return tr("another extra-commented string"); + /*: blah! */ + return QApplication::translate("scope", "works in translate, too", "blabb", 0); + } + +}; + +//: extra comment for NOOP +//: which spans multiple lines +QT_TRANSLATE_NOOP("scope", "string") // 4.4 says the line of this is at the next statement +//: extra comment for NOOP3 +QT_TRANSLATE_NOOP3_UTF8("scope", "string", "comment") // 4.4 doesn't see this + +QT_TRANSLATE_NOOP("scope", "string " // this is an interleaved comment + "continuation on next line") diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro new file mode 100644 index 0000000..4582705 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp +SOURCES += finddialog.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result new file mode 100644 index 0000000..9386c19 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -0,0 +1,271 @@ + + + + + Dialog2 + + + %n files + plural form + + + + + + + %n cars + + + + + + + &Find %n cars + + + + + + + Search in %n items? + + + + + + + %1. Search in %n items? + + + + + + + Age: %1 + + + + + There are %n house(s) + Plurals and function call + + + + + + + func3 + + + + + FindDialog + + + Enter the text you are looking for. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + + null comment + + + + + KÃ¥ntekst + + + encoding, using QApplication + + + + + Plurals, QCoreApplication + + + %n house(s) + Plurals and identifier + + + + + + + %n car(s) + Plurals and literal number + + + + + + + %n horse(s) + Plurals and function call + + + + + + + QApplication + + + QT_LAYOUT_DIRECTION + Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. + + + + + QCoreApplication + + + with comment + comment + + + + + empty comment + + + + + null comment + + + + + encoding, using QCoreApplication + + + + + encoding, using QApplication + + + + + QTranslator + + + + Simple + + + + + Simple with comment + with comment + + + + + Plural without comment + + + + + + + Plural with comment + comment 1 + + + + + + + Plural with comment + comment 2 + + + + + + + TestClass + + + inline function + TestClass + + + + + inline function 2 + TestClass + + + + + static inline function + TestClass + + + + + Testing + + + extra-commented string + this is an extra comment for the translator + + + + + not extra-commented string + + + + + another extra-commented string + another extra-comment + + + + + scope + + + works in translate, too + blabb + blah! + + + + + + + string + extra comment for NOOP which spans multiple lines + + + + + string + comment + extra comment for NOOP3 + + + + + string continuation on next line + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java b/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java new file mode 100644 index 0000000..07681d2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/main.java @@ -0,0 +1,54 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +package com.trolltech.examples; + +public class I18N extends QDialog { + + private class MainWindow extends QMainWindow { + private String foo = tr("pack class class"); + + //: extra comment for t-tor + private String bar = tr("pack class class extra"); + + public MainWindow(QWidget parent) { + super(parent); + + listWidget = new QListWidget(); + listWidget.addItem(tr("pack class class method")); + + } + } + + public I18N(QWidget parent) { + super(parent, new Qt.WindowFlags(Qt.WindowType.WindowStaysOnTopHint)); + + tr("pack class method"); + + tr("QT_LAYOUT_DIRECTION", + "Translate this string to the string 'LTR' in left-to-right" + + " languages or to 'RTL' in right-to-left languages (such as Hebrew" + + " and Arabic) to get proper widget layout."); + + tr("%n files", "plural form", n); + tr("%n cars", null, n); + tr("Age: %1"); + tr("There are %n house(s)", "Plurals and function call", getCount()); + + QTranslator trans; + trans.translate("QTranslator", "Simple"); + trans.translate("QTranslator", "Simple", null); + trans.translate("QTranslator", "Simple with comment", "with comment"); + trans.translate("QTranslator", "Plural without comment", null, 1); + trans.translate("QTranslator", "Plural with comment", "comment 1", n); + trans.translate("QTranslator", "Plural with comment", "comment 2", getCount()); + + /*: with extra comment! */ + QCoreApplication.translate("Plurals, QCoreApplication", "%n house(s)", "Plurals and identifier", n); + + // FIXME: This will fail. + //QApplication.tr("QT_LAYOUT_DIRECTION", "scoped to qapp"); + + } + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro new file mode 100644 index 0000000..7e64c80 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = Java + +SOURCES += main.java + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejava/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.ts.result new file mode 100644 index 0000000..69c0a00 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejava/project.ts.result @@ -0,0 +1,115 @@ + + + + + Plurals, QCoreApplication + + + %n house(s) + Plurals and identifier + with extra comment! + + + + + + + QTranslator + + + + Simple + + + + + Simple with comment + with comment + + + + + Plural without comment + + + + + + + Plural with comment + comment 1 + + + + + + + Plural with comment + comment 2 + + + + + + + com.trolltech.examples.I18N + + + pack class method + + + + + QT_LAYOUT_DIRECTION + Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. + + + + + %n files + plural form + + + + + + + %n cars + + + + + + + Age: %1 + + + + + There are %n house(s) + Plurals and function call + + + + + + + com.trolltech.examples.I18N$MainWindow + + + pack class class + + + + + pack class class extra + extra comment for t-tor + + + + + pack class class method + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro new file mode 100644 index 0000000..bdc06e7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +LANGUAGE = C++ + +FORMS += project.ui + +TRANSLATIONS = project.ts + +exists( $$TRANSLATIONS ) { + win32 : system(del $$TRANSLATIONS) + unix : system(rm $$TRANSLATIONS) +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result new file mode 100644 index 0000000..ddf58c3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -0,0 +1,17 @@ + + + + + FindDialog + + + Qt Assistant - Finn text + + + + + Finn tekst - Der Bjørn möchte auch mal. + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui new file mode 100644 index 0000000..19fcaf5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ui @@ -0,0 +1,44 @@ + + + ********************************************************************* +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +********************************************************************* + + FindDialog + + + + 0 + 0 + 400 + 172 + + + + Qt Assistant - Finn text + + + Finn tekst - Der Bjørn möchte auch mal. + + + + comboFind + checkWords + checkCase + radioForward + radioBackward + findButton + closeButton + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp new file mode 100644 index 0000000..d845853 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp @@ -0,0 +1,17 @@ + + + +QString foo() +{ + QCoreApplication::translate("Foo","XXX","YYY"); +} + +Foo::Foo() +{ + tr("CTOR"); +} + +void Foo::bar() +{ + tr("BAR"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro new file mode 100644 index 0000000..7547a8d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES = main.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result new file mode 100644 index 0000000..5ced00d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result @@ -0,0 +1,23 @@ + + + + + Foo + + + XXX + YYY + + + + + CTOR + + + + + BAR + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp b/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp new file mode 100644 index 0000000..9abfa5e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/main.cpp @@ -0,0 +1,37 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + + + +void func2() { +#ifdef Q_OS_WIN + QApplication::tr("Kind", "Windows only, see Type"); +#else + QApplication::tr("Type", "Not used on windows, see Kind"); +#endif + +} + + + +void stringconcatenation() +{ + QApplication::tr("One string," + " three" + " lines"); + + QApplication::tr("a backslash followed by newline \ +should be ignored \ +and the next line should be syntactically considered to be \ +on the same line"); + +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro new file mode 100644 index 0000000..012c7e0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/preprocess/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.ts.result new file mode 100644 index 0000000..3aec045 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/preprocess/project.ts.result @@ -0,0 +1,35 @@ + + + + + QApplication + + + Hello world + Platform-independent file + + + + + Kind + Windows only, see Type + + + + + Type + Not used on windows, see Kind + + + + + One string, three lines + + + + + a backslash followed by newline should be ignored and the next line should be syntactically considered to be on the same line + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp new file mode 100644 index 0000000..236bbe7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp new file mode 100644 index 0000000..845aaa6 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_mac.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello macworld", "mac-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp new file mode 100644 index 0000000..229e154 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_unix.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello unixworld", "unix-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp new file mode 100644 index 0000000..4eb39f7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main_win.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello windowsworld", "Windows-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro new file mode 100644 index 0000000..3078817 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -0,0 +1,40 @@ +TEMPLATE = app +LANGUAGE = C++ + +# Try to reference a variable that does not exist: +MYVAR=$$THIS_VARIABLE_IS_NOT_DEFINED + +SOURCES += main.cpp + +win32 { + SOURCES += main_win.cpp +} + +unix { + SOURCES += main_unix.cpp +} + +mac { + SOURCES += main_mac.cpp +} + +SOURCES += wildcard/main*.cpp \ +# yadiyada it should also parse the next line + wildcard*.cpp + + +DEPENDPATH = vpaths/dependpath + +# The purpose of this test is to test expansion of environment variables, +# and to test if the DEPENDPATH variable is considered correctly. +if (exists($$member($$(PATH), 0))) { + SOURCES += main_dependpath.cpp +} + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result new file mode 100644 index 0000000..ef98596 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result @@ -0,0 +1,64 @@ + + + + + QApplication + + + Hello world + Platform-independent file + + + + + Hello macworld + mac-only file + + + + + Hello unixworld + unix-only file + + + + + Hello windowsworld + Windows-only file + + + + + Hello world + wildcard/main1.cpp + + + + + Hello world + wildcard/main2.cpp + + + + + Hello world + wildcard1.cpp + + + + + Hello world + wildcard99.cpp + + + + + QCoreApplication + + + Hello from a DEPENDPATH + See if the DEPENDPATH thing works + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp new file mode 100644 index 0000000..f019c79 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/vpaths/dependpath/main_dependpath.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +int main(int argc, char **argv) +{ + QCoreApplication::tr("Hello from a DEPENDPATH", "See if the DEPENDPATH thing works"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp new file mode 100644 index 0000000..506ae42 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/main1.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard/main1.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp new file mode 100644 index 0000000..f4cd00a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard/mainfile.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard/main2.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp new file mode 100644 index 0000000..c7790c5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard1.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard1.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp new file mode 100644 index 0000000..93febda --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/wildcard99.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "wildcard99.cpp"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a new file mode 100644 index 0000000..5966392 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("a"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp new file mode 100644 index 0000000..1d80ed3 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/a.cpp @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("a.cpp"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b new file mode 100644 index 0000000..d0fe066 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("b"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp new file mode 100644 index 0000000..a5c386d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/b.cpp @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("b.cpp"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/e b/tests/auto/linguist/lupdate/testdata/good/proparsing2/e new file mode 100644 index 0000000..66e89a8 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/e @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("e"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp new file mode 100644 index 0000000..d86bee2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/f/g.cpp @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("f/g.cpp"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/files-cc.txt b/tests/auto/linguist/lupdate/testdata/good/proparsing2/files-cc.txt new file mode 100644 index 0000000..5bd8d03 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/files-cc.txt @@ -0,0 +1 @@ +a.cpp b.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro new file mode 100644 index 0000000..1d6895a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.pro @@ -0,0 +1,42 @@ +# This is to test if quoted elements with spaces are treated as elements (and not splitted up due +# to the spaces.) +# It also tries to verify the behaviour of combining quoted and non-quoted elements with literals. +# + +TEMPLATE = app +LANGUAGE = C++ + +QUOTED = $$quote(variable with spaces) +VERSIONAB = "a.b" +VAB = $$split(VERSIONAB, ".") +V += $$VAB +V += $$QUOTED + +# this is just to make p4 happy with no spaces in filename +SOURCES += $$member(V,0,1) +V2 = $$member(V,2) +V2S = $$split(V2, " ") +SOURCES += $$join(V2S,"_") +message($$SOURCES) +# SOURCES += [a, b, variable_with_spaces] + +LIST = d e f +L2 = x/$$LIST/g.cpp +SOURCES += $$L2 +# SOURCES += [x/d, e, f/g.cpp] + +QUOTEDEXTRA = x/$$QUOTED/z +Q3 = $$split(QUOTEDEXTRA, " ") +SOURCES += $$Q3 +# SOURCES += [x/variable, with, spaces/z] + +win32: SOURCES += $$system(type files-cc.txt) +unix: SOURCES += $$system(cat files-cc.txt) + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.ts.result new file mode 100644 index 0000000..2e60696 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/project.ts.result @@ -0,0 +1,62 @@ + + + + + QLineEdit + + + a + + + + + a.cpp + + + + + b + + + + + b.cpp + + + + + e + + + + + f/g.cpp + + + + + spaces/z + + + + + variable with spaces + + + + + with + + + + + x/d + + + + + x/variable + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z b/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z new file mode 100644 index 0000000..34364d6 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/spaces/z @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("spaces/z"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces b/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces new file mode 100644 index 0000000..cf56fc4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/variable_with_spaces @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("variable with spaces"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/with b/tests/auto/linguist/lupdate/testdata/good/proparsing2/with new file mode 100644 index 0000000..a156ca1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/with @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("with"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d new file mode 100644 index 0000000..e2effde --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/d @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("x/d"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable new file mode 100644 index 0000000..a86e387 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing2/x/variable @@ -0,0 +1,4 @@ +QString func() +{ + return QLineEdit::tr("x/variable"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/common.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/common.pri new file mode 100644 index 0000000..ba3169d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/common.pri @@ -0,0 +1 @@ +include(main.pri) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp new file mode 100644 index 0000000..236bbe7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.pri new file mode 100644 index 0000000..a8d4a2b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/common/main.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/mac.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/mac.pri new file mode 100644 index 0000000..549eab5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/mac.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main_mac.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp new file mode 100644 index 0000000..845aaa6 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/mac/main_mac.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello macworld", "mac-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro new file mode 100644 index 0000000..3810a02 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.pro @@ -0,0 +1,16 @@ +TEMPLATE = app +LANGUAGE = C++ + +include(win/win.pri) +include(mac/mac.pri) +include(unix/unix.pri) +include (common/common.pri) # Important: keep the space before the '(' +include(relativity/relativity.pri) + +message($$SOURCES) +TRANSLATIONS = project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.ts.result new file mode 100644 index 0000000..c64ba82 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/project.ts.result @@ -0,0 +1,37 @@ + + + + + QApplication + + + Hello world + Platform-independent file + + + + + Hello macworld + mac-only file + + + + + relativity.pri + Platform-independent file + + + + + Hello unixworld + unix-only file + + + + + Hello windowsworld + Windows-only file + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp new file mode 100644 index 0000000..83ae7d5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("relativity.pri", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.pri new file mode 100644 index 0000000..42658f0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/relativity.pri @@ -0,0 +1,3 @@ +# Lets test how well the proparser can walk the tree of includes... + +include(sub/sub.pri) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub/sub.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub/sub.pri new file mode 100644 index 0000000..17055a7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub/sub.pri @@ -0,0 +1 @@ +include(../sub2/sub2.pri) diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub2/sub2.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub2/sub2.pri new file mode 100644 index 0000000..e2876b1 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/relativity/sub2/sub2.pri @@ -0,0 +1,2 @@ +SOURCES += $$PWD/../relativity.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp new file mode 100644 index 0000000..229e154 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/main_unix.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello unixworld", "unix-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/unix.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/unix.pri new file mode 100644 index 0000000..99777d7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/unix/unix.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main_unix.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp new file mode 100644 index 0000000..4eb39f7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/main_win.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello windowsworld", "Windows-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/win.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/win.pri new file mode 100644 index 0000000..742417c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpri/win/win.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += $$PWD/main_win.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro new file mode 100644 index 0000000..4de6622 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.pro @@ -0,0 +1,3 @@ +TEMPLATE =subdirs + +SUBDIRS = sub1 diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.ts.result new file mode 100644 index 0000000..5914d0b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/project.ts.result @@ -0,0 +1,13 @@ + + + + + QApplication + + + Hello world + Platform-independent file + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp new file mode 100644 index 0000000..236bbe7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/main.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro new file mode 100644 index 0000000..1d50c2b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubdirs/sub1/sub1.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp + +TRANSLATIONS += ../project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro new file mode 100644 index 0000000..a8b3106 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/common.pro @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp new file mode 100644 index 0000000..236bbe7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/common/main.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "Platform-independent file"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro new file mode 100644 index 0000000..87478bf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/mac.pro @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main_mac.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp new file mode 100644 index 0000000..845aaa6 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/mac/main_mac.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello macworld", "mac-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro new file mode 100644 index 0000000..668ecf4 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro @@ -0,0 +1,7 @@ +TEMPLATE = subdirs +SUBDIRS = win mac unix common + +exists( project.ts ) { + win32: system(del project.ts) + unix: system(rm project.ts) +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.ts.result new file mode 100644 index 0000000..c0352fb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.ts.result @@ -0,0 +1,31 @@ + + + + + QApplication + + + Hello windowsworld + Windows-only file + + + + + Hello macworld + mac-only file + + + + + Hello unixworld + unix-only file + + + + + Hello world + Platform-independent file + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp new file mode 100644 index 0000000..229e154 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/main_unix.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello unixworld", "unix-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro new file mode 100644 index 0000000..d0ebec7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/unix/unix.pro @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main_unix.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp new file mode 100644 index 0000000..4eb39f7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/main_win.cpp @@ -0,0 +1,10 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello windowsworld", "Windows-only file"); +} + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro new file mode 100644 index 0000000..a9a9751 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/win/win.pro @@ -0,0 +1,5 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main_win.cpp + diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro new file mode 100644 index 0000000..28ba291 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +FORMS += project.ui + +TRANSLATIONS = project.ts + +# Copy the ts to a temp file because: +# 1. The depot file is usually read-only +# 2. We don't want to modify the original file, since then it won't be possible to run the test twice +# without reverting the original file again. + +win32: system(copy /Y project.ts.before $$TRANSLATIONS) +unix: system(cp -f project.ts.before $$TRANSLATIONS && chmod a+w $$TRANSLATIONS) diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before new file mode 100644 index 0000000..f06c22c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before @@ -0,0 +1,16 @@ + + + + FindDialog + + + Test similarity + Test likhet (test1) + + + + Similarity should have kicked in here! + Test likhet (test2) + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result new file mode 100644 index 0000000..d65110a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result @@ -0,0 +1,22 @@ + + + + + FindDialog + + Test similarity + Test likhet (test1) + + + + This should not be considered to be more or less equal to the corresponding one in the ts file. + + + + + Here, similarity should kick in! + Similarity should have kicked in here! + Test likhet (test2) + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui new file mode 100644 index 0000000..0d0defd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui @@ -0,0 +1,26 @@ + + + + + + FindDialog + + + + This should not be considered to be more or less equal to the corresponding one in the ts file. + + + Here, similarity should kick in! + + + diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd new file mode 100644 index 0000000..80319de --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/output_ts/lupdatecmd @@ -0,0 +1,5 @@ +# Add the command that lupdate should run here. If it can't find anything it will default to +# 'lupdate project.pro -ts project.ts' + +# lupdate project.pro +lupdate toplevel/library/tools/tools.pro diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result b/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result new file mode 100644 index 0000000..7fde820 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/output_ts/project.ts.result @@ -0,0 +1,12 @@ + + + + + QApplication + + + Hello world + + + + diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp new file mode 100644 index 0000000..477f5ec --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/main.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro new file mode 100644 index 0000000..ec6c01d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/tools.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp + +TRANSLATIONS += translations/project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt new file mode 100644 index 0000000..83adcd2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/output_ts/toplevel/library/tools/translations/readme.txt @@ -0,0 +1,2 @@ +This is just a dummy file so that GIT creates this folder + diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result new file mode 100644 index 0000000..e132342 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/bar.ts.result @@ -0,0 +1,27 @@ + + + + + FindDialog + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result new file mode 100644 index 0000000..6646014 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/foo.ts.result @@ -0,0 +1,115 @@ + + + + + FindDialog + + + Qt Assistant - Finn text + + + + + Finn tekst + + + + + Enter the text you want to find. + + + + + Search reached end of the document + + + + + Search reached start of the document + + + + + Text not found + + + + + QObject + + + +newline at the start + + + + + newline at the end + + + + + + newline and space at the end + + + + + + space and newline at the end + + + + + + Tab at the start and newline at the end + + + + + + + newline and tab at the start + + + + + space and tab at the start + + + + + space_first + + + + + space_last + + + + + text/c++ + + + test + + + + + text/cpp + + + test + + + + + text/cxx + + + test + + + + diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp new file mode 100644 index 0000000..905cccd --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/main.cpp @@ -0,0 +1,22 @@ +#include +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QTranslator translator; + translator.load("whitespace"); + app.installTranslator(&translator); + + QObject::tr("\nnewline at the start"); + QObject::tr("newline at the end\n"); + QObject::tr("newline and space at the end\n "); + QObject::tr("space and newline at the end \n"); + QObject::tr("\tTab at the start and newline at the end\n"); + QObject::tr("\n\tnewline and tab at the start"); + QObject::tr(" \tspace and tab at the start"); + QObject::tr(" space_first"); + QObject::tr("space_last "); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui new file mode 100644 index 0000000..e03a66e --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/project.ui @@ -0,0 +1,44 @@ + + + ********************************************************************* +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +********************************************************************* + + FindDialog + + + + 0 + 0 + 400 + 172 + + + + Qt Assistant - Finn text + + + Finn tekst + + + + comboFind + checkWords + checkCase + radioForward + radioBackward + findButton + closeButton + + + + diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ new file mode 100644 index 0000000..4da3ded --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.c++ @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QApplication::translate("text/c++", "test"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp new file mode 100644 index 0000000..9b3207d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QApplication::translate("text/cpp", "test"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx new file mode 100644 index 0000000..b741ff0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/filetypes/main.cxx @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QApplication::translate("text/cxx", "test"); + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp new file mode 100644 index 0000000..8e92a2a --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/recursivescan/sub/finddialog.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved. +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "finddialog.h" +#include "mainwindow.h" +#include "tabbedbrowser.h" +#include "helpwindow.h" + +#include +#include +#include +#include +#include +#include + +CaseSensitiveModel::CaseSensitiveModel(int rows, int columns, QObject *parent) + : QStandardItemModel(rows, columns, parent) +{} +QModelIndexList CaseSensitiveModel::match(const QModelIndex &start, int role, const QVariant &value, + int hits, Qt::MatchFlags flags) const +{ + if (flags == Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) + flags |= Qt::MatchCaseSensitive; + + return QStandardItemModel::match(start, role, value, hits, flags); +} + +FindDialog::FindDialog(MainWindow *parent) + : QDialog(parent) +{ + contentsWidget = new QWidget(this); + ui.setupUi(contentsWidget); + ui.comboFind->setModel(new CaseSensitiveModel(0, 1, ui.comboFind)); + + QVBoxLayout *l = new QVBoxLayout(this); + l->setMargin(0); + l->setSpacing(0); + l->addWidget(contentsWidget); + + lastBrowser = 0; + onceFound = false; + findExpr.clear(); + + sb = new QStatusBar(this); + l->addWidget(sb); + + sb->showMessage(tr("Enter the text you want to find.")); + + connect(ui.findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked())); + connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +FindDialog::~FindDialog() +{ +} + +void FindDialog::findButtonClicked() +{ + doFind(ui.radioForward->isChecked()); +} + +void FindDialog::doFind(bool forward) +{ + QTextBrowser *browser = static_cast(mainWindow()->browsers()->currentBrowser()); + sb->clearMessage(); + + if (ui.comboFind->currentText() != findExpr || lastBrowser != browser) + onceFound = false; + findExpr = ui.comboFind->currentText(); + + QTextDocument::FindFlags flags = 0; + + if (ui.checkCase->isChecked()) + flags |= QTextDocument::FindCaseSensitively; + + if (ui.checkWords->isChecked()) + flags |= QTextDocument::FindWholeWords; + + QTextCursor c = browser->textCursor(); + if (!c.hasSelection()) { + if (forward) + c.movePosition(QTextCursor::Start); + else + c.movePosition(QTextCursor::End); + + browser->setTextCursor(c); + } + + QTextDocument::FindFlags options; + if (forward == false) + flags |= QTextDocument::FindBackward; + + QTextCursor found = browser->document()->find(findExpr, c, flags); + if (found.isNull()) { + if (onceFound) { + if (forward) + statusMessage(tr("Search reached end of the document")); + else + statusMessage(tr("Search reached start of the document")); + } else { + statusMessage(tr( "Text not found" )); + } + } else { + browser->setTextCursor(found); + } + onceFound |= !found.isNull(); + lastBrowser = browser; +} + +bool FindDialog::hasFindExpression() const +{ + return !findExpr.isEmpty(); +} + +void FindDialog::statusMessage(const QString &message) +{ + if (isVisible()) + sb->showMessage(message); + else + static_cast(parent())->statusBar()->showMessage(message, 2000); +} + +MainWindow *FindDialog::mainWindow() const +{ + return static_cast(parentWidget()); +} + +void FindDialog::reset() +{ + ui.comboFind->setFocus(); + ui.comboFind->lineEdit()->setSelection( + 0, ui.comboFind->lineEdit()->text().length()); +} diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp new file mode 100644 index 0000000..c80dd54 --- /dev/null +++ b/tests/auto/linguist/lupdate/testlupdate.cpp @@ -0,0 +1,116 @@ +#include "testlupdate.h" +#include +#include +#include +#include +#include + +#ifdef Q_OS_WIN32 +# include +#endif + +#include + + +TestLUpdate::TestLUpdate() +{ + childProc = 0; + m_cmdLupdate = QLatin1String("lupdate"); + m_cmdQMake = QLatin1String("qmake"); +} + +TestLUpdate::~TestLUpdate() +{ + if (childProc) + delete childProc; +} + +void TestLUpdate::setWorkingDirectory(const QString &workDir) +{ + m_workDir = workDir; + QDir::setCurrent(m_workDir); +} + +void TestLUpdate::addMakeResult( const QString &result ) +{ + make_result.append( result ); +} + +bool TestLUpdate::runChild( bool showOutput, const QString &program, const QStringList &argList) +{ + make_result.clear(); + exit_ok = FALSE; + if (childProc) + delete childProc; + + child_show = showOutput; + if ( showOutput ) { + QString S = argList.join(" "); + addMakeResult( program + QLatin1String(" ") + S ); + } + + childProc = new QProcess(); + Q_ASSERT(childProc); + + childProc->setWorkingDirectory(m_workDir); + connect(childProc, SIGNAL(finished(int)), this, SLOT(childReady(int))); + childProc->setProcessChannelMode(QProcess::MergedChannels); + if (argList.isEmpty()) { + childProc->start( program ); + } else { + childProc->start( program, argList ); + } + bool ok; + + ok = childProc->waitForStarted(); + + if (ok) + ok = childProc->waitForFinished(); + + if (!ok) + addMakeResult( "Error executing '" + program + "'." ); + + childReady(ok ? 0 : -1); + + return ok; +} + +void TestLUpdate::childReady(int /*exitCode*/) +{ + if (childProc != 0) { + childHasData(); + exit_ok = childProc->state() == QProcess::NotRunning + && childProc->exitStatus() == 0; + childProc->deleteLater(); + } + childProc = 0; +} + +void TestLUpdate::childHasData() +{ + //QByteArray ba = childProc->readAllStandardError(); + //qDebug() << "ERROR:" << ba; + QString stdoutput = childProc->readAllStandardOutput(); + stdoutput = stdoutput.replace("\t", " "); + if (child_show) + addMakeResult(stdoutput); +} + +bool TestLUpdate::run(const QString &commandline) +{ + return runChild(true, m_cmdLupdate + QLatin1String(" ") + commandline); +} + + +bool TestLUpdate::updateProFile(const QString &arguments) +{ + QStringList args = arguments.split(QChar(' ')); + return runChild( true, m_cmdLupdate, args ); +} + +bool TestLUpdate::qmake() +{ + QStringList args; + args << "-r"; + return runChild(true, m_cmdQMake, args); +} diff --git a/tests/auto/linguist/lupdate/testlupdate.h b/tests/auto/linguist/lupdate/testlupdate.h new file mode 100644 index 0000000..3fd7dcb --- /dev/null +++ b/tests/auto/linguist/lupdate/testlupdate.h @@ -0,0 +1,46 @@ +#ifndef TESTLUPDATE_H +#define TESTLUPDATE_H + +#include +#include +#include + +class TestLUpdate : public QObject +{ + Q_OBJECT + +public: + TestLUpdate(); + virtual ~TestLUpdate(); + + void setWorkingDirectory( const QString &workDir); + bool run( const QString &commandline); + bool updateProFile( const QString &arguments); + bool qmake(); + QStringList getErrorMessages() { + return make_result; + } + void clearResult() { + make_result.clear(); + } +private: + QString m_cmdLupdate; + QString m_cmdQMake; + QString m_workDir; + QProcess *childProc; + QStringList env_list; + QStringList make_result; + + bool child_show; + bool qws_mode; + bool exit_ok; + + bool runChild( bool showOutput, const QString &program, const QStringList &argList = QStringList()); + void addMakeResult( const QString &result ); + void childHasData(); + +private slots: + void childReady(int exitCode); +}; + +#endif // TESTLUPDATE_H diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp new file mode 100644 index 0000000..1beae73 --- /dev/null +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -0,0 +1,277 @@ +#include "testlupdate.h" +#if CHECK_SIMTEXTH +#include "../shared/simtexth.h" +#endif + +#include +#include +#include +#include + +#include + +class tst_lupdate : public QObject +{ + Q_OBJECT +public: + tst_lupdate() { m_basePath = QDir::currentPath() + QLatin1String("/testdata/"); } + +private slots: + void good_data(); + void good(); + void output_ts(); + void commandline_data(); + void commandline(); +#if CHECK_SIMTEXTH + void simtexth(); + void simtexth_data(); +#endif + +private: + TestLUpdate m_lupdate; + QString m_basePath; + + void doCompare(const QStringList &actual, const QString &expectedFn, bool err); + void doCompare(const QString &actualFn, const QString &expectedFn, bool err); +}; + + +void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn, bool err) +{ + QFile file(expectedFn); + QVERIFY(file.open(QIODevice::ReadOnly)); + QStringList expected = QString(file.readAll()).trimmed().remove('\r').split('\n'); + + int i = 0, ei = expected.size(), gi = actual.size(); + for (; ; i++) { + if (i == gi) { + if (i == ei) + return; + gi = 0; + break; + } else if (i == ei) { + ei = 0; + break; + } else if (err ? !QRegExp(expected.at(i)).exactMatch(actual.at(i)) : + (actual.at(i) != expected.at(i))) { + while ((ei - 1) >= i && (gi - 1) >= i && + (err ? QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)) : + (actual.at(gi - 1) == expected.at(ei - 1)))) + ei--, gi--; + break; + } + } + QByteArray diff; + for (int j = qMax(0, i - 3); j < i; j++) + diff += expected.at(j) + '\n'; + diff += "<<<<<<< got\n"; + for (int j = i; j < gi; j++) { + diff += actual.at(j) + '\n'; + if (j >= i + 5) { + diff += "...\n"; + break; + } + } + diff += "=========\n"; + for (int j = i; j < ei; j++) { + diff += expected.at(j) + '\n'; + if (j >= i + 5) { + diff += "...\n"; + break; + } + } + diff += ">>>>>>> expected\n"; + for (int j = ei; j < qMin(ei + 3, expected.size()); j++) + diff += expected.at(j) + '\n'; + QFAIL(qPrintable((err ? "Output for " : "Result for ") + expectedFn + " does not meet expectations:\n" + diff)); +} + +void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, bool err) +{ + QFile afile(actualFn); + QVERIFY(afile.open(QIODevice::ReadOnly)); + QStringList actual = QString(afile.readAll()).trimmed().remove('\r').split('\n'); + + doCompare(actual, expectedFn, err); +} + +void tst_lupdate::good_data() +{ + QTest::addColumn("directory"); + + QDir parsingDir(m_basePath + "good"); + QStringList dirs = parsingDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); + +#ifndef Q_OS_WIN + dirs.removeAll(QLatin1String("backslashes")); +#endif + + foreach (const QString &dir, dirs) + QTest::newRow(dir.toLocal8Bit()) << dir; +} + +void tst_lupdate::good() +{ + QFETCH(QString, directory); + + QString dir = m_basePath + "good/" + directory; + QString expectedFile = dir + QLatin1String("/project.ts.result"); + + qDebug() << "Checking..."; + + // qmake will delete the previous one, to ensure that we don't do any merging.... + QString generatedtsfile(QLatin1String("project.ts")); + + m_lupdate.setWorkingDirectory(dir); + m_lupdate.qmake(); + // look for a command + QString lupdatecmd; + QFile file(dir + "/lupdatecmd"); + if (file.exists()) { + QVERIFY(file.open(QIODevice::ReadOnly)); + while (!file.atEnd()) { + QByteArray cmdstring = file.readLine().simplified(); + if (cmdstring.startsWith('#')) + continue; + if (cmdstring.startsWith("lupdate")) { + cmdstring.remove(0, 8); + lupdatecmd.append(cmdstring); + break; + } else if (cmdstring.startsWith("TRANSLATION:")) { + cmdstring.remove(0, 12); + generatedtsfile = dir + QLatin1Char('/') + cmdstring.trimmed(); + } + } + file.close(); + } + + if (lupdatecmd.isEmpty()) { + lupdatecmd = QLatin1String("project.pro -ts project.ts"); + } + lupdatecmd.prepend("-silent "); + m_lupdate.updateProFile(lupdatecmd); + + // If the file expectedoutput.txt exists, compare the + // console output with the content of that file + QFile outfile(dir + "/expectedoutput.txt"); + if (outfile.exists()) { + QString errs = m_lupdate.getErrorMessages().at(1).trimmed(); + QStringList errslist = errs.split(QLatin1Char('\n')); + doCompare(errslist, outfile.fileName(), true); + if (QTest::currentTestFailed()) + return; + } + + doCompare(generatedtsfile, expectedFile, false); +} + +void tst_lupdate::output_ts() +{ + QString dir = m_basePath + "output_ts"; + m_lupdate.setWorkingDirectory(dir); + + // look for a command + QString lupdatecmd; + QFile file(dir + "/lupdatecmd"); + if (file.exists()) { + QVERIFY(file.open(QIODevice::ReadOnly)); + while (!file.atEnd()) { + QByteArray cmdstring = file.readLine().simplified(); + if (cmdstring.startsWith('#')) + continue; + if (cmdstring.startsWith("lupdate")) { + cmdstring.remove(0, 8); + lupdatecmd.append(cmdstring); + break; + } + } + file.close(); + } + + QDir parsingDir(m_basePath + "output_ts"); + + QString generatedtsfile = + dir + QLatin1String("/toplevel/library/tools/translations/project.ts"); + + QFile::remove(generatedtsfile); + + lupdatecmd.prepend("-silent "); + m_lupdate.qmake(); + m_lupdate.updateProFile(lupdatecmd); + + // If the file expectedoutput.txt exists, compare the + // console output with the content of that file + QFile outfile(dir + "/expectedoutput.txt"); + if (outfile.exists()) { + QString errs = m_lupdate.getErrorMessages().at(1).trimmed(); + QStringList errslist = errs.split(QLatin1Char('\n')); + doCompare(errslist, outfile.fileName(), true); + if (QTest::currentTestFailed()) + return; + } + + doCompare(generatedtsfile, dir + QLatin1String("/project.ts.result"), false); +} + +void tst_lupdate::commandline_data() +{ + QTest::addColumn("currentPath"); + QTest::addColumn("commandline"); + QTest::addColumn("generatedtsfile"); + QTest::addColumn("expectedtsfile"); + + QTest::newRow("Recursive scan") << QString("recursivescan") + << QString(". -ts foo.ts") << QString("foo.ts") << QString("foo.ts.result"); + QTest::newRow("Deep path argument") << QString("recursivescan") + << QString("sub/finddialog.cpp -ts bar.ts") << QString("bar.ts") << QString("bar.ts.result"); +} + +void tst_lupdate::commandline() +{ + QFETCH(QString, currentPath); + QFETCH(QString, commandline); + QFETCH(QString, generatedtsfile); + QFETCH(QString, expectedtsfile); + + m_lupdate.setWorkingDirectory(m_basePath + currentPath); + QString generated = + m_basePath + currentPath + QLatin1Char('/') + generatedtsfile; + QFile gen(generated); + if (gen.exists()) + QVERIFY(gen.remove()); + if (!m_lupdate.run("-silent " + commandline)) + qDebug() << m_lupdate.getErrorMessages().last(); + + doCompare(generated, m_basePath + currentPath + QLatin1Char('/') + expectedtsfile, false); +} + +#if CHECK_SIMTEXTH +void tst_lupdate::simtexth() +{ + QFETCH(QString, one); + QFETCH(QString, two); + QFETCH(int, expected); + + int measured = getSimilarityScore(one, two.toLatin1()); + QCOMPARE(measured, expected); +} + + +void tst_lupdate::simtexth_data() +{ + using namespace QTest; + + addColumn("one"); + addColumn("two"); + addColumn("expected"); + + newRow("00") << "" << "" << 1024; + newRow("01") << "a" << "a" << 1024; + newRow("02") << "ab" << "ab" << 1024; + newRow("03") << "abc" << "abc" << 1024; + newRow("04") << "abcd" << "abcd" << 1024; +} +#endif + +QTEST_MAIN(tst_lupdate) +#include "tst_lupdate.moc" diff --git a/tests/auto/tests.xml b/tests/auto/tests.xml index d2f378d..a5386b2 100644 --- a/tests/auto/tests.xml +++ b/tests/auto/tests.xml @@ -9,6 +9,9 @@ + + + @@ -412,6 +415,9 @@ + + + -- cgit v0.12 From e0463464773f5eb2bda98a467a9c91092a1f1964 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Jun 2009 14:11:38 +0200 Subject: const ref for foreach() --- tools/linguist/lupdate/cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index eb743c2..09148e7 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1799,7 +1799,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat ? translator.codecName() : cd.m_codecForSource; QTextCodec *codec = QTextCodec::codecForName(codecName); - foreach (const QString filename, filenames) { + foreach (const QString &filename, filenames) { if (CppFiles::getResults(filename) || CppFiles::isBlacklisted(filename)) continue; -- cgit v0.12 From 7e91986c352677d4c0456d30e1cb5fc3179e28c3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 30 Jun 2009 18:02:00 +0200 Subject: add 4.6 specific modifications to linguist tools tests --- .../testdata/good/lacksqobject/expectedoutput.txt | 8 +++-- .../testdata/good/parsecpp2/expectedoutput.txt | 7 ++++ .../lupdate/testdata/good/parsecpp2/main.cpp | 24 +++++++++++++ .../lupdate/testdata/good/parsecpp2/main2.cpp | 28 +++++++++++++++ .../lupdate/testdata/good/parsecpp2/main3.cpp | 42 ++++++++++++++++++++++ .../lupdate/testdata/good/parsecpp2/project.pro | 12 +++++++ .../testdata/good/parsecpp2/project.ts.result | 4 +++ 7 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result diff --git a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt index 8a0bd11..1a6cfeb 100644 --- a/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt @@ -1,4 +1,8 @@ .*/lupdate/testdata/good/lacksqobject/main.cpp:17: Class 'B' lacks Q_OBJECT macro -.*/lupdate/testdata/good/lacksqobject/main.cpp:26: Class 'C' lacks Q_OBJECT macro + +.*/lupdate/testdata/good/lacksqobject/main.cpp:24: Class 'C' lacks Q_OBJECT macro + .*/lupdate/testdata/good/lacksqobject/main.cpp:37: Class 'nsB::B' lacks Q_OBJECT macro -.*/lupdate/testdata/good/lacksqobject/main.cpp:45: Class 'nsB::C' lacks Q_OBJECT macro + +.*/lupdate/testdata/good/lacksqobject/main.cpp:43: Class 'nsB::C' lacks Q_OBJECT macro + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt new file mode 100644 index 0000000..e3f7926 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -0,0 +1,7 @@ +.*/lupdate/testdata/good/parsecpp2/main.cpp:10: Excess closing brace .* + +.*/lupdate/testdata/good/parsecpp2/main.cpp:14: Excess closing brace .* + +.*/lupdate/testdata/good/parsecpp2/main.cpp:20: Excess closing brace .* + +.*/lupdate/testdata/good/parsecpp2/main.cpp:24: Excess closing brace .* diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp new file mode 100644 index 0000000..eb4a09b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -0,0 +1,24 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +// nothing here + +// sickness: multi-\ +line c++ comment } (with brace) + +#define This is a closing brace } which was ignored +} // complain here + +#define This is another \ + closing brace } which was ignored +} // complain here + +#define This is another /* comment in } define */\ + something /* comment ) + spanning {multiple} lines */ \ + closing brace } which was ignored +} // complain here + +#define This is another // comment in } define \ + something } comment +} // complain here diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp new file mode 100644 index 0000000..1c72ac2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp @@ -0,0 +1,28 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +// nothing here + +// sickness: multi-\ +line c++ comment } (with brace) + +#define This is a closing brace } which was ignored +} // complain here + +#define This is another \ + closing brace } which was ignored +} // complain here + +#define This is another /* comment in } define */\ + something /* comment ) + spanning {multiple} lines */ \ + closing brace } which was ignored +} // complain here + +#define This is another // comment in } define \ + something } comment +} // complain here + +char somestring[] = "\ + continued\n\ + here and \"quoted\" to activate\n"; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp new file mode 100644 index 0000000..731d5cdf --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp @@ -0,0 +1,42 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +// nothing here + +// sickness: multi-\ +line c++ comment } (with brace) + +#define This is a closing brace } which was ignored +} // complain here + +#define This is another \ + closing brace } which was ignored +} // complain here + +#define This is another /* comment in } define */\ + something /* comment ) + spanning {multiple} lines */ \ + closing brace } which was ignored +} // complain here + +#define This is another // comment in } define \ + something } comment +} // complain here + +char somestring[] = "\ + continued\n\ + here and \"quoted\" to activate\n"; + + NSString *scriptSource = @"\ + on SetupNewMail(theRecipientAddress, theSubject, theContent, theAttachmentPath)\n\ + tell application \"Mail\" to activate\n\ + tell application \"Mail\"\n\ + set theMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theContent}\n\ + tell theMessage\n\ + make new to recipient at end of to recipients with properties {address:theRecipientAddress}\n\ + end tell\n\ + tell content of theMessage\n\ + make new attachment with properties {file name:theAttachmentPath} at after last paragraph\n\ + end tell\n\ + end tell\n\ + end SetupNewMail\n"; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro new file mode 100644 index 0000000..7547a8d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES = main.cpp + +TRANSLATIONS += project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm $$TRANSLATIONS) +} + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result new file mode 100644 index 0000000..07a7469 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -0,0 +1,4 @@ + + + + -- cgit v0.12 From a1d5b33bd33ecf1d809346a39d2386cafaf50cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 30 Jun 2009 18:41:18 +0200 Subject: Partially revert 7fe4f8ff71cf09bbabbd3438ef637fe408a11c33 We have to ensure that the item's top-level is marked as discovered. This broke the dragandroprobot example after we started using the BSP from QGraphicsSceneIndex::items()* (see 6ee3fb750377eeedf161d96fef02c5fa336810e9) --- src/gui/graphicsview/qgraphicsscene.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index faacf4d..ed1d2f3 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1087,11 +1087,8 @@ QList QGraphicsScenePrivate::topLevelItemsInStackingOrder(const QList tmp = index->estimateItems(sceneRect, Qt::SortOrder(-1), viewTransform ? *viewTransform : QTransform()); - for (int i = 0; i < tmp.size(); ++i) { - QGraphicsItem *item = tmp.at(i); - if (!item->d_ptr->parent) - item->d_ptr->itemDiscovered = 1; - } + for (int i = 0; i < tmp.size(); ++i) + tmp.at(i)->topLevelItem()->d_ptr->itemDiscovered = 1; // Sort if the toplevel list is unsorted. if (needSortTopLevelItems) { -- cgit v0.12 From 436a71e8950ea5a050f95b5889b85e5fafb2e716 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 30 Jun 2009 22:50:48 +0200 Subject: Set the focus to a child widget when set on a QGroupBox When the focus is set on a QGroupBox with the policy NoFocus, the focus should be propagated to one of the child if it accepts the focus. This was failing because QWidget::focusWidget() returns the QGroupBox itself. Task-number: 257158 Reviewed-by: Denis --- src/gui/widgets/qgroupbox.cpp | 5 ++--- tests/auto/qgroupbox/tst_qgroupbox.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qgroupbox.cpp b/src/gui/widgets/qgroupbox.cpp index 0bfa8c0..2380e78 100644 --- a/src/gui/widgets/qgroupbox.cpp +++ b/src/gui/widgets/qgroupbox.cpp @@ -431,7 +431,7 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason) { Q_Q(QGroupBox); QWidget *fw = q->focusWidget(); - if (!fw) { + if (!fw || fw == q) { QWidget * best = 0; QWidget * candidate = 0; QWidget * w = q; @@ -449,8 +449,7 @@ void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason) } if (best) fw = best; - else - if (candidate) + else if (candidate) fw = candidate; } if (fw) diff --git a/tests/auto/qgroupbox/tst_qgroupbox.cpp b/tests/auto/qgroupbox/tst_qgroupbox.cpp index 2fa553f..3b94851 100644 --- a/tests/auto/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/qgroupbox/tst_qgroupbox.cpp @@ -80,6 +80,7 @@ private slots: void clicked(); void toggledVsClicked(); void childrenAreDisabled(); + void propagateFocus(); private: bool checked; @@ -459,5 +460,15 @@ void tst_QGroupBox::childrenAreDisabled() } } +void tst_QGroupBox::propagateFocus() +{ + QGroupBox box; + QLineEdit lineEdit(&box); + box.show(); + box.setFocus(); + QTest::qWait(250); + QCOMPARE(qApp->focusWidget(), &lineEdit); +} + QTEST_MAIN(tst_QGroupBox) #include "tst_qgroupbox.moc" -- cgit v0.12 From b2d61c982e860a532f931dfaea143749927784a6 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Wed, 1 Jul 2009 08:49:22 +1000 Subject: Don assume QVariant::String data is going to always be unicode in QODBC - as was not the case for the psqlODBC driver Reviewed-by: Bill King --- src/sql/drivers/odbc/qsql_odbc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 2bedf7f..e18a9eb 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1006,7 +1006,7 @@ QVariant QODBCResult::data(int field) d->fieldCache[i] = qGetBinaryData(d->hStmt, i); break; case QVariant::String: - d->fieldCache[i] = qGetStringData(d->hStmt, i, info.length(), true); + d->fieldCache[i] = qGetStringData(d->hStmt, i, info.length(), d->unicode); break; case QVariant::Double: { -- cgit v0.12 From bb8e25a5074a378d5003577fefbeabb1de846a81 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 1 Jul 2009 10:29:09 +1000 Subject: Fixes configure.exe silently disabling cetest even if you asked for it when paths to the ActiveSync headers/libraries are not set up. Reviewed-by: Michael Goddard --- tools/configure/configureapp.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 8780c62..597cd0e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -604,10 +604,13 @@ void Configure::parseCmdLine() // cetest --------------------------------------------------- else if (configCmdLine.at(i) == "-no-cetest") { dictionary[ "CETEST" ] = "no"; + dictionary[ "CETEST_REQUESTED" ] = "no"; } else if (configCmdLine.at(i) == "-cetest") { // although specified to use it, we stay at "auto" state // this is because checkAvailability() adds variables - // we need for crosscompilation + // we need for crosscompilation; but remember if we asked + // for it. + dictionary[ "CETEST_REQUESTED" ] = "yes"; } // Qt/CE - signing tool ------------------------------------- else if( configCmdLine.at(i) == "-signature") { @@ -1824,6 +1827,11 @@ bool Configure::checkAvailability(const QString &part) dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\""); dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\""); } + else if (dictionary[ "CETEST_REQUESTED" ] == "yes") { + cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl; + cout << "Make sure the environment is set up for compiling with ActiveSync." << endl; + dictionary[ "DONE" ] = "error"; + } } else if (part == "INCREDIBUILD_XGE") available = findFile("BuildConsole.exe") && findFile("xgConsole.exe"); -- cgit v0.12 From c5b5cd3d704bf7c84634188d44c5208fbe55e25b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 1 Jul 2009 12:00:16 +1000 Subject: OpenVG compile fix - use const_cast instead of static_cast Reviewed-by: trustme --- src/openvg/qpaintengine_vg.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 37945bf..c7fe604 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1320,11 +1320,11 @@ QPainterState *QVGPaintEngine::createState(QPainterState *orig) const if (!orig) { return new QVGPainterState(); } else { - QVGPaintEnginePrivate *d = - static_cast(d_ptr); + Q_D(const QVGPaintEngine); + QVGPaintEnginePrivate *d2 = const_cast(d); QVGPainterState *origState = static_cast(orig); - origState->savedDirty = d->dirty; - d->dirty = 0; + origState->savedDirty = d2->dirty; + d2->dirty = 0; return new QVGPainterState(*origState); } } -- cgit v0.12 From 70137e0601549af1056082cdfbb4f141c70befab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chusslove=20Illich=20=28=D0=A7=D0=B0=D1=81=D0=BB=D0=B0?= =?UTF-8?q?=D0=B2=20=D0=98=D0=BB=D0=B8=D1=9B=29?= Date: Tue, 30 Jun 2009 23:29:02 +0200 Subject: operator==() for Unicode properties was omitting one property, which resulted in wrong choice of unique properties for characters 451-45f. Reviewed-By: Thiago Macieira Reviewed-By: Denis Dzyubenko --- util/unicode/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index cab6570..f1b4641 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -293,6 +293,7 @@ struct PropertyFlags { && lowerCaseDiff == o.lowerCaseDiff && upperCaseDiff == o.upperCaseDiff && titleCaseDiff == o.titleCaseDiff + && caseFoldDiff == o.caseFoldDiff && lowerCaseSpecial == o.lowerCaseSpecial && upperCaseSpecial == o.upperCaseSpecial && titleCaseSpecial == o.titleCaseSpecial -- cgit v0.12 From 5057276344a061b7f5553ef3ac12c513ccd9c694 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 30 Jun 2009 17:30:58 +0200 Subject: Document unified toolbar change with regard to full screen change. --- src/gui/widgets/qmainwindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 0a0faa0..0c841eb 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1419,9 +1419,10 @@ bool QMainWindow::event(QEvent *event) \i Toolbar breaks are not respected or preserved \i Any custom widgets in the toolbar will not be shown if the toolbar becomes too small (only actions will be shown) - \i If you call showFullScreen() on the main window, the QToolbar will - disappear since it is considered to be part of the title bar. You can - work around this by turning off the unified toolbar before you call + \i Before Qt 4.5, if you called showFullScreen() on the main window, the QToolbar would + disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling + the toolbars out and back into the regular toolbar and vice versa when you swap out. + However, a good practice would be that turning off the unified toolbar before you call showFullScreen() and restoring it after you call showNormal(). \endlist -- cgit v0.12 From 9cb231d773db6deb8fb145eb40aa949a2758d002 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 1 Jul 2009 10:22:15 +0200 Subject: ItemViews: Fixed signal entered not being emitted when using the mouse wheel The solution is to check the the current "entered item" hasn't change also when the scrollbars change values Task-number: 200665 Reviewed-by: janarve --- src/gui/itemviews/qabstractitemview.cpp | 72 ++++++++++++---------- src/gui/itemviews/qabstractitemview_p.h | 3 + .../qabstractitemview/tst_qabstractitemview.cpp | 19 ++++++ 3 files changed, 61 insertions(+), 33 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index cb0037b..b64bc71 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -127,6 +127,37 @@ void QAbstractItemViewPrivate::init() q->setAttribute(Qt::WA_InputMethodEnabled); } +void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) +{ + //we take a persistent model index because the model might change by emitting signals + Q_Q(QAbstractItemView); + if (viewportEnteredNeeded || enteredIndex != index) { + viewportEnteredNeeded = false; + + if (index.isValid()) { + emit q->entered(index); +#ifndef QT_NO_STATUSTIP + QString statustip = model->data(index, Qt::StatusTipRole).toString(); + if (parent && !statustip.isEmpty()) { + QStatusTipEvent tip(statustip); + QApplication::sendEvent(parent, &tip); + } +#endif + } else { +#ifndef QT_NO_STATUSTIP + if (parent) { + QString emptyString; + QStatusTipEvent tip( emptyString ); + QApplication::sendEvent(parent, &tip); + } +#endif + emit q->viewportEntered(); + } + enteredIndex = index; + } +} + + /*! \class QAbstractItemView @@ -1557,7 +1588,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) } #endif // QT_NO_DRAGANDDROP - QModelIndex index = indexAt(bottomRight); + QPersistentModelIndex index = indexAt(bottomRight); QModelIndex buddy = d->model->buddy(d->pressedIndex); if ((state() == EditingState && d->hasEditor(buddy)) || edit(index, NoEditTriggers, event)) @@ -1568,33 +1599,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) else topLeft = bottomRight; - if (d->viewportEnteredNeeded || d->enteredIndex != index) { - d->viewportEnteredNeeded = false; - - // signal handlers may change the model - QPersistentModelIndex persistent = index; - if (persistent.isValid()) { - emit entered(persistent); -#ifndef QT_NO_STATUSTIP - QString statustip = d->model->data(persistent, Qt::StatusTipRole).toString(); - if (parent() && !statustip.isEmpty()) { - QStatusTipEvent tip(statustip); - QApplication::sendEvent(parent(), &tip); - } -#endif - } else { -#ifndef QT_NO_STATUSTIP - if (parent()) { - QString emptyString; - QStatusTipEvent tip(emptyString); - QApplication::sendEvent(parent(), &tip); - } -#endif - emit viewportEntered(); - } - d->enteredIndex = persistent; - index = persistent; - } + d->checkMouseMove(index); #ifndef QT_NO_DRAGANDDROP if (index.isValid() @@ -1613,14 +1618,13 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) // Do the normalize ourselves, since QRect::normalized() is flawed QRect selectionRect = QRect(topLeft, bottomRight); - QPersistentModelIndex persistent = index; setSelection(selectionRect, command); // set at the end because it might scroll the view - if (persistent.isValid() - && (persistent != d->selectionModel->currentIndex()) - && d->isIndexEnabled(persistent)) - d->selectionModel->setCurrentIndex(persistent, QItemSelectionModel::NoUpdate); + if (index.isValid() + && (index != d->selectionModel->currentIndex()) + && d->isIndexEnabled(index)) + d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); } } @@ -2422,6 +2426,7 @@ void QAbstractItemView::verticalScrollbarValueChanged(int value) Q_D(QAbstractItemView); if (verticalScrollBar()->maximum() == value && d->model->canFetchMore(d->root)) d->model->fetchMore(d->root); + d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos())); } /*! @@ -2432,6 +2437,7 @@ void QAbstractItemView::horizontalScrollbarValueChanged(int value) Q_D(QAbstractItemView); if (horizontalScrollBar()->maximum() == value && d->model->canFetchMore(d->root)) d->model->fetchMore(d->root); + d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos())); } /*! diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 030147b..c2c1f32 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -139,6 +139,9 @@ public: const QEvent *event) const; virtual void selectAll(QItemSelectionModel::SelectionFlags command); + void checkMouseMove(const QPersistentModelIndex &index); + inline void checkMouseMove(const QPoint &pos) { checkMouseMove(q_func()->indexAt(pos)); } + inline QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const { switch (selectionBehavior) { diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index c117aa4..0bc459e 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -212,6 +212,7 @@ private slots: void task221955_selectedEditor(); void task250754_fontChange(); + void task200665_itemEntered(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -1199,5 +1200,23 @@ void tst_QAbstractItemView::task250754_fontChange() qApp->setStyleSheet(app_css); } +void tst_QAbstractItemView::task200665_itemEntered() +{ + //we test that view will emit entered + //when the scrollbar move but not the mouse itself + QStandardItemModel model(1000,1); + QListView view; + view.setModel(&model); + view.show(); + QTest::qWait(200); + QRect rect = view.visualRect(model.index(0,0)); + QCursor::setPos( view.viewport()->mapToGlobal(rect.center()) ); + QSignalSpy spy(&view, SIGNAL(entered(QModelIndex))); + view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); + QCOMPARE(spy.count(), 1); + +} + + QTEST_MAIN(tst_QAbstractItemView) #include "tst_qabstractitemview.moc" -- cgit v0.12 From 728430d16fd62de001ba8eaccabae41feef790f2 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 1 Jul 2009 10:38:51 +0200 Subject: Added QGraphicsScene::sendEvent(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 787 Reviewed-by: Bjørn Erik Nilsen --- src/gui/graphicsview/qgraphicsscene.cpp | 28 +++++++++++++++++++++++ src/gui/graphicsview/qgraphicsscene.h | 2 ++ tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 29 +++++++++++++++++++++++- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0dc77cc..d790640 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5988,6 +5988,34 @@ void QGraphicsScene::setActiveWindow(QGraphicsWidget *widget) } } +/*! + \since 4.6 + + Sends event \a event to item \a item through possible event filters. + + The event is sent only if the item is enabled. + + Returns \c false if the event was filtered or if the item is disabled. + Otherwise returns the value that was returned from the event handler. + + \sa QGraphicsItem::sceneEvent(), QGraphicsItem::sceneEventFilter() +*/ +bool QGraphicsScene::sendEvent(QGraphicsItem *item, QEvent *event) +{ + Q_D(QGraphicsScene); + if (!item) { + qWarning("QGraphicsScene::sendEvent: cannot send event to a null item"); + return false; + } + if (item->scene() != this) { + qWarning("QGraphicsScene::sendEvent: item %p's scene (%p)" + " is different from this scene (%p)", + item, item->scene(), this); + return false; + } + return d->sendEvent(item, event); +} + void QGraphicsScenePrivate::addView(QGraphicsView *view) { views << view; diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 4d65b91..c8b147f 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -229,6 +229,8 @@ public: QGraphicsWidget *activeWindow() const; void setActiveWindow(QGraphicsWidget *widget); + bool sendEvent(QGraphicsItem *item, QEvent *event); + public Q_SLOTS: void update(const QRectF &rect = QRectF()); void invalidate(const QRectF &rect = QRectF(), SceneLayers layers = AllLayers); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 6439125..4247cca 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -141,7 +141,7 @@ protected: } }; -class EventSpy : public QObject +class EventSpy : public QGraphicsWidget { Q_OBJECT public: @@ -151,6 +151,13 @@ public: watched->installEventFilter(this); } + EventSpy(QGraphicsScene *scene, QGraphicsItem *watched, QEvent::Type type) + : _count(0), spied(type) + { + scene->addItem(this); + watched->installSceneEventFilter(this); + } + int count() const { return _count; } protected: @@ -162,6 +169,14 @@ protected: return false; } + bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) + { + Q_UNUSED(watched); + if (event->type() == spied) + ++_count; + return false; + } + int _count; QEvent::Type spied; }; @@ -236,6 +251,7 @@ private slots: void changedSignal(); void stickyFocus_data(); void stickyFocus(); + void sendEvent(); // task specific tests below me void task139710_bspTreeCrash(); @@ -3587,5 +3603,16 @@ void tst_QGraphicsScene::stickyFocus() QCOMPARE(text->hasFocus(), sticky); } +void tst_QGraphicsScene::sendEvent() +{ + QGraphicsScene scene; + QGraphicsTextItem *item = scene.addText(QString()); + EventSpy *spy = new EventSpy(&scene, item, QEvent::User); + QCOMPARE(spy->count(), 0); + QEvent event(QEvent::User); + scene.sendEvent(item, &event); + QCOMPARE(spy->count(), 1); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" -- cgit v0.12 From f79955fc9b250f03d54be3c99b79062368b6273d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 1 Jul 2009 11:42:22 +0200 Subject: Improve QtHelp error reporting. Reviewed-by: kh --- tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp index b6e726b..c50f48d 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp @@ -639,7 +639,7 @@ void QHelpSearchIndexWriter::run() QFileInfo fInfo(indexPath); if (fInfo.exists() && !fInfo.isWritable()) { - qWarning("Full Text Search, could not create index (missing permissions)."); + qWarning("Full Text Search, could not create index (missing permissions for '%s').", qPrintable(indexPath)); return; } @@ -720,7 +720,7 @@ void QHelpSearchIndexWriter::run() } #if !defined(QT_NO_EXCEPTIONS) } catch (...) { - qWarning("Full Text Search, could not create index writer."); + qWarning("Full Text Search, could not create index writer in '%s'.", qPrintable(indexPath)); return; } #endif -- cgit v0.12 From f1d54091ec24e6cf57008f9b4fac7ddf7c7c8de3 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 1 Jul 2009 11:49:29 +0200 Subject: doc: Fixed several qdoc error reports. Also changed qdoc not to warn about undocumented parameters if the function is marked with the \reimp command. --- src/gui/kernel/qgesture.cpp | 16 +++++ src/gui/styles/qwindowsvistastyle.cpp | 127 ++++++++++++++++------------------ tools/qdoc3/generator.cpp | 2 +- 3 files changed, 78 insertions(+), 67 deletions(-) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index d7b2d1b..ff369e2 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -266,6 +266,22 @@ void QGesture::setPos(const QPoint &point) d_func()->pos = point; } +/*! \fn void QGesture::setAccepted(bool accepted) + Marks the gesture with the value of \a accepted. + */ + +/*! \fn bool QGesture::isAccepted() const + Returns true if the gesture is marked accepted. + */ + +/*! \fn void QGesture::accept() + Marks the gesture accepted. +*/ + +/*! \fn void QGesture::ignore() + Marks the gesture ignored. +*/ + /*! \class QPanningGesture \since 4.6 diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 5f0f053..b131d39 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -196,17 +196,15 @@ void Animation::paint(QPainter *painter, const QStyleOption *option) Q_UNUSED(painter); } -/* -* ! \internal -* -* Helperfunction to paint the current transition state -* between two animation frames. -* -* The result is a blended image consisting of -* ((alpha)*_primaryImage) + ((1-alpha)*_secondaryImage) -* -*/ +/*! \internal + + Helperfunction to paint the current transition state between two + animation frames. + The result is a blended image consisting of ((alpha)*_primaryImage) + + ((1-alpha)*_secondaryImage) + +*/ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) { if (_secondaryImage.isNull() || _primaryImage.isNull()) return; @@ -248,14 +246,11 @@ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) { painter->drawImage(rect, _tempImage); } -/* -* ! \internal -* -* Paints a transition state. The result will be a mix between the -* initial and final state of the transition, depending on the -* time difference between _startTime and current time. +/*! \internal + Paints a transition state. The result will be a mix between the + initial and final state of the transition, depending on the time + difference between _startTime and current time. */ - void Transition::paint(QPainter *painter, const QStyleOption *option) { float alpha = 1.0; @@ -278,15 +273,11 @@ void Transition::paint(QPainter *painter, const QStyleOption *option) drawBlendedImage(painter, option->rect, alpha); } -/* -* ! \internal -* -* Paints a pulse. The result will be a mix between the -* primary and secondary pulse images depending on the -* time difference between _startTime and current time. +/*! \internal + Paints a pulse. The result will be a mix between the primary and + secondary pulse images depending on the time difference between + _startTime and current time. */ - - void Pulse::paint(QPainter *painter, const QStyleOption *option) { float alpha = 1.0; @@ -308,31 +299,37 @@ void Pulse::paint(QPainter *painter, const QStyleOption *option) /*! - \reimp - * - * Animations are used for some state transitions on specific widgets. - * - * Only one running animation can exist for a widget at any specific time. - * Animations can be added through QWindowsVistaStylePrivate::startAnimation(Animation *) - * and any existing animation on a widget can be retrieved with - * QWindowsVistaStylePrivate::widgetAnimation(Widget *). - * - * Once an animation has been started, QWindowsVistaStylePrivate::timerEvent(QTimerEvent *) - * will continuously call update() on the widget until it is stopped, meaning that drawPrimitive - * will be called many times until the transition has completed. During this time, the result - * will be retrieved by the Animation::paint(...) function and not by the style itself. - * - * To determine if a transition should occur, the style needs to know the previous state of the - * widget as well as the current one. This is solved by updating dynamic properties on the widget - * every time the function is called. - * - * Transitions interrupting existing transitions should always be smooth, so whenever a hover-transition - * is started on a pulsating button, it uses the current frame of the pulse-animation as the - * starting image for the hover transition. - * + \internal + + Animations are used for some state transitions on specific widgets. + + Only one running animation can exist for a widget at any specific + time. Animations can be added through + QWindowsVistaStylePrivate::startAnimation(Animation *) and any + existing animation on a widget can be retrieved with + QWindowsVistaStylePrivate::widgetAnimation(Widget *). + + Once an animation has been started, + QWindowsVistaStylePrivate::timerEvent(QTimerEvent *) will + continuously call update() on the widget until it is stopped, + meaning that drawPrimitive will be called many times until the + transition has completed. During this time, the result will be + retrieved by the Animation::paint(...) function and not by the style + itself. + + To determine if a transition should occur, the style needs to know + the previous state of the widget as well as the current one. This is + solved by updating dynamic properties on the widget every time the + function is called. + + Transitions interrupting existing transitions should always be + smooth, so whenever a hover-transition is started on a pulsating + button, it uses the current frame of the pulse-animation as the + starting image for the hover transition. + */ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const + QPainter *painter, const QWidget *widget) const { QWindowsVistaStylePrivate *d = const_cast(d_func()); @@ -877,11 +874,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt /*! - - \reimp + \internal see drawPrimitive for comments on the animation support - */ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const @@ -1541,7 +1536,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption } /*! - \reimp + \internal see drawPrimitive for comments on the animation support @@ -1927,7 +1922,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle } /*! - \reimp + \internal */ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const @@ -2004,7 +1999,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption } /*! - \reimp + \internal */ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { @@ -2175,7 +2170,7 @@ static bool buttonVisible(const QStyle::SubControl sc, const QStyleOptionTitleBa } -/*! \reimp */ +/*! \internal */ int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const { @@ -2209,7 +2204,7 @@ int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, co /*! - \reimp + \internal */ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const @@ -2318,7 +2313,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt } /*! - \reimp + \internal */ bool QWindowsVistaStyle::event(QEvent *e) { @@ -2341,7 +2336,7 @@ bool QWindowsVistaStyle::event(QEvent *e) } /*! - \reimp + \internal */ QStyle::SubControl QWindowsVistaStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget) const @@ -2353,7 +2348,7 @@ QStyle::SubControl QWindowsVistaStyle::hitTestComplexControl(ComplexControl cont } /*! - \reimp + \internal */ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { @@ -2378,7 +2373,7 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti } /*! - \reimp + \internal */ QPalette QWindowsVistaStyle::standardPalette() const { @@ -2386,7 +2381,7 @@ QPalette QWindowsVistaStyle::standardPalette() const } /*! - \reimp + \internal */ void QWindowsVistaStyle::polish(QApplication *app) { @@ -2394,7 +2389,7 @@ void QWindowsVistaStyle::polish(QApplication *app) } /*! - \reimp + \internal */ void QWindowsVistaStyle::polish(QWidget *widget) { @@ -2448,7 +2443,7 @@ void QWindowsVistaStyle::polish(QWidget *widget) } /*! - \reimp + \internal */ void QWindowsVistaStyle::unpolish(QWidget *widget) { @@ -2490,7 +2485,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) /*! - \reimp + \internal */ void QWindowsVistaStyle::unpolish(QApplication *app) { @@ -2498,7 +2493,7 @@ void QWindowsVistaStyle::unpolish(QApplication *app) } /*! - \reimp + \internal */ void QWindowsVistaStyle::polish(QPalette &pal) { @@ -2507,7 +2502,7 @@ void QWindowsVistaStyle::polish(QPalette &pal) } /*! - \reimp + \internal */ QPixmap QWindowsVistaStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option, const QWidget *widget) const diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 7e10f3e..00831d1 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -401,7 +401,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) } } } - if (needWarning) + if (needWarning && !func->isReimp()) node->doc().location().warning( tr("Undocumented parameter '%1' in %2").arg(*a).arg(marker->plainFullName(node))); } -- cgit v0.12 From adc1c08ed9a5de2263564ba654a8ef7fed54af82 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:49:45 +0200 Subject: src/winmain: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also TCHAR -> wchar_t LPTSTR/LPCTSTRs -> LPWSTR/LPCWSTRs Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/winmain/qtmain_win.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index c266cbf..5f929d6 100644 --- a/src/winmain/qtmain_win.cpp +++ b/src/winmain/qtmain_win.cpp @@ -89,18 +89,12 @@ extern "C" int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR /*cmdParamarg*/, int cmdShow) #endif { - QByteArray cmdParam; - QT_WA({ - LPTSTR cmdline = GetCommandLineW(); - cmdParam = QString::fromUtf16((const unsigned short *)cmdline).toLocal8Bit(); - }, { - cmdParam = GetCommandLineA(); - }); + QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit(); #if defined(Q_OS_WINCE) - TCHAR appName[256]; - GetModuleFileName(0, appName, 255); - cmdParam.prepend(QString::fromLatin1("\"%1\" ").arg(QString::fromUtf16((const unsigned short *)appName)).toLocal8Bit()); + wchar_t appName[MAX_PATH]; + GetModuleFileName(0, appName, MAX_PATH); + cmdParam.prepend(QString(QLatin1String("\"%1\" ")).arg(QString::fromWCharArray(appName)).toLocal8Bit()); #endif int argc = 0; @@ -108,9 +102,9 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR /*cmdPara qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc, argv); #if defined(Q_OS_WINCE) - TCHAR uniqueAppID[256]; - GetModuleFileName(0, uniqueAppID, 255); - QString uid = QString::fromUtf16((const unsigned short *)uniqueAppID).toLower().replace(QLatin1Char('\\'), QLatin1Char('_')); + wchar_t uniqueAppID[MAX_PATH]; + GetModuleFileName(0, uniqueAppID, MAX_PATH); + QString uid = QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1String("\\"), QLatin1String("_")); // If there exists an other instance of this application // it will be the owner of a mutex with the unique ID. -- cgit v0.12 From 5ae330b6546dabada53c394b53ce9513f552a8a5 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:49:48 +0200 Subject: src/corelib: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also: QString::fromUtf16() -> QString::fromWCharArray() WCHAR & TCHAR -> wchar_t LPTSTR/LPCTSTR -> LPWSTR/LPCWSTR Documentation update Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/corelib/codecs/qtextcodec.cpp | 14 +- src/corelib/global/qglobal.cpp | 43 +- src/corelib/global/qglobal.h | 4 +- src/corelib/io/qfileinfo.cpp | 6 +- src/corelib/io/qfilesystemwatcher_win.cpp | 12 +- src/corelib/io/qfsfileengine_iterator_win.cpp | 32 +- src/corelib/io/qfsfileengine_p.h | 4 +- src/corelib/io/qfsfileengine_win.cpp | 798 +++++++++----------------- src/corelib/io/qprocess_win.cpp | 231 +++----- src/corelib/io/qsettings.cpp | 37 +- src/corelib/io/qsettings_win.cpp | 209 ++----- src/corelib/kernel/qcoreapplication.cpp | 22 +- src/corelib/kernel/qcoreapplication_win.cpp | 66 +-- src/corelib/kernel/qcorecmdlineargs_p.h | 9 +- src/corelib/kernel/qeventdispatcher_win.cpp | 89 ++- src/corelib/kernel/qfunctions_wince.cpp | 12 +- src/corelib/kernel/qfunctions_wince.h | 6 +- src/corelib/kernel/qsharedmemory_win.cpp | 17 +- src/corelib/kernel/qsystemsemaphore_win.cpp | 6 +- src/corelib/kernel/qtimer.cpp | 5 +- src/corelib/plugin/qlibrary.cpp | 8 +- src/corelib/plugin/qlibrary_win.cpp | 34 +- src/corelib/thread/qmutex_win.cpp | 14 +- src/corelib/thread/qthread_win.cpp | 38 +- src/corelib/thread/qwaitcondition_win.cpp | 6 +- src/corelib/tools/qdatetime.cpp | 13 +- src/corelib/tools/qlocale.cpp | 133 ++--- src/corelib/tools/qstring.cpp | 26 +- 28 files changed, 554 insertions(+), 1340 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index d4e5d44..c4266a0 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -233,9 +233,9 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv return QString(); const int wclen_auto = 4096; - WCHAR wc_auto[wclen_auto]; + wchar_t wc_auto[wclen_auto]; int wclen = wclen_auto; - WCHAR *wc = wc_auto; + wchar_t *wc = wc_auto; int len; QString sp; bool prepend = false; @@ -275,7 +275,7 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv } else { wclen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mb, mblen, 0, 0); - wc = new WCHAR[wclen]; + wc = new wchar_t[wclen]; // and try again... } } else if (r == ERROR_NO_UNICODE_TRANSLATION) { @@ -341,7 +341,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le const char *next = 0; QString s; while((next = CharNextExA(CP_ACP, mb, 0)) != mb) { - WCHAR wc[2] ={0}; + wchar_t wc[2] ={0}; int charlength = next - mb; int len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, mb, charlength, wc, 2); if (len>0) { @@ -1042,16 +1042,10 @@ QList QTextCodec::availableMibs() This might be needed for some applications that want to use their own mechanism for setting the locale. - Setting this codec is not supported on DOS based Windows. - \sa codecForLocale() */ void QTextCodec::setCodecForLocale(QTextCodec *c) { -#ifdef Q_WS_WIN - if (QSysInfo::WindowsVersion& QSysInfo::WV_DOS_based) - return; -#endif localeMapper = c; if (!localeMapper) setupLocaleMapper(); diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index bb639fe..f7a97e1 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -915,7 +915,7 @@ QT_BEGIN_NAMESPACE \fn bool qt_winUnicode() \relates - Use QSysInfo::WindowsVersion and QSysInfo::WV_DOS_based instead. + This function always returns true. \sa QSysInfo */ @@ -1620,15 +1620,11 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() if (winver) return winver; winver = QSysInfo::WV_NT; -#ifndef Q_OS_WINCE - OSVERSIONINFOA osver; - osver.dwOSVersionInfoSize = sizeof(osver); - GetVersionExA(&osver); -#else - DWORD qt_cever = 0; OSVERSIONINFOW osver; osver.dwOSVersionInfoSize = sizeof(osver); GetVersionEx(&osver); +#ifdef Q_OS_WINCE + DWORD qt_cever = 0; qt_cever = osver.dwMajorVersion * 100; qt_cever += osver.dwMinorVersion * 10; #endif @@ -1904,29 +1900,16 @@ QString qt_error_string(int errorCode) break; default: { #ifdef Q_OS_WIN - QT_WA({ - unsigned short *string = 0; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - errorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&string, - 0, - NULL); - ret = QString::fromUtf16(string); - LocalFree((HLOCAL)string); - }, { - char *string = 0; - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - errorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)&string, - 0, - NULL); - ret = QString::fromLocal8Bit(string); - LocalFree((HLOCAL)string); - }); + wchar_t *string = 0; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + errorCode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + string, + 0, + NULL); + ret = QString::fromWCharArray(string); + LocalFree((HLOCAL)string); if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND) ret = QString::fromLatin1("The specified module could not be found."); diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index afc3f58..00a9466 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -147,7 +147,7 @@ namespace QT_NAMESPACE {} MSDOS - MS-DOS and Windows OS2 - OS/2 OS2EMX - XFree86 on OS/2 (not PM) - WIN32 - Win32 (Windows 95/98/ME and Windows NT/2000/XP) + WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) WINCE - WinCE (Windows CE 5.0) CYGWIN - Cygwin SOLARIS - Sun Solaris @@ -1416,7 +1416,7 @@ inline QT3_SUPPORT bool qSysInfo(int *wordSize, bool *bigEndian) #if defined(Q_WS_WIN) || defined(Q_OS_CYGWIN) #if defined(QT3_SUPPORT) -inline QT3_SUPPORT bool qt_winUnicode() { return !(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based); } +inline QT3_SUPPORT bool qt_winUnicode() { return true; } inline QT3_SUPPORT int qWinVersion() { return QSysInfo::WindowsVersion; } #endif diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 4c1c21a..c50bb51 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -117,11 +117,7 @@ bool QFileInfoPrivate::hasAccess(Access access) const if (access == ExecuteAccess) return getFileFlags(QAbstractFileEngine::ExeUserPerm); - QT_WA( { - return ::_waccess((TCHAR *)QFSFileEnginePrivate::longFileName(data->fileName).utf16(), mode) == 0; - } , { - return QT_ACCESS(QFSFileEnginePrivate::win95Name(data->fileName), mode) == 0; - } ); + return ::_waccess((wchar_t*)QFSFileEnginePrivate::longFileName(data->fileName).utf16(), mode) == 0; #endif return false; } diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 9a3aeae..c15b1d2 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -56,9 +56,7 @@ QT_BEGIN_NAMESPACE QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine() : msg(0) { - HANDLE h = QT_WA_INLINE(CreateEventW(0, false, false, 0), - CreateEventA(0, false, false, 0)); - if (h != INVALID_HANDLE_VALUE) { + if (HANDLE h = CreateEvent(0, false, false, 0)) { handles.reserve(MAXIMUM_WAIT_OBJECTS); handles.append(h); } @@ -216,13 +214,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, const QString effectiveAbsolutePath = isDir ? (absolutePath + QLatin1Char('/')) : absolutePath; - QT_WA({ - handle.handle = FindFirstChangeNotificationW((TCHAR *) QDir::toNativeSeparators(effectiveAbsolutePath).utf16(), - false, flags); - },{ - handle.handle = FindFirstChangeNotificationA(QDir::toNativeSeparators(effectiveAbsolutePath).toLocal8Bit(), - false, flags); - }) + handle.handle = FindFirstChangeNotification((wchar_t*) QDir::toNativeSeparators(effectiveAbsolutePath).utf16(), false, flags); handle.flags = flags; if (handle.handle == INVALID_HANDLE_VALUE) continue; diff --git a/src/corelib/io/qfsfileengine_iterator_win.cpp b/src/corelib/io/qfsfileengine_iterator_win.cpp index 2336542..dd4ddf3 100644 --- a/src/corelib/io/qfsfileengine_iterator_win.cpp +++ b/src/corelib/io/qfsfileengine_iterator_win.cpp @@ -79,11 +79,7 @@ void QFSFileEngineIteratorPlatformSpecificData::saveCurrentFileName() it->currentEntry = uncShares.at(uncShareIndex - 1); } else { // Local directory - QT_WA({ - it->currentEntry = QString::fromUtf16((unsigned short *)findData.cFileName); - } , { - it->currentEntry = QString::fromLocal8Bit((const char *)findData.cFileName); - }); + it->currentEntry = QString::fromWCharArray(findData.cFileName); } } @@ -97,17 +93,10 @@ void QFSFileEngineIterator::advance() if (platform->uncFallback) { ++platform->uncShareIndex; } else if (platform->findFileHandle != INVALID_HANDLE_VALUE) { - QT_WA({ - if (!FindNextFile(platform->findFileHandle, &platform->findData)) { - platform->done = true; - FindClose(platform->findFileHandle); - } - } , { - if (!FindNextFileA(platform->findFileHandle, (WIN32_FIND_DATAA *)&platform->findData)) { - platform->done = true; - FindClose(platform->findFileHandle); - } - }); + if (!FindNextFile(platform->findFileHandle, &platform->findData)) { + platform->done = true; + FindClose(platform->findFileHandle); + } } } @@ -141,15 +130,8 @@ bool QFSFileEngineIterator::hasNext() const path.append(QLatin1Char('/')); path.append(QLatin1String("*.*")); - QT_WA({ - QString fileName = QFSFileEnginePrivate::longFileName(path); - platform->findFileHandle = FindFirstFileW((TCHAR *)fileName.utf16(), - &platform->findData); - }, { - // Cast is safe, since char is at end of WIN32_FIND_DATA - platform->findFileHandle = FindFirstFileA(QFSFileEnginePrivate::win95Name(path), - (WIN32_FIND_DATAA*)&platform->findData); - }); + QString fileName = QFSFileEnginePrivate::longFileName(path); + platform->findFileHandle = FindFirstFile((const wchar_t *)fileName.utf16(), &platform->findData); if (platform->findFileHandle == INVALID_HANDLE_VALUE) { if (path.startsWith(QLatin1String("//"))) { diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 5aef229..864599f 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -72,7 +72,6 @@ class QFSFileEnginePrivate : public QAbstractFileEnginePrivate public: #ifdef Q_WS_WIN - static QByteArray win95Name(const QString &path); static QString longFileName(const QString &path); #endif static QString canonicalized(const QString &path); @@ -151,8 +150,7 @@ public: #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) static void resolveLibs(); - static bool resolveUNCLibs_NT(); - static bool resolveUNCLibs_9x(); + static bool resolveUNCLibs(); static bool uncListSharesOnServer(const QString &server, QStringList *list); #endif diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index eef39e4..ee49853 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -152,66 +152,64 @@ void QFSFileEnginePrivate::resolveLibs() triedResolve = true; #if !defined(Q_OS_WINCE) - if(QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) { - HINSTANCE advapiHnd = LoadLibraryW(L"advapi32"); - if (advapiHnd) { - ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW"); - ptrLookupAccountSidW = (PtrLookupAccountSidW)GetProcAddress(advapiHnd, "LookupAccountSidW"); - ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid"); - ptrBuildTrusteeWithSidW = (PtrBuildTrusteeWithSidW)GetProcAddress(advapiHnd, "BuildTrusteeWithSidW"); - ptrBuildTrusteeWithNameW = (PtrBuildTrusteeWithNameW)GetProcAddress(advapiHnd, "BuildTrusteeWithNameW"); - ptrGetEffectiveRightsFromAclW = (PtrGetEffectiveRightsFromAclW)GetProcAddress(advapiHnd, "GetEffectiveRightsFromAclW"); - ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid"); - } - if (ptrBuildTrusteeWithNameW) { - HINSTANCE versionHnd = LoadLibraryW(L"version"); - if (versionHnd) { - typedef DWORD (WINAPI *PtrGetFileVersionInfoSizeW)(LPWSTR lptstrFilename,LPDWORD lpdwHandle); - PtrGetFileVersionInfoSizeW ptrGetFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)GetProcAddress(versionHnd, "GetFileVersionInfoSizeW"); - typedef BOOL (WINAPI *PtrGetFileVersionInfoW)(LPWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); - PtrGetFileVersionInfoW ptrGetFileVersionInfoW = (PtrGetFileVersionInfoW)GetProcAddress(versionHnd, "GetFileVersionInfoW"); - typedef BOOL (WINAPI *PtrVerQueryValueW)(const LPVOID pBlock,LPWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); - PtrVerQueryValueW ptrVerQueryValueW = (PtrVerQueryValueW)GetProcAddress(versionHnd, "VerQueryValueW"); - if(ptrGetFileVersionInfoSizeW && ptrGetFileVersionInfoW && ptrVerQueryValueW) { - DWORD fakeHandle; - DWORD versionSize = ptrGetFileVersionInfoSizeW(L"secur32.dll", &fakeHandle); - if(versionSize) { - LPVOID versionData; - versionData = malloc(versionSize); - if(ptrGetFileVersionInfoW(L"secur32.dll", 0, versionSize, versionData)) { - UINT puLen; - VS_FIXEDFILEINFO *pLocalInfo; - if(ptrVerQueryValueW(versionData, L"\\", (void**)&pLocalInfo, &puLen)) { - WORD wVer1, wVer2, wVer3, wVer4; - wVer1 = HIWORD(pLocalInfo->dwFileVersionMS); - wVer2 = LOWORD(pLocalInfo->dwFileVersionMS); - wVer3 = HIWORD(pLocalInfo->dwFileVersionLS); - wVer4 = LOWORD(pLocalInfo->dwFileVersionLS); - // It will not work with secur32.dll version 5.0.2195.2862 - if(!(wVer1 == 5 && wVer2 == 0 && wVer3 == 2195 && (wVer4 == 2862 || wVer4 == 4587))) { - HINSTANCE userHnd = LoadLibraryW(L"secur32"); - if (userHnd) { - typedef BOOL (WINAPI *PtrGetUserNameExW)(EXTENDED_NAME_FORMAT nameFormat, ushort* lpBuffer, LPDWORD nSize); - PtrGetUserNameExW ptrGetUserNameExW = (PtrGetUserNameExW)GetProcAddress(userHnd, "GetUserNameExW"); - if(ptrGetUserNameExW) { - static TCHAR buffer[258]; - DWORD bufferSize = 257; - ptrGetUserNameExW(NameSamCompatible, (ushort*)buffer, &bufferSize); - ptrBuildTrusteeWithNameW(¤tUserTrusteeW, (ushort*)buffer); - } - FreeLibrary(userHnd); + HINSTANCE advapiHnd = LoadLibraryW(L"advapi32"); + if (advapiHnd) { + ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW"); + ptrLookupAccountSidW = (PtrLookupAccountSidW)GetProcAddress(advapiHnd, "LookupAccountSidW"); + ptrAllocateAndInitializeSid = (PtrAllocateAndInitializeSid)GetProcAddress(advapiHnd, "AllocateAndInitializeSid"); + ptrBuildTrusteeWithSidW = (PtrBuildTrusteeWithSidW)GetProcAddress(advapiHnd, "BuildTrusteeWithSidW"); + ptrBuildTrusteeWithNameW = (PtrBuildTrusteeWithNameW)GetProcAddress(advapiHnd, "BuildTrusteeWithNameW"); + ptrGetEffectiveRightsFromAclW = (PtrGetEffectiveRightsFromAclW)GetProcAddress(advapiHnd, "GetEffectiveRightsFromAclW"); + ptrFreeSid = (PtrFreeSid)GetProcAddress(advapiHnd, "FreeSid"); + } + if (ptrBuildTrusteeWithNameW) { + HINSTANCE versionHnd = LoadLibraryW(L"version"); + if (versionHnd) { + typedef DWORD (WINAPI *PtrGetFileVersionInfoSizeW)(LPWSTR lptstrFilename,LPDWORD lpdwHandle); + PtrGetFileVersionInfoSizeW ptrGetFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)GetProcAddress(versionHnd, "GetFileVersionInfoSizeW"); + typedef BOOL (WINAPI *PtrGetFileVersionInfoW)(LPWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); + PtrGetFileVersionInfoW ptrGetFileVersionInfoW = (PtrGetFileVersionInfoW)GetProcAddress(versionHnd, "GetFileVersionInfoW"); + typedef BOOL (WINAPI *PtrVerQueryValueW)(const LPVOID pBlock,LPWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); + PtrVerQueryValueW ptrVerQueryValueW = (PtrVerQueryValueW)GetProcAddress(versionHnd, "VerQueryValueW"); + if(ptrGetFileVersionInfoSizeW && ptrGetFileVersionInfoW && ptrVerQueryValueW) { + DWORD fakeHandle; + DWORD versionSize = ptrGetFileVersionInfoSizeW(L"secur32.dll", &fakeHandle); + if(versionSize) { + LPVOID versionData; + versionData = malloc(versionSize); + if(ptrGetFileVersionInfoW(L"secur32.dll", 0, versionSize, versionData)) { + UINT puLen; + VS_FIXEDFILEINFO *pLocalInfo; + if(ptrVerQueryValueW(versionData, L"\\", (void**)&pLocalInfo, &puLen)) { + WORD wVer1, wVer2, wVer3, wVer4; + wVer1 = HIWORD(pLocalInfo->dwFileVersionMS); + wVer2 = LOWORD(pLocalInfo->dwFileVersionMS); + wVer3 = HIWORD(pLocalInfo->dwFileVersionLS); + wVer4 = LOWORD(pLocalInfo->dwFileVersionLS); + // It will not work with secur32.dll version 5.0.2195.2862 + if(!(wVer1 == 5 && wVer2 == 0 && wVer3 == 2195 && (wVer4 == 2862 || wVer4 == 4587))) { + HINSTANCE userHnd = LoadLibraryW(L"secur32"); + if (userHnd) { + typedef BOOL (WINAPI *PtrGetUserNameExW)(EXTENDED_NAME_FORMAT nameFormat, ushort* lpBuffer, LPDWORD nSize); + PtrGetUserNameExW ptrGetUserNameExW = (PtrGetUserNameExW)GetProcAddress(userHnd, "GetUserNameExW"); + if(ptrGetUserNameExW) { + static wchar_t buffer[258]; + DWORD bufferSize = 257; + ptrGetUserNameExW(NameSamCompatible, (ushort*)buffer, &bufferSize); + ptrBuildTrusteeWithNameW(¤tUserTrusteeW, (ushort*)buffer); } + FreeLibrary(userHnd); } } } - free(versionData); } + free(versionData); } - FreeLibrary(versionHnd); } + FreeLibrary(versionHnd); } ptrOpenProcessToken = (PtrOpenProcessToken)GetProcAddress(advapiHnd, "OpenProcessToken"); - HINSTANCE userenvHnd = LoadLibraryW(L"userenv"); + HINSTANCE userenvHnd = LoadLibraryW(L"userenv"); if (userenvHnd) { ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW"); } @@ -225,120 +223,60 @@ void QFSFileEnginePrivate::resolveLibs() #endif // QT_NO_LIBRARY // UNC functions NT -typedef DWORD (WINAPI *PtrNetShareEnum_NT)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD); -static PtrNetShareEnum_NT ptrNetShareEnum_NT = 0; -typedef DWORD (WINAPI *PtrNetApiBufferFree_NT)(LPVOID); -static PtrNetApiBufferFree_NT ptrNetApiBufferFree_NT = 0; -typedef struct _SHARE_INFO_1_NT { +typedef DWORD (WINAPI *PtrNetShareEnum)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD); +static PtrNetShareEnum ptrNetShareEnum = 0; +typedef DWORD (WINAPI *PtrNetApiBufferFree)(LPVOID); +static PtrNetApiBufferFree ptrNetApiBufferFree = 0; +typedef struct _SHARE_INFO_1 { LPWSTR shi1_netname; DWORD shi1_type; LPWSTR shi1_remark; -} SHARE_INFO_1_NT; +} SHARE_INFO_1; -bool QFSFileEnginePrivate::resolveUNCLibs_NT() +bool QFSFileEnginePrivate::resolveUNCLibs() { static bool triedResolve = false; if (!triedResolve) { #ifndef QT_NO_THREAD QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve)); if (triedResolve) { - return ptrNetShareEnum_NT && ptrNetApiBufferFree_NT; + return ptrNetShareEnum && ptrNetApiBufferFree; } #endif triedResolve = true; #if !defined(Q_OS_WINCE) HINSTANCE hLib = LoadLibraryW(L"Netapi32"); if (hLib) { - ptrNetShareEnum_NT = (PtrNetShareEnum_NT)GetProcAddress(hLib, "NetShareEnum"); - if (ptrNetShareEnum_NT) - ptrNetApiBufferFree_NT = (PtrNetApiBufferFree_NT)GetProcAddress(hLib, "NetApiBufferFree"); - } -#endif - } - return ptrNetShareEnum_NT && ptrNetApiBufferFree_NT; -} - -// UNC functions 9x -typedef DWORD (WINAPI *PtrNetShareEnum_9x)(const char FAR *, short, char FAR *, unsigned short, unsigned short FAR *, unsigned short FAR *); -static PtrNetShareEnum_9x ptrNetShareEnum_9x = 0; -#ifdef LM20_NNLEN -# define LM20_NNLEN_9x LM20_NNLEN -#else -# define LM20_NNLEN_9x 12 -#endif -typedef struct _SHARE_INFO_1_9x { - char shi1_netname[LM20_NNLEN_9x+1]; - char shi1_pad1; - unsigned short shi1_type; - char FAR* shi1_remark; -} SHARE_INFO_1_9x; - -bool QFSFileEnginePrivate::resolveUNCLibs_9x() -{ - static bool triedResolve = false; - if (!triedResolve) { -#ifndef QT_NO_THREAD - QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve)); - if (triedResolve) { - return ptrNetShareEnum_9x; + ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum"); + if (ptrNetShareEnum) + ptrNetApiBufferFree = (PtrNetApiBufferFree)GetProcAddress(hLib, "NetApiBufferFree"); } #endif - triedResolve = true; -#if !defined(Q_OS_WINCE) - HINSTANCE hLib = LoadLibraryA("Svrapi"); - if (hLib) - ptrNetShareEnum_9x = (PtrNetShareEnum_9x)GetProcAddress(hLib, "NetShareEnum"); -#endif } - return ptrNetShareEnum_9x; + return ptrNetShareEnum && ptrNetApiBufferFree; } bool QFSFileEnginePrivate::uncListSharesOnServer(const QString &server, QStringList *list) { - if (resolveUNCLibs_NT()) { - SHARE_INFO_1_NT *BufPtr, *p; + if (resolveUNCLibs()) { + SHARE_INFO_1 *BufPtr, *p; DWORD res; DWORD er=0,tr=0,resume=0, i; do { - res = ptrNetShareEnum_NT((wchar_t*)server.utf16(), 1, (LPBYTE *)&BufPtr, DWORD(-1), &er, &tr, &resume); + res = ptrNetShareEnum((wchar_t*)server.utf16(), 1, (LPBYTE *)&BufPtr, DWORD(-1), &er, &tr, &resume); if (res == ERROR_SUCCESS || res == ERROR_MORE_DATA) { p=BufPtr; for (i = 1; i <= er; ++i) { if (list && p->shi1_type == 0) - list->append(QString::fromUtf16((unsigned short *)p->shi1_netname)); + list->append(QString::fromWCharArray(p->shi1_netname)); p++; } } - ptrNetApiBufferFree_NT(BufPtr); + ptrNetApiBufferFree(BufPtr); } while (res==ERROR_MORE_DATA); return res == ERROR_SUCCESS; - } else if (resolveUNCLibs_9x()) { - SHARE_INFO_1_9x *pBuf = 0; - short cbBuffer; - unsigned short nEntriesRead = 0; - unsigned short nTotalEntries = 0; - short numBuffs = 20; - DWORD nStatus = 0; - do { - cbBuffer = numBuffs * sizeof(SHARE_INFO_1_9x); - pBuf = (SHARE_INFO_1_9x *)malloc(cbBuffer); - if (pBuf) { - nStatus = ptrNetShareEnum_9x(server.toLocal8Bit().constData(), 1, (char FAR *)pBuf, cbBuffer, &nEntriesRead, &nTotalEntries); - if ((nStatus == ERROR_SUCCESS)) { - for (int i = 0; i < nEntriesRead; ++i) { - if (list && pBuf[i].shi1_type == 0) - list->append(QString::fromLocal8Bit(pBuf[i].shi1_netname)); - } - free(pBuf); - break; - } - free(pBuf); - numBuffs *=2; - } - } while (nStatus == ERROR_MORE_DATA); - return nStatus == ERROR_SUCCESS; } return false; } @@ -399,39 +337,19 @@ static bool uncShareExists(const QString &server) return false; } -#if !defined(Q_OS_WINCE) -// If you change this function, remember to also change the UNICODE version -static QString nativeAbsoluteFilePathA(const QString &path) -{ - QString ret; - QVarLengthArray buf(MAX_PATH); - char *fileName = 0; - QByteArray ba = path.toLocal8Bit(); - DWORD retLen = GetFullPathNameA(ba.constData(), buf.size(), buf.data(), &fileName); - if (retLen > (DWORD)buf.size()) { - buf.resize(retLen); - retLen = GetFullPathNameA(ba.constData(), buf.size(), buf.data(), &fileName); - } - if (retLen != 0) - ret = QString::fromLocal8Bit(buf.data(), retLen); - return ret; -} -#endif - -// If you change this function, remember to also change the NON-UNICODE version -static QString nativeAbsoluteFilePathW(const QString &path) +static QString nativeAbsoluteFilePathCore(const QString &path) { QString ret; #if !defined(Q_OS_WINCE) QVarLengthArray buf(MAX_PATH); wchar_t *fileName = 0; - DWORD retLen = GetFullPathNameW((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName); + DWORD retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName); if (retLen > (DWORD)buf.size()) { buf.resize(retLen); - retLen = GetFullPathNameW((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName); + retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName); } if (retLen != 0) - ret = QString::fromUtf16((unsigned short *)buf.data(), retLen); + ret = QString::fromWCharArray(buf.data(), retLen); #else if (path.startsWith(QLatin1Char('/')) || path.startsWith(QLatin1Char('\\'))) ret = QDir::toNativeSeparators(path); @@ -443,7 +361,7 @@ static QString nativeAbsoluteFilePathW(const QString &path) static QString nativeAbsoluteFilePath(const QString &path) { - QString absPath = QT_WA_INLINE(nativeAbsoluteFilePathW(path), nativeAbsoluteFilePathA(path)); + QString absPath = nativeAbsoluteFilePathCore(path); // This is really ugly, but GetFullPathName strips off whitespace at the end. // If you for instance write ". " in the lineedit of QFileDialog, // (which is an invalid filename) this function will strip the space off and viola, @@ -461,26 +379,6 @@ static QString nativeAbsoluteFilePath(const QString &path) return absPath; } -QByteArray QFSFileEnginePrivate::win95Name(const QString &path) -{ - QString ret(path); - if(path.length() > 1 && path[0] == QLatin1Char('/') && path[1] == QLatin1Char('/')) { - // Win95 cannot handle slash-slash needs slosh-slosh. - ret[0] = QLatin1Char('\\'); - ret[1] = QLatin1Char('\\'); - int n = ret.indexOf(QLatin1Char('/')); - if(n >= 0) - ret[n] = QLatin1Char('\\'); - } else if(path.length() > 3 && path[2] == QLatin1Char('/') && path[3] == QLatin1Char('/')) { - ret[2] = QLatin1Char('\\'); - ret.remove(3, 1); - int n = ret.indexOf(QLatin1Char('/')); - if(n >= 0) - ret[n] = QLatin1Char('\\'); - } - return ret.toLocal8Bit(); -} - /*! \internal */ @@ -507,13 +405,8 @@ QString QFSFileEnginePrivate::longFileName(const QString &path) */ void QFSFileEnginePrivate::nativeInitFileName() { - QT_WA({ - QString path = longFileName(QDir::toNativeSeparators(fixIfRelativeUncPath(filePath))); - nativeFilePath = QByteArray((const char *)path.utf16(), path.size() * 2 + 1); - }, { - QString path = fixIfRelativeUncPath(filePath); - nativeFilePath = win95Name(path).replace('/', '\\'); - }); + QString path = longFileName(QDir::toNativeSeparators(fixIfRelativeUncPath(filePath))); + nativeFilePath = QByteArray((const char *)path.utf16(), path.size() * 2 + 1); } /* @@ -539,23 +432,13 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) ? OPEN_ALWAYS : OPEN_EXISTING; // Create the file handle. - QT_WA({ - fileHandle = CreateFileW((TCHAR *)nativeFilePath.constData(), - accessRights, - shareMode, - &securityAtts, - creationDisp, - FILE_ATTRIBUTE_NORMAL, - NULL); - }, { - fileHandle = CreateFileA(nativeFilePath.constData(), - accessRights, - shareMode, - &securityAtts, - creationDisp, - FILE_ATTRIBUTE_NORMAL, - NULL); - }); + fileHandle = CreateFile((const wchar_t*)nativeFilePath.constData(), + accessRights, + shareMode, + &securityAtts, + creationDisp, + FILE_ATTRIBUTE_NORMAL, + NULL); // Bail out on error. if (fileHandle == INVALID_HANDLE_VALUE) { @@ -641,15 +524,9 @@ qint64 QFSFileEnginePrivate::nativeSize() const // Not-open mode, where the file name is known: We'll check the // file system directly. if (openMode == QIODevice::NotOpen && !nativeFilePath.isEmpty()) { - bool ok = false; WIN32_FILE_ATTRIBUTE_DATA attribData; - QT_WA({ - ok = ::GetFileAttributesExW((TCHAR *)nativeFilePath.constData(), - GetFileExInfoStandard, &attribData); - } , { - ok = ::GetFileAttributesExA(nativeFilePath.constData(), + bool ok = ::GetFileAttributesEx((const wchar_t*)nativeFilePath.constData(), GetFileExInfoStandard, &attribData); - }); if (ok) { qint64 size = attribData.nFileSizeHigh; size <<= 32; @@ -949,35 +826,21 @@ bool QFSFileEnginePrivate::nativeIsSequential() const bool QFSFileEngine::remove() { Q_D(QFSFileEngine); - QT_WA({ - return ::DeleteFileW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16()) != 0; - } , { - return ::DeleteFileA(QFSFileEnginePrivate::win95Name(d->filePath)) != 0; - }); + return ::DeleteFile((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16()) != 0; } bool QFSFileEngine::copy(const QString ©Name) { Q_D(QFSFileEngine); - QT_WA({ - return ::CopyFileW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), - (TCHAR*)QFSFileEnginePrivate::longFileName(copyName).utf16(), true) != 0; - } , { - return ::CopyFileA(QFSFileEnginePrivate::win95Name(d->filePath), - QFSFileEnginePrivate::win95Name(copyName), true) != 0; - }); + return ::CopyFile((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), + (wchar_t*)QFSFileEnginePrivate::longFileName(copyName).utf16(), true) != 0; } bool QFSFileEngine::rename(const QString &newName) { Q_D(QFSFileEngine); - QT_WA({ - return ::MoveFileW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), - (TCHAR*)QFSFileEnginePrivate::longFileName(newName).utf16()) != 0; - } , { - return ::MoveFileA(QFSFileEnginePrivate::win95Name(d->filePath), - QFSFileEnginePrivate::win95Name(newName)) != 0; - }); + return ::MoveFile((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), + (wchar_t*)QFSFileEnginePrivate::longFileName(newName).utf16()) != 0; } static inline bool mkDir(const QString &path) @@ -1001,20 +864,12 @@ static inline bool mkDir(const QString &path) if (platformId == 1 && QFSFileEnginePrivate::longFileName(path).size() > 256) return false; #endif - QT_WA({ - return ::CreateDirectoryW((TCHAR*)QFSFileEnginePrivate::longFileName(path).utf16(), 0); - } , { - return ::CreateDirectoryA(QFSFileEnginePrivate::win95Name(QFileInfo(path).absoluteFilePath()), 0); - }); + return ::CreateDirectory((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16(), 0); } static inline bool rmDir(const QString &path) { - QT_WA({ - return ::RemoveDirectoryW((TCHAR*)QFSFileEnginePrivate::longFileName(path).utf16()); - } , { - return ::RemoveDirectoryA(QFSFileEnginePrivate::win95Name(QFileInfo(path).absoluteFilePath())); - }); + return ::RemoveDirectory((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16()); } static inline bool isDirPath(const QString &dirPath, bool *existed) @@ -1023,12 +878,7 @@ static inline bool isDirPath(const QString &dirPath, bool *existed) if (path.length() == 2 &&path.at(1) == QLatin1Char(':')) path += QLatin1Char('\\'); - DWORD fileAttrib = INVALID_FILE_ATTRIBUTES; - QT_WA({ - fileAttrib = ::GetFileAttributesW((TCHAR*)QFSFileEnginePrivate::longFileName(path).utf16()); - } , { - fileAttrib = ::GetFileAttributesA(QFSFileEnginePrivate::win95Name(QFileInfo(path).absoluteFilePath())); - }); + DWORD fileAttrib = ::GetFileAttributes((wchar_t*)QFSFileEnginePrivate::longFileName(path).utf16()); if (existed) *existed = fileAttrib != INVALID_FILE_ATTRIBUTES; @@ -1110,16 +960,10 @@ bool QFSFileEngine::setCurrentPath(const QString &path) return false; #if !defined(Q_OS_WINCE) - int r; - QT_WA({ - r = ::SetCurrentDirectoryW((WCHAR*)path.utf16()); - } , { - r = ::SetCurrentDirectoryA(QFSFileEnginePrivate::win95Name(path)); - }); - return r != 0; + return ::SetCurrentDirectory((wchar_t*)path.utf16()) != 0; #else - qfsPrivateCurrentDir = QFSFileEnginePrivate::longFileName(path); - return true; + qfsPrivateCurrentDir = QFSFileEnginePrivate::longFileName(path); + return true; #endif } @@ -1132,48 +976,34 @@ QString QFSFileEngine::currentPath(const QString &fileName) fileName.at(0).isLetter() && fileName.at(1) == QLatin1Char(':')) { int drv = fileName.toUpper().at(0).toLatin1() - 'A' + 1; if (_getdrive() != drv) { - QT_WA({ - TCHAR buf[PATH_MAX]; - ::_wgetdcwd(drv, buf, PATH_MAX); - ret.setUtf16((ushort*)buf, uint(::wcslen(buf))); - }, { - char buf[PATH_MAX]; - ::_getdcwd(drv, buf, PATH_MAX); - ret = QString::fromLatin1(buf); - }); + wchar_t buf[PATH_MAX]; + ::_wgetdcwd(drv, buf, PATH_MAX); + ret = QString::fromWCharArray(buf); } } if (ret.isEmpty()) { //just the pwd - QT_WA({ - DWORD size = 0; - WCHAR currentName[PATH_MAX]; - size = ::GetCurrentDirectoryW(PATH_MAX, currentName); - if (size !=0) { - if (size > PATH_MAX) { - WCHAR * newCurrentName = new WCHAR[size]; - if (::GetCurrentDirectoryW(PATH_MAX, newCurrentName) != 0) - ret = QString::fromUtf16((ushort*)newCurrentName); - delete [] newCurrentName; - } else { - ret = QString::fromUtf16((ushort*)currentName); - } + DWORD size = 0; + wchar_t currentName[PATH_MAX]; + size = ::GetCurrentDirectory(PATH_MAX, currentName); + if (size != 0) { + if (size > PATH_MAX) { + wchar_t *newCurrentName = new wchar_t[size]; + if (::GetCurrentDirectory(PATH_MAX, newCurrentName) != 0) + ret = QString::fromWCharArray(newCurrentName); + delete [] newCurrentName; + } else { + ret = QString::fromWCharArray(currentName); } - } , { - DWORD size = 0; - char currentName[PATH_MAX]; - size = ::GetCurrentDirectoryA(PATH_MAX, currentName); - if (size !=0) - ret = QString::fromLocal8Bit(currentName); - }); + } } if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. return QDir::fromNativeSeparators(ret); #else - Q_UNUSED(fileName); - if (qfsPrivateCurrentDir.isEmpty()) - qfsPrivateCurrentDir = QCoreApplication::applicationDirPath(); + Q_UNUSED(fileName); + if (qfsPrivateCurrentDir.isEmpty()) + qfsPrivateCurrentDir = QCoreApplication::applicationDirPath(); return QDir::fromNativeSeparators(qfsPrivateCurrentDir); #endif @@ -1183,35 +1013,27 @@ QString QFSFileEngine::homePath() { QString ret; #if !defined(QT_NO_LIBRARY) - QT_WA ( - { - QFSFileEnginePrivate::resolveLibs(); - if (ptrOpenProcessToken && ptrGetUserProfileDirectoryW) { - HANDLE hnd = ::GetCurrentProcess(); - HANDLE token = 0; - BOOL ok = ::ptrOpenProcessToken(hnd, TOKEN_QUERY, &token); - if (ok) { - DWORD dwBufferSize = 0; - // First call, to determine size of the strings (with '\0'). - ok = ::ptrGetUserProfileDirectoryW(token, NULL, &dwBufferSize); - if (!ok && dwBufferSize != 0) { // We got the required buffer size - wchar_t *userDirectory = new wchar_t[dwBufferSize]; - // Second call, now we can fill the allocated buffer. - ok = ::ptrGetUserProfileDirectoryW(token, userDirectory, &dwBufferSize); - if (ok) - ret = QString::fromUtf16((ushort*)userDirectory); - - delete [] userDirectory; - } - ::CloseHandle(token); - } - } - } - , - { - // GetUserProfileDirectory is only available from NT 4.0, - // so fall through for Win98 and friends version. - }) + QFSFileEnginePrivate::resolveLibs(); + if (ptrOpenProcessToken && ptrGetUserProfileDirectoryW) { + HANDLE hnd = ::GetCurrentProcess(); + HANDLE token = 0; + BOOL ok = ::ptrOpenProcessToken(hnd, TOKEN_QUERY, &token); + if (ok) { + DWORD dwBufferSize = 0; + // First call, to determine size of the strings (with '\0'). + ok = ::ptrGetUserProfileDirectoryW(token, NULL, &dwBufferSize); + if (!ok && dwBufferSize != 0) { // We got the required buffer size + wchar_t *userDirectory = new wchar_t[dwBufferSize]; + // Second call, now we can fill the allocated buffer. + ok = ::ptrGetUserProfileDirectoryW(token, userDirectory, &dwBufferSize); + if (ok) + ret = QString::fromWCharArray(userDirectory); + + delete [] userDirectory; + } + ::CloseHandle(token); + } + } #endif if(ret.isEmpty() || !QFile::exists(ret)) { ret = QString::fromLocal8Bit(qgetenv("USERPROFILE").constData()); @@ -1251,17 +1073,10 @@ QString QFSFileEngine::rootPath() QString QFSFileEngine::tempPath() { - QString ret; - int success; - QT_WA({ - wchar_t tempPath[MAX_PATH]; - success = GetTempPathW(MAX_PATH, tempPath); - ret = QString::fromUtf16((ushort*)tempPath); - } , { - char tempPath[MAX_PATH]; - success = GetTempPathA(MAX_PATH, tempPath); - ret = QString::fromLocal8Bit(tempPath); - }); + wchar_t tempPath[MAX_PATH]; + int success = GetTempPath(MAX_PATH, tempPath); + QString ret = QString::fromWCharArray(tempPath); + if (ret.isEmpty() || !success) { #if !defined(Q_OS_WINCE) ret = QString::fromLatin1("c:/tmp"); @@ -1285,7 +1100,7 @@ QFileInfoList QFSFileEngine::drives() #elif defined(Q_OS_OS2EMX) quint32 driveBits, cur; if(DosQueryCurrentDisk(&cur,&driveBits) != NO_ERROR) - exit(1); + exit(1); driveBits &= 0x3ffffff; #endif char driveName[] = "A:/"; @@ -1327,18 +1142,14 @@ bool QFSFileEnginePrivate::doStat() const } } #else - DWORD tmpAttributes = GetFileAttributesW((TCHAR*)QFSFileEnginePrivate::longFileName(fname).utf16()); + DWORD tmpAttributes = GetFileAttributes((wchar_t*)QFSFileEnginePrivate::longFileName(fname).utf16()); if (tmpAttributes != -1) { fileAttrib = tmpAttributes; could_stat = true; } #endif } else { - QT_WA({ - fileAttrib = GetFileAttributesW((TCHAR*)QFSFileEnginePrivate::longFileName(fname).utf16()); - } , { - fileAttrib = GetFileAttributesA(QFSFileEnginePrivate::win95Name(QFileInfo(fname).absoluteFilePath())); - }); + fileAttrib = GetFileAttributes((wchar_t*)QFSFileEnginePrivate::longFileName(fname).utf16()); could_stat = fileAttrib != INVALID_FILE_ATTRIBUTES; if (!could_stat) { #if !defined(Q_OS_WINCE) @@ -1398,74 +1209,39 @@ static QString readLink(const QString &link) #if !defined(Q_OS_WINCE) #if !defined(QT_NO_LIBRARY) QString ret; - QT_WA({ - bool neededCoInit = false; - IShellLink *psl; // pointer to IShellLink i/f - HRESULT hres; - WIN32_FIND_DATA wfd; - TCHAR szGotPath[MAX_PATH]; - // Get pointer to the IShellLink interface. - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_IShellLink, (LPVOID *)&psl); - if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized - neededCoInit = true; - CoInitialize(NULL); - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_IShellLink, (LPVOID *)&psl); - } - if(SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface. - IPersistFile *ppf; - hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf); - if(SUCCEEDED(hres)) { - hres = ppf->Load((LPOLESTR)link.utf16(), STGM_READ); - //The original path of the link is retrieved. If the file/folder - //was moved, the return value still have the old path. - if(SUCCEEDED(hres)) { - if (psl->GetPath(szGotPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY) == NOERROR) - ret = QString::fromUtf16((ushort*)szGotPath); - } - ppf->Release(); - } - psl->Release(); - } - if(neededCoInit) - CoUninitialize(); - } , { - bool neededCoInit = false; - IShellLinkA *psl; // pointer to IShellLink i/f - HRESULT hres; - WIN32_FIND_DATAA wfd; - char szGotPath[MAX_PATH]; - // Get pointer to the IShellLink interface. + bool neededCoInit = false; + IShellLink *psl; // pointer to IShellLink i/f + WIN32_FIND_DATA wfd; + wchar_t szGotPath[MAX_PATH]; - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_IShellLinkA, (LPVOID *)&psl); + // Get pointer to the IShellLink interface. + HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *)&psl); - if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized - neededCoInit = true; - CoInitialize(NULL); - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_IShellLinkA, (LPVOID *)&psl); - } - if(SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface. - IPersistFile *ppf; - hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf); - if(SUCCEEDED(hres)) { - hres = ppf->Load((LPOLESTR)QFileInfo(link).absoluteFilePath().utf16(), STGM_READ); - //The original path of the link is retrieved. If the file/folder - //was moved, the return value still have the old path. - if(SUCCEEDED(hres)) { - if (psl->GetPath((char*)szGotPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY) == NOERROR) - ret = QString::fromLocal8Bit(szGotPath); - } - ppf->Release(); + if (hres == CO_E_NOTINITIALIZED) { // COM was not initialized + neededCoInit = true; + CoInitialize(NULL); + hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + IID_IShellLink, (LPVOID *)&psl); + } + if (SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface. + IPersistFile *ppf; + hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf); + if(SUCCEEDED(hres)) { + hres = ppf->Load((LPOLESTR)link.utf16(), STGM_READ); + //The original path of the link is retrieved. If the file/folder + //was moved, the return value still have the old path. + if(SUCCEEDED(hres)) { + if (psl->GetPath(szGotPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY) == NOERROR) + ret = QString::fromWCharArray(szGotPath); } - psl->Release(); + ppf->Release(); } - if(neededCoInit) - CoUninitialize(); - }); + psl->Release(); + } + if (neededCoInit) + CoUninitialize(); + return ret; #else Q_UNUSED(link); @@ -1475,7 +1251,7 @@ static QString readLink(const QString &link) wchar_t target[MAX_PATH]; QString result; if (SHGetShortcutTarget((wchar_t*)QFileInfo(link).absoluteFilePath().replace(QLatin1Char('/'),QLatin1Char('\\')).utf16(), target, MAX_PATH)) { - result = QString::fromUtf16(reinterpret_cast (target)); + result = QString::fromWCharArray(target); if (result.startsWith(QLatin1Char('"'))) result.remove(0,1); if (result.endsWith(QLatin1Char('"'))) @@ -1502,76 +1278,37 @@ bool QFSFileEngine::link(const QString &newName) QString linkName = newName; //### assume that they add .lnk - QT_WA({ - HRESULT hres; - IShellLink *psl; - bool neededCoInit = false; + IShellLink *psl; + bool neededCoInit = false; - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized - neededCoInit = true; - CoInitialize(NULL); - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - } - if (SUCCEEDED(hres)) { - hres = psl->SetPath((wchar_t *)fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16()); - if (SUCCEEDED(hres)) { - hres = psl->SetWorkingDirectory((wchar_t *)fileName(AbsolutePathName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16()); - if (SUCCEEDED(hres)) { - IPersistFile *ppf; - hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); - if (SUCCEEDED(hres)) { - hres = ppf->Save((TCHAR*)linkName.utf16(), TRUE); - if (SUCCEEDED(hres)) - ret = true; - ppf->Release(); - } - } - } - psl->Release(); - } - if(neededCoInit) - CoUninitialize(); - } , { - // the SetPath() call _sometimes_ changes the current path and when it does it sometimes - // does not let us change it back unless we call currentPath() many times. - QString cwd = currentPath(); - HRESULT hres; - IShellLinkA *psl; - bool neededCoInit = false; + HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); + if (hres == CO_E_NOTINITIALIZED) { // COM was not initialized + neededCoInit = true; + CoInitialize(NULL); hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - if(hres == CO_E_NOTINITIALIZED) { // COM was not initialized - neededCoInit = true; - CoInitialize(NULL); - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - } + } + + if (SUCCEEDED(hres)) { + hres = psl->SetPath((wchar_t *)fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16()); if (SUCCEEDED(hres)) { - currentPath(); - hres = psl->SetPath((char *)QString::fromLocal8Bit(QFSFileEnginePrivate::win95Name(fileName(AbsoluteName))).utf16()); - currentPath(); + hres = psl->SetWorkingDirectory((wchar_t *)fileName(AbsolutePathName).replace(QLatin1Char('/'), QLatin1Char('\\')).utf16()); if (SUCCEEDED(hres)) { - hres = psl->SetWorkingDirectory((char *)QString::fromLocal8Bit(QFSFileEnginePrivate::win95Name(fileName(AbsolutePathName))).utf16()); - currentPath(); + IPersistFile *ppf; + hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); if (SUCCEEDED(hres)) { - IPersistFile *ppf; - hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); - if (SUCCEEDED(hres)) { - currentPath(); - hres = ppf->Save((LPCOLESTR)linkName.utf16(), TRUE); - currentPath(); - if (SUCCEEDED(hres)) - ret = true; - ppf->Release(); - } + hres = ppf->Save((wchar_t*)linkName.utf16(), TRUE); + if (SUCCEEDED(hres)) + ret = true; + ppf->Release(); } - psl->Release(); } } - if(neededCoInit) + psl->Release(); + } + if(neededCoInit) CoUninitialize(); - setCurrentPath(cwd); - }); + return ret; #else Q_UNUSED(newName); @@ -1598,9 +1335,9 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const #if !defined(QT_NO_LIBRARY) if((qt_ntfs_permission_lookup > 0) && ((QSysInfo::WindowsVersion&QSysInfo::WV_NT_based) > QSysInfo::WV_NT)) { - PSID pOwner = 0; - PSID pGroup = 0; - PACL pDacl; + PSID pOwner = 0; + PSID pGroup = 0; + PACL pDacl; PSECURITY_DESCRIPTOR pSD; ACCESS_MASK access_mask; @@ -1610,42 +1347,42 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const QString fname = filePath.endsWith(QLatin1String(".lnk")) ? readLink(filePath) : filePath; DWORD res = ptrGetNamedSecurityInfoW((wchar_t*)fname.utf16(), SE_FILE_OBJECT, - OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, - &pOwner, &pGroup, &pDacl, 0, &pSD); + OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + &pOwner, &pGroup, &pDacl, 0, &pSD); if(res == ERROR_SUCCESS) { TRUSTEE_W trustee; { //user if(ptrGetEffectiveRightsFromAclW(pDacl, ¤tUserTrusteeW, &access_mask) != ERROR_SUCCESS) access_mask = (ACCESS_MASK)-1; - if(access_mask & ReadMask) - ret |= QAbstractFileEngine::ReadUserPerm; - if(access_mask & WriteMask) - ret |= QAbstractFileEngine::WriteUserPerm; - if(access_mask & ExecMask) - ret |= QAbstractFileEngine::ExeUserPerm; + if(access_mask & ReadMask) + ret |= QAbstractFileEngine::ReadUserPerm; + if(access_mask & WriteMask) + ret |= QAbstractFileEngine::WriteUserPerm; + if(access_mask & ExecMask) + ret |= QAbstractFileEngine::ExeUserPerm; } { //owner ptrBuildTrusteeWithSidW(&trustee, pOwner); if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS) access_mask = (ACCESS_MASK)-1; - if(access_mask & ReadMask) - ret |= QAbstractFileEngine::ReadOwnerPerm; - if(access_mask & WriteMask) - ret |= QAbstractFileEngine::WriteOwnerPerm; - if(access_mask & ExecMask) - ret |= QAbstractFileEngine::ExeOwnerPerm; + if(access_mask & ReadMask) + ret |= QAbstractFileEngine::ReadOwnerPerm; + if(access_mask & WriteMask) + ret |= QAbstractFileEngine::WriteOwnerPerm; + if(access_mask & ExecMask) + ret |= QAbstractFileEngine::ExeOwnerPerm; } { //group ptrBuildTrusteeWithSidW(&trustee, pGroup); if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS) access_mask = (ACCESS_MASK)-1; - if(access_mask & ReadMask) - ret |= QAbstractFileEngine::ReadGroupPerm; - if(access_mask & WriteMask) - ret |= QAbstractFileEngine::WriteGroupPerm; - if(access_mask & ExecMask) - ret |= QAbstractFileEngine::ExeGroupPerm; + if(access_mask & ReadMask) + ret |= QAbstractFileEngine::ReadGroupPerm; + if(access_mask & WriteMask) + ret |= QAbstractFileEngine::WriteGroupPerm; + if(access_mask & ExecMask) + ret |= QAbstractFileEngine::ExeGroupPerm; } { //other (world) // Create SID for Everyone (World) @@ -1655,12 +1392,12 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const ptrBuildTrusteeWithSidW(&trustee, pWorld); if(ptrGetEffectiveRightsFromAclW(pDacl, &trustee, &access_mask) != ERROR_SUCCESS) access_mask = (ACCESS_MASK)-1; // ### - if(access_mask & ReadMask) - ret |= QAbstractFileEngine::ReadOtherPerm; - if(access_mask & WriteMask) - ret |= QAbstractFileEngine::WriteOtherPerm; - if(access_mask & ExecMask) - ret |= QAbstractFileEngine::ExeOtherPerm; + if(access_mask & ReadMask) + ret |= QAbstractFileEngine::ReadOtherPerm; + if(access_mask & WriteMask) + ret |= QAbstractFileEngine::WriteOtherPerm; + if(access_mask & ExecMask) + ret |= QAbstractFileEngine::ExeOtherPerm; } ptrFreeSid(pWorld); } @@ -1670,13 +1407,13 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const } else #endif { - //### what to do with permissions if we don't use ntfs or are not on a NT system - // for now just add all permissions and what about exe missions ?? - // also qt_ntfs_permission_lookup is now not set by defualt ... should it ? - ret |= QAbstractFileEngine::ReadOtherPerm | QAbstractFileEngine::ReadGroupPerm - | QAbstractFileEngine::ReadOwnerPerm | QAbstractFileEngine::ReadUserPerm - | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::WriteOwnerPerm - | QAbstractFileEngine::WriteGroupPerm | QAbstractFileEngine::WriteOtherPerm; + //### what to do with permissions if we don't use NTFS + // for now just add all permissions and what about exe missions ?? + // also qt_ntfs_permission_lookup is now not set by defualt ... should it ? + ret |= QAbstractFileEngine::ReadOtherPerm | QAbstractFileEngine::ReadGroupPerm + | QAbstractFileEngine::ReadOwnerPerm | QAbstractFileEngine::ReadUserPerm + | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::WriteOwnerPerm + | QAbstractFileEngine::WriteGroupPerm | QAbstractFileEngine::WriteOtherPerm; } if (doStat()) { @@ -1911,13 +1648,9 @@ bool QFSFileEngine::setPermissions(uint perms) return false; #if !defined(Q_OS_WINCE) - QT_WA({ - ret = ::_wchmod((TCHAR*)d->filePath.utf16(), mode) == 0; - } , { - ret = ::_chmod(d->filePath.toLocal8Bit(), mode) == 0; - }); + ret = ::_wchmod((wchar_t*)d->filePath.utf16(), mode) == 0; #else - ret = ::_wchmod((TCHAR*)d->longFileName(d->filePath).utf16(), mode); + ret = ::_wchmod((wchar_t*)d->longFileName(d->filePath).utf16(), mode); #endif return ret; } @@ -1960,34 +1693,33 @@ bool QFSFileEngine::setSize(qint64 size) static inline QDateTime fileTimeToQDateTime(const FILETIME *time) { QDateTime ret; - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based || QSysInfo::WindowsVersion & QSysInfo::WV_CE_based) { - // SystemTimeToTzSpecificLocalTime is not available on Win98/ME so we have to pull it off ourselves. - SYSTEMTIME systime; - FILETIME ftime; - systime.wYear = 1970; - systime.wMonth = 1; - systime.wDay = 1; - systime.wHour = 0; - systime.wMinute = 0; - systime.wSecond = 0; - systime.wMilliseconds = 0; - systime.wDayOfWeek = 4; - SystemTimeToFileTime(&systime, &ftime); - unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime; - FileTimeToSystemTime(time, &systime); - unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime; - unsigned __int64 difftime = acttime - time1970; - difftime /= 10000000; - ret.setTime_t((unsigned int)difftime); - } else { -#ifndef Q_OS_WINCE - SYSTEMTIME sTime, lTime; - FileTimeToSystemTime(time, &sTime); - SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime); - ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay)); - ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds)); + +#if defined(Q_OS_WINCE) + SYSTEMTIME systime; + FILETIME ftime; + systime.wYear = 1970; + systime.wMonth = 1; + systime.wDay = 1; + systime.wHour = 0; + systime.wMinute = 0; + systime.wSecond = 0; + systime.wMilliseconds = 0; + systime.wDayOfWeek = 4; + SystemTimeToFileTime(&systime, &ftime); + unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime; + FileTimeToSystemTime(time, &systime); + unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime; + unsigned __int64 difftime = acttime - time1970; + difftime /= 10000000; + ret.setTime_t((unsigned int)difftime); +#else + SYSTEMTIME sTime, lTime; + FileTimeToSystemTime(time, &sTime); + SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime); + ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay)); + ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds)); #endif - } + return ret; } @@ -2011,13 +1743,8 @@ QDateTime QFSFileEngine::fileTime(FileTime time) const } #endif } else { - bool ok = false; WIN32_FILE_ATTRIBUTE_DATA attribData; - QT_WA({ - ok = ::GetFileAttributesExW((TCHAR*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), GetFileExInfoStandard, &attribData); - } , { - ok = ::GetFileAttributesExA(QFSFileEnginePrivate::win95Name(QFileInfo(d->filePath).absoluteFilePath()), GetFileExInfoStandard, &attribData); - }); + bool ok = ::GetFileAttributesEx((wchar_t*)QFSFileEnginePrivate::longFileName(d->filePath).utf16(), GetFileExInfoStandard, &attribData); if (ok) { if(time == CreationTime) ret = fileTimeToQDateTime(&attribData.ftCreationTime); @@ -2037,11 +1764,11 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, Q_UNUSED(flags); if (openMode == QFile::NotOpen) { q->setError(QFile::PermissionsError, qt_error_string()); - return 0; + return 0; } if (offset == 0 && size == 0) { q->setError(QFile::UnspecifiedError, qt_error_string()); - return 0; + return 0; } @@ -2054,7 +1781,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, #ifdef Q_USE_DEPRECATED_MAP_API nativeClose(); if (fileMapHandle == INVALID_HANDLE_VALUE) { - fileMapHandle = CreateFileForMappingW((TCHAR *)nativeFilePath.constData(), + fileMapHandle = CreateFileForMapping((const wchar_t*)nativeFilePath.constData(), GENERIC_READ | (openMode & QIODevice::WriteOnly ? GENERIC_WRITE : 0), 0, NULL, @@ -2069,21 +1796,14 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, #endif // first create the file mapping handle - HANDLE mapHandle = 0; DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY; - QT_WA({ - mapHandle = ::CreateFileMappingW(handle, 0, protection, - 0, 0, 0); - },{ - mapHandle = ::CreateFileMappingA(handle, 0, protection, - 0, 0, 0); - }); + HANDLE mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0); if (mapHandle == NULL) { q->setError(QFile::PermissionsError, qt_error_string()); #ifdef Q_USE_DEPRECATED_MAP_API mapHandleClose(); #endif - return 0; + return 0; } // setup args to map @@ -2112,7 +1832,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, switch(GetLastError()) { case ERROR_ACCESS_DENIED: q->setError(QFile::PermissionsError, qt_error_string()); - break; + break; case ERROR_INVALID_PARAMETER: // size are out of bounds default: diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index d028df1..eae17b4 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -54,7 +54,7 @@ #include #include -#include "private/qfsfileengine_p.h" // for longFileName and win95FileName +#include "private/qfsfileengine_p.h" // for longFileName #ifndef QT_NO_PROCESS @@ -122,25 +122,15 @@ bool QProcessPrivate::createChannel(Channel &channel) if (&channel == &stdinChannel) { // try to open in read-only mode channel.pipe[1] = INVALID_Q_PIPE; - QT_WA({ - channel.pipe[0] = - CreateFileW((TCHAR*)QFSFileEnginePrivate::longFileName(channel.file).utf16(), - GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &secAtt, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - }, { - channel.pipe[0] = - CreateFileA(QFSFileEnginePrivate::win95Name(channel.file), - GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &secAtt, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - }); + channel.pipe[0] = + CreateFile((const wchar_t*)QFSFileEnginePrivate::longFileName(channel.file).utf16(), + GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &secAtt, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (channel.pipe[0] != INVALID_Q_PIPE) return true; @@ -148,31 +138,15 @@ bool QProcessPrivate::createChannel(Channel &channel) } else { // open in write mode channel.pipe[0] = INVALID_Q_PIPE; - DWORD creation; - if (channel.append) - creation = OPEN_ALWAYS; - else - creation = CREATE_ALWAYS; - - QT_WA({ - channel.pipe[1] = - CreateFileW((TCHAR*)QFSFileEnginePrivate::longFileName(channel.file).utf16(), - GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &secAtt, - creation, - FILE_ATTRIBUTE_NORMAL, - NULL); - }, { - channel.pipe[1] = - CreateFileA(QFSFileEnginePrivate::win95Name(channel.file), - GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &secAtt, - creation, - FILE_ATTRIBUTE_NORMAL, - NULL); - }); + channel.pipe[1] = + CreateFile((const wchar_t *)QFSFileEnginePrivate::longFileName(channel.file).utf16(), + GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + &secAtt, + channel.append ? OPEN_ALWAYS : CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (channel.pipe[1] != INVALID_Q_PIPE) { if (channel.append) { SetFilePointer(channel.pipe[1], 0, NULL, FILE_END); @@ -327,56 +301,37 @@ static QByteArray qt_create_environment(const QHash *environme int pos = 0; QHash::ConstIterator it = copy.constBegin(), end = copy.constEnd(); -#ifdef UNICODE - if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) { - static const TCHAR equal = L'='; - static const TCHAR nul = L'\0'; - - for ( ; it != end; ++it) { - uint tmpSize = sizeof(TCHAR) * (it.key().length() + it.value().length() + 2); - // ignore empty strings - if (tmpSize == sizeof(TCHAR)*2) - continue; - envlist.resize(envlist.size() + tmpSize); - - tmpSize = it.key().length() * sizeof(TCHAR); - memcpy(envlist.data()+pos, it.key().utf16(), tmpSize); - pos += tmpSize; - - memcpy(envlist.data()+pos, &equal, sizeof(TCHAR)); - pos += sizeof(TCHAR); - - tmpSize = it.value().length() * sizeof(TCHAR); - memcpy(envlist.data()+pos, it.value().utf16(), tmpSize); - pos += tmpSize; - - memcpy(envlist.data()+pos, &nul, sizeof(TCHAR)); - pos += sizeof(TCHAR); - } - // add the 2 terminating 0 (actually 4, just to be on the safe side) - envlist.resize( envlist.size()+4 ); - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - } else -#endif // UNICODE - { - for ( ; it != end; it++) { - QByteArray tmp = it.key().toLocal8Bit(); - tmp.append('='); - tmp.append(it.value().toLocal8Bit()); - - uint tmpSize = tmp.length() + 1; - envlist.resize(envlist.size() + tmpSize); - memcpy(envlist.data()+pos, tmp.data(), tmpSize); - pos += tmpSize; - } - // add the terminating 0 (actually 2, just to be on the safe side) - envlist.resize(envlist.size()+2); - envlist[pos++] = 0; - envlist[pos++] = 0; + + static const wchar_t equal = L'='; + static const wchar_t nul = L'\0'; + + for ( ; it != end; ++it) { + uint tmpSize = sizeof(wchar_t) * (it.key().length() + it.value().length() + 2); + // ignore empty strings + if (tmpSize == sizeof(wchar_t) * 2) + continue; + envlist.resize(envlist.size() + tmpSize); + + tmpSize = it.key().length() * sizeof(wchar_t); + memcpy(envlist.data()+pos, it.key().utf16(), tmpSize); + pos += tmpSize; + + memcpy(envlist.data()+pos, &equal, sizeof(wchar_t)); + pos += sizeof(wchar_t); + + tmpSize = it.value().length() * sizeof(wchar_t); + memcpy(envlist.data()+pos, it.value().utf16(), tmpSize); + pos += tmpSize; + + memcpy(envlist.data()+pos, &nul, sizeof(wchar_t)); + pos += sizeof(wchar_t); } + // add the 2 terminating 0 (actually 4, just to be on the safe side) + envlist.resize( envlist.size()+4 ); + envlist[pos++] = 0; + envlist[pos++] = 0; + envlist[pos++] = 0; + envlist[pos++] = 0; } return envlist; } @@ -417,58 +372,33 @@ void QProcessPrivate::startProcess() qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes"); #endif - DWORD dwCreationFlags = 0; - if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) - dwCreationFlags |= CREATE_NO_WINDOW; + DWORD dwCreationFlags = CREATE_NO_WINDOW; -#ifdef UNICODE - if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) { #if defined(Q_OS_WINCE) QString fullPathProgram = program; if (!QDir::isAbsolutePath(fullPathProgram)) fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath(); fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); - success = CreateProcessW((WCHAR*)fullPathProgram.utf16(), - (WCHAR*)args.utf16(), - 0, 0, false, 0, 0, 0, 0, pid); + success = CreateProcess((wchar_t*)fullPathProgram.utf16(), + (wchar_t*)args.utf16(), + 0, 0, false, 0, 0, 0, 0, pid); #else dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, - STARTF_USESTDHANDLES, - 0, 0, 0, - stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1] + (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, + 0, 0, 0, + STARTF_USESTDHANDLES, + 0, 0, 0, + stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1] }; - success = CreateProcessW(0, (WCHAR*)args.utf16(), - 0, 0, TRUE, dwCreationFlags, - environment ? envlist.data() : 0, - workingDirectory.isEmpty() ? 0 - : (WCHAR*)QDir::toNativeSeparators(workingDirectory).utf16(), - &startupInfo, pid); -#endif - } else -#endif // UNICODE - { -#ifndef Q_OS_WINCE - STARTUPINFOA startupInfo = { sizeof( STARTUPINFOA ), 0, 0, 0, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, - STARTF_USESTDHANDLES, - 0, 0, 0, - stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1] - }; - - success = CreateProcessA(0, args.toLocal8Bit().data(), - 0, 0, TRUE, dwCreationFlags, environment ? envlist.data() : 0, - workingDirectory.isEmpty() ? 0 - : QDir::toNativeSeparators(workingDirectory).toLocal8Bit().data(), - &startupInfo, pid); -#endif // Q_OS_WINCE - } -#ifndef Q_OS_WINCE + success = CreateProcess(0, (wchar_t*)args.utf16(), + 0, 0, TRUE, dwCreationFlags, + environment ? envlist.data() : 0, + workingDirectory.isEmpty() ? 0 + : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(), + &startupInfo, pid); + if (stdinChannel.pipe[0] != INVALID_Q_PIPE) { CloseHandle(stdinChannel.pipe[0]); stdinChannel.pipe[0] = INVALID_Q_PIPE; @@ -508,7 +438,7 @@ void QProcessPrivate::startProcess() } // give the process a chance to start ... - Sleep(SLEEPMIN*2); + Sleep(SLEEPMIN * 2); _q_startupNotification(); } @@ -882,42 +812,25 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a PROCESS_INFORMATION pinfo; -#ifdef UNICODE - if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) { #if defined(Q_OS_WINCE) QString fullPathProgram = program; if (!QDir::isAbsolutePath(fullPathProgram)) fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/'))); fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\')); - success = CreateProcessW((WCHAR*)fullPathProgram.utf16(), - (WCHAR*)args.utf16(), - 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo); + success = CreateProcess((wchar_t*)fullPathProgram.utf16(), + (wchar_t*)args.utf16(), + 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo); #else STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - success = CreateProcessW(0, (WCHAR*)args.utf16(), - 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0, - workingDir.isEmpty() ? (const WCHAR *)0 : (const WCHAR *)workingDir.utf16(), - &startupInfo, &pinfo); -#endif - } else -#endif // UNICODE - { -#ifndef Q_OS_WINCE - STARTUPINFOA startupInfo = { sizeof( STARTUPINFOA ), 0, 0, 0, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - success = CreateProcessA(0, args.toLocal8Bit().data(), - 0, 0, FALSE, CREATE_NEW_CONSOLE, 0, - workingDir.isEmpty() ? (LPCSTR)0 : workingDir.toLocal8Bit().constData(), + success = CreateProcess(0, (wchar_t*)args.utf16(), + 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0, + workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(), &startupInfo, &pinfo); #endif // Q_OS_WINCE - } if (success) { CloseHandle(pinfo.hThread); diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 3f8dc36f..7de5030 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1037,33 +1037,16 @@ static QString windowsConfigPath(int type) // This only happens when bootstrapping qmake. #ifndef Q_OS_WINCE QLibrary library(QLatin1String("shell32")); - QT_WA( { - typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL); - GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); - if (SHGetSpecialFolderPath) { - TCHAR path[MAX_PATH]; - SHGetSpecialFolderPath(0, path, type, FALSE); - result = QString::fromUtf16((ushort*)path); - } - } , { - typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, char*, int, BOOL); - GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathA"); - if (SHGetSpecialFolderPath) { - char path[MAX_PATH]; - SHGetSpecialFolderPath(0, path, type, FALSE); - result = QString::fromLocal8Bit(path); - } - } ); #else QLibrary library(QLatin1String("coredll")); - typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL); - GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPath"); +#endif // Q_OS_WINCE + typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); + GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); if (SHGetSpecialFolderPath) { wchar_t path[MAX_PATH]; SHGetSpecialFolderPath(0, path, type, FALSE); - result = QString::fromUtf16((ushort*)path); + result = QString::fromWCharArray(path); } -#endif // Q_OS_WINCE #endif // QT_NO_QOBJECT @@ -1459,11 +1442,7 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo) QString writeSemName = QLatin1String("QSettingsWriteSem "); writeSemName.append(file.fileName()); - QT_WA( { - writeSemaphore = CreateSemaphoreW(0, 1, 1, reinterpret_cast(writeSemName.utf16())); - } , { - writeSemaphore = CreateSemaphoreA(0, 1, 1, writeSemName.toLocal8Bit()); - } ); + writeSemaphore = CreateSemaphore(0, 1, 1, reinterpret_cast(writeSemName.utf16())); if (writeSemaphore) { WaitForSingleObject(writeSemaphore, INFINITE); @@ -1479,11 +1458,7 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo) QString readSemName(QLatin1String("QSettingsReadSem ")); readSemName.append(file.fileName()); - QT_WA( { - readSemaphore = CreateSemaphoreW(0, FileLockSemMax, FileLockSemMax, reinterpret_cast(readSemName.utf16())); - } , { - readSemaphore = CreateSemaphoreA(0, FileLockSemMax, FileLockSemMax, readSemName.toLocal8Bit()); - } ); + readSemaphore = CreateSemaphore(0, FileLockSemMax, FileLockSemMax, reinterpret_cast(readSemName.utf16())); if (readSemaphore) { for (int i = 0; i < numReadLocks; ++i) diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 0cbcc10..1e1509d 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -130,24 +130,13 @@ static void mergeKeySets(NameSet *dest, const QStringList &src) static QString errorCodeToString(DWORD errorCode) { - QString result; - QT_WA({ - wchar_t *data = 0; - FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - 0, errorCode, 0, - data, 0, 0); - result = QString::fromUtf16(reinterpret_cast (data)); - if (data != 0) - LocalFree(data); - }, { - char *data = 0; - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - 0, errorCode, 0, - (char *)&data, 0, 0); - result = QString::fromLocal8Bit(data); - if (data != 0) - LocalFree(data); - }) + wchar_t *data = 0; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, 0, 0); + QString result = QString::fromWCharArray(data); + + if (data != 0) + LocalFree(data); + if (result.endsWith(QLatin1Char('\n'))) result.truncate(result.length() - 1); @@ -158,15 +147,8 @@ static QString errorCodeToString(DWORD errorCode) static HKEY openKey(HKEY parentHandle, REGSAM perms, const QString &rSubKey) { HKEY resultHandle = 0; - - LONG res; - QT_WA( { - res = RegOpenKeyExW(parentHandle, reinterpret_cast(rSubKey.utf16()), - 0, perms, &resultHandle); - } , { - res = RegOpenKeyExA(parentHandle, rSubKey.toLocal8Bit(), + LONG res = RegOpenKeyEx(parentHandle, reinterpret_cast(rSubKey.utf16()), 0, perms, &resultHandle); - } ); if (res == ERROR_SUCCESS) return resultHandle; @@ -183,14 +165,8 @@ static HKEY createOrOpenKey(HKEY parentHandle, REGSAM perms, const QString &rSub return resultHandle; // try to create it - LONG res; - QT_WA( { - res = RegCreateKeyExW(parentHandle, reinterpret_cast(rSubKey.utf16()), 0, 0, - REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0); - } , { - res = RegCreateKeyExA(parentHandle, rSubKey.toLocal8Bit(), 0, 0, + LONG res = RegCreateKeyEx(parentHandle, reinterpret_cast(rSubKey.utf16()), 0, 0, REG_OPTION_NON_VOLATILE, perms, 0, &resultHandle, 0); - } ); if (res == ERROR_SUCCESS) return resultHandle; @@ -225,20 +201,14 @@ static HKEY createOrOpenKey(HKEY parentHandle, const QString &rSubKey, bool *rea static QStringList childKeysOrGroups(HKEY parentHandle, QSettingsPrivate::ChildSpec spec) { QStringList result; - LONG res; DWORD numKeys; DWORD maxKeySize; DWORD numSubgroups; DWORD maxSubgroupSize; // Find the number of keys and subgroups, as well as the max of their lengths. - QT_WA( { - res = RegQueryInfoKeyW(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0, + LONG res = RegQueryInfoKey(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0, &numKeys, &maxKeySize, 0, 0, 0); - }, { - res = RegQueryInfoKeyA(parentHandle, 0, 0, 0, &numSubgroups, &maxSubgroupSize, 0, - &numKeys, &maxKeySize, 0, 0, 0); - } ); if (res != ERROR_SUCCESS) { qWarning("QSettings: RegQueryInfoKey() failed: %s", errorCodeToString(res).toLatin1().data()); @@ -258,36 +228,21 @@ static QStringList childKeysOrGroups(HKEY parentHandle, QSettingsPrivate::ChildS m = maxSubgroupSize; } - /* Windows NT/2000/XP: The size does not include the terminating null character. - Windows Me/98/95: The size includes the terminating null character. */ + /* The size does not include the terminating null character. */ ++m; // Get the list - QByteArray buff(m*sizeof(ushort), 0); + QByteArray buff(m * sizeof(wchar_t), 0); for (int i = 0; i < n; ++i) { QString item; - QT_WA( { - DWORD l = buff.size() / sizeof(ushort); - if (spec == QSettingsPrivate::ChildKeys) { - res = RegEnumValueW(parentHandle, i, - reinterpret_cast(buff.data()), - &l, 0, 0, 0, 0); - } else { - res = RegEnumKeyExW(parentHandle, i, - reinterpret_cast(buff.data()), - &l, 0, 0, 0, 0); - } - if (res == ERROR_SUCCESS) - item = QString::fromUtf16(reinterpret_cast(buff.data()), l); - }, { - DWORD l = buff.size(); - if (spec == QSettingsPrivate::ChildKeys) - res = RegEnumValueA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0); - else - res = RegEnumKeyExA(parentHandle, i, buff.data(), &l, 0, 0, 0, 0); - if (res == ERROR_SUCCESS) - item = QString::fromLocal8Bit(buff.data(), l); - } ); + DWORD l = buff.size() / sizeof(wchar_t); + if (spec == QSettingsPrivate::ChildKeys) { + res = RegEnumValue(parentHandle, i, reinterpret_cast(buff.data()), &l, 0, 0, 0, 0); + } else { + res = RegEnumKeyEx(parentHandle, i, reinterpret_cast(buff.data()), &l, 0, 0, 0, 0); + } + if (res == ERROR_SUCCESS) + item = QString::fromWCharArray((const wchar_t *)buff.constData(), l); if (res != ERROR_SUCCESS) { qWarning("QSettings: RegEnumValue failed: %s", errorCodeToString(res).toLatin1().data()); @@ -342,12 +297,7 @@ static void deleteChildGroups(HKEY parentHandle) RegCloseKey(childGroupHandle); // delete group itself - LONG res; - QT_WA( { - res = RegDeleteKeyW(parentHandle, reinterpret_cast(group.utf16())); - }, { - res = RegDeleteKeyA(parentHandle, group.toLocal8Bit()); - } ); + LONG res = RegDeleteKey(parentHandle, reinterpret_cast(group.utf16())); if (res != ERROR_SUCCESS) { qWarning("QSettings: RegDeleteKey failed on subkey \"%s\": %s", group.toLatin1().data(), errorCodeToString(res).toLatin1().data()); @@ -519,12 +469,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa // get the size and type of the value DWORD dataType; DWORD dataSize; - LONG res; - QT_WA( { - res = RegQueryValueExW(handle, reinterpret_cast(rSubkeyName.utf16()), 0, &dataType, 0, &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize); - } ); + LONG res = RegQueryValueEx(handle, reinterpret_cast(rSubkeyName.utf16()), 0, &dataType, 0, &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return false; @@ -532,13 +477,8 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa // get the value QByteArray data(dataSize, 0); - QT_WA( { - res = RegQueryValueExW(handle, reinterpret_cast(rSubkeyName.utf16()), 0, 0, - reinterpret_cast(data.data()), &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - } ); + res = RegQueryValueEx(handle, reinterpret_cast(rSubkeyName.utf16()), 0, 0, + reinterpret_cast(data.data()), &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return false; @@ -549,11 +489,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_SZ: { QString s; if (dataSize) { - QT_WA( { - s = QString::fromUtf16(((const ushort*)data.constData())); - }, { - s = QString::fromLocal8Bit(data.constData()); - } ); + s = QString::fromWCharArray(((const wchar_t *)data.constData())); } if (value != 0) *value = stringToVariant(s); @@ -565,12 +501,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa if (dataSize) { int i = 0; for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLocal8Bit(data.constData() + i); - } ); + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); i += s.length() + 1; if (s.isEmpty()) @@ -587,11 +518,7 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_BINARY: { QString s; if (dataSize) { - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - s = QString::fromLocal8Bit(data.constData(), data.size()); - } ); + s = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); } if (value != 0) *value = stringToVariant(s); @@ -635,13 +562,8 @@ QWinSettingsPrivate::~QWinSettingsPrivate() #if defined(Q_OS_WINCE) remove(regList.at(0).key()); #else - DWORD res; QString emptyKey; - QT_WA( { - res = RegDeleteKeyW(writeHandle(), reinterpret_cast(emptyKey.utf16())); - }, { - res = RegDeleteKeyA(writeHandle(), emptyKey.toLocal8Bit()); - } ); + DWORD res = RegDeleteKey(writeHandle(), reinterpret_cast(emptyKey.utf16())); if (res != ERROR_SUCCESS) { qWarning("QSettings: Failed to delete key \"%s\": %s", regList.at(0).key().toLatin1().data(), errorCodeToString(res).toLatin1().data()); @@ -666,11 +588,7 @@ void QWinSettingsPrivate::remove(const QString &uKey) LONG res; HKEY handle = openKey(writeHandle(), registryPermissions, keyPath(rKey)); if (handle != 0) { - QT_WA( { - res = RegDeleteValueW(handle, reinterpret_cast(keyName(rKey).utf16())); - }, { - res = RegDeleteValueA(handle, keyName(rKey).toLocal8Bit()); - } ); + res = RegDeleteValue(handle, reinterpret_cast(keyName(rKey).utf16())); RegCloseKey(handle); } @@ -685,12 +603,7 @@ void QWinSettingsPrivate::remove(const QString &uKey) for (int i = 0; i < childKeys.size(); ++i) { QString group = childKeys.at(i); - LONG res; - QT_WA( { - res = RegDeleteValueW(handle, reinterpret_cast(group.utf16())); - }, { - res = RegDeleteValueA(handle, group.toLocal8Bit()); - } ); + LONG res = RegDeleteValue(handle, reinterpret_cast(group.utf16())); if (res != ERROR_SUCCESS) { qWarning("QSettings: RegDeleteValue failed on subkey \"%s\": %s", group.toLatin1().data(), errorCodeToString(res).toLatin1().data()); @@ -701,11 +614,7 @@ void QWinSettingsPrivate::remove(const QString &uKey) // For WinCE always Close the handle first. RegCloseKey(handle); #endif - QT_WA( { - res = RegDeleteKeyW(writeHandle(), reinterpret_cast(rKey.utf16())); - }, { - res = RegDeleteKeyA(writeHandle(), rKey.toLocal8Bit()); - } ); + res = RegDeleteKey(writeHandle(), reinterpret_cast(rKey.utf16())); if (res != ERROR_SUCCESS) { qWarning("QSettings: RegDeleteKey failed on key \"%s\": %s", @@ -761,27 +670,15 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) if (type == REG_BINARY) { QString s = variantToString(value); - QT_WA( { - regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2); - }, { - regValueBuff = QByteArray((const char*)s.toLocal8Bit(), s.length()); - } ); + regValueBuff = QByteArray((const char*)s.utf16(), s.length() * 2); } else { QStringList::const_iterator it = l.constBegin(); for (; it != l.constEnd(); ++it) { const QString &s = *it; - QT_WA( { - regValueBuff += QByteArray((const char*)s.utf16(), (s.length() + 1)*2); - }, { - regValueBuff += QByteArray((const char*)s.toLocal8Bit(), s.length() + 1); - } ); + regValueBuff += QByteArray((const char*)s.utf16(), (s.length() + 1) * 2); } - QT_WA( { - regValueBuff.append((char)0); - regValueBuff.append((char)0); - }, { - regValueBuff.append((char)0); - } ); + regValueBuff.append((char)0); + regValueBuff.append((char)0); } break; } @@ -794,21 +691,6 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) } case QVariant::ByteArray: - // On Win95/98/Me QString::toLocal8Bit() fails to handle chars > 0x7F. So we don't go through variantToString() at all. - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - QByteArray ba = value.toByteArray(); - regValueBuff = "@ByteArray("; - regValueBuff += ba; - regValueBuff += ')'; - if (ba.contains('\0')) { - type = REG_BINARY; - } else { - type = REG_SZ; - regValueBuff += '\0'; - } - - break; - } // fallthrough intended default: { @@ -817,33 +699,18 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) QString s = variantToString(value); type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ; if (type == REG_BINARY) { - QT_WA( { - regValueBuff = QByteArray((const char*)s.utf16(), s.length()*2); - }, { - regValueBuff = QByteArray((const char*)s.toLocal8Bit(), s.length()); - } ); + regValueBuff = QByteArray((const char*)s.utf16(), s.length() * 2); } else { - QT_WA( { - regValueBuff = QByteArray((const char*)s.utf16(), (s.length() + 1)*2); - }, { - regValueBuff = QByteArray((const char*)s.toLocal8Bit(), s.length() + 1); - } ); + regValueBuff = QByteArray((const char*)s.utf16(), (s.length() + 1) * 2); } break; } } // set the value - LONG res; - QT_WA( { - res = RegSetValueExW(handle, reinterpret_cast(keyName(rKey).utf16()), 0, type, - reinterpret_cast(regValueBuff.constData()), - regValueBuff.size()); - }, { - res = RegSetValueExA(handle, keyName(rKey).toLocal8Bit(), 0, type, + LONG res = RegSetValueEx(handle, reinterpret_cast(keyName(rKey).utf16()), 0, type, reinterpret_cast(regValueBuff.constData()), regValueBuff.size()); - } ); if (res == ERROR_SUCCESS) { deleteWriteHandleOnExit = false; diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e6a471c..f0a3fec 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1742,18 +1742,10 @@ QString QCoreApplication::applicationFilePath() return d->cachedApplicationFilePath; #if defined( Q_WS_WIN ) - QFileInfo filePath; - QT_WA({ - wchar_t module_name[MAX_PATH+1]; - GetModuleFileNameW(0, module_name, MAX_PATH); - module_name[MAX_PATH] = 0; - filePath = QString::fromUtf16((ushort *)module_name); - }, { - char module_name[MAX_PATH+1]; - GetModuleFileNameA(0, module_name, MAX_PATH); - module_name[MAX_PATH] = 0; - filePath = QString::fromLocal8Bit(module_name); - }); + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, MAX_PATH); + module_name[MAX_PATH] = 0; + QFileInfo filePath = QString::fromWCharArray(module_name); d->cachedApplicationFilePath = filePath.filePath(); return d->cachedApplicationFilePath; @@ -1902,13 +1894,13 @@ QStringList QCoreApplication::arguments() return list; } #ifdef Q_OS_WIN - QString cmdline = QT_WA_INLINE(QString::fromUtf16((unsigned short *)GetCommandLineW()), QString::fromLocal8Bit(GetCommandLineA())); + QString cmdline = QString::fromWCharArray(GetCommandLine()); #if defined(Q_OS_WINCE) wchar_t tempFilename[MAX_PATH+1]; - if (GetModuleFileNameW(0, tempFilename, MAX_PATH)) { + if (GetModuleFileName(0, tempFilename, MAX_PATH)) { tempFilename[MAX_PATH] = 0; - cmdline.prepend(QLatin1Char('\"') + QString::fromUtf16((unsigned short *)tempFilename) + QLatin1String("\" ")); + cmdline.prepend(QLatin1Char('\"') + QString::fromWCharArray(tempFilename) + QLatin1String("\" ")); } #endif // Q_OS_WINCE diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 7a35340..657abd1 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -45,14 +45,15 @@ #include "qt_windows.h" #include "qvector.h" #include "qmutex.h" +#include "qfileinfo.h" #include "qcorecmdlineargs_p.h" #include #include QT_BEGIN_NAMESPACE -char appFileName[MAX_PATH+1]; // application file name -char theAppName[MAX_PATH+1]; // application name +char appFileName[MAX_PATH]; // application file name +char theAppName[MAX_PATH]; // application name HINSTANCE appInst = 0; // handle to app instance HINSTANCE appPrevInst = 0; // handle to prev app instance int appCmdShow = 0; @@ -73,48 +74,35 @@ Q_CORE_EXPORT int qWinAppCmdShow() // get main window sho return appCmdShow; } +Q_CORE_EXPORT QString qAppFileName() // get application file name +{ + wchar_t buffer[MAX_PATH]; + GetModuleFileName(0, buffer, MAX_PATH); + return QString::fromWCharArray(buffer); +} void set_winapp_name() { static bool already_set = false; if (!already_set) { already_set = true; -#ifndef Q_OS_WINCE - GetModuleFileNameA(0, appFileName, sizeof(appFileName)); - appFileName[sizeof(appFileName)-1] = 0; -#else - QString afm; - afm.resize(sizeof(appFileName)); - afm.resize(GetModuleFileName(0, (wchar_t *) (afm.unicode()), sizeof(appFileName))); - memcpy(appFileName, afm.toLatin1(), sizeof(appFileName)); -#endif - const char *p = strrchr(appFileName, '\\'); // skip path - if (p) - memcpy(theAppName, p+1, qstrlen(p)); - int l = qstrlen(theAppName); - if ((l > 4) && !qstricmp(theAppName + l - 4, ".exe")) - theAppName[l-4] = '\0'; // drop .exe extension - if (appInst == 0) { - QT_WA({ - appInst = GetModuleHandle(0); - }, { - appInst = GetModuleHandleA(0); - }); - } - } -} + QString moduleName = qAppFileName(); -Q_CORE_EXPORT QString qAppFileName() // get application file name -{ - return QString::fromLatin1(appFileName); + QByteArray filePath = moduleName.toLocal8Bit(); + QByteArray fileName = QFileInfo(moduleName).baseName().toLocal8Bit(); + + memcpy(appFileName, filePath.constData(), filePath.length()); + memcpy(theAppName, fileName.constData(), fileName.length()); + + if (appInst == 0) + appInst = GetModuleHandle(0); + } } QString QCoreApplicationPrivate::appName() const { - if (!theAppName[0]) - set_winapp_name(); - return QString::fromLatin1(theAppName); + return QFileInfo(qAppFileName()).baseName(); } class QWinMsgHandlerCriticalSection @@ -145,15 +133,11 @@ Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char* str) str = "(null)"; staticCriticalSection.lock(); - QT_WA({ - QString s(QString::fromLocal8Bit(str)); - s += QLatin1Char('\n'); - OutputDebugStringW((TCHAR*)s.utf16()); - }, { - QByteArray s(str); - s += '\n'; - OutputDebugStringA(s.data()); - }) + + QString s(QString::fromLocal8Bit(str)); + s += QLatin1Char('\n'); + OutputDebugString((wchar_t*)s.utf16()); + staticCriticalSection.unlock(); } diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h index c0dd813..a012b4e 100644 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ b/src/corelib/kernel/qcorecmdlineargs_p.h @@ -135,9 +135,9 @@ static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this mi QStringList args; int argc = 0; - QVector argv = qWinCmdLine((ushort*)cmdLine.utf16(), cmdLine.length(), argc); + QVector argv = qWinCmdLine((wchar_t *)cmdLine.utf16(), cmdLine.length(), argc); for (int a = 0; a < argc; ++a) { - args << QString::fromUtf16(argv[a]); + args << QString::fromWCharArray(argv[a]); } return args; @@ -147,10 +147,7 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[]) { Q_UNUSED(argc) Q_UNUSED(argv) - QString cmdLine = QT_WA_INLINE( - QString::fromUtf16((unsigned short*)GetCommandLineW()), - QString::fromLocal8Bit(GetCommandLineA()) - ); + QString cmdLine = QString::fromWCharArray(GetCommandLine()); return qWinCmdArgs(cmdLine); } diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index cb1549c..23e4fa9 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -355,8 +355,7 @@ QEventDispatcherWin32Private::QEventDispatcherWin32Private() { resolveTimerAPI(); - wakeUpNotifier.setHandle(QT_WA_INLINE(CreateEventW(0, FALSE, FALSE, 0), - CreateEventA(0, FALSE, FALSE, 0))); + wakeUpNotifier.setHandle(CreateEvent(0, FALSE, FALSE, 0)); if (!wakeUpNotifier.handle()) qWarning("QEventDispatcher: Creating QEventDispatcherWin32Private wakeup event failed"); } @@ -367,13 +366,8 @@ QEventDispatcherWin32Private::~QEventDispatcherWin32Private() CloseHandle(wakeUpNotifier.handle()); if (internalHwnd) DestroyWindow(internalHwnd); - QByteArray className = "QEventDispatcherWin32_Internal_Widget" + QByteArray::number(quintptr(qt_internal_proc)); -#if !defined(Q_OS_WINCE) - UnregisterClassA(className.constData(), qWinAppInst()); -#else - UnregisterClassW(reinterpret_cast (QString::fromLatin1(className.constData()).utf16()) - , qWinAppInst()); -#endif + QString className = QLatin1String("QEventDispatcherWin32_Internal_Widget") + QString::number(quintptr(qt_internal_proc)); + UnregisterClass((wchar_t*)className.utf16(), qWinAppInst()); } void QEventDispatcherWin32Private::activateEventNotifier(QWinEventNotifier * wen) @@ -382,18 +376,24 @@ void QEventDispatcherWin32Private::activateEventNotifier(QWinEventNotifier * wen QCoreApplication::sendEvent(wen, &event); } - +// ### Qt 5: remove Q_CORE_EXPORT bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) { - QT_WA({ return PeekMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); } , - { return PeekMessageA(msg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); }); + return PeekMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); } +// ### Qt 5: remove Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - QT_WA({ return PostMessage(hWnd, msg, wParam, lParam); } , - { return PostMessageA(hWnd, msg, wParam, lParam); }); + return PostMessage(hWnd, msg, wParam, lParam); +} + +// ### Qt 5: remove +Q_CORE_EXPORT bool winGetMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, + UINT wMsgFilterMax) +{ + return GetMessage(msg, hWnd, wMsgFilterMin, wMsgFilterMax); } // This function is called by a workerthread @@ -443,10 +443,10 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) #ifdef GWLP_USERDATA QEventDispatcherWin32 *eventDispatcher = - (QEventDispatcherWin32 *) GetWindowLongPtrA(hwnd, GWLP_USERDATA); + (QEventDispatcherWin32 *) GetWindowLongPtr(hwnd, GWLP_USERDATA); #else QEventDispatcherWin32 *eventDispatcher = - (QEventDispatcherWin32 *) GetWindowLongA(hwnd, GWL_USERDATA); + (QEventDispatcherWin32 *) GetWindowLong(hwnd, GWL_USERDATA); #endif if (eventDispatcher) { QEventDispatcherWin32Private *d = eventDispatcher->d_func(); @@ -494,54 +494,35 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher) { - HINSTANCE hi = qWinAppInst(); -#if defined(Q_OS_WINCE) + // make sure that multiple Qt's can coexist in the same process + QString className = QLatin1Strign("QEventDispatcherWin32_Internal_Widget") + QString::number(quintptr(qt_internal_proc)); + WNDCLASS wc; -#else - WNDCLASSA wc; -#endif wc.style = 0; wc.lpfnWndProc = qt_internal_proc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = hi; + wc.hInstance = qWinAppInst(); wc.hIcon = 0; wc.hCursor = 0; wc.hbrBackground = 0; wc.lpszMenuName = NULL; + wc.lpszClassName = reinterpret_cast (className.utf16()); - // make sure that multiple Qt's can coexist in the same process - QByteArray className = "QEventDispatcherWin32_Internal_Widget" + QByteArray::number(quintptr(qt_internal_proc)); -#if defined(Q_OS_WINCE) - QString tmp = QString::fromLatin1(className.data()); - wc.lpszClassName = reinterpret_cast (tmp.utf16()); RegisterClass(&wc); HWND wnd = CreateWindow(wc.lpszClassName, // classname - wc.lpszClassName, // window name - 0, // style - 0, 0, 0, 0, // geometry - 0, // parent - 0, // menu handle - hi, // application - 0); // windows creation data. -#else - wc.lpszClassName = className.constData(); - RegisterClassA(&wc); - HWND wnd = CreateWindowA(wc.lpszClassName, // classname - wc.lpszClassName, // window name - 0, // style - 0, 0, 0, 0, // geometry - 0, // parent - 0, // menu handle - hi, // application - 0); // windows creation data. -#endif - + wc.lpszClassName, // window name + 0, // style + 0, 0, 0, 0, // geometry + 0, // parent + 0, // menu handle + qWinAppInst(), // application + 0); // windows creation data. #ifdef GWLP_USERDATA - SetWindowLongPtrA(wnd, GWLP_USERDATA, (LONG_PTR)eventDispatcher); + SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)eventDispatcher); #else - SetWindowLongA(wnd, GWL_USERDATA, (LONG)eventDispatcher); + SetWindowLong(wnd, GWL_USERDATA, (LONG)eventDispatcher); #endif if (!wnd) { @@ -690,7 +671,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) haveMessage = true; msg = d->queuedSocketEvents.takeFirst(); } else { - haveMessage = winPeekMessage(&msg, 0, 0, 0, PM_REMOVE); + haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE); if (haveMessage && (flags & QEventLoop::ExcludeUserInputEvents) && ((msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST) @@ -738,11 +719,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) if (!filterEvent(&msg)) { TranslateMessage(&msg); - QT_WA({ - DispatchMessage(&msg); - } , { - DispatchMessageA(&msg); - }); + DispatchMessage(&msg); } } else if (waitRet >= WAIT_OBJECT_0 && waitRet < WAIT_OBJECT_0 + nCount) { d->activateEventNotifier(d->winEventNotifierList.at(waitRet - WAIT_OBJECT_0)); @@ -781,7 +758,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) bool QEventDispatcherWin32::hasPendingEvents() { MSG msg; - return qGlobalPostedEventsCount() || winPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); + return qGlobalPostedEventsCount() || PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); } void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp index 2c47adb..5680ad5 100644 --- a/src/corelib/kernel/qfunctions_wince.cpp +++ b/src/corelib/kernel/qfunctions_wince.cpp @@ -108,7 +108,7 @@ int qt_wince__getdrive( void ) return 1; } -int qt_wince__waccess( const WCHAR *path, int pmode ) +int qt_wince__waccess( const wchar_t *path, int pmode ) { DWORD res = GetFileAttributes( path ); if ( 0xFFFFFFFF == res ) @@ -118,7 +118,7 @@ int qt_wince__waccess( const WCHAR *path, int pmode ) return -1; if ( (pmode & X_OK) && !(res & FILE_ATTRIBUTE_DIRECTORY) ) { - QString file = QString::fromUtf16(reinterpret_cast (path)); + QString file = QString::fromWCharArray(path); if ( !(file.endsWith(QString::fromLatin1(".exe")) || file.endsWith(QString::fromLatin1(".com"))) ) return -1; @@ -130,12 +130,12 @@ int qt_wince__waccess( const WCHAR *path, int pmode ) int qt_wince_open( const char *filename, int oflag, int pmode ) { QString fn( QString::fromLatin1(filename) ); - return _wopen( (WCHAR*)fn.utf16(), oflag, pmode ); + return _wopen( (wchar_t*)fn.utf16(), oflag, pmode ); } -int qt_wince__wopen( const WCHAR *filename, int oflag, int /*pmode*/ ) +int qt_wince__wopen( const wchar_t *filename, int oflag, int /*pmode*/ ) { - WCHAR *flag; + wchar_t *flag; if ( oflag & _O_APPEND ) { if ( oflag & _O_WRONLY ) { @@ -290,7 +290,7 @@ bool qt_wince__chmod(const char *file, int mode) return _wchmod( reinterpret_cast (QString::fromLatin1(file).utf16()), mode); } -bool qt_wince__wchmod(const WCHAR *file, int mode) +bool qt_wince__wchmod(const wchar_t *file, int mode) { // ### Does not work properly, what about just adding one property? if(mode&_S_IWRITE) { diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h index 307e17b..41cb641 100644 --- a/src/corelib/kernel/qfunctions_wince.h +++ b/src/corelib/kernel/qfunctions_wince.h @@ -175,8 +175,8 @@ typedef int mode_t; extern int errno; int qt_wince__getdrive( void ); -int qt_wince__waccess( const WCHAR *path, int pmode ); -int qt_wince__wopen( const WCHAR *filename, int oflag, int pmode ); +int qt_wince__waccess( const wchar_t *path, int pmode ); +int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode ); long qt_wince__lseek( int handle, long offset, int origin ); int qt_wince__read( int handle, void *buffer, unsigned int count ); int qt_wince__write( int handle, const void *buffer, unsigned int count ); @@ -204,7 +204,7 @@ int qt_wince_SetErrorMode(int); #endif bool qt_wince__chmod(const char *file, int mode); -bool qt_wince__wchmod(const WCHAR *file, int mode); +bool qt_wince__wchmod(const wchar_t *file, int mode); #pragma warning(disable: 4273) HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index d963a6d..c88149a 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -106,16 +106,11 @@ HANDLE QSharedMemoryPrivate::handle() return false; } #ifndef Q_OS_WINCE - QT_WA({ - hand = OpenFileMappingW(FILE_MAP_ALL_ACCESS, false, (TCHAR*)safeKey.utf16()); - }, { - hand = OpenFileMappingA(FILE_MAP_ALL_ACCESS, false, safeKey.toLocal8Bit().constData()); - }); + hand = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, (wchar_t*)safeKey.utf16()); #else // This works for opening a mapping too, but always opens it with read/write access in // attach as it seems. - hand = CreateFileMappingW(INVALID_HANDLE_VALUE, - 0, PAGE_READWRITE, 0, 0, (TCHAR*)safeKey.utf16()); + hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 0, (wchar_t*)safeKey.utf16()); #endif if (!hand) { setErrorString(function); @@ -148,13 +143,7 @@ bool QSharedMemoryPrivate::create(int size) } // Create the file mapping. - QT_WA( { - hand = CreateFileMappingW(INVALID_HANDLE_VALUE, - 0, PAGE_READWRITE, 0, size, (TCHAR*)safeKey.utf16()); - }, { - hand = CreateFileMappingA(INVALID_HANDLE_VALUE, - 0, PAGE_READWRITE, 0, size, safeKey.toLocal8Bit().constData()); - } ); + hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size, (wchar_t*)safeKey.utf16()); setErrorString(function); // hand is valid when it already exists unlike unix so explicitly check diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 4e03ddf..1102258 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -87,11 +87,7 @@ HANDLE QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode) // Create it if it doesn't already exists. if (semaphore == 0) { QString safeName = makeKeyFileName(); - QT_WA({ - semaphore = CreateSemaphoreW(0, initialValue, MAXLONG, (TCHAR*)safeName.utf16()); - }, { - semaphore = CreateSemaphoreA(0, initialValue, MAXLONG, safeName.toLocal8Bit().constData()); - }); + semaphore = CreateSemaphore(0, initialValue, MAXLONG, (wchar_t*)safeName.utf16()); if (semaphore == NULL) setErrorString(QLatin1String("QSystemSemaphore::handle")); } diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index d2a0b3a..2ee9d26 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -103,9 +103,8 @@ QT_BEGIN_NAMESPACE Note that QTimer's accuracy depends on the underlying operating system and hardware. Most platforms support an accuracy of - 1 millisecond, but Windows 98 supports only 55. If Qt is - unable to deliver the requested number of timer clicks, it will - silently discard some. + 1 millisecond. If Qt is unable to deliver the requested number of + timer clicks, it will silently discard some. An alternative to using QTimer is to call QObject::startTimer() for your object and reimplement the QObject::timerEvent() event diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 4d465dc..8f364ba 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -623,11 +623,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) #endif if (!pHnd) { #ifdef Q_OS_WIN - QT_WA({ - hTempModule = ::LoadLibraryExW((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES); - } , { - temporary_load = load_sys(); - }); + hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES); #else temporary_load = load_sys(); #endif @@ -641,7 +637,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule ? (QtPluginQueryVerificationDataFunction) #ifdef Q_OS_WINCE - ::GetProcAddressW(hTempModule, L"qt_plugin_query_verification_data") + ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data") #else ::GetProcAddress(hTempModule, "qt_plugin_query_verification_data") #endif diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index 43eeafa..847c0d2 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -67,30 +67,18 @@ bool QLibraryPrivate::load_sys() //avoid 'Bad Image' message box UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - QT_WA({ - pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(attempt).utf16()); - } , { - pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(attempt)).data()); - }); - + pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16()); + if (pluginState != IsAPlugin) { #if defined(Q_OS_WINCE) if (!pHnd && ::GetLastError() == ERROR_MOD_NOT_FOUND) { QString secondAttempt = fileName; - QT_WA({ - pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(secondAttempt).utf16()); - } , { - pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(secondAttempt)).data()); - }); + pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(secondAttempt).utf16()); } #endif if (!pHnd && ::GetLastError() == ERROR_MOD_NOT_FOUND) { attempt += QLatin1String(".dll"); - QT_WA({ - pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(attempt).utf16()); - } , { - pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(attempt)).data()); - }); + pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16()); } } @@ -100,15 +88,11 @@ bool QLibraryPrivate::load_sys() } if (pHnd) { errorString.clear(); - QT_WA({ - TCHAR buffer[MAX_PATH + 1]; - ::GetModuleFileNameW(pHnd, buffer, MAX_PATH); - attempt = QString::fromUtf16(reinterpret_cast(&buffer)); - }, { - char buffer[MAX_PATH + 1]; - ::GetModuleFileNameA(pHnd, buffer, MAX_PATH); - attempt = QString::fromLocal8Bit(buffer); - }); + + wchar_t buffer[MAX_PATH]; + ::GetModuleFileName(pHnd, buffer, MAX_PATH); + attempt = QString::fromWCharArray(buffer); + const QDir dir = QFileInfo(fileName).dir(); const QString realfilename = attempt.mid(attempt.lastIndexOf(QLatin1Char('\\')) + 1); if (dir.path() == QLatin1String(".")) diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp index f2022a5..1d247fc 100644 --- a/src/corelib/thread/qmutex_win.cpp +++ b/src/corelib/thread/qmutex_win.cpp @@ -50,19 +50,7 @@ QT_BEGIN_NAMESPACE QMutexPrivate::QMutexPrivate(QMutex::RecursionMode mode) : recursive(mode == QMutex::Recursive), contenders(0), lastSpinCount(0), owner(0), count(0) { - if (QSysInfo::WindowsVersion == 0) { - // mutex was created before initializing WindowsVersion. this - // can happen when creating the resource file engine handler, - // for example. try again with just the A version -#ifdef Q_OS_WINCE - event = CreateEventW(0, FALSE, FALSE, 0); -#else - event = CreateEventA(0, FALSE, FALSE, 0); -#endif - } else { - event = QT_WA_INLINE(CreateEventW(0, FALSE, FALSE, 0), - CreateEventA(0, FALSE, FALSE, 0)); - } + event = CreateEvent(0, FALSE, FALSE, 0); if (!event) qWarning("QMutexPrivate::QMutexPrivate: Cannot create event"); } diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index b5bdba3..6c24784 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -163,8 +163,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread) // Start watcher thread if it is not already running. if (qt_adopted_thread_watcher_handle == 0) { if (qt_adopted_thread_wakeup == 0) { - qt_adopted_thread_wakeup = QT_WA_INLINE(CreateEventW(0, false, false, 0), - CreateEventA(0, false, false, 0)); + qt_adopted_thread_wakeup = CreateEvent(0, false, false, 0); qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup); } @@ -364,11 +363,10 @@ int QThread::idealThreadCount() void QThread::yieldCurrentThread() { #ifndef Q_OS_WINCE - if (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) - SwitchToThread(); - else + SwitchToThread(); +#else + ::Sleep(0); #endif - ::Sleep(0); } void QThread::sleep(unsigned long secs) @@ -419,17 +417,11 @@ void QThread::start(Priority priority) return; } - // Since Win 9x will have problems if the priority is idle or time critical - // we have to use the closest one instead int prio; d->priority = priority; switch (d->priority) { case IdlePriority: - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - prio = THREAD_PRIORITY_LOWEST; - } else { - prio = THREAD_PRIORITY_IDLE; - } + prio = THREAD_PRIORITY_IDLE; break; case LowestPriority: @@ -453,11 +445,7 @@ void QThread::start(Priority priority) break; case TimeCriticalPriority: - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - prio = THREAD_PRIORITY_HIGHEST; - } else { - prio = THREAD_PRIORITY_TIME_CRITICAL; - } + prio = THREAD_PRIORITY_TIME_CRITICAL; break; case InheritPriority: @@ -563,17 +551,11 @@ void QThread::setPriority(Priority priority) // copied from start() with a few modifications: - // Since Win 9x will have problems if the priority is idle or time critical - // we have to use the closest one instead int prio; d->priority = priority; switch (d->priority) { case IdlePriority: - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - prio = THREAD_PRIORITY_LOWEST; - } else { - prio = THREAD_PRIORITY_IDLE; - } + prio = THREAD_PRIORITY_IDLE; break; case LowestPriority: @@ -597,11 +579,7 @@ void QThread::setPriority(Priority priority) break; case TimeCriticalPriority: - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - prio = THREAD_PRIORITY_HIGHEST; - } else { - prio = THREAD_PRIORITY_TIME_CRITICAL; - } + prio = THREAD_PRIORITY_TIME_CRITICAL; break; case InheritPriority: diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index 9129fb6..b0146d2 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -64,11 +64,7 @@ class QWaitConditionEvent public: inline QWaitConditionEvent() : priority(0), wokenUp(false) { - QT_WA ({ - event = CreateEvent(NULL, TRUE, FALSE, NULL); - }, { - event = CreateEventA(NULL, TRUE, FALSE, NULL); - }); + event = CreateEvent(NULL, TRUE, FALSE, NULL); } inline ~QWaitConditionEvent() { CloseHandle(event); } int priority; diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 6674717..42f4304 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2503,16 +2503,9 @@ QString QDateTime::toString(Qt::DateFormat f) const buf += QLatin1Char(' '); buf += QString::number(d->date.day()); #else - QString winstr; - QT_WA({ - TCHAR out[255]; - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILDATE, out, 255); - winstr = QString::fromUtf16((ushort*)out); - } , { - char out[255]; - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ILDATE, (char*)&out, 255); - winstr = QString::fromLocal8Bit(out); - }); + wchar_t out[255]; + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILDATE, out, 255); + QString winstr = QString::fromWCharArray(out); switch (winstr.toInt()) { case 1: buf = d->date.shortDayName(d->date.dayOfWeek()); diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 8c1a0ff..fef1931 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -386,15 +386,8 @@ static QString winIso3116CtryName(LCID id = LOCALE_USER_DEFAULT); static QString getWinLocaleInfo(LCTYPE type) { - int cnt = 0; - LCID id = GetUserDefaultLCID(); - - QT_WA({ - cnt = GetLocaleInfoW(id, type, 0, 0)*2; - } , { - cnt = GetLocaleInfoA(id, type, 0, 0); - }); + int cnt = GetLocaleInfo(id, type, 0, 0) * 2; if (cnt == 0) { qWarning("QLocale: empty windows locale info (%d)", (int)type); @@ -403,27 +396,14 @@ static QString getWinLocaleInfo(LCTYPE type) QByteArray buff(cnt, 0); - QT_WA({ - cnt = GetLocaleInfoW(id, type, - reinterpret_cast(buff.data()), - buff.size()/2); - } , { - cnt = GetLocaleInfoA(id, type, - buff.data(), buff.size()); - }); + cnt = GetLocaleInfo(id, type, reinterpret_cast(buff.data()), buff.size() / 2); if (cnt == 0) { qWarning("QLocale: empty windows locale info (%d)", (int)type); return QString(); } - QString result; - QT_WA({ - result = QString::fromUtf16(reinterpret_cast(buff.data())); - } , { - result = QString::fromLocal8Bit(buff.data()); - }); - return result; + return QString::fromWCharArray(reinterpret_cast(buff.data())); } QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT) @@ -445,20 +425,19 @@ QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT) } } - if (QSysInfo::WindowsVersion == QSysInfo::WV_95 - || (QSysInfo::WindowsVersion & QSysInfo::WV_CE_based)) { - result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID()); - } else { - if (id == LOCALE_USER_DEFAULT) - id = GetUserDefaultLCID(); - QString resultuage = winIso639LangName(id); - QString country = winIso3116CtryName(id); - result = resultuage.toLatin1(); - if (!country.isEmpty()) { - result += '_'; - result += country.toLatin1(); - } +#if defined(Q_OS_WINCE) + result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID()); +#else + if (id == LOCALE_USER_DEFAULT) + id = GetUserDefaultLCID(); + QString resultuage = winIso639LangName(id); + QString country = winIso3116CtryName(id); + result = resultuage.toLatin1(); + if (!country.isEmpty()) { + result += '_'; + result += country.toLatin1(); } +#endif return result; } @@ -544,15 +523,9 @@ static QString winDateToString(const QDate &date, DWORD flags) LCID id = GetUserDefaultLCID(); - QT_WA({ - TCHAR buf[255]; - if (GetDateFormatW(id, flags, &st, 0, buf, 255)) - return QString::fromUtf16((ushort*)buf); - } , { - char buf[255]; - if (GetDateFormatA(id, flags, &st, 0, (char*)&buf, 255)) - return QString::fromLocal8Bit(buf); - }); + wchar_t buf[255]; + if (GetDateFormat(id, flags, &st, 0, buf, 255)) + return QString::fromWCharArray(buf); return QString(); } @@ -569,15 +542,9 @@ static QString winTimeToString(const QTime &time) DWORD flags = 0; LCID id = GetUserDefaultLCID(); - QT_WA({ - TCHAR buf[255]; - if (GetTimeFormatW(id, flags, &st, 0, buf, 255)) - return QString::fromUtf16((ushort*)buf); - } , { - char buf[255]; - if (GetTimeFormatA(id, flags, &st, 0, (char*)&buf, 255)) - return QString::fromLocal8Bit(buf); - }); + wchar_t buf[255]; + if (GetTimeFormat(id, flags, &st, 0, buf, 255)) + return QString::fromWCharArray(buf); return QString(); } @@ -626,12 +593,10 @@ static QString winMonthName(int month, bool short_format) static QLocale::MeasurementSystem winSystemMeasurementSystem() { LCID id = GetUserDefaultLCID(); - TCHAR output[2]; + wchar_t output[2]; if (GetLocaleInfo(id, LOCALE_IMEASURE, output, 2)) { - QString iMeasure = QT_WA_INLINE( - QString::fromUtf16(reinterpret_cast(output)), - QString::fromLocal8Bit(reinterpret_cast(output))); + QString iMeasure = QString::fromWCharArray(output); if (iMeasure == QLatin1String("1")) { return QLocale::ImperialSystem; } @@ -643,12 +608,10 @@ static QLocale::MeasurementSystem winSystemMeasurementSystem() static QString winSystemAMText() { LCID id = GetUserDefaultLCID(); - TCHAR output[15]; // maximum length including terminating zero character for Win2003+ + wchar_t output[15]; // maximum length including terminating zero character for Win2003+ if (GetLocaleInfo(id, LOCALE_S1159, output, 15)) { - return QT_WA_INLINE( - QString::fromUtf16(reinterpret_cast(output)), - QString::fromLocal8Bit(reinterpret_cast(output))); + return QString::fromWCharArray(output); } return QString(); @@ -657,12 +620,10 @@ static QString winSystemAMText() static QString winSystemPMText() { LCID id = GetUserDefaultLCID(); - TCHAR output[15]; // maximum length including terminating zero character for Win2003+ + wchar_t output[15]; // maximum length including terminating zero character for Win2003+ if (GetLocaleInfo(id, LOCALE_S2359, output, 15)) { - return QT_WA_INLINE( - QString::fromUtf16(reinterpret_cast(output)), - QString::fromLocal8Bit(reinterpret_cast(output))); + return QString::fromWCharArray(output); } return QString(); @@ -766,9 +727,6 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const return QVariant(); } -/* Win95 doesn't have a function to return the ISO lang/country name of the user's locale. - Instead it can return a "Windows code". This maps windows codes to ISO country names. */ - struct WindowsToISOListElt { ushort windows_code; char iso_name[6]; @@ -924,15 +882,9 @@ static QString winIso639LangName(LCID id) // Windows returns the wrong ISO639 for some languages, we need to detect them here using // the language code QString lang_code; - QT_WA({ - TCHAR out[256]; - if (GetLocaleInfoW(id, LOCALE_ILANGUAGE, out, 255)) - lang_code = QString::fromUtf16((ushort*)out); - } , { - char out[256]; - if (GetLocaleInfoA(id, LOCALE_ILANGUAGE, out, 255)) - lang_code = QString::fromLocal8Bit(out); - }); + wchar_t out[256]; + if (GetLocaleInfo(id, LOCALE_ILANGUAGE, out, 255)) + lang_code = QString::fromWCharArray(out); if (!lang_code.isEmpty()) { const char *endptr; @@ -954,15 +906,8 @@ static QString winIso639LangName(LCID id) return result; // not one of the problematic languages - do the usual lookup - QT_WA({ - TCHAR out[256]; - if (GetLocaleInfoW(id, LOCALE_SISO639LANGNAME , out, 255)) - result = QString::fromUtf16((ushort*)out); - } , { - char out[256]; - if (GetLocaleInfoA(id, LOCALE_SISO639LANGNAME, out, 255)) - result = QString::fromLocal8Bit(out); - }); + if (GetLocaleInfo(id, LOCALE_SISO639LANGNAME , out, 255)) + result = QString::fromWCharArray(out); return result; } @@ -971,15 +916,9 @@ static QString winIso3116CtryName(LCID id) { QString result; - QT_WA({ - TCHAR out[256]; - if (GetLocaleInfoW(id, LOCALE_SISO3166CTRYNAME, out, 255)) - result = QString::fromUtf16((ushort*)out); - } , { - char out[256]; - if (GetLocaleInfoA(id, LOCALE_SISO3166CTRYNAME, out, 255)) - result = QString::fromLocal8Bit(out); - }); + wchar_t out[256]; + if (GetLocaleInfo(id, LOCALE_SISO3166CTRYNAME, out, 255)) + result = QString::fromWCharArray(out); return result; } @@ -2689,7 +2628,7 @@ static QString timeZone() DWORD res = GetTimeZoneInformation(&info); if (res == TIME_ZONE_ID_UNKNOWN) return QString(); - return QString::fromUtf16(reinterpret_cast (info.StandardName)); + return QString::fromWCharArray(info.StandardName); #elif defined(Q_OS_WIN) _tzset(); # if defined(_MSC_VER) && _MSC_VER >= 1400 diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 71482f5..b160b90 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3714,13 +3714,13 @@ QByteArray qt_winQString2MB(const QChar *ch, int uclen) BOOL used_def; QByteArray mb(4096, 0); int len; - while (!(len=WideCharToMultiByte(CP_ACP, 0, (const WCHAR*)ch, uclen, + while (!(len=WideCharToMultiByte(CP_ACP, 0, (const wchar_t*)ch, uclen, mb.data(), mb.size()-1, 0, &used_def))) { int r = GetLastError(); if (r == ERROR_INSUFFICIENT_BUFFER) { mb.resize(1+WideCharToMultiByte(CP_ACP, 0, - (const WCHAR*)ch, uclen, + (const wchar_t*)ch, uclen, 0, 0, 0, &used_def)); // and try again... } else { @@ -3741,9 +3741,9 @@ QString qt_winMB2QString(const char *mb, int mblen) if (!mb || !mblen) return QString(); const int wclen_auto = 4096; - WCHAR wc_auto[wclen_auto]; + wchar_t wc_auto[wclen_auto]; int wclen = wclen_auto; - WCHAR *wc = wc_auto; + wchar_t *wc = wc_auto; int len; while (!(len=MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mb, mblen, wc, wclen))) @@ -3756,7 +3756,7 @@ QString qt_winMB2QString(const char *mb, int mblen) } else { wclen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mb, mblen, 0, 0); - wc = new WCHAR[wclen]; + wc = new wchar_t[wclen]; // and try again... } } else { @@ -3799,11 +3799,6 @@ QString QString::fromLocal8Bit(const char *str, int size) return QString(); if (size == 0 || (!*str && size < 0)) return QLatin1String(""); -#if defined(Q_OS_WIN32) - if(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - return qt_winMB2QString(str, size); - } -#endif #if !defined(QT_NO_TEXTCODEC) if (size < 0) size = qstrlen(str); @@ -4697,16 +4692,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, return ucstrcmp(data1, length1, data2, length2); #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) - int res; - QT_WA({ - const TCHAR* s1 = (TCHAR*)data1; - const TCHAR* s2 = (TCHAR*)data2; - res = CompareStringW(GetUserDefaultLCID(), 0, s1, length1, s2, length2); - } , { - QByteArray s1 = toLocal8Bit_helper(data1, length1); - QByteArray s2 = toLocal8Bit_helper(data2, length2); - res = CompareStringA(GetUserDefaultLCID(), 0, s1.data(), s1.length(), s2.data(), s2.length()); - }); + int res = CompareString(GetUserDefaultLCID(), 0, (wchar_t*)data1, length1, (wchar_t*)data2, length2); switch (res) { case CSTR_LESS_THAN: -- cgit v0.12 From cfadf08a6c06ce319f6144e724f45e4923e72778 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 1 Jul 2009 11:49:51 +0200 Subject: Handle application paths larger than MAX_PATH, and fix potential buffer overflow These days we can easily get very long paths, so we should support application paths as long as needed. There was also a potention exploit in that if the path was MAX_PATH or larger, the string would not be \0 terminated (see MSDN docs for GetModuleFileName), and thus cause problems in QString::fromWCharArray(). Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/corelib/kernel/qcoreapplication.cpp | 9 ++----- src/corelib/kernel/qcoreapplication_win.cpp | 40 ++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index f0a3fec..e2708c3 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1741,13 +1741,8 @@ QString QCoreApplication::applicationFilePath() if (!d->cachedApplicationFilePath.isNull()) return d->cachedApplicationFilePath; -#if defined( Q_WS_WIN ) - wchar_t module_name[MAX_PATH]; - GetModuleFileName(0, module_name, MAX_PATH); - module_name[MAX_PATH] = 0; - QFileInfo filePath = QString::fromWCharArray(module_name); - - d->cachedApplicationFilePath = filePath.filePath(); +#if defined(Q_WS_WIN) + d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath(); return d->cachedApplicationFilePath; #elif defined(Q_WS_MAC) QString qAppFileName_str = qAppFileName(); diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 657abd1..a71f284 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -76,9 +76,43 @@ Q_CORE_EXPORT int qWinAppCmdShow() // get main window sho Q_CORE_EXPORT QString qAppFileName() // get application file name { - wchar_t buffer[MAX_PATH]; - GetModuleFileName(0, buffer, MAX_PATH); - return QString::fromWCharArray(buffer); + // We do MAX_PATH + 2 here, and request with MAX_PATH + 1, so we can handle all paths + // up to, and including MAX_PATH size perfectly fine with string termination, as well + // as easily detect if the file path is indeed larger than MAX_PATH, in which case we + // need to use the heap instead. This is a work-around, since contrary to what the + // MSDN documentation states, GetModuleFileName sometimes doesn't set the + // ERROR_INSUFFICIENT_BUFFER error number, and we thus cannot rely on this value if + // GetModuleFileName(0, buffer, MAX_PATH) == MAX_PATH. + // GetModuleFileName(0, buffer, MAX_PATH + 1) == MAX_PATH just means we hit the normal + // file path limit, and we handle it normally, if the result is MAX_PATH + 1, we use + // heap (even if the result _might_ be exactly MAX_PATH + 1, but that's ok). + wchar_t buffer[MAX_PATH + 2]; + DWORD v = GetModuleFileName(0, buffer, MAX_PATH + 1); + buffer[MAX_PATH + 1] = 0; + + if (v == 0) + return QString(); + else if (v <= MAX_PATH) + return QString::fromWCharArray(buffer); + + // MAX_PATH sized buffer wasn't large enough to contain the full path, use heap + wchar_t *b = 0; + int i = 1; + size_t size; + do { + ++i; + size = MAX_PATH * i; + b = reinterpret_cast(realloc(b, (size + 1) * sizeof(wchar_t))); + if (b) + v = GetModuleFileName(NULL, b, size); + } while (b && v == size); + + if (b) + *(b + size) = 0; + QString res = QString::fromWCharArray(b); + free(b); + + return res; } void set_winapp_name() -- cgit v0.12 From 55137901012db28857fe7638e63c78743e277c56 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:49:54 +0200 Subject: src/gui: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also - Make winPeekMessage() & winPostMessage() obsolete - FlashWindowEx, IsValidLanguageGroup functions no longer resolved dynamically (available on >= Windows 2000) - LoadIcon/LoadCursor -> LoadImage w/LR_SHARED for system icons/cursors - qsystemtrayicon_win: use Shell_NotifyIconGetRect if available (Windows 7) Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/corelib/global/qt_windows.h | 21 +- src/corelib/kernel/qeventdispatcher_win.cpp | 2 +- src/gui/accessible/qaccessible_win.cpp | 32 +- src/gui/dialogs/qdialog.cpp | 3 +- src/gui/dialogs/qfiledialog_p.h | 3 +- src/gui/dialogs/qfiledialog_win.cpp | 456 +++++-------------- src/gui/dialogs/qfilesystemmodel.cpp | 20 +- src/gui/dialogs/qpagesetupdialog_win.cpp | 3 +- src/gui/dialogs/qprintdialog_win.cpp | 76 +--- src/gui/dialogs/qwizard.cpp | 14 +- src/gui/image/qpixmap_win.cpp | 12 +- src/gui/inputmethod/qwininputcontext_win.cpp | 116 ++--- src/gui/itemviews/qfileiconprovider.cpp | 12 +- src/gui/kernel/qapplication.cpp | 18 +- src/gui/kernel/qapplication_win.cpp | 409 +++++------------ src/gui/kernel/qclipboard_win.cpp | 10 +- src/gui/kernel/qcursor_win.cpp | 44 +- src/gui/kernel/qdesktopwidget_win.cpp | 121 ++--- src/gui/kernel/qdnd_win.cpp | 75 ++-- src/gui/kernel/qguifunctions_wince.cpp | 24 +- src/gui/kernel/qguifunctions_wince.h | 8 +- src/gui/kernel/qkeymapper_win.cpp | 120 +---- src/gui/kernel/qmime_win.cpp | 146 +++--- src/gui/kernel/qsound_win.cpp | 40 +- src/gui/kernel/qwhatsthis.cpp | 8 +- src/gui/kernel/qwidget.cpp | 8 +- src/gui/kernel/qwidget_win.cpp | 127 ++---- src/gui/kernel/qwidget_wince.cpp | 46 +- src/gui/painting/qpdf.cpp | 2 +- src/gui/painting/qprintengine_pdf.cpp | 2 +- src/gui/painting/qprintengine_win.cpp | 646 +++++++++------------------ src/gui/painting/qprintengine_win_p.h | 16 +- src/gui/painting/qprinterinfo_win.cpp | 98 ++-- src/gui/painting/qregion.cpp | 4 - src/gui/painting/qwindowsurface_raster.cpp | 24 +- src/gui/painting/qwindowsurface_raster_p.h | 13 +- src/gui/styles/qwindowsstyle.cpp | 115 ++--- src/gui/styles/qwindowsvistastyle.cpp | 4 +- src/gui/styles/qwindowsxpstyle.cpp | 9 +- src/gui/text/qfont_win.cpp | 8 +- src/gui/text/qfontdatabase_win.cpp | 259 +++-------- src/gui/text/qfontengine_win.cpp | 440 ++++-------------- src/gui/text/qfontengine_win_p.h | 18 +- src/gui/util/qdesktopservices_win.cpp | 28 +- src/gui/util/qsystemtrayicon_win.cpp | 323 ++++---------- src/gui/widgets/qeffects.cpp | 97 ++-- src/gui/widgets/qframe.cpp | 2 +- src/gui/widgets/qmdisubwindow.cpp | 35 +- src/gui/widgets/qsizegrip.cpp | 3 +- src/gui/widgets/qworkspace.cpp | 26 +- 50 files changed, 1227 insertions(+), 2919 deletions(-) diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index 5df57e5..27c06e5 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -60,7 +60,6 @@ #endif // already defined when compiled with WINVER >= 0x0500 -// and we only use them in Qt::WV_2000 and Qt::WV_98 #ifndef SPI_SETMENUANIMATION #define SPI_SETMENUANIMATION 0x1003 #endif @@ -113,4 +112,24 @@ #define ETO_PDY 0x2000 #endif +// already defined when compiled with WINVER >= 0x0600 +#ifndef SPI_GETFLATMENU +#define SPI_GETFLATMENU 0x1022 +#endif +#ifndef CS_DROPSHADOW +#define CS_DROPSHADOW 0x00020000 +#endif +#ifndef CLEARTYPE_QUALITY +#define CLEARTYPE_QUALITY 5 +#endif + +#ifdef Q_WS_WINCE +#ifndef LR_DEFAULTSIZE +#define LR_DEFAULTSIZE 0 +#endif +#ifndef LR_SHARED +#define LR_SHARED 0 +#endif +#endif // Q_WS_WINCE + #endif // QT_WINDOWS_H diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 23e4fa9..33b66f5 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -495,7 +495,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher) { // make sure that multiple Qt's can coexist in the same process - QString className = QLatin1Strign("QEventDispatcherWin32_Internal_Widget") + QString::number(quintptr(qt_internal_proc)); + QString className = QLatin1String("QEventDispatcherWin32_Internal_Widget") + QString::number(quintptr(qt_internal_proc)); WNDCLASS wc; wc.style = 0; diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp index ccb2673..bfacb94 100644 --- a/src/gui/accessible/qaccessible_win.cpp +++ b/src/gui/accessible/qaccessible_win.cpp @@ -177,14 +177,14 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) return; } - QByteArray soundName; + QString soundName; switch (reason) { case PopupMenuStart: - soundName = "MenuPopup"; + soundName = QLatin1String("MenuPopup"); break; case MenuCommand: - soundName = "MenuCommand"; + soundName = QLatin1String("MenuCommand"); break; case Alert: @@ -194,13 +194,13 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) if (mb) { switch (mb->icon()) { case QMessageBox::Warning: - soundName = "SystemExclamation"; + soundName = QLatin1String("SystemExclamation"); break; case QMessageBox::Critical: - soundName = "SystemHand"; + soundName = QLatin1String("SystemHand"); break; case QMessageBox::Information: - soundName = "SystemAsterisk"; + soundName = QLatin1String("SystemAsterisk"); break; default: break; @@ -208,7 +208,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) } else #endif // QT_NO_MESSAGEBOX { - soundName = "SystemAsterisk"; + soundName = QLatin1String("SystemAsterisk"); } } @@ -219,20 +219,16 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) if (soundName.size()) { #ifndef QT_NO_SETTINGS - QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") + - QString::fromLatin1(soundName.constData()), QSettings::NativeFormat); + QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") + soundName, + QSettings::NativeFormat); QString file = settings.value(QLatin1String(".Current/.")).toString(); #else - QString file; + QString file; #endif - if (!file.isEmpty()) { - QT_WA({ - PlaySoundW(reinterpret_cast (QString::fromLatin1(soundName).utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT ); - } , { - PlaySoundA(soundName.constData(), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT ); - }); - } - } + if (!file.isEmpty()) { + PlaySound(reinterpret_cast(soundName.utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT); + } + } if (!isActive()) return; diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 0288cd9..bb6c6d6 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -762,8 +762,7 @@ void QDialog::setVisible(bool visible) #ifdef Q_WS_WIN if (d->mainDef && isActiveWindow()) { BOOL snapToDefault = false; - if ( QT_WA_INLINE( SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, &snapToDefault, 0) , - SystemParametersInfoA(SPI_GETSNAPTODEFBUTTON, 0, &snapToDefault, 0) )) { + if (SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, &snapToDefault, 0)) { if (snapToDefault) QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center())); } diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 654b3bb..d798f9d 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -187,8 +187,7 @@ public: #ifndef Q_OS_WINCE DWORD maxLength; QString drive = path.left(3); - if (QT_WA_INLINE(::GetVolumeInformationW(reinterpret_cast(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0), - ::GetVolumeInformationA(drive.toLocal8Bit().constData(), NULL, 0, NULL, &maxLength, NULL, NULL, 0)) == FALSE) + if (::GetVolumeInformation(reinterpret_cast(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE) return -1; return maxLength; #else diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 4cb31f5..6883bf9 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -70,8 +70,8 @@ typedef struct qt_priv_browseinfo { HWND hwndOwner; LPCITEMIDLIST pidlRoot; - LPTSTR pszDisplayName; - LPCTSTR lpszTitle; + LPWSTR pszDisplayName; + LPCWSTR lpszTitle; UINT ulFlags; BFFCALLBACK lpfn; LPARAM lParam; @@ -90,6 +90,9 @@ typedef LPITEMIDLIST (WINAPI *PtrSHBrowseForFolder)(BROWSEINFO*); static PtrSHBrowseForFolder ptrSHBrowseForFolder = 0; typedef BOOL (WINAPI *PtrSHGetPathFromIDList)(LPITEMIDLIST,LPWSTR); static PtrSHGetPathFromIDList ptrSHGetPathFromIDList = 0; +typedef HRESULT (WINAPI *PtrSHGetMalloc)(LPMALLOC *); +static PtrSHGetMalloc ptrSHGetMalloc = 0; + QT_BEGIN_NAMESPACE @@ -111,20 +114,20 @@ static void qt_win_resolve_libs() #endif triedResolve = true; - if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) { #if !defined(Q_WS_WINCE) - QLibrary lib(QLatin1String("shell32")); - ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW"); - ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW"); + QLibrary lib(QLatin1String("shell32")); + ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW"); + ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW"); + ptrSHGetMalloc = (PtrSHGetMalloc) lib.resolve("SHGetMalloc"); #else - // CE stores them in a different lib and does not use unicode version - HINSTANCE handle = LoadLibraryW(L"Ceshell"); - ptrSHBrowseForFolder = (PtrSHBrowseForFolder)GetProcAddress(handle, L"SHBrowseForFolder"); - ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)GetProcAddress(handle, L"SHGetPathFromIDList"); - if (ptrSHBrowseForFolder && ptrSHGetPathFromIDList) - qt_priv_ptr_valid = true; + // CE stores them in a different lib and does not use unicode version + HINSTANCE handle = LoadLibraryW(L"Ceshell"); + ptrSHBrowseForFolder = (PtrSHBrowseForFolder)GetProcAddress(handle, L"SHBrowseForFolder"); + ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)GetProcAddress(handle, L"SHGetPathFromIDList"); + ptrSHGetMalloc = (PtrSHGetMalloc)GetProcAddress(handle, L"SHGetMalloc"); + if (ptrSHBrowseForFolder && ptrSHGetPathFromIDList && ptrSHGetMalloc) + qt_priv_ptr_valid = true; #endif - } } } @@ -186,95 +189,15 @@ static QString qt_win_selected_filter(const QString &filter, DWORD idx) return qt_win_make_filters_list(filter).at((int)idx - 1); } -#ifndef Q_WS_WINCE -// Static vars for OFNA funcs: -static QByteArray aInitDir; -static QByteArray aInitSel; -static QByteArray aTitle; -static QByteArray aFilter; -// Use ANSI strings and API - -// If you change this, then make sure you change qt_win_make_OFN (below) too -static OPENFILENAMEA *qt_win_make_OFNA(QWidget *parent, - const QString &initialSelection, - const QString &initialDirectory, - const QString &title, - const QString &filters, - QFileDialog::FileMode mode, - QFileDialog::Options options) -{ - if (parent) - parent = parent->window(); - else - parent = QApplication::activeWindow(); - - aTitle = title.toLocal8Bit(); - aInitDir = QDir::toNativeSeparators(initialDirectory).toLocal8Bit(); - if (initialSelection.isEmpty()) { - aInitSel = ""; - } else { - aInitSel = QDir::toNativeSeparators(initialSelection).toLocal8Bit(); - aInitSel.replace('<', ""); - aInitSel.replace('>', ""); - aInitSel.replace('\"', ""); - aInitSel.replace('|', ""); - } - int maxLen = mode == QFileDialog::ExistingFiles ? maxMultiLen : maxNameLen; - aInitSel.resize(maxLen + 1); // make room for return value - aFilter = filters.toLocal8Bit(); - - OPENFILENAMEA* ofn = new OPENFILENAMEA; - memset(ofn, 0, sizeof(OPENFILENAMEA)); - -#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500) - // according to the MSDN, this should also be necessary for MSVC, but - // OPENFILENAME_SIZE_VERSION_400A is in not Microsoft header, as it seems - if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) { - ofn->lStructSize = OPENFILENAME_SIZE_VERSION_400A; - } else { - ofn->lStructSize = sizeof(OPENFILENAMEA); - } -#else - ofn->lStructSize = sizeof(OPENFILENAMEA); -#endif - Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); - ofn->hwndOwner = parent ? parent->winId() : 0; - ofn->lpstrFilter = aFilter; - ofn->lpstrFile = aInitSel.data(); - ofn->nMaxFile = maxLen; - ofn->lpstrInitialDir = aInitDir.data(); - ofn->lpstrTitle = aTitle.data(); - ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER); - - if (mode == QFileDialog::ExistingFile || - mode == QFileDialog::ExistingFiles) - ofn->Flags |= (OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST); - if (mode == QFileDialog::ExistingFiles) - ofn->Flags |= (OFN_ALLOWMULTISELECT); - if (!(options & QFileDialog::DontConfirmOverwrite)) - ofn->Flags |= OFN_OVERWRITEPROMPT; - - return ofn; -} - -static void qt_win_clean_up_OFNA(OPENFILENAMEA **ofn) -{ - delete *ofn; - *ofn = 0; -} -#endif - static QString tFilters, tTitle, tInitDir; -#ifdef UNICODE -// If you change this, then make sure you change qt_win_make_OFNA (above) too static OPENFILENAME* qt_win_make_OFN(QWidget *parent, const QString& initialSelection, const QString& initialDirectory, const QString& title, const QString& filters, QFileDialog::FileMode mode, - QFileDialog::Options options) + QFileDialog::Options options) { if (parent) parent = parent->window(); @@ -286,14 +209,14 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent, tTitle = title; QString initSel = QDir::toNativeSeparators(initialSelection); if (!initSel.isEmpty()) { - initSel.remove(QLatin1Char('<')); - initSel.remove(QLatin1Char('>')); - initSel.remove(QLatin1Char('\"')); - initSel.remove(QLatin1Char('|')); + initSel.remove(QLatin1Char('<')); + initSel.remove(QLatin1Char('>')); + initSel.remove(QLatin1Char('\"')); + initSel.remove(QLatin1Char('|')); } int maxLen = mode == QFileDialog::ExistingFiles ? maxMultiLen : maxNameLen; - TCHAR *tInitSel = new TCHAR[maxLen+1]; + wchar_t *tInitSel = new wchar_t[maxLen + 1]; if (initSel.length() > 0 && initSel.length() <= maxLen) memcpy(tInitSel, initSel.utf16(), (initSel.length()+1)*sizeof(QChar)); else @@ -302,24 +225,14 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent, OPENFILENAME* ofn = new OPENFILENAME; memset(ofn, 0, sizeof(OPENFILENAME)); -#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500) - // according to the MSDN, this should also be necessary for MSVC, but - // OPENFILENAME_SIZE_VERSION_400 is in not Microsoft header, as it seems - if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) { - ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400; - } else { - ofn->lStructSize = sizeof(OPENFILENAME); - } -#else ofn->lStructSize = sizeof(OPENFILENAME); -#endif Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); ofn->hwndOwner = parent ? parent->winId() : 0; - ofn->lpstrFilter = (TCHAR *)tFilters.utf16(); + ofn->lpstrFilter = (wchar_t*)tFilters.utf16(); ofn->lpstrFile = tInitSel; ofn->nMaxFile = maxLen; - ofn->lpstrInitialDir = (TCHAR *)tInitDir.utf16(); - ofn->lpstrTitle = (TCHAR *)tTitle.utf16(); + ofn->lpstrInitialDir = (wchar_t*)tInitDir.utf16(); + ofn->lpstrTitle = (wchar_t*)tTitle.utf16(); ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER); if (mode == QFileDialog::ExistingFile || mode == QFileDialog::ExistingFiles) @@ -332,7 +245,6 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent, return ofn; } - static void qt_win_clean_up_OFN(OPENFILENAME **ofn) { delete [] (*ofn)->lpstrFile; @@ -340,8 +252,6 @@ static void qt_win_clean_up_OFN(OPENFILENAME **ofn) *ofn = 0; } -#endif // UNICODE - extern void qt_win_eatMouseMove(); QString qt_win_get_open_file_name(const QFileDialogArgs &args, @@ -377,35 +287,20 @@ QString qt_win_get_open_file_name(const QFileDialogArgs &args, modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); modal_widget.setParent(args.parent, Qt::Window); QApplicationPrivate::enterModal(&modal_widget); - QT_WA({ - // Use Unicode strings and API - OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection, - args.directory, args.caption, - qt_win_filter(args.filter), - QFileDialog::ExistingFile, - args.options); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileName(ofn)) { - result = QString::fromUtf16((ushort*)ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - qt_win_clean_up_OFN(&ofn); - } , { - // Use ANSI strings and API - OPENFILENAMEA* ofn = qt_win_make_OFNA(args.parent, args.selection, - args.directory, args.caption, - qt_win_filter(args.filter), - QFileDialog::ExistingFile, - args.options); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileNameA(ofn)) { - result = QString::fromLocal8Bit(ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - qt_win_clean_up_OFNA(&ofn); - }); + + OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection, + args.directory, args.caption, + qt_win_filter(args.filter), + QFileDialog::ExistingFile, + args.options); + if (idx) + ofn->nFilterIndex = idx + 1; + if (GetOpenFileName(ofn)) { + result = QString::fromWCharArray(ofn->lpstrFile); + selFilIdx = ofn->nFilterIndex; + } + qt_win_clean_up_OFN(&ofn); + QApplicationPrivate::leaveModal(&modal_widget); qt_win_eatMouseMove(); @@ -422,7 +317,7 @@ QString qt_win_get_open_file_name(const QFileDialogArgs &args, QString qt_win_get_save_file_name(const QFileDialogArgs &args, QString *initialDirectory, - QString *selectedFilter) + QString *selectedFilter) { QString result; @@ -470,41 +365,22 @@ QString qt_win_get_save_file_name(const QFileDialogArgs &args, } } - QT_WA({ - // Use Unicode strings and API - OPENFILENAME *ofn = qt_win_make_OFN(args.parent, args.selection, - args.directory, args.caption, - qt_win_filter(args.filter), - QFileDialog::AnyFile, - args.options); - - ofn->lpstrDefExt = (TCHAR *)defaultSaveExt.utf16(); - - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetSaveFileName(ofn)) { - result = QString::fromUtf16((ushort*)ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - qt_win_clean_up_OFN(&ofn); - } , { - // Use ANSI strings and API - OPENFILENAMEA *ofn = qt_win_make_OFNA(args.parent, args.selection, - args.directory, args.caption, - qt_win_filter(args.filter), - QFileDialog::AnyFile, - args.options); - QByteArray asciiExt = defaultSaveExt.toAscii(); - ofn->lpstrDefExt = asciiExt.data(); - - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetSaveFileNameA(ofn)) { - result = QString::fromLocal8Bit(ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - qt_win_clean_up_OFNA(&ofn); - }); + OPENFILENAME *ofn = qt_win_make_OFN(args.parent, args.selection, + args.directory, args.caption, + qt_win_filter(args.filter), + QFileDialog::AnyFile, + args.options); + + ofn->lpstrDefExt = (wchar_t*)defaultSaveExt.utf16(); + + if (idx) + ofn->nFilterIndex = idx + 1; + if (GetSaveFileName(ofn)) { + result = QString::fromWCharArray(ofn->lpstrFile); + selFilIdx = ofn->nFilterIndex; + } + qt_win_clean_up_OFN(&ofn); + #if defined(Q_WS_WINCE) int semIndex = result.indexOf(QLatin1Char(';')); if (semIndex >= 0) @@ -558,73 +434,40 @@ QStringList qt_win_get_open_file_names(const QFileDialogArgs &args, modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); modal_widget.setParent(args.parent, Qt::Window); QApplicationPrivate::enterModal(&modal_widget); - QT_WA({ - OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection, - args.directory, args.caption, - qt_win_filter(args.filter), - QFileDialog::ExistingFiles, - args.options); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileName(ofn)) { - QString fileOrDir = QString::fromUtf16((ushort*)ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - int offset = fileOrDir.length() + 1; - if (ofn->lpstrFile[offset] == 0) { - // Only one file selected; has full path - fi.setFile(fileOrDir); - QString res = fi.absoluteFilePath(); - if (!res.isEmpty()) - result.append(res); - } - else { - // Several files selected; first string is path - dir.setPath(fileOrDir); - QString f; - while(!(f = QString::fromUtf16((ushort*)ofn->lpstrFile+offset)).isEmpty()) { - fi.setFile(dir, f); - QString res = fi.absoluteFilePath(); - if (!res.isEmpty()) - result.append(res); - offset += f.length() + 1; - } - } + + OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection, + args.directory, args.caption, + qt_win_filter(args.filter), + QFileDialog::ExistingFiles, + args.options); + if (idx) + ofn->nFilterIndex = idx + 1; + if (GetOpenFileName(ofn)) { + QString fileOrDir = QString::fromWCharArray(ofn->lpstrFile); + selFilIdx = ofn->nFilterIndex; + int offset = fileOrDir.length() + 1; + if (ofn->lpstrFile[offset] == 0) { + // Only one file selected; has full path + fi.setFile(fileOrDir); + QString res = fi.absoluteFilePath(); + if (!res.isEmpty()) + result.append(res); } - qt_win_clean_up_OFN(&ofn); - } , { - OPENFILENAMEA* ofn = qt_win_make_OFNA(args.parent, args.selection, - args.directory, args.caption, - qt_win_filter(args.filter), - QFileDialog::ExistingFiles, - args.options); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileNameA(ofn)) { - QByteArray fileOrDir(ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - int offset = fileOrDir.length() + 1; - if (ofn->lpstrFile[offset] == '\0') { - // Only one file selected; has full path - fi.setFile(QString::fromLocal8Bit(fileOrDir)); + else { + // Several files selected; first string is path + dir.setPath(fileOrDir); + QString f; + while(!(f = QString::fromWCharArray(ofn->lpstrFile + offset)).isEmpty()) { + fi.setFile(dir, f); QString res = fi.absoluteFilePath(); if (!res.isEmpty()) result.append(res); + offset += f.length() + 1; } - else { - // Several files selected; first string is path - dir.setPath(QString::fromLocal8Bit(fileOrDir)); - QByteArray f; - while (!(f = QByteArray(ofn->lpstrFile + offset)).isEmpty()) { - fi.setFile(dir, QString::fromLocal8Bit(f)); - QString res = fi.absoluteFilePath(); - if (!res.isEmpty()) - result.append(res); - offset += f.length() + 1; - } - } - qt_win_clean_up_OFNA(&ofn); } - }); + } + qt_win_clean_up_OFN(&ofn); + QApplicationPrivate::leaveModal(&modal_widget); qt_win_eatMouseMove(); @@ -647,34 +490,20 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd, if (uMsg == BFFM_INITIALIZED && lpData != 0) { QString *initDir = (QString *)(lpData); if (!initDir->isEmpty()) { - // ### Lars asks: is this correct for the A version???? - QT_WA({ - SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initDir->utf16())); - } , { - SendMessageA(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initDir->utf16())); - }); + SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initDir->utf16())); } } else if (uMsg == BFFM_SELCHANGED) { - QT_WA({ - qt_win_resolve_libs(); - TCHAR path[MAX_PATH]; + qt_win_resolve_libs(); + if (ptrSHGetPathFromIDList) { + wchar_t path[MAX_PATH]; ptrSHGetPathFromIDList(LPITEMIDLIST(lParam), path); - QString tmpStr = QString::fromUtf16((ushort*)path); + QString tmpStr = QString::fromWCharArray(path); if (!tmpStr.isEmpty()) SendMessage(hwnd, BFFM_ENABLEOK, 1, 1); else SendMessage(hwnd, BFFM_ENABLEOK, 0, 0); SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, LPARAM(path)); - } , { - char path[MAX_PATH]; - SHGetPathFromIDListA(LPITEMIDLIST(lParam), path); - QString tmpStr = QString::fromLocal8Bit(path); - if (!tmpStr.isEmpty()) - SendMessageA(hwnd, BFFM_ENABLEOK, 1, 1); - else - SendMessageA(hwnd, BFFM_ENABLEOK, 0, 0); - SendMessageA(hwnd, BFFM_SETSTATUSTEXT, 1, LPARAM(path)); - }); + } } return 0; } @@ -700,116 +529,49 @@ QString qt_win_get_existing_directory(const QFileDialogArgs &args) modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); modal_widget.setParent(parent, Qt::Window); QApplicationPrivate::enterModal(&modal_widget); -#if !defined(Q_WS_WINCE) - QT_WA({ - qt_win_resolve_libs(); - QString initDir = QDir::toNativeSeparators(args.directory); - TCHAR path[MAX_PATH]; - TCHAR initPath[MAX_PATH]; - initPath[0] = 0; - path[0] = 0; - tTitle = args.caption; - BROWSEINFO bi; - Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); - bi.hwndOwner = (parent ? parent->winId() : 0); - bi.pidlRoot = NULL; - //### This does not seem to be respected? - the dialog always displays "Browse for folder" - bi.lpszTitle = (TCHAR*)tTitle.utf16(); - bi.pszDisplayName = initPath; - bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; - bi.lpfn = winGetExistDirCallbackProc; - bi.lParam = LPARAM(&initDir); - if (ptrSHBrowseForFolder) { - LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder(&bi); - if (pItemIDList && ptrSHGetPathFromIDList) { - ptrSHGetPathFromIDList(pItemIDList, path); - IMalloc *pMalloc; - if (SHGetMalloc(&pMalloc) != NOERROR) - result = QString(); - else { - pMalloc->Free(pItemIDList); - pMalloc->Release(); - result = QString::fromUtf16((ushort*)path); - } - } else - result = QString(); - } - tTitle = QString(); - } , { - QString initDir = QDir::toNativeSeparators(args.directory); - char path[MAX_PATH]; - char initPath[MAX_PATH]; - QByteArray ctitle = args.caption.toLocal8Bit(); - initPath[0]=0; - path[0]=0; - BROWSEINFOA bi; - Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); - bi.hwndOwner = (parent ? parent->winId() : 0); - bi.pidlRoot = NULL; - bi.lpszTitle = ctitle; - bi.pszDisplayName = initPath; - bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; - bi.lpfn = winGetExistDirCallbackProc; - bi.lParam = LPARAM(&initDir); - LPITEMIDLIST pItemIDList = SHBrowseForFolderA(&bi); - if (pItemIDList) { - SHGetPathFromIDListA(pItemIDList, path); - IMalloc *pMalloc; - if (SHGetMalloc(&pMalloc) != NOERROR) - result = QString(); - else { - pMalloc->Free(pItemIDList); - pMalloc->Release(); - result = QString::fromLocal8Bit(path); - } - } else - result = QString(); - }); -#else - qt_win_resolve_libs(); + QString initDir = QDir::toNativeSeparators(args.directory); - TCHAR path[MAX_PATH]; - TCHAR initPath[MAX_PATH]; - memset(initPath, 0 , MAX_PATH*sizeof(TCHAR)); - memset(path, 0, MAX_PATH*sizeof(TCHAR)); + wchar_t path[MAX_PATH]; + wchar_t initPath[MAX_PATH]; + initPath[0] = 0; + path[0] = 0; tTitle = args.caption; + +#if !defined(Q_WS_WINCE) + BROWSEINFO bi; +#else qt_BROWSEINFO bi; +#endif + Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); bi.hwndOwner = (parent ? parent->winId() : 0); bi.pidlRoot = NULL; - bi.lpszTitle = (TCHAR*)tTitle.utf16(); + //### This does not seem to be respected? - the dialog always displays "Browse for folder" + bi.lpszTitle = (wchar_t*)tTitle.utf16(); bi.pszDisplayName = initPath; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; bi.lpfn = winGetExistDirCallbackProc; bi.lParam = LPARAM(&initDir); + + qt_win_resolve_libs(); if (ptrSHBrowseForFolder) { LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder((BROWSEINFO*)&bi); - if (pItemIDList && ptrSHGetPathFromIDList) { + if (pItemIDList) { ptrSHGetPathFromIDList(pItemIDList, path); IMalloc *pMalloc; - if (SHGetMalloc(&pMalloc) != NOERROR) - result = QString(); - else { + if (ptrSHGetMalloc(&pMalloc) == NOERROR) { pMalloc->Free(pItemIDList); pMalloc->Release(); - result = QString::fromUtf16((ushort*)path); + result = QString::fromWCharArray(path); } - } else - result = QString(); + } } tTitle = QString(); -#endif QApplicationPrivate::leaveModal(&modal_widget); qt_win_eatMouseMove(); - // Due to a bug on Windows Me, we need to reset the current - // directory - if ((QSysInfo::WindowsVersion == QSysInfo::WV_98 || QSysInfo::WindowsVersion == QSysInfo::WV_Me) - && QDir::currentPath() != currentDir) - QDir::setCurrent(currentDir); - if (!result.isEmpty()) result.replace(QLatin1Char('\\'), QLatin1Char('/')); return result; diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 347a084..e523ec3 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -296,22 +296,14 @@ static QString qt_GetLongPathName(const QString &strShortPath) #else QString longSection = QDir::toNativeSeparators(section); #endif - QT_WA({ - WIN32_FIND_DATAW findData; - h = ::FindFirstFileW((wchar_t *)longSection.utf16(), &findData); - if (h != INVALID_HANDLE_VALUE) - longPath.append(QString::fromUtf16((ushort*)findData.cFileName)); - } , { - WIN32_FIND_DATAA findData; - h = ::FindFirstFileA(section.toLocal8Bit(), &findData); - if (h != INVALID_HANDLE_VALUE) - longPath.append(QString::fromLocal8Bit(findData.cFileName)); - }); - if (h == INVALID_HANDLE_VALUE) { + WIN32_FIND_DATA findData; + h = ::FindFirstFile((wchar_t*)longSection.utf16(), &findData); + if (h != INVALID_HANDLE_VALUE) { + longPath.append(QString::fromWCharArray(findData.cFileName)); + ::FindClose(h); + } else { longPath.append(section); break; - } else { - ::FindClose(h); } } if (it != constEnd) diff --git a/src/gui/dialogs/qpagesetupdialog_win.cpp b/src/gui/dialogs/qpagesetupdialog_win.cpp index 136f939..a84a7ce 100644 --- a/src/gui/dialogs/qpagesetupdialog_win.cpp +++ b/src/gui/dialogs/qpagesetupdialog_win.cpp @@ -81,8 +81,7 @@ int QPageSetupDialog::exec() HGLOBAL hDevMode; int devModeSize; if (!ep->globalDevMode) { - QT_WA( { devModeSize = sizeof(DEVMODEW) + ((DEVMODEW *) ep->devMode)->dmDriverExtra; }, - { devModeSize = sizeof(DEVMODEA) + ((DEVMODEA *) ep->devMode)->dmDriverExtra; }); + devModeSize = sizeof(DEVMODE) + ep->devMode->dmDriverExtra; hDevMode = GlobalAlloc(GHND, devModeSize); if (hDevMode) { void *dest = GlobalLock(hDevMode); diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index e89ce90..6022a66 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -77,27 +77,22 @@ public: QWin32PrintEnginePrivate *ep; }; -#ifndef Q_OS_WINCE -// If you change this function, make sure you also change the unicode equivalent -template -static PrintDialog *qt_win_make_PRINTDLG(QWidget *parent, - QPrintDialog *pdlg, - QPrintDialogPrivate *d, HGLOBAL *tempDevNames) +static PRINTDLG* qt_win_make_PRINTDLG(QWidget *parent, + QPrintDialog *pdlg, + QPrintDialogPrivate *d, HGLOBAL *tempDevNames) { - PrintDialog *pd = new PrintDialog; - memset(pd, 0, sizeof(PrintDialog)); - pd->lStructSize = sizeof(PrintDialog); + PRINTDLG *pd = new PRINTDLG; + memset(pd, 0, sizeof(PRINTDLG)); + pd->lStructSize = sizeof(PRINTDLG); - void *devMode = sizeof(DeviceMode) == sizeof(DEVMODEA) - ? (void *) d->ep->devModeA() - : (void *) d->ep->devModeW(); + DEVMODE *devMode = d->ep->devMode; if (devMode) { - int size = sizeof(DeviceMode) + ((DeviceMode *) devMode)->dmDriverExtra; + int size = sizeof(DEVMODE) + devMode->dmDriverExtra; pd->hDevMode = GlobalAlloc(GHND, size); { void *dest = GlobalLock(pd->hDevMode); - memcpy(dest, d->ep->devMode, size); + memcpy(dest, devMode, size); GlobalUnlock(pd->hDevMode); } } else { @@ -140,20 +135,14 @@ static PrintDialog *qt_win_make_PRINTDLG(QWidget *parent, return pd; } -#endif // Q_OS_WINCE -// If you change this function, make sure you also change the ansi equivalent -template -static void qt_win_clean_up_PRINTDLG(T **pd) +static void qt_win_clean_up_PRINTDLG(PRINTDLG **pd) { delete *pd; *pd = 0; } - -// If you change this function, make sure you also change the ansi equivalent -template -static void qt_win_read_back_PRINTDLG(T *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) +static void qt_win_read_back_PRINTDLG(PRINTDLG *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) { if (pd->Flags & PD_SELECTION) { pdlg->setPrintRange(QPrintDialog::Selection); @@ -236,32 +225,18 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() bool result; bool done; - void *pd = QT_WA_INLINE( - (void*)(qt_win_make_PRINTDLG(parent, q, this, tempDevNames)), - (void*)(qt_win_make_PRINTDLG(parent, q, this, tempDevNames)) - ); + PRINTDLG *pd = qt_win_make_PRINTDLG(parent, q, this, tempDevNames); do { done = true; - QT_WA({ - PRINTDLGW *pdw = reinterpret_cast(pd); - result = PrintDlgW(pdw); - if ((pdw->Flags & PD_PAGENUMS) && (pdw->nFromPage > pdw->nToPage)) - done = false; - if (result && pdw->hDC == 0) - result = false; - else if (!result) - done = true; - }, { - PRINTDLGA *pda = reinterpret_cast(pd); - result = PrintDlgA(pda); - if ((pda->Flags & PD_PAGENUMS) && (pda->nFromPage > pda->nToPage)) - done = false; - if (result && pda->hDC == 0) - result = false; - else if (!result) - done = true; - }); + result = PrintDlg(pd); + if ((pd->Flags & PD_PAGENUMS) && (pd->nFromPage > pd->nToPage)) + done = false; + if (result && pd->hDC == 0) + result = false; + else if (!result) + done = true; + if (!done) { QMessageBox::warning(0, QPrintDialog::tr("Print"), QPrintDialog::tr("The 'From' value cannot be greater than the 'To' value."), @@ -275,15 +250,8 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() // write values back... if (result) { - QT_WA({ - PRINTDLGW *pdw = reinterpret_cast(pd); - qt_win_read_back_PRINTDLG(pdw, q, this); - qt_win_clean_up_PRINTDLG(&pdw); - }, { - PRINTDLGA *pda = reinterpret_cast(pd); - qt_win_read_back_PRINTDLG(pda, q, this); - qt_win_clean_up_PRINTDLG(&pda); - }); + qt_win_read_back_PRINTDLG(pd, q, this); + qt_win_clean_up_PRINTDLG(&pd); // update printer validity printer->d_func()->validPrinter = !ep->name.isEmpty(); } diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index 3fdea54..a7dccd8 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -1251,13 +1251,7 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info) extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset(); #endif QSize minimumSize = mainLayout->totalMinimumSize() + QSize(0, extraHeight); - QSize maximumSize; - bool skipMaxSize = false; -#if defined(Q_WS_WIN) - if (QSysInfo::WindowsVersion <= QSysInfo::WV_Me) // ### See Tasks 164078 and 161660 - skipMaxSize = true; -#endif - maximumSize = mainLayout->totalMaximumSize(); + QSize maximumSize = mainLayout->totalMaximumSize(); if (info.header && headerWidget->maximumWidth() != QWIDGETSIZE_MAX) { minimumSize.setWidth(headerWidget->maximumWidth()); maximumSize.setWidth(headerWidget->maximumWidth()); @@ -1276,13 +1270,11 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info) } if (q->maximumWidth() == maximumWidth) { maximumWidth = maximumSize.width(); - if (!skipMaxSize) - q->setMaximumWidth(maximumWidth); + q->setMaximumWidth(maximumWidth); } if (q->maximumHeight() == maximumHeight) { maximumHeight = maximumSize.height(); - if (!skipMaxSize) - q->setMaximumHeight(maximumHeight); + q->setMaximumHeight(maximumHeight); } } diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 2c84ce7..56b53bd 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -179,13 +179,7 @@ QPixmap QPixmap::fromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format) BITMAP bitmap_info; memset(&bitmap_info, 0, sizeof(BITMAP)); - int res; - QT_WA({ - res = GetObjectW(bitmap, sizeof(BITMAP), &bitmap_info); - } , { - res = GetObjectA(bitmap, sizeof(BITMAP), &bitmap_info); - }); - + int res = GetObject(bitmap, sizeof(BITMAP), &bitmap_info); if (!res) { qErrnoWarning("QPixmap::fromWinHBITMAP(), failed to get bitmap info"); return QPixmap(); @@ -417,9 +411,9 @@ QPixmap convertHIconToPixmap( const HICON icon, bool large) QPixmap loadIconFromShell32( int resourceId, int size ) { #ifdef Q_OS_WINCE - HMODULE hmod = LoadLibrary((const wchar_t *) QString::fromLatin1("ceshell.dll").utf16()); + HMODULE hmod = LoadLibrary(L"ceshell.dll"); #else - HMODULE hmod = LoadLibraryA("shell32.dll"); + HMODULE hmod = LoadLibrary(L"shell32.dll"); #endif if( hmod ) { HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size, size, 0); diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp index 3bbde89..741d8da 100644 --- a/src/gui/inputmethod/qwininputcontext_win.cpp +++ b/src/gui/inputmethod/qwininputcontext_win.cpp @@ -45,16 +45,11 @@ #include "qfont.h" #include "qwidget.h" #include "qapplication.h" -#include "qlibrary.h" #include "qevent.h" #include "qtextformat.h" //#define Q_IME_DEBUG -/* Active Input method support on Win95/98/NT */ -#include -#include - #ifdef Q_IME_DEBUG #include "qdebug.h" #endif @@ -218,25 +213,6 @@ static DWORD WM_MSIME_MOUSE = 0; QWinInputContext::QWinInputContext(QObject *parent) : QInputContext(parent), recursionGuard(false) { - if (QSysInfo::WindowsVersion < QSysInfo::WV_2000) { - // try to get the Active IMM COM object on Win95/98/NT, where english versions don't - // support the regular Windows input methods. - if (CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER, - IID_IActiveIMMApp, (LPVOID *)&aimm) != S_OK) { - aimm = 0; - } - if (aimm && (aimm->QueryInterface(IID_IActiveIMMMessagePumpOwner, (LPVOID *)&aimmpump) != S_OK || - aimm->Activate(true) != S_OK)) { - aimm->Release(); - aimm = 0; - if (aimmpump) - aimmpump->Release(); - aimmpump = 0; - } - if (aimmpump) - aimmpump->Start(); - } - #ifndef Q_WS_WINCE QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); if (ver & QSysInfo::WV_NT_based && ver >= QSysInfo::WV_VISTA) { @@ -262,25 +238,21 @@ QWinInputContext::QWinInputContext(QObject *parent) delete []lpList; } } else { - // figure out whether a RTL language is installed - typedef BOOL(WINAPI *PtrIsValidLanguageGroup)(DWORD,DWORD); - PtrIsValidLanguageGroup isValidLanguageGroup = (PtrIsValidLanguageGroup)QLibrary::resolve(QLatin1String("kernel32"), "IsValidLanguageGroup"); - if (isValidLanguageGroup) { - qt_use_rtl_extensions = isValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED) - || isValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED); - } - qt_use_rtl_extensions |= IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) + // figure out whether a RTL language is installed + qt_use_rtl_extensions = IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED) + || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED) + || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) + || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) #ifdef LANG_SYRIAC - || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) + || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) #endif - || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED); + || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED); } #else qt_use_rtl_extensions = false; #endif - WM_MSIME_MOUSE = QT_WA_INLINE(RegisterWindowMessage(L"MSIMEMouseOperation"), RegisterWindowMessageA("MSIMEMouseOperation")); + WM_MSIME_MOUSE = RegisterWindowMessage(L"MSIMEMouseOperation"); } QWinInputContext::~QWinInputContext() @@ -337,26 +309,13 @@ static void notifyIME(HIMC imc, DWORD dwAction, DWORD dwIndex, DWORD dwValue) ImmNotifyIME(imc, dwAction, dwIndex, dwValue); } -static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen, bool *unicode = 0) +static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen) { LONG len = 0; - if (unicode) - *unicode = true; if (aimm) aimm->GetCompositionStringW(himc, dwIndex, dBufLen, &len, lpbuf); else - { - if(QSysInfo::WindowsVersion != QSysInfo::WV_95) { - len = ImmGetCompositionStringW(himc, dwIndex, lpbuf, dBufLen); - } -#if !defined(Q_WS_WINCE) - else { - len = ImmGetCompositionStringA(himc, dwIndex, lpbuf, dBufLen); - if (unicode) - *unicode = false; - } -#endif - } + len = ImmGetCompositionString(himc, dwIndex, lpbuf, dBufLen); return len; } @@ -367,29 +326,28 @@ static int getCursorPosition(HIMC himc) static QString getString(HIMC himc, DWORD dwindex, int *selStart = 0, int *selLength = 0) { - static char *buffer = 0; + static wchar_t *buffer = 0; static int buflen = 0; int len = getCompositionString(himc, dwindex, 0, 0) + 1; if (!buffer || len > buflen) { delete [] buffer; buflen = qMin(len, 256); - buffer = new char[buflen]; + buffer = new wchar_t[buflen]; } - bool unicode = true; - len = getCompositionString(himc, dwindex, buffer, buflen, &unicode); + len = getCompositionString(himc, dwindex, buffer, buflen * sizeof(wchar_t)); if (selStart) { - static char *attrbuffer = 0; + static wchar_t *attrbuffer = 0; static int attrbuflen = 0; int attrlen = getCompositionString(himc, dwindex, 0, 0) + 1; if (!attrbuffer || attrlen> attrbuflen) { delete [] attrbuffer; attrbuflen = qMin(attrlen, 256); - attrbuffer = new char[attrbuflen]; + attrbuffer = new wchar_t[attrbuflen]; } - attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, attrbuflen); + attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, attrbuflen * sizeof(wchar_t)); *selStart = attrlen+1; *selLength = -1; for (int i = 0; i < attrlen; i++) { @@ -403,18 +361,8 @@ static QString getString(HIMC himc, DWORD dwindex, int *selStart = 0, int *selLe if (len <= 0) return QString(); - if (unicode) { - return QString((QChar *)buffer, len/sizeof(QChar)); - } - else { - buffer[len] = 0; - WCHAR *wc = new WCHAR[len+1]; - int l = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, - buffer, len, wc, len+1); - QString res = QString((QChar *)wc, l); - delete [] wc; - return res; - } + + return QString((QChar*)buffer, len / sizeof(QChar)); } void QWinInputContext::TranslateMessage(const MSG *msg) @@ -428,11 +376,7 @@ LRESULT QWinInputContext::DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR LRESULT retval; if (!aimm || aimm->OnDefWindowProc(hwnd, msg, wParam, lParam, &retval) != S_OK) { - QT_WA({ - retval = ::DefWindowProc(hwnd, msg, wParam, lParam); - } , { - retval = ::DefWindowProcA(hwnd,msg, wParam, lParam); - }); + retval = ::DefWindowProc(hwnd, msg, wParam, lParam); } return retval; } @@ -454,21 +398,13 @@ void QWinInputContext::update() HFONT hf; hf = f.handle(); - QT_WA({ - LOGFONT lf; - if (GetObject(hf, sizeof(lf), &lf)) - if (aimm) - aimm->SetCompositionFontW(imc, &lf); - else - ImmSetCompositionFont(imc, &lf); - } , { - LOGFONTA lf; - if (GetObjectA(hf, sizeof(lf), &lf)) - if (aimm) - aimm->SetCompositionFontA(imc, &lf); - else - ImmSetCompositionFontA(imc, &lf); - }); + LOGFONT lf; + if (GetObject(hf, sizeof(lf), &lf)) { + if (aimm) + aimm->SetCompositionFontW(imc, &lf); + else + ImmSetCompositionFont(imc, &lf); + } QRect r = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index 3f7b53d..506b988 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -243,10 +243,10 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const //Get the small icon #ifndef Q_OS_WINCE - val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, + val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS); #else - val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, + val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_SYSICONINDEX); #endif if (val) { @@ -282,10 +282,10 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const //Get the big icon #ifndef Q_OS_WINCE - val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, + val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_LARGEICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS); #else - val = SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, + val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX); #endif if (val) { @@ -357,9 +357,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const if (info.isRoot()) #if defined (Q_WS_WIN) && !defined(Q_WS_WINCE) { - uint type = DRIVE_UNKNOWN; - QT_WA({ type = GetDriveTypeW((wchar_t *)info.absoluteFilePath().utf16()); }, - { type = GetDriveTypeA(info.absoluteFilePath().toLocal8Bit()); }); + UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16()); switch (type) { case DRIVE_REMOVABLE: diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 05d9b3c..15ddce8 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -863,12 +863,6 @@ void QApplicationPrivate::initialize() if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0) q->setAttribute(Qt::AA_NativeWindows); -#if defined(Q_WS_WIN) - // Alien is not currently working on Windows 98 - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) - q->setAttribute(Qt::AA_NativeWindows); -#endif - #ifdef Q_WS_WINCE #ifdef QT_AUTO_MAXIMIZE_THRESHOLD autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD; @@ -4414,13 +4408,13 @@ HRESULT qt_CoCreateGuid(GUID* guid) { // We will use the following information to create the GUID // 1. absolute path to application - wchar_t tempFilename[512]; - if (!GetModuleFileNameW(0, tempFilename, 512)) + wchar_t tempFilename[MAX_PATH]; + if (!GetModuleFileName(0, tempFilename, MAX_PATH)) return S_FALSE; - unsigned int hash = qHash(QString::fromUtf16((const unsigned short *) tempFilename)); + unsigned int hash = qHash(QString::fromWCharArray(tempFilename)); guid->Data1 = hash; // 2. creation time of file - QFileInfo info(QString::fromUtf16((const unsigned short *) tempFilename)); + QFileInfo info(QString::fromWCharArray(tempFilename)); guid->Data2 = qHash(info.created().toTime_t()); // 3. current system time guid->Data3 = qHash(QDateTime::currentDateTime().toTime_t()); @@ -4454,10 +4448,10 @@ QSessionManager::QSessionManager(QApplication * app, QString &id, QString &key) GUID guid; CoCreateGuid(&guid); StringFromGUID2(guid, guidstr, 40); - id = QString::fromUtf16((ushort*)guidstr); + id = QString::fromWCharArray(guidstr); CoCreateGuid(&guid); StringFromGUID2(guid, guidstr, 40); - key = QString::fromUtf16((ushort*)guidstr); + key = QString::fromWCharArray(guidstr); #endif d->sessionId = id; d->sessionKey = key; diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index bb7d931..e1af0f7 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -145,24 +145,6 @@ typedef struct tagTOUCHINPUT #endif -#ifndef FLASHW_STOP -typedef struct { - UINT cbSize; - HWND hwnd; - DWORD dwFlags; - UINT uCount; - DWORD dwTimeout; -} FLASHWINFO, *PFLASHWINFO; -#define FLASHW_STOP 0 -#define FLASHW_CAPTION 0x00000001 -#define FLASHW_TRAY 0x00000002 -#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY) -#define FLASHW_TIMER 0x00000004 -#define FLASHW_TIMERNOFG 0x0000000C -#endif /* FLASHW_STOP */ -typedef BOOL (WINAPI *PtrFlashWindowEx)(PFLASHWINFO pfwi); -static PtrFlashWindowEx pFlashWindowEx = 0; - #include #include #include @@ -272,10 +254,6 @@ QTabletDeviceData currentTabletPointer; // from qregion_win.cpp extern HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int right, int bottom); -Q_CORE_EXPORT bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, - UINT wMsgFilterMax, UINT wRemoveMsg); -Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - // support for on-the-fly changes of the XP theme engine #ifndef WM_THEMECHANGED #define WM_THEMECHANGED 0x031A @@ -302,7 +280,7 @@ Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa #define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam)) #endif -// support for multi-media-keys on ME/2000/XP +// support for multi-media-keys #ifndef WM_APPCOMMAND #define WM_APPCOMMAND 0x0319 @@ -375,8 +353,6 @@ Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa #endif // WM_APPCOMMAND -static UINT WM95_MOUSEWHEEL = 0; - #if (_WIN32_WINNT < 0x0400) // This struct is defined in winuser.h if the _WIN32_WINNT >= 0x0400 -- in the // other cases we have to define it on our own. @@ -543,14 +519,13 @@ static void qt_set_windows_color_resources() pal.setColor(QPalette::Inactive, QPalette::Light, pal.light().color()); pal.setColor(QPalette::Inactive, QPalette::Dark, pal.dark().color()); - if (QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95) { - if (pal.midlight() == pal.button()) - pal.setColor(QPalette::Midlight, pal.button().color().lighter(110)); - if (pal.background() != pal.base()) { - pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Inactive, QPalette::Window)); - pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Inactive, QPalette::Text)); - } + if (pal.midlight() == pal.button()) + pal.setColor(QPalette::Midlight, pal.button().color().lighter(110)); + if (pal.background() != pal.base()) { + pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Inactive, QPalette::Window)); + pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Inactive, QPalette::Text)); } + const QColor bg = pal.background().color(); const QColor fg = pal.foreground().color(), btn = pal.button().color(); QColor disabled((fg.red()+btn.red())/2,(fg.green()+btn.green())/2, @@ -601,35 +576,18 @@ static void qt_set_windows_color_resources() static void qt_set_windows_font_resources() { #ifndef Q_WS_WINCE - QFont menuFont; - QFont messageFont; - QFont statusFont; - QFont titleFont; - QFont iconTitleFont; - QT_WA({ - NONCLIENTMETRICS ncm; - ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONTW); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0); - menuFont = qt_LOGFONTtoQFont(ncm.lfMenuFont,true); - messageFont = qt_LOGFONTtoQFont(ncm.lfMessageFont,true); - statusFont = qt_LOGFONTtoQFont(ncm.lfStatusFont,true); - titleFont = qt_LOGFONTtoQFont(ncm.lfCaptionFont,true); - LOGFONTW lfIconTitleFont; - SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0); - iconTitleFont = qt_LOGFONTtoQFont(lfIconTitleFont,true); - } , { - // A version - NONCLIENTMETRICSA ncm; - ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, lfMessageFont) + sizeof(LOGFONTA); - SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); - menuFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMenuFont,true); - messageFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMessageFont,true); - statusFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfStatusFont,true); - titleFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfCaptionFont,true); - LOGFONTA lfIconTitleFont; - SystemParametersInfoA(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0); - iconTitleFont = qt_LOGFONTtoQFont((LOGFONT&)lfIconTitleFont,true); - }); + NONCLIENTMETRICS ncm; + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0); + + QFont menuFont = qt_LOGFONTtoQFont(ncm.lfMenuFont, true); + QFont messageFont = qt_LOGFONTtoQFont(ncm.lfMessageFont, true); + QFont statusFont = qt_LOGFONTtoQFont(ncm.lfStatusFont, true); + QFont titleFont = qt_LOGFONTtoQFont(ncm.lfCaptionFont, true); + + LOGFONT lfIconTitleFont; + SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0); + QFont iconTitleFont = qt_LOGFONTtoQFont(lfIconTitleFont, true); QApplication::setFont(menuFont, "QMenu"); QApplication::setFont(menuFont, "QMenuBar"); @@ -657,26 +615,13 @@ static void qt_set_windows_font_resources() static void qt_win_read_cleartype_settings() { + UINT result = 0; #ifdef Q_OS_WINCE - UINT result; - BOOL ok; - ok = SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &result, 0); - if (ok) - qt_cleartype_enabled = result; + if (SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &result, 0)) + qt_cleartype_enabled = result; #else - QT_WA({ - UINT result; - BOOL ok; - ok = SystemParametersInfoW(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0); - if (ok) - qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE); - }, { - UINT result; - BOOL ok; - ok = SystemParametersInfoA(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0); - if (ok) - qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE); - }); + if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0)) + qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE); #endif } @@ -694,10 +639,10 @@ void QApplicationPrivate::initializeWidgetPaletteHash() QPalette pal = *QApplicationPrivate::sys_pal; QColor menuCol(qt_colorref2qrgb(GetSysColor(COLOR_MENU))); QColor menuText(qt_colorref2qrgb(GetSysColor(COLOR_MENUTEXT))); - BOOL isFlat = 0; + BOOL isFlat = false; if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) - SystemParametersInfo(0x1022 /*SPI_GETFLATMENU*/, 0, &isFlat, 0); + SystemParametersInfo(SPI_GETFLATMENU, 0, &isFlat, 0); QPalette menu(pal); // we might need a special color group for the menu. menu.setColor(QPalette::Active, QPalette::Button, menuCol); @@ -712,8 +657,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash() QColor(qt_colorref2qrgb(GetSysColor( (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) - && isFlat ? COLOR_MENUHILIGHT - : COLOR_HIGHLIGHT)))); + && isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT)))); menu.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled); menu.setColor(QPalette::Disabled, QPalette::Button, menu.color(QPalette::Active, QPalette::Button)); @@ -729,10 +673,8 @@ void QApplicationPrivate::initializeWidgetPaletteHash() menu.color(QPalette::Active, QPalette::Highlight)); menu.setColor(QPalette::Inactive, QPalette::HighlightedText, menu.color(QPalette::Active, QPalette::HighlightedText)); - - if (QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95) - menu.setColor(QPalette::Inactive, QPalette::ButtonText, - pal.color(QPalette::Inactive, QPalette::Dark)); + menu.setColor(QPalette::Inactive, QPalette::ButtonText, + pal.color(QPalette::Inactive, QPalette::Dark)); QApplication::setPalette(menu, "QMenu"); if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP @@ -749,15 +691,10 @@ void QApplicationPrivate::initializeWidgetPaletteHash() qt_init() - initializes Qt for Windows *****************************************************************************/ -typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst, - const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey, - const Q_BLENDFUNCTION *pblend, DWORD dwflags); - typedef BOOL (WINAPI *PtrSetProcessDPIAware) (VOID); - -static PtrUpdateLayeredWindow ptrUpdateLayeredWindow = 0; static PtrSetProcessDPIAware ptrSetProcessDPIAware = 0; - +PtrUpdateLayeredWindow ptrUpdateLayeredWindow = 0; +PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect = 0; static BOOL WINAPI qt_updateLayeredWindowIndirect(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *info) { return (*ptrUpdateLayeredWindow)(hwnd, info->hdcDst, info->pptDst, info->psize, info->hdcSrc, @@ -822,46 +759,30 @@ void qt_init(QApplicationPrivate *priv, int) #endif qApp->setObjectName(priv->appName()); -#if !defined(Q_WS_WINCE) // default font - HFONT hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); - QFont f(QLatin1String("MS Sans Serif"),8); - int result = 0; - QT_WA({ - LOGFONT lf; - if (result = GetObject(hfont, sizeof(lf), &lf)) - f = qt_LOGFONTtoQFont((LOGFONT&)lf,true); - } , { - LOGFONTA lf; - if (result = GetObjectA(hfont, sizeof(lf), &lf)) - f = qt_LOGFONTtoQFont((LOGFONT&)lf,true); - }); - if (result - && QSysInfo::WindowsVersion >= QSysInfo::WV_2000 - && QSysInfo::WindowsVersion <= QSysInfo::WV_NT_based - && f.family() == QLatin1String("MS Shell Dlg")) - f.setFamily(QLatin1String("MS Shell Dlg 2")); - QApplicationPrivate::setSystemFont(f); -#else //Q_WS_WINCE - LOGFONT lf; - HGDIOBJ stockFont = GetStockObject(SYSTEM_FONT); - int result = 0; - result = GetObject(stockFont, sizeof(lf), &lf); - QFont font = qt_LOGFONTtoQFont(lf, true); - if (result) - QApplicationPrivate::setSystemFont(font); -#endif //Q_WS_WINCE +#ifndef Q_WS_WINCE + HGDIOBJ stockFont = GetStockObject(DEFAULT_GUI_FONT); +#else + HGDIOBJ stockFont = GetStockObject(SYSTEM_FONT); +#endif + + LOGFONT lf; + GetObject(stockFont, sizeof(lf), &lf); + QFont systemFont = qt_LOGFONTtoQFont(lf, true); + +#ifndef Q_WS_WINCE + if (systemFont.family() == QLatin1String("MS Shell Dlg")) { + systemFont.setFamily(QLatin1String("MS Shell Dlg 2")); + } +#endif + + QApplicationPrivate::setSystemFont(systemFont); // QFont::locale_init(); ### Uncomment when it does something on Windows if (QApplication::desktopSettingsAware()) qt_set_windows_resources(); - QT_WA({ - WM95_MOUSEWHEEL = RegisterWindowMessage(L"MSWHEEL_ROLLMSG"); - } , { - WM95_MOUSEWHEEL = RegisterWindowMessageA("MSWHEEL_ROLLMSG"); - }); initWinTabFunctions(); QApplicationPrivate::inputContext = new QWinInputContext(0); @@ -963,7 +884,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class if (w->inherits("QTipLabel") || w->inherits("QAlphaWidget")) { if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { - style |= 0x00020000; // CS_DROPSHADOW + style |= CS_DROPSHADOW; } cname = QLatin1String("QToolTip"); } else { @@ -981,7 +902,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class #endif if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) - style |= 0x00020000; // CS_DROPSHADOW + style |= CS_DROPSHADOW; icon = false; } else { cname = QLatin1String("QWidget"); @@ -1001,10 +922,10 @@ const QString qt_reg_winclass(QWidget *w) // register window class // unique ID on WinCE to make sure we can // move the windows to the front when starting // a second instance. - wchar_t uniqueAppID[256]; - GetModuleFileNameW(0, uniqueAppID, 255); - cname = QString::number(RegisterWindowMessageW( - (const wchar_t *) QString::fromUtf16((const ushort *)uniqueAppID).toLower().replace(QLatin1Char('\\'), + wchar_t uniqueAppID[MAX_PATH]; + GetModuleFileName(0, uniqueAppID, MAX_PATH); + cname = QString::number(RegisterWindowMessage( + (const wchar_t *) QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1Char('\\'), QLatin1Char('_')).utf16())); #endif @@ -1016,15 +937,9 @@ const QString qt_reg_winclass(QWidget *w) // register window class static int classExists = -1; if (classExists == -1) { - QT_WA({ - WNDCLASS wcinfo; - classExists = GetClassInfo(qWinAppInst(), (TCHAR*)cname.utf16(), &wcinfo); - classExists = classExists && wcinfo.lpfnWndProc != QtWndProc; - }, { - WNDCLASSA wcinfo; - classExists = GetClassInfoA(qWinAppInst(), cname.toLatin1(), &wcinfo); - classExists = classExists && wcinfo.lpfnWndProc != QtWndProc; - }); + WNDCLASS wcinfo; + classExists = GetClassInfo((HINSTANCE)qWinAppInst(), (wchar_t*)cname.utf16(), &wcinfo); + classExists = classExists && wcinfo.lpfnWndProc != QtWndProc; } if (classExists) @@ -1033,69 +948,31 @@ const QString qt_reg_winclass(QWidget *w) // register window class if (winclassNames()->contains(cname)) // already registered in our list return cname; - ATOM atom; + WNDCLASS wc; + wc.style = style; + wc.lpfnWndProc = (WNDPROC)QtWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = qWinAppInst(); + if (icon) { + wc.hIcon = (HICON)LoadImage(qWinAppInst(), L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); #ifndef Q_WS_WINCE - HBRUSH bgBrush = (HBRUSH)GetSysColorBrush(COLOR_WINDOW); - QT_WA({ - WNDCLASS wc; - wc.style = style; - wc.lpfnWndProc = (WNDPROC)QtWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = qWinAppInst(); - if (icon) { - wc.hIcon = LoadIcon(qWinAppInst(), L"IDI_ICON1"); - if (!wc.hIcon) - wc.hIcon = LoadIcon(0, IDI_APPLICATION); - } else { - wc.hIcon = 0; - } - wc.hCursor = 0; - wc.hbrBackground= bgBrush; - wc.lpszMenuName = 0; - wc.lpszClassName= (TCHAR*)cname.utf16(); - atom = RegisterClass(&wc); - } , { - WNDCLASSA wc; - wc.style = style; - wc.lpfnWndProc = (WNDPROC)QtWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = qWinAppInst(); - if (icon) { - wc.hIcon = LoadIconA(qWinAppInst(), (char*)"IDI_ICON1"); - if (!wc.hIcon) - wc.hIcon = LoadIconA(0, (char*)IDI_APPLICATION); - } else { - wc.hIcon = 0; - } - wc.hCursor = 0; - wc.hbrBackground= bgBrush; - wc.lpszMenuName = 0; - QByteArray tempArray = cname.toLatin1(); - wc.lpszClassName= tempArray; - atom = RegisterClassA(&wc); - }); + if (!wc.hIcon) + wc.hIcon = (HICON)LoadImage(0, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); +#endif + } else { + wc.hIcon = 0; + } + wc.hCursor = 0; +#ifndef Q_WS_WINCE + wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW); #else - WNDCLASS wc; - wc.style = style; - wc.lpfnWndProc = (WNDPROC)QtWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = qWinAppInst(); - if (icon) { - wc.hIcon = LoadIcon(qWinAppInst(), L"IDI_ICON1"); -// if (!wc.hIcon) -// wc.hIcon = LoadIcon(0, IDI_APPLICATION); - } else { - wc.hIcon = 0; - } - wc.hCursor = 0; - wc.hbrBackground= 0; - wc.lpszMenuName = 0; - wc.lpszClassName= (TCHAR*)cname.utf16(); - atom = RegisterClass(&wc); + wc.hbrBackground = 0; #endif + wc.lpszMenuName = 0; + wc.lpszClassName = (wchar_t*)cname.utf16(); + + ATOM atom = RegisterClass(&wc); #ifndef QT_NO_DEBUG if (!atom) @@ -1117,11 +994,7 @@ static void unregWinClasses() WinClassNameHash *hash = winclassNames(); QHash::ConstIterator it = hash->constBegin(); while (it != hash->constEnd()) { - QT_WA({ - UnregisterClass((TCHAR*)it.key().utf16(), qWinAppInst()); - } , { - UnregisterClassA(it.key().toLatin1(), qWinAppInst()); - }); + UnregisterClass((wchar_t*)it.key().utf16(), qWinAppInst()); ++it; } hash->clear(); @@ -1338,16 +1211,10 @@ void QApplication::beep() static void alert_widget(QWidget *widget, int duration) { - bool stopFlash = duration < 0; - - if (!pFlashWindowEx) { #ifndef Q_OS_WINCE - QLibrary themeLib(QLatin1String("user32")); - pFlashWindowEx = (PtrFlashWindowEx)themeLib.resolve("FlashWindowEx"); -#endif - } + bool stopFlash = duration < 0; - if (pFlashWindowEx && widget && (!widget->isActiveWindow() || stopFlash)) { + if (widget && (!widget->isActiveWindow() || stopFlash)) { DWORD timeOut = GetCaretBlinkTime(); if (timeOut <= 0) timeOut = 250; @@ -1365,8 +1232,9 @@ static void alert_widget(QWidget *widget, int duration) info.dwTimeout = stopFlash ? 0 : timeOut; info.uCount = stopFlash ? 0 : flashCount; - pFlashWindowEx(&info); + FlashWindowEx(&info); } +#endif } void QApplication::alert(QWidget *widget, int duration) @@ -1727,7 +1595,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam // Sometimes we only get a WM_MOUSEMOVE message // and sometimes we get both a WM_MOUSEMOVE and // a WM_LBUTTONDOWN/UP, this creates a spurious mouse - // press/release event, using the winPeekMessage + // press/release event, using the PeekMessage // will help us fix this. This leaves us with a // question: // This effectively kills using the mouse AND the @@ -1737,16 +1605,14 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam bool is_mouse_move = (message == WM_MOUSEMOVE); if (is_mouse_move) { MSG msg1; - if (winPeekMessage(&msg1, msg.hwnd, WM_MOUSEFIRST, - WM_MOUSELAST, PM_NOREMOVE)) + if (PeekMessage(&msg1, msg.hwnd, WM_MOUSEFIRST, + WM_MOUSELAST, PM_NOREMOVE)) next_is_button = (msg1.message == WM_LBUTTONUP || msg1.message == WM_LBUTTONDOWN); } if (!is_mouse_move || (is_mouse_move && !next_is_button)) qt_tabletChokeMouse = false; } - } else if (message == WM95_MOUSEWHEEL) { - result = widget->translateWheelEvent(msg); } else { switch (message) { case WM_TOUCH: @@ -1777,7 +1643,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam case WM_IME_KEYDOWN: case WM_CHAR: { MSG msg1; - bool anyMsg = winPeekMessage(&msg1, msg.hwnd, 0, 0, PM_NOREMOVE); + bool anyMsg = PeekMessage(&msg1, msg.hwnd, 0, 0, PM_NOREMOVE); if (anyMsg && msg1.message == WM_DEADCHAR) { result = true; // consume event since there is a dead char next break; @@ -1977,11 +1843,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam #ifndef QT_NO_WHATSTHIS QWhatsThis::enterWhatsThisMode(); #endif - QT_WA({ - DefWindowProc(hwnd, WM_NCPAINT, 1, 0); - } , { - DefWindowProcA(hwnd, WM_NCPAINT, 1, 0); - }); + DefWindowProc(hwnd, WM_NCPAINT, 1, 0); break; #if defined(QT_NON_COMMERCIAL) QT_NC_SYSCOMMAND @@ -2043,8 +1905,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam break; if (!msg.wParam) { - QString area = QT_WA_INLINE(QString::fromUtf16((unsigned short *)msg.lParam), - QString::fromLocal8Bit((char*)msg.lParam)); + QString area = QString::fromWCharArray((wchar_t*)msg.lParam); if (area == QLatin1String("intl")) { QLocalePrivate::updateSystemPrivate(); if (!widget->testAttribute(Qt::WA_SetLocale)) @@ -2422,11 +2283,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam text = widget->objectName(); ret = qMin(wParam - 1, text.size()); text.resize(ret); - QT_WA({ - memcpy((void *)lParam, text.utf16(), (text.size() + 1) * 2); - }, { - memcpy((void *)lParam, text.toLocal8Bit().data(), text.size() + 1); - }); + memcpy((void *)lParam, text.utf16(), (text.size() + 1) * sizeof(ushort)); delete acc; } if (!ret) { @@ -2514,11 +2371,11 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam #ifndef Q_WS_WINCE case WM_INPUTLANGCHANGE: { - char info[7]; - if (!GetLocaleInfoA(MAKELCID(lParam, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, info, 6)) { + wchar_t info[7]; + if (!GetLocaleInfo(MAKELCID(lParam, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, info, 6)) { inputcharset = CP_ACP; } else { - inputcharset = QString::fromLatin1(info).toInt(); + inputcharset = QString::fromWCharArray(info).toInt(); } QKeyMapper::changeKeyboard(); break; @@ -2714,8 +2571,7 @@ bool qt_try_modal(QWidget *widget, MSG *msg, int& ret) if (type != WM_NCHITTEST) #endif if ((type >= WM_MOUSEFIRST && type <= WM_MOUSELAST) || - type == WM_MOUSEWHEEL || type == (int)WM95_MOUSEWHEEL || - type == WM_MOUSEHWHEEL || + type == WM_MOUSEWHEEL || type == WM_MOUSEHWHEEL || type == WM_MOUSELEAVE || (type >= WM_KEYFIRST && type <= WM_KEYLAST) #ifndef Q_WS_WINCE @@ -2955,19 +2811,10 @@ void qt_win_eatMouseMove() // reset button state MSG msg = {0, 0, 0, 0, 0, 0, 0}; - QT_WA( { - while (PeekMessage(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) - ; - if (msg.message == WM_MOUSEMOVE) - PostMessage(msg.hwnd, msg.message, 0, msg.lParam); - }, { - MSG msg; - msg.message = 0; - while (PeekMessageA(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) - ; - if (msg.message == WM_MOUSEMOVE) - PostMessageA(msg.hwnd, msg.message, 0, msg.lParam); - } ); + while (PeekMessage(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) + ; + if (msg.message == WM_MOUSEMOVE) + PostMessage(msg.hwnd, msg.message, 0, msg.lParam); } // In DnD, the mouse release event never appears, so the @@ -3002,8 +2849,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg) // Compress mouse move events if (msg.message == WM_MOUSEMOVE) { MSG mouseMsg; - while (winPeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEFIRST, - WM_MOUSELAST, PM_NOREMOVE)) { + while (PeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEFIRST, + WM_MOUSELAST, PM_NOREMOVE)) { if (mouseMsg.message == WM_MOUSEMOVE) { #define PEEKMESSAGE_IS_BROKEN 1 #ifdef PEEKMESSAGE_IS_BROKEN @@ -3014,12 +2861,12 @@ bool QETWidget::translateMouseEvent(const MSG &msg) // key release events (kls 2003-05-13): MSG keyMsg; bool done = false; - while (winPeekMessage(&keyMsg, 0, WM_KEYFIRST, WM_KEYLAST, - PM_NOREMOVE)) { + while (PeekMessage(&keyMsg, 0, WM_KEYFIRST, WM_KEYLAST, + PM_NOREMOVE)) { if (keyMsg.time < mouseMsg.time) { if ((keyMsg.lParam & 0xC0000000) == 0x40000000) { - winPeekMessage(&keyMsg, 0, keyMsg.message, - keyMsg.message, PM_REMOVE); + PeekMessage(&keyMsg, 0, keyMsg.message, + keyMsg.message, PM_REMOVE); } else { done = true; break; @@ -3045,8 +2892,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg) msgPtr->wParam = mouseMsg.wParam; msgPtr->pt = mouseMsg.pt; // Remove the mouse move message - winPeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEMOVE, - WM_MOUSEMOVE, PM_REMOVE); + PeekMessage(&mouseMsg, msg.hwnd, WM_MOUSEMOVE, + WM_MOUSEMOVE, PM_REMOVE); } else { break; // there was no more WM_MOUSEMOVE event } @@ -3260,7 +3107,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg) POINT widgetpt = gpos; ScreenToClient(hwndTarget, &widgetpt); LPARAM lParam = MAKELPARAM(widgetpt.x, widgetpt.y); - winPostMessage(hwndTarget, msg.message, msg.wParam, lParam); + PostMessage(hwndTarget, msg.message, msg.wParam, lParam); } } else if (type == QEvent::MouseButtonRelease && button == Qt::RightButton && QApplication::activePopupWidget() == activePopupWidget) { @@ -3627,14 +3474,8 @@ static void initWinTabFunctions() QLibrary library(QLatin1String("wintab32")); if (library.load()) { - QT_WA({ - ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW"); - ptrWTGet = (PtrWTGet)library.resolve("WTGetW"); - } , { - ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoA"); - ptrWTGet = (PtrWTGet)library.resolve("WTGetA"); - }); - + ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW"); + ptrWTGet = (PtrWTGet)library.resolve("WTGetW"); ptrWTEnable = (PtrWTEnable)library.resolve("WTEnable"); ptrWTOverlap = (PtrWTEnable)library.resolve("WTOverlap"); ptrWTPacketsGet = (PtrWTPacketsGet)library.resolve("WTPacketsGet"); @@ -3861,11 +3702,7 @@ void QApplication::setWheelScrollLines(int n) #ifdef SPI_SETWHEELSCROLLLINES if (n < 0) n = 0; - QT_WA({ - SystemParametersInfo(SPI_SETWHEELSCROLLLINES, (uint)n, 0, 0); - } , { - SystemParametersInfoA(SPI_SETWHEELSCROLLLINES, (uint)n, 0, 0); - }); + SystemParametersInfo(SPI_SETWHEELSCROLLLINES, (uint)n, 0, 0); #else QApplicationPrivate::wheel_scroll_lines = n; #endif @@ -3875,11 +3712,7 @@ int QApplication::wheelScrollLines() { #ifdef SPI_GETWHEELSCROLLLINES uint i = 3; - QT_WA({ - SystemParametersInfo(SPI_GETWHEELSCROLLLINES, sizeof(uint), &i, 0); - } , { - SystemParametersInfoA(SPI_GETWHEELSCROLLLINES, sizeof(uint), &i, 0); - }); + SystemParametersInfo(SPI_GETWHEELSCROLLLINES, sizeof(uint), &i, 0); if (i > INT_MAX) i = INT_MAX; return i; @@ -3924,8 +3757,7 @@ bool QApplication::isEffectEnabled(Qt::UIEffect effect) if (QColormap::instance().depth() < 16) return false; - if (!effect_override && desktopSettingsAware() - && !(QSysInfo::WindowsVersion == QSysInfo::WV_95 || QSysInfo::WindowsVersion == QSysInfo::WV_NT)) { + if (!effect_override && desktopSettingsAware()) { // we know that they can be used when we are here BOOL enabled = false; UINT api; @@ -3934,33 +3766,22 @@ bool QApplication::isEffectEnabled(Qt::UIEffect effect) api = SPI_GETMENUANIMATION; break; case Qt::UI_FadeMenu: - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) - return false; api = SPI_GETMENUFADE; break; case Qt::UI_AnimateCombo: api = SPI_GETCOMBOBOXANIMATION; break; case Qt::UI_AnimateTooltip: - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) - api = SPI_GETMENUANIMATION; - else - api = SPI_GETTOOLTIPANIMATION; + api = SPI_GETTOOLTIPANIMATION; break; case Qt::UI_FadeTooltip: - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) - return false; api = SPI_GETTOOLTIPFADE; break; default: api = SPI_GETUIEFFECTS; break; } - QT_WA({ - SystemParametersInfo(api, 0, &enabled, 0); - } , { - SystemParametersInfoA(api, 0, &enabled, 0); - }); + SystemParametersInfo(api, 0, &enabled, 0); return enabled; } diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp index 09b5448..f5aa088 100644 --- a/src/gui/kernel/qclipboard_win.cpp +++ b/src/gui/kernel/qclipboard_win.cpp @@ -200,7 +200,7 @@ HRESULT QtCeGetClipboard(IDataObject** obj) if (clipData == 0) { clipData = GetClipboardData(CF_UNICODETEXT); if (clipData != 0) - clipText = QString::fromUtf16((unsigned short *)clipData); + clipText = QString::fromWCharArray((wchar_t *)clipData); } else { clipText = QString::fromLatin1((const char*)clipData); } @@ -325,13 +325,7 @@ bool QClipboard::event(QEvent *e) } if (propagate && d->nextClipboardViewer) { - QT_WA({ - SendMessage(d->nextClipboardViewer, m->message, - m->wParam, m->lParam); - } , { - SendMessageA(d->nextClipboardViewer, m->message, - m->wParam, m->lParam); - }); + SendMessage(d->nextClipboardViewer, m->message, m->wParam, m->lParam); } return true; diff --git a/src/gui/kernel/qcursor_win.cpp b/src/gui/kernel/qcursor_win.cpp index f0dc108..db00835 100644 --- a/src/gui/kernel/qcursor_win.cpp +++ b/src/gui/kernel/qcursor_win.cpp @@ -317,54 +317,50 @@ void QCursorData::update() phand_bits, phandm_bits }; - unsigned short *sh; + wchar_t *sh = 0; switch (cshape) { // map to windows cursor case Qt::ArrowCursor: - sh = (unsigned short*)IDC_ARROW; + sh = IDC_ARROW; break; case Qt::UpArrowCursor: - sh = (unsigned short*)IDC_UPARROW; + sh = IDC_UPARROW; break; case Qt::CrossCursor: - sh = (unsigned short*)IDC_CROSS; + sh = IDC_CROSS; break; case Qt::WaitCursor: - sh = (unsigned short*)IDC_WAIT; + sh = IDC_WAIT; break; case Qt::IBeamCursor: - sh = (unsigned short*)IDC_IBEAM; + sh = IDC_IBEAM; break; case Qt::SizeVerCursor: - sh = (unsigned short*)IDC_SIZENS; + sh = IDC_SIZENS; break; case Qt::SizeHorCursor: - sh = (unsigned short*)IDC_SIZEWE; + sh = IDC_SIZEWE; break; case Qt::SizeBDiagCursor: - sh = (unsigned short*)IDC_SIZENESW; + sh = IDC_SIZENESW; break; case Qt::SizeFDiagCursor: - sh = (unsigned short*)IDC_SIZENWSE; + sh = IDC_SIZENWSE; break; case Qt::SizeAllCursor: - sh = (unsigned short*)IDC_SIZEALL; + sh = IDC_SIZEALL; break; case Qt::ForbiddenCursor: - sh = (unsigned short*)IDC_NO; + sh = IDC_NO; break; case Qt::WhatsThisCursor: - sh = (unsigned short*)IDC_HELP; + sh = IDC_HELP; break; case Qt::BusyCursor: - sh = (unsigned short*)IDC_APPSTARTING; + sh = IDC_APPSTARTING; break; case Qt::PointingHandCursor: - if ((QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) > QSysInfo::WV_95 || - (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) > QSysInfo::WV_NT) { - sh = (unsigned short*)IDC_HAND; - break; - } - // fall through + sh = IDC_HAND; + break; case Qt::BlankCursor: case Qt::SplitVCursor: case Qt::SplitHCursor: @@ -480,13 +476,7 @@ void QCursorData::update() qWarning("QCursor::update: Invalid cursor shape %d", cshape); return; } - // ### From MSDN: - // ### LoadCursor has been superseded by the LoadImage function. - QT_WA({ - hcurs = LoadCursorW(0, reinterpret_cast(sh)); - } , { - hcurs = LoadCursorA(0, reinterpret_cast(sh)); - }); + hcurs = (HCURSOR)LoadImage(0, sh, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qdesktopwidget_win.cpp b/src/gui/kernel/qdesktopwidget_win.cpp index aa290c4..fb176b7 100644 --- a/src/gui/kernel/qdesktopwidget_win.cpp +++ b/src/gui/kernel/qdesktopwidget_win.cpp @@ -152,41 +152,27 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that) rects = new QVector(); workrects = new QVector(); + screenCount = 0; #ifndef Q_OS_WINCE - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - screenCount = 0; - // Trying to get the function pointers to Win98/2000 only functions - QLibrary user32Lib(QLatin1String("user32")); - if (!user32Lib.load()) - return; + QLibrary user32Lib(QLatin1String("user32")); + if (user32Lib.load()) { enumDisplayMonitors = (EnumFunc)user32Lib.resolve("EnumDisplayMonitors"); - QT_WA({ - getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoW"); - } , { - getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoA"); - }); - - if (!enumDisplayMonitors || !getMonitorInfo) { - screenCount = GetSystemMetrics(80); // SM_CMONITORS - rects->resize(screenCount); - for (int i = 0; i < screenCount; ++i) - rects->replace(i, that->rect()); - return; - } - // Calls enumCallback - enumDisplayMonitors(0, 0, enumCallback, 0); - enumDisplayMonitors = 0; - getMonitorInfo = 0; - } else { - rects->resize(1); - rects->replace(0, that->rect()); - workrects->resize(1); - workrects->replace(0, that->rect()); + getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoW"); } -#else - screenCount = 0; + if (!enumDisplayMonitors || !getMonitorInfo) { + screenCount = GetSystemMetrics(80); // SM_CMONITORS + rects->resize(screenCount); + for (int i = 0; i < screenCount; ++i) + rects->replace(i, that->rect()); + return; + } + // Calls enumCallback + enumDisplayMonitors(0, 0, enumCallback, 0); + enumDisplayMonitors = 0; + getMonitorInfo = 0; +#else QLibrary coreLib(QLatin1String("coredll")); if (coreLib.load()) { // CE >= 4.0 case @@ -307,70 +293,61 @@ const QRect QDesktopWidget::availableGeometry(int screen) const for(int i=0; i < d->workrects->size(); ++i) qt_get_sip_info((*d->workrects)[i]); #endif - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - if (screen < 0 || screen >= d->screenCount) - screen = d->primaryScreen; + if (screen < 0 || screen >= d->screenCount) + screen = d->primaryScreen; - return d->workrects->at(screen); - } else { - return d->workrects->at(d->primaryScreen); - } + return d->workrects->at(screen); } const QRect QDesktopWidget::screenGeometry(int screen) const { const QDesktopWidgetPrivate *d = d_func(); - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - if (screen < 0 || screen >= d->screenCount) - screen = d->primaryScreen; + if (screen < 0 || screen >= d->screenCount) + screen = d->primaryScreen; - return d->rects->at(screen); - } else { - return d->rects->at(d->primaryScreen); - } + return d->rects->at(screen); } int QDesktopWidget::screenNumber(const QWidget *widget) const { Q_D(const QDesktopWidget); - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - if (!widget) - return d->primaryScreen; - QRect frame = widget->frameGeometry(); - if (!widget->isWindow()) - frame.moveTopLeft(widget->mapToGlobal(QPoint(0,0))); - - int maxSize = -1; - int maxScreen = -1; - - for (int i = 0; i < d->screenCount; ++i) { - QRect sect = d->rects->at(i).intersected(frame); - int size = sect.width() * sect.height(); - if (size > maxSize && sect.width() > 0 && sect.height() > 0) { - maxSize = size; - maxScreen = i; - } - } - return maxScreen; - } else { + if (!widget) return d->primaryScreen; + + QRect frame = widget->frameGeometry(); + if (!widget->isWindow()) + frame.moveTopLeft(widget->mapToGlobal(QPoint(0,0))); + + int maxSize = -1; + int maxScreen = -1; + + for (int i = 0; i < d->screenCount; ++i) { + QRect sect = d->rects->at(i).intersected(frame); + int size = sect.width() * sect.height(); + if (size > maxSize && sect.width() > 0 && sect.height() > 0) { + maxSize = size; + maxScreen = i; + } } + + return maxScreen; } int QDesktopWidget::screenNumber(const QPoint &point) const { Q_D(const QDesktopWidget); + int closestScreen = -1; - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - int shortestDistance = INT_MAX; - for (int i = 0; i < d->screenCount; ++i) { - int thisDistance = d->pointToRect(point, d->rects->at(i)); - if (thisDistance < shortestDistance) { - shortestDistance = thisDistance; - closestScreen = i; - } + int shortestDistance = INT_MAX; + + for (int i = 0; i < d->screenCount; ++i) { + int thisDistance = d->pointToRect(point, d->rects->at(i)); + if (thisDistance < shortestDistance) { + shortestDistance = thisDistance; + closestScreen = i; } } + return closestScreen; } diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp index 99c960c..70f89d2 100644 --- a/src/gui/kernel/qdnd_win.cpp +++ b/src/gui/kernel/qdnd_win.cpp @@ -154,9 +154,9 @@ QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium) #ifdef QDND_DEBUG qDebug("QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)"); #ifndef Q_OS_WINCE - char buf[256] = {0}; - GetClipboardFormatNameA(pformatetc->cfFormat, buf, 255); - qDebug("CF = %d : %s", pformatetc->cfFormat, buf); + wchar_t buf[256] = {0}; + GetClipboardFormatName(pformatetc->cfFormat, buf, 255); + qDebug("CF = %d : %s", pformatetc->cfFormat, QString::fromWCharArray(buf)); #endif #endif @@ -398,52 +398,47 @@ void QOleDropSource::createCursors() int h = cpm.height(); if (!pm.isNull()) { - int x1 = qMin(-hotSpot.x(),0); - int x2 = qMax(pm.width()-hotSpot.x(),cpm.width()); - int y1 = qMin(-hotSpot.y(),0); - int y2 = qMax(pm.height()-hotSpot.y(),cpm.height()); + int x1 = qMin(-hotSpot.x(), 0); + int x2 = qMax(pm.width() - hotSpot.x(), cpm.width()); + int y1 = qMin(-hotSpot.y(), 0); + int y2 = qMax(pm.height() - hotSpot.y(), cpm.height()); - w = x2-x1+1; - h = y2-y1+1; + w = x2 - x1 + 1; + h = y2 - y1 + 1; } QRect srcRect = pm.rect(); QPoint pmDest = QPoint(qMax(0, -hotSpot.x()), qMax(0, -hotSpot.y())); QPoint newHotSpot = hotSpot; -#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS) - bool limitedCursorSize = (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) - || (QSysInfo::WindowsVersion == QSysInfo::WV_NT) - || (QSysInfo::WindowsVersion == QSysInfo::WV_CE); - - if (limitedCursorSize) { - // Limited cursor size - int reqw = GetSystemMetrics(SM_CXCURSOR); - int reqh = GetSystemMetrics(SM_CYCURSOR); - - QPoint hotspotInPM = newHotSpot - pmDest; - if (reqw < w) { - // Not wide enough - move objectpm right - qreal r = qreal(newHotSpot.x()) / w; - newHotSpot = QPoint(int(r * reqw), newHotSpot.y()); - if (newHotSpot.x() + cpm.width() > reqw) - newHotSpot.setX(reqw - cpm.width()); - - srcRect = QRect(QPoint(hotspotInPM.x() - newHotSpot.x(), srcRect.top()), QSize(reqw, srcRect.height())); - } - if (reqh < h) { - qreal r = qreal(newHotSpot.y()) / h; - newHotSpot = QPoint(newHotSpot.x(), int(r * reqh)); - if (newHotSpot.y() + cpm.height() > reqh) - newHotSpot.setY(reqh - cpm.height()); - - srcRect = QRect(QPoint(srcRect.left(), hotspotInPM.y() - newHotSpot.y()), QSize(srcRect.width(), reqh)); - } - // Always use system cursor size - w = reqw; - h = reqh; +#if defined(Q_OS_WINCE) + // Limited cursor size + int reqw = GetSystemMetrics(SM_CXCURSOR); + int reqh = GetSystemMetrics(SM_CYCURSOR); + + QPoint hotspotInPM = newHotSpot - pmDest; + if (reqw < w) { + // Not wide enough - move objectpm right + qreal r = qreal(newHotSpot.x()) / w; + newHotSpot = QPoint(int(r * reqw), newHotSpot.y()); + if (newHotSpot.x() + cpm.width() > reqw) + newHotSpot.setX(reqw - cpm.width()); + + srcRect = QRect(QPoint(hotspotInPM.x() - newHotSpot.x(), srcRect.top()), QSize(reqw, srcRect.height())); } + if (reqh < h) { + qreal r = qreal(newHotSpot.y()) / h; + newHotSpot = QPoint(newHotSpot.x(), int(r * reqh)); + if (newHotSpot.y() + cpm.height() > reqh) + newHotSpot.setY(reqh - cpm.height()); + + srcRect = QRect(QPoint(srcRect.left(), hotspotInPM.y() - newHotSpot.y()), QSize(srcRect.width(), reqh)); + } + // Always use system cursor size + w = reqw; + h = reqh; #endif + QPixmap newCursor(w, h); if (!pm.isNull()) { newCursor.fill(QColor(0, 0, 0, 0)); diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index c986117..011c726 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -215,13 +215,7 @@ int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID l return ret; } -bool qt_wince_TextOutW(HDC hdc, int x, int y, LPWSTR lpString, UINT c) -{ - return ExtTextOutW(hdc, x, y, 0, NULL, lpString, c, NULL); -} - - -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCTSTR, LPCTSTR file, LPCTSTR params, LPCTSTR dir, int showCmd) +HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd) { SHELLEXECUTEINFO info; info.hwnd = hwnd; @@ -253,17 +247,11 @@ COLORREF qt_wince_PALETTEINDEX( WORD /*wPaletteIndex*/) return 0; } -BOOL qt_wince_TextOut( HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cbString ) -{ - return ExtTextOut( hdc, nXStart, nYStart - 16, 0, NULL, lpString, cbString, NULL ); -} - // Internal Qt ----------------------------------------------------- bool qt_wince_is_platform(const QString &platformString) { - TCHAR tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast (platformString.utf16()), tszPlatform)) + wchar_t tszPlatform[64]; + if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform) / sizeof(wchar_t), tszPlatform, 0)) + if (0 == _tcsicmp(reinterpret_cast (platformString.utf16()), tszPlatform)) return true; return false; } @@ -316,8 +304,8 @@ void qt_wince_maximize(QWidget *widget) void qt_wince_minimize(HWND hwnd) { - uint exstyle = GetWindowLongW(hwnd, GWL_EXSTYLE); - uint style = GetWindowLongW(hwnd, GWL_STYLE); + uint exstyle = GetWindowLong(hwnd, GWL_EXSTYLE); + uint style = GetWindowLong(hwnd, GWL_STYLE); RECT rect; RECT crect = {0,0,0,0}; GetWindowRect(hwnd, &rect); diff --git a/src/gui/kernel/qguifunctions_wince.h b/src/gui/kernel/qguifunctions_wince.h index bcf2004..234c8c6 100644 --- a/src/gui/kernel/qguifunctions_wince.h +++ b/src/gui/kernel/qguifunctions_wince.h @@ -73,10 +73,6 @@ int qt_wince_GetDIBits(HDC, HBITMAP, uint, uint, void*, LPBITMAPINFO, uint); // QWidget #define SW_SHOWMINIMIZED SW_MINIMIZE -// QPaintEngine -bool qt_wince_TextOutW(HDC, int, int, LPWSTR, UINT); -#define TextOutW(a,b,c,d,e) qt_wince_TextOutW(a,b,c,d,e) - // QRegion #define ALTERNATE 0 #define WINDING 1 @@ -128,7 +124,7 @@ typedef struct tagTTPOLYCURVE #define TT_PRIM_CSPLINE 3 #define ANSI_VAR_FONT 12 -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCTSTR operation, LPCTSTR file, LPCTSTR params, LPCTSTR dir, int showCmd); +HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd); #define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f) @@ -150,8 +146,6 @@ HWND qt_wince_SetClipboardViewer( // Graphics --------------------------------------------------------- COLORREF qt_wince_PALETTEINDEX( WORD wPaletteIndex ); #define PALETTEINDEX(a) qt_wince_PALETTEINDEX(a) -BOOL qt_wince_TextOut( HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cbString ); -#define TextOut(a,b,c,d,e) qt_wince_TextOut(a,b,c,d,e) #endif // Q_OS_WINCE #endif // QGUIFUNCTIONS_WCE_H diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index e40dfa0..3d53f31 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -57,9 +57,7 @@ QT_BEGIN_NAMESPACE // Implemented elsewhere extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); -Q_CORE_EXPORT bool winPostMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -Q_CORE_EXPORT bool winPeekMessage(MSG* msg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, - UINT wRemoveMsg); + extern Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id); #ifndef LANG_PASHTO #define LANG_PASHTO 0x63 @@ -467,12 +465,7 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer, Q_ASSERT(vk > 0 && vk < 256); int code = 0; QChar unicodeBuffer[5]; - int res = 0; - if (QSysInfo::WindowsVersion < QSysInfo::WV_NT) - res = ToAscii(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 0); - else - res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 5, 0); - + int res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 5, 0); if (res) code = unicodeBuffer[0].toUpper().unicode(); @@ -504,38 +497,6 @@ static inline int asciiToKeycode(char a, int state) return a & 0xff; } -static int inputcharset = CP_ACP; -static inline QChar wmchar_to_unicode(DWORD c) -{ - // qt_winMB2QString is the generalization of this function. - QT_WA({ - return QChar((ushort)c); - } , { - char mb[2]; - mb[0] = c & 0xff; - mb[1] = 0; - WCHAR wc[1]; - MultiByteToWideChar(inputcharset, MB_PRECOMPOSED, mb, -1, wc, 1); - return QChar(wc[0]); - }); -} - -static inline QChar imechar_to_unicode(DWORD c) -{ - // qt_winMB2QString is the generalization of this function. - QT_WA({ - return QChar((ushort)c); - } , { - char mb[3]; - mb[0] = (c >> 8) & 0xff; - mb[1] = c & 0xff; - mb[2] = 0; - WCHAR wc[1]; - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, mb, -1, wc, 1); - return QChar(wc[0]); - }); -} - static inline bool isModifierKey(int code) { return (code >= Qt::Key_Shift) && (code <= Qt::Key_ScrollLock); @@ -635,43 +596,15 @@ void QKeyMapperPrivate::clearMappings() /* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout() * returns a DWORD. */ -// LCID newLCID = MAKELCID(DWORD(GetKeyboardLayout(0)), SORT_DEFAULT); + + LCID newLCID = MAKELCID((DWORD)GetKeyboardLayout(0), SORT_DEFAULT); // keyboardInputLocale = qt_localeFromLCID(newLCID); - LCID newLCID = MAKELCID( - reinterpret_cast(GetKeyboardLayout(0)), - SORT_DEFAULT - ); - keyboardInputLocale = qt_localeFromLCID(newLCID); + bool bidi = false; -#ifdef UNICODE - if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000) { - WCHAR wchLCIDFontSig[16]; - if (GetLocaleInfoW(newLCID, - LOCALE_FONTSIGNATURE, - &wchLCIDFontSig[0], - (sizeof(wchLCIDFontSig)/sizeof(WCHAR))) - && (wchLCIDFontSig[7] & (WCHAR)0x0800)) + wchar_t LCIDFontSig[16]; + if (GetLocaleInfo(newLCID, LOCALE_FONTSIGNATURE, LCIDFontSig, sizeof(LCIDFontSig) / sizeof(wchar_t)) + && (LCIDFontSig[7] & (wchar_t)0x0800)) bidi = true; - } else -#endif //UNICODE - { - if (newLCID == 0x0859 || //Sindhi (Arabic script) - newLCID == 0x0460) //Kashmiri (Arabic script) - bidi = true;; - - switch (PRIMARYLANGID(newLCID)) - { - case LANG_ARABIC: - case LANG_HEBREW: - case LANG_URDU: - case LANG_FARSI: - case LANG_PASHTO: - //case LANG_UIGHUR: - case LANG_SYRIAC: - case LANG_DIVEHI: - bidi = true; - } - } keyboardInputDirection = bidi ? Qt::RightToLeft : Qt::LeftToRight; } @@ -760,7 +693,7 @@ void QKeyMapperPrivate::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 keyLayout[vk_key]->qtKey[8] = fallbackKey; // If this vk_key a Dead Key - if (MapVirtualKey(vk_key, 2) & 0x80008000) { // (High-order dead key on Win 95 is 0x8000) + if (MapVirtualKey(vk_key, 2) & 0x80000000) { // Push a Space, then the original key through the low-level ToAscii functions. // We do this because these functions (ToAscii / ToUnicode) will alter the internal state of // the keyboard driver By doing the following, we set the keyboard driver state back to what @@ -837,13 +770,13 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool bool isNumpad = (msg.wParam >= VK_NUMPAD0 && msg.wParam <= VK_NUMPAD9); quint32 nModifiers = 0; - if (QSysInfo::WindowsVersion < QSysInfo::WV_NT || QSysInfo::WindowsVersion & QSysInfo::WV_CE_based) { +#if defined(QT_OS_WINCE) nModifiers |= (GetKeyState(VK_SHIFT ) < 0 ? ShiftAny : 0); nModifiers |= (GetKeyState(VK_CONTROL) < 0 ? ControlAny : 0); nModifiers |= (GetKeyState(VK_MENU ) < 0 ? AltAny : 0); nModifiers |= (GetKeyState(VK_LWIN ) < 0 ? MetaLeft : 0); nModifiers |= (GetKeyState(VK_RWIN ) < 0 ? MetaRight : 0); - } else { +#else // Map native modifiers to some bit representation nModifiers |= (GetKeyState(VK_LSHIFT ) & 0x80 ? ShiftLeft : 0); nModifiers |= (GetKeyState(VK_RSHIFT ) & 0x80 ? ShiftRight : 0); @@ -857,7 +790,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool nModifiers |= (GetKeyState(VK_CAPITAL ) & 0x01 ? CapsLock : 0); nModifiers |= (GetKeyState(VK_NUMLOCK ) & 0x01 ? NumLock : 0); nModifiers |= (GetKeyState(VK_SCROLL ) & 0x01 ? ScrollLock : 0); - } +#endif // QT_OS_WINCE + if (msg.lParam & ExtendedKey) nModifiers |= msg.lParam & ExtendedKey; @@ -870,12 +804,12 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool // Now we know enough to either have MapVirtualKey or our own keymap tell us if it's a deadkey bool isDeadKey = isADeadKey(msg.wParam, state) - || MapVirtualKey(msg.wParam, 2) & 0x80008000; // High-order on 95 is 0x8000 + || MapVirtualKey(msg.wParam, 2) & 0x80000000; // A multi-character key not found by our look-ahead if (msgType == WM_CHAR) { QString s; - QChar ch = wmchar_to_unicode(msg.wParam); + QChar ch = QChar((ushort)msg.wParam); if (!ch.isNull()) s += ch; @@ -886,7 +820,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool // Input method characters not found by our look-ahead else if (msgType == WM_IME_CHAR) { QString s; - QChar ch = imechar_to_unicode(msg.wParam); + QChar ch = QChar((ushort)msg.wParam); if (!ch.isNull()) s += ch; @@ -1050,11 +984,9 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool : msgType == WM_IME_KEYDOWN ? WM_IME_CHAR : WM_SYSCHAR); QChar uch; - if (winPeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) { + if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) { // Found a ?_CHAR - uch = charType == WM_IME_CHAR - ? imechar_to_unicode(wm_char.wParam) - : wmchar_to_unicode(wm_char.wParam); + uch = QChar((ushort)wm_char.wParam); if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN)) uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter if (!code && !uch.row()) @@ -1067,7 +999,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool // to find the correct key using the current message parameters & keyboard state. if (uch.isNull() && msgType == WM_IME_KEYDOWN) { BYTE keyState[256]; - WCHAR newKey[3] = {0}; + wchar_t newKey[3] = {0}; GetKeyboardState(keyState); int val = ToUnicode(vk_key, scancode, keyState, newKey, 2, 0); if (val == 1) { @@ -1085,18 +1017,10 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool uch = QChar(QLatin1Char(0x7f)); // Windows doesn't know this one. } else { if (msgType != WM_SYSKEYDOWN || !code) { - UINT map; - QT_WA({ - map = MapVirtualKey(msg.wParam, 2); - } , { - map = MapVirtualKeyA(msg.wParam, 2); - // High-order bit is 0x8000 on '95 - if (map & 0x8000) - map = (map^0x8000)|0x80000000; - }); + UINT map = MapVirtualKey(msg.wParam, 2); // If the high bit of the return value is set, it's a deadkey if (!(map & 0x80000000)) - uch = wmchar_to_unicode((DWORD)map); + uch = QChar((ushort)map); } } if (!code && !uch.row()) @@ -1237,6 +1161,8 @@ bool QKeyMapper::sendKeyEvent(QWidget *widget, bool grab, if (QApplicationPrivate::instance()->qt_tryAccelEvent(widget, &a)) return true; } +#else + Q_UNUSED(grab); #endif if (!widget->isEnabled()) return false; diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp index bc15638..c7559d8 100644 --- a/src/gui/kernel/qmime_win.cpp +++ b/src/gui/kernel/qmime_win.cpp @@ -281,11 +281,7 @@ QWindowsMime::~QWindowsMime() */ int QWindowsMime::registerMimeType(const QString &mime) { -#ifdef Q_OS_WINCE int f = RegisterClipboardFormat(reinterpret_cast (mime.utf16())); -#else - int f = RegisterClipboardFormatA(mime.toLocal8Bit()); -#endif if (!f) qErrnoWarning("QWindowsMime::registerMimeType: Failed to register clipboard format"); @@ -401,9 +397,9 @@ QStringList QWindowsMime::allMimesForFormats(IDataObject *pDataObj) while (S_OK == fmtenum->Next(1, &fmtetc, 0)) { #if defined(QMIME_DEBUG) && !defined(Q_OS_WINCE) qDebug("QWindowsMime::allMimesForFormats()"); - char buf[256] = {0}; - GetClipboardFormatNameA(fmtetc.cfFormat, buf, 255); - qDebug("CF = %d : %s", fmtetc.cfFormat, buf); + wchar_t buf[256] = {0}; + GetClipboardFormatName(fmtetc.cfFormat, buf, 255); + qDebug("CF = %d : %s", fmtetc.cfFormat, QString::fromWCharArray(buf)); #endif for (int i=mimes.size()-1; i>=0; --i) { QString format = mimes.at(i)->mimeForFormat(fmtetc); @@ -504,7 +500,7 @@ bool QWindowsMimeText::convertFromMime(const FORMATETC &formatetc, const QMimeDa ++u; } res.truncate(ri); - const int byteLength = res.length()*2; + const int byteLength = res.length() * sizeof(ushort); QByteArray r(byteLength + 2, '\0'); memcpy(r.data(), res.unicode(), byteLength); r[byteLength] = 0; @@ -549,7 +545,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData QString str; QByteArray data = getData(CF_UNICODETEXT, pDataObj); if (!data.isEmpty()) { - str = QString::fromUtf16((const unsigned short *)data.data()); + str = QString::fromWCharArray((const wchar_t *)data.data()); str.replace(QLatin1String("\r\n"), QLatin1String("\n")); } else { data = getData(CF_TEXT, pDataObj); @@ -620,11 +616,7 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat for (int i=0; ifNC = true; char* files = ((char*)d) + d->pFiles; - QT_WA({ - d->fWide = true; - TCHAR* f = (TCHAR*)files; - for (int i=0; ifWide = false; - char* f = files; - for (int i=0; ifWide = true; + wchar_t* f = (wchar_t*)files; + for (int i=0; i urls = mimeData->urls(); QByteArray result; QString url = urls.at(0).toString(); - result = QByteArray((const char *)url.utf16(), url.length() * 2); + result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort)); result.append('\0'); result.append('\0'); return setData(result, pmedium); @@ -720,15 +698,15 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD LPDROPFILES hdrop = (LPDROPFILES)data.data(); if (hdrop->fWide) { - const ushort* filesw = (const ushort*)(data.data() + hdrop->pFiles); - int i=0; + const wchar_t* filesw = (const wchar_t *)(data.data() + hdrop->pFiles); + int i = 0; while (filesw[i]) { - QString fileurl = QString::fromUtf16(filesw+i); + QString fileurl = QString::fromWCharArray(filesw + i); urls += QUrl::fromLocalFile(fileurl); i += fileurl.length()+1; } } else { - const char* files = (const char*)data.data() + hdrop->pFiles; + const char* files = (const char *)data.data() + hdrop->pFiles; int i=0; while (files[i]) { urls += QUrl::fromLocalFile(QString::fromLocal8Bit(files+i)); @@ -744,7 +722,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD QByteArray data = getData(CF_INETURL_W, pDataObj); if (data.isEmpty()) return QVariant(); - return QUrl(QString::fromUtf16((const unsigned short *)data.constData())); + return QUrl(QString::fromWCharArray((const wchar_t *)data.constData())); } else if (canGetData(CF_INETURL, pDataObj)) { QByteArray data = getData(CF_INETURL, pDataObj); if (data.isEmpty()) @@ -913,11 +891,7 @@ private: QWindowsMimeImage::QWindowsMimeImage() { -#ifdef Q_OS_WINCE - CF_PNG = RegisterClipboardFormat(reinterpret_cast (QString::fromLatin1("PNG").utf16())); -#else - CF_PNG = RegisterClipboardFormatA("PNG"); -#endif + CF_PNG = RegisterClipboardFormat(L"PNG"); } QVector QWindowsMimeImage::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const @@ -1114,7 +1088,7 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData ++u; } res.truncate(ri); - const int byteLength = res.length()*2; + const int byteLength = res.length() * sizeof(ushort); QByteArray r(byteLength + 2, '\0'); memcpy(r.data(), res.unicode(), byteLength); r[byteLength] = 0; @@ -1154,8 +1128,8 @@ QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDat qDebug("QBuiltInMimes::convertToMime()"); #endif if (mimeType == QLatin1String("text/html") && preferredType == QVariant::String) { - // text/html is in wide chars on windows (compatible with mozillia) - val = QString::fromUtf16((const unsigned short *)data.data()); + // text/html is in wide chars on windows (compatible with Mozilla) + val = QString::fromWCharArray((const wchar_t *)data.data()); } else { val = data; // it should be enough to return the data and let QMimeData do the rest. } @@ -1280,11 +1254,7 @@ bool QLastResortMimes::canConvertToMime(const QString &mimeType, IDataObject *pD { if (isCustomMimeType(mimeType)) { QString clipFormat = customMimeType(mimeType); -#ifdef Q_OS_WINCE int cf = RegisterClipboardFormat(reinterpret_cast (clipFormat.utf16())); -#else - int cf = RegisterClipboardFormatA(clipFormat.toLocal8Bit()); -#endif return canGetData(cf, pDataObj); } else if (formats.keys(mimeType).isEmpty()) { // if it is not in there then register it an see if we can get it @@ -1304,11 +1274,7 @@ QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *p QByteArray data; if (isCustomMimeType(mimeType)) { QString clipFormat = customMimeType(mimeType); -#ifdef Q_OS_WINCE int cf = RegisterClipboardFormat(reinterpret_cast (clipFormat.utf16())); -#else - int cf = RegisterClipboardFormatA(clipFormat.toLocal8Bit()); -#endif data = getData(cf, pDataObj); } else if (formats.keys(mimeType).isEmpty()) { int cf = QWindowsMime::registerMimeType(mimeType); @@ -1325,46 +1291,38 @@ QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *p QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const { QString format = formats.value(getCf(formatetc)); - if (format.isEmpty()) { - QByteArray ba; - QString clipFormat; - int len; - QT_WA({ - ba.resize(256*2); - len = GetClipboardFormatNameW(getCf(formatetc), (TCHAR*)ba.data(), 255); - if (len) - clipFormat = QString::fromUtf16((ushort *)ba.data(), len); - } , { - ba.resize(256); - len = GetClipboardFormatNameA(getCf(formatetc), ba.data(), 255); - if (len) - clipFormat = QString::fromLocal8Bit(ba.data(), len); - }); - if (len) { + if (!format.isEmpty()) + return format; + + wchar_t buffer[256]; + int len = GetClipboardFormatName(getCf(formatetc), buffer, 256); + + if (len) { + QString clipFormat = QString::fromWCharArray(buffer, len); #ifndef QT_NO_DRAGANDDROP - if (QInternalMimeData::canReadData(clipFormat)) - format = clipFormat; - else if((formatetc.cfFormat >= 0xC000)){ - //create the mime as custom. not registered. - if (!excludeList.contains(clipFormat, Qt::CaseInsensitive)) { - //check if this is a mime type - bool ianaType = false; - int sz = ianaTypes.size(); - for (int i = 0; i < sz; i++) { - if (clipFormat.startsWith(ianaTypes[i], Qt::CaseInsensitive)) { - ianaType = true; - break; - } + if (QInternalMimeData::canReadData(clipFormat)) + format = clipFormat; + else if((formatetc.cfFormat >= 0xC000)){ + //create the mime as custom. not registered. + if (!excludeList.contains(clipFormat, Qt::CaseInsensitive)) { + //check if this is a mime type + bool ianaType = false; + int sz = ianaTypes.size(); + for (int i = 0; i < sz; i++) { + if (clipFormat.startsWith(ianaTypes[i], Qt::CaseInsensitive)) { + ianaType = true; + break; } - if (!ianaType) - format = QLatin1String(x_qt_windows_mime) + clipFormat + QLatin1Char('\"'); - else - format = clipFormat; } + if (!ianaType) + format = QLatin1String(x_qt_windows_mime) + clipFormat + QLatin1Char('\"'); + else + format = clipFormat; } -#endif //QT_NO_DRAGANDDROP } +#endif //QT_NO_DRAGANDDROP } + return format; } diff --git a/src/gui/kernel/qsound_win.cpp b/src/gui/kernel/qsound_win.cpp index 7330d4b..82854ae 100644 --- a/src/gui/kernel/qsound_win.cpp +++ b/src/gui/kernel/qsound_win.cpp @@ -77,13 +77,8 @@ public: QAuServerWindows::QAuServerWindows(QObject* parent) : QAuServer(parent), current(0) { - QT_WA({ - mutex = CreateMutexW(0, 0, 0); - event = CreateEventW(0, FALSE, FALSE, 0); - } , { - mutex = CreateMutexA(0, 0, 0); - event = CreateEventA(0, FALSE, FALSE, 0); - }); + mutex = CreateMutex(0, 0, 0); + event = CreateEvent(0, FALSE, FALSE, 0); } QAuServerWindows::~QAuServerWindows() @@ -133,13 +128,9 @@ DWORD WINAPI SoundPlayProc(LPVOID param) if (loops == -1) flags |= SND_LOOP; - QT_WA({ - PlaySoundW((TCHAR*)filename.utf16(), 0, flags); - } , { - PlaySoundA(QFile::encodeName(filename).data(), 0, flags); - }); - if (sound && loops == 1) - server->decLoop(sound); + PlaySound((wchar_t*)filename.utf16(), 0, flags); + if (sound && loops == 1) + server->decLoop(sound); // GUI thread continues, but we are done as well. SetEvent(event); @@ -148,18 +139,13 @@ DWORD WINAPI SoundPlayProc(LPVOID param) QPointer guarded_sound = sound; SetEvent(event); - for (int l = 0; l < loops && server->current; ++l) { - QT_WA( { - PlaySoundW( (TCHAR*)filename.utf16(), 0, SND_FILENAME|SND_SYNC ); - } , { - PlaySoundA( QFile::encodeName(filename).data(), 0, - SND_FILENAME|SND_SYNC ); - } ); - - if (guarded_sound) - server->decLoop(guarded_sound); - } - server->current = 0; + for (int l = 0; l < loops && server->current; ++l) { + PlaySound((wchar_t*)filename.utf16(), 0, SND_FILENAME | SND_SYNC); + + if (guarded_sound) + server->decLoop(guarded_sound); + } + server->current = 0; } ReleaseMutex(mutex); @@ -169,7 +155,7 @@ DWORD WINAPI SoundPlayProc(LPVOID param) void QAuServerWindows::playHelper(const QString &filename, int loop, QSound *snd) { if (loop == 0) - return; + return; // busy? if (WaitForSingleObject(mutex, 0) == WAIT_TIMEOUT) return; diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index 067c783..f38b0f6 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -226,7 +226,9 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor text); } #if defined(Q_WS_WIN) - if ((QSysInfo::WindowsVersion&QSysInfo::WV_NT_based) > QSysInfo::WV_2000) { + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + { BOOL shadow; SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0); shadowWidth = shadow ? 0 : 6; @@ -302,7 +304,9 @@ void QWhatsThat::paintEvent(QPaintEvent*) { bool drawShadow = true; #if defined(Q_WS_WIN) - if ((QSysInfo::WindowsVersion&QSysInfo::WV_NT_based) > QSysInfo::WV_2000) { + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + { BOOL shadow; SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0); drawShadow = !shadow; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 304d72a..1b31318 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -863,8 +863,8 @@ void QWidget::setAutoFillBackground(bool enabled) \list \o X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager. - \o Windows: This feature requires Windows 2000 or later. The widget needs to have - the Qt::FramelessWindowHint window flag set for the translucency to work. + \o Windows: The widget needs to have the Qt::FramelessWindowHint window flag set + for the translucency to work. \endlist @@ -9964,8 +9964,8 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const By default the value of this property is 1.0. - This feature is available on Embedded Linux, Mac OS X, X11 platforms that - support the Composite extension, and Windows 2000 and later. + This feature is available on Embedded Linux, Mac OS X, Windows, + and X11 platforms that support the Composite extension. This feature is not available on Windows CE. diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index e39ca77..dcf541c 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -140,14 +140,8 @@ static void init_wintab_functions() if (!qt_is_gui_used) return; QLibrary library(QLatin1String("wintab32")); - QT_WA({ - ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenW"); - ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW"); - } , { - ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenA"); - ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoA"); - }); - + ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenW"); + ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW"); ptrWTClose = (PtrWTClose)library.resolve("WTClose"); ptrWTQueueSizeGet = (PtrWTQueueSizeGet)library.resolve("WTQueueSizeGet"); ptrWTQueueSizeSet = (PtrWTQueueSizeSet)library.resolve("WTQueueSizeSet"); @@ -287,25 +281,18 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (desktop && !q->testAttribute(Qt::WA_DontShowOnScreen)) { // desktop widget popup = false; // force this flags off - if (QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95) - data.crect.setRect(GetSystemMetrics(76 /* SM_XVIRTUALSCREEN */), GetSystemMetrics(77 /* SM_YVIRTUALSCREEN */), + data.crect.setRect(GetSystemMetrics(76 /* SM_XVIRTUALSCREEN */), GetSystemMetrics(77 /* SM_YVIRTUALSCREEN */), GetSystemMetrics(78 /* SM_CXVIRTUALSCREEN */), GetSystemMetrics(79 /* SM_CYVIRTUALSCREEN */)); - else - data.crect.setRect(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); } parentw = q->parentWidget() ? q->parentWidget()->effectiveWinId() : 0; -#ifdef UNICODE QString title; - const TCHAR *ttitle = 0; -#endif - QByteArray title95; int style = WS_CHILD; int exsty = 0; if (window) { - style = GetWindowLongA(window, GWL_STYLE); + style = GetWindowLong(window, GWL_STYLE); if (!style) qErrnoWarning("QWidget::create: GetWindowLong failed"); topLevel = false; // #### needed for some IE plugins?? @@ -361,12 +348,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } if (flags & Qt::WindowTitleHint) { - QT_WA({ - title = q->isWindow() ? qAppName() : q->objectName(); - ttitle = (TCHAR*)title.utf16(); - } , { - title95 = q->isWindow() ? qAppName().toLocal8Bit() : q->objectName().toLatin1(); - }); + title = q->isWindow() ? qAppName() : q->objectName(); } // The Qt::WA_WState_Created flag is checked by translateConfigEvent() in @@ -379,13 +361,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO destroyw = data.winid; id = window; setWinId(window); - LONG res = SetWindowLongA(window, GWL_STYLE, style); + LONG res = SetWindowLong(window, GWL_STYLE, style); if (!res) qErrnoWarning("QWidget::create: Failed to set window style"); #ifdef _WIN64 - res = SetWindowLongPtrA( window, GWLP_WNDPROC, (LONG_PTR)QtWndProc ); + res = SetWindowLongPtr( window, GWLP_WNDPROC, (LONG_PTR)QtWndProc ); #else - res = SetWindowLongA( window, GWL_WNDPROC, (LONG)QtWndProc ); + res = SetWindowLong( window, GWL_WNDPROC, (LONG)QtWndProc ); #endif if (!res) qErrnoWarning("QWidget::create: Failed to set window procedure"); @@ -436,16 +418,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } } - QT_WA({ - const TCHAR *cname = (TCHAR*)windowClassName.utf16(); - id = CreateWindowEx(exsty, cname, ttitle, style, - x, y, w, h, - parentw, 0, appinst, 0); - } , { - id = CreateWindowExA(exsty, windowClassName.toLatin1(), title95, style, - x, y, w, h, - parentw, 0, appinst, 0); - }); + id = CreateWindowEx(exsty, reinterpret_cast(windowClassName.utf16()), + reinterpret_cast(title.utf16()), style, + x, y, w, h, + parentw, NULL, appinst, NULL); if (!id) qErrnoWarning("QWidget::create: Failed to create window"); setWinId(id); @@ -457,16 +433,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO SetWindowPos(id, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); winUpdateIsOpaque(); } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create child widget - QT_WA({ - const TCHAR *cname = (TCHAR*)windowClassName.utf16(); - id = CreateWindowEx(exsty, cname, ttitle, style, - data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(), - parentw, NULL, appinst, NULL); - } , { - id = CreateWindowExA(exsty, windowClassName.toLatin1(), title95, style, - data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(), + id = CreateWindowEx(exsty, reinterpret_cast(windowClassName.utf16()), + reinterpret_cast(title.utf16()), style, + data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(), parentw, NULL, appinst, NULL); - }); if (!id) qErrnoWarning("QWidget::create: Failed to create window"); SetWindowPos(id, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); @@ -682,7 +652,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // Show borderless toplevel windows in tasklist & NavBar if (!parent) { QString txt = q->windowTitle().isEmpty()?qAppName():q->windowTitle(); - SetWindowText(q->internalWinId(), (TCHAR*)txt.utf16()); + SetWindowText(q->internalWinId(), (wchar_t*)txt.utf16()); } #endif invalidateBuffer(q->rect()); @@ -767,11 +737,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) return; Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QT_WA({ - SetWindowText(q->internalWinId(), (TCHAR*)caption.utf16()); - } , { - SetWindowTextA(q->internalWinId(), caption.toLocal8Bit()); - }); + SetWindowText(q->internalWinId(), (wchar_t*)caption.utf16()); } /* @@ -853,11 +819,11 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), &(x->iconPixmap)); if (x->winIconBig) { - SendMessageA(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall); - SendMessageA(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconBig); + SendMessage(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall); + SendMessage(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconBig); } else { - SendMessageA(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall); - SendMessageA(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconSmall); + SendMessage(q->internalWinId(), WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)x->winIconSmall); + SendMessage(q->internalWinId(), WM_SETICON, 1 /* ICON_BIG */, (LPARAM)x->winIconSmall); } } @@ -884,7 +850,7 @@ LRESULT CALLBACK qJournalRecordProc(int nCode, WPARAM wParam, LPARAM lParam) /* Works only as long as pointer is inside the application's window, which is good enough for QDockWidget. - Doesn't call SetWindowsHookExA() - this function causes a system-wide + Doesn't call SetWindowsHookEx() - this function causes a system-wide freeze if any other app on the system installs a hook and fails to process events. */ void QWidgetPrivate::grabMouseWhileInWindow() @@ -908,7 +874,7 @@ void QWidget::grabMouse() if (!qt_nograb()) { if (mouseGrb) mouseGrb->releaseMouse(); - journalRec = SetWindowsHookExA(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandleA(0), 0); + journalRec = SetWindowsHookEx(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandle(0), 0); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); SetCapture(effectiveWinId()); mouseGrb = this; @@ -921,7 +887,7 @@ void QWidget::grabMouse(const QCursor &cursor) if (!qt_nograb()) { if (mouseGrb) mouseGrb->releaseMouse(); - journalRec = SetWindowsHookExA(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandleA(0), 0); + journalRec = SetWindowsHookEx(WH_JOURNALRECORD, (HOOKPROC)qJournalRecordProc, GetModuleHandle(0), 0); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); SetCapture(effectiveWinId()); mouseGrbCur = new QCursor(cursor); @@ -1028,7 +994,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowFullScreen) { if (d->topData()->normalGeometry.width() < 0 && !(oldstate & Qt::WindowMaximized)) d->topData()->normalGeometry = geometry(); - d->topData()->savedFlags = Qt::WindowFlags(GetWindowLongA(internalWinId(), GWL_STYLE)); + d->topData()->savedFlags = Qt::WindowFlags(GetWindowLong(internalWinId(), GWL_STYLE)); #ifndef Q_FLATTEN_EXPOSE UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; #else @@ -1038,7 +1004,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) style |= WS_SYSMENU; if (isVisible()) style |= WS_VISIBLE; - SetWindowLongA(internalWinId(), GWL_STYLE, style); + SetWindowLong(internalWinId(), GWL_STYLE, style); QRect r = QApplication::desktop()->screenGeometry(this); UINT swpf = SWP_FRAMECHANGED; if (newstate & Qt::WindowActive) @@ -1050,7 +1016,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) UINT style = d->topData()->savedFlags; if (isVisible()) style |= WS_VISIBLE; - SetWindowLongA(internalWinId(), GWL_STYLE, style); + SetWindowLong(internalWinId(), GWL_STYLE, style); UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE; if (newstate & Qt::WindowActive) @@ -1395,7 +1361,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) UINT style = top->savedFlags; if (q->isVisible()) style |= WS_VISIBLE; - SetWindowLongA(q->internalWinId(), GWL_STYLE, style); + SetWindowLong(q->internalWinId(), GWL_STYLE, style); UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE; if (data.window_state & Qt::WindowActive) @@ -1410,7 +1376,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); const bool inTopLevelResize = tlwExtra ? tlwExtra->inTopLevelResize : false; const bool isTranslucentWindow = !isOpaque && ptrUpdateLayeredWindowIndirect && (data.window_flags & Qt::FramelessWindowHint) - && GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED; + && GetWindowLong(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED; if (q->testAttribute(Qt::WA_WState_ConfigPending)) { // processing config event if (q->internalWinId()) @@ -1578,11 +1544,11 @@ void QWidgetPrivate::winUpdateIsOpaque() return; if (!isOpaque && ptrUpdateLayeredWindowIndirect) { - SetWindowLongA(q->internalWinId(), GWL_EXSTYLE, - GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) | Q_WS_EX_LAYERED); + SetWindowLong(q->internalWinId(), GWL_EXSTYLE, + GetWindowLong(q->internalWinId(), GWL_EXSTYLE) | Q_WS_EX_LAYERED); } else { - SetWindowLongA(q->internalWinId(), GWL_EXSTYLE, - GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) & ~Q_WS_EX_LAYERED); + SetWindowLong(q->internalWinId(), GWL_EXSTYLE, + GetWindowLong(q->internalWinId(), GWL_EXSTYLE) & ~Q_WS_EX_LAYERED); } #endif } @@ -1592,12 +1558,12 @@ void QWidgetPrivate::setConstraints_sys() #ifndef Q_WS_WINCE_WM Q_Q(QWidget); if (q->isWindow() && q->testAttribute(Qt::WA_WState_Created)) { - int style = GetWindowLongA(q->internalWinId(), GWL_STYLE); + int style = GetWindowLong(q->internalWinId(), GWL_STYLE); if (shouldShowMaximizeButton()) style |= WS_MAXIMIZEBOX; else style &= ~WS_MAXIMIZEBOX; - SetWindowLongA(q->internalWinId(), GWL_STYLE, style); + SetWindowLong(q->internalWinId(), GWL_STYLE, style); } #endif } @@ -1867,10 +1833,8 @@ void QWidgetPrivate::updateFrameStrut() RECT rect = {0,0,0,0}; QTLWExtra *top = topData(); - uint exstyle = QT_WA_INLINE(GetWindowLongW(q->internalWinId(), GWL_EXSTYLE), - GetWindowLongA(q->internalWinId(), GWL_EXSTYLE)); - uint style = QT_WA_INLINE(GetWindowLongW(q->internalWinId(), GWL_STYLE), - GetWindowLongA(q->internalWinId(), GWL_STYLE)); + uint exstyle = GetWindowLong(q->internalWinId(), GWL_EXSTYLE); + uint style = GetWindowLong(q->internalWinId(), GWL_STYLE); #ifndef Q_WS_WINCE if (AdjustWindowRectEx(&rect, style & ~(WS_OVERLAPPED), FALSE, exstyle)) { #else @@ -1886,11 +1850,10 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level) { Q_Q(QWidget); - if (!isOpaque && ptrUpdateLayeredWindowIndirect && (data.window_flags & Qt::FramelessWindowHint)) { - if (GetWindowLongA(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED) { - Q_BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * level), Q_AC_SRC_ALPHA}; - Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, NULL, NULL, NULL, NULL, 0, &blend, Q_ULW_ALPHA, NULL}; - (*ptrUpdateLayeredWindowIndirect)(q->internalWinId(), &info); + if (!isOpaque && ptrUpdateLayeredWindow && (data.window_flags & Qt::FramelessWindowHint)) { + if (GetWindowLong(q->internalWinId(), GWL_EXSTYLE) & Q_WS_EX_LAYERED) { + BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * level), AC_SRC_ALPHA}; + ptrUpdateLayeredWindow(q->internalWinId(), NULL, NULL, NULL, NULL, NULL, 0, &blend, Q_ULW_ALPHA); } return; } @@ -1906,15 +1869,15 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level) if (!ptrSetLayeredWindowAttributes) return; - int wl = GetWindowLongA(q->internalWinId(), GWL_EXSTYLE); + int wl = GetWindowLong(q->internalWinId(), GWL_EXSTYLE); if (level != 1.0) { if ((wl&Q_WS_EX_LAYERED) == 0) - SetWindowLongA(q->internalWinId(), GWL_EXSTYLE, wl|Q_WS_EX_LAYERED); + SetWindowLong(q->internalWinId(), GWL_EXSTYLE, wl | Q_WS_EX_LAYERED); } else if (wl&Q_WS_EX_LAYERED) { - SetWindowLongA(q->internalWinId(), GWL_EXSTYLE, wl & ~Q_WS_EX_LAYERED); + SetWindowLong(q->internalWinId(), GWL_EXSTYLE, wl & ~Q_WS_EX_LAYERED); } - (*ptrSetLayeredWindowAttributes)(q->internalWinId(), 0, (int)(level * 255), Q_LWA_ALPHA); + ptrSetLayeredWindowAttributes(q->internalWinId(), 0, (int)(level * 255), Q_LWA_ALPHA); } #endif //Q_WS_WINCE diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index 24d8156..b0eaa12 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -188,11 +188,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO parentw = q->parentWidget() ? q->parentWidget()->effectiveWinId() : 0; -#ifdef UNICODE QString title; - const TCHAR *ttitle = 0; -#endif - QByteArray title95; int style = WS_CHILD; int exsty = WS_EX_NOPARENTNOTIFY; @@ -236,12 +232,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } if (flags & Qt::WindowTitleHint) { - QT_WA({ - title = q->isWindow() ? qAppName() : q->objectName(); - ttitle = (TCHAR*)title.utf16(); - } , { - title95 = q->isWindow() ? qAppName().toLocal8Bit() : q->objectName().toLatin1(); - }); + title = q->isWindow() ? qAppName() : q->objectName(); } // The Qt::WA_WState_Created flag is checked by translateConfigEvent() in @@ -254,11 +245,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO destroyw = data.winid; id = window; setWinId(window); - LONG res = SetWindowLongA(window, GWL_STYLE, style); + LONG res = SetWindowLong(window, GWL_STYLE, style); if (!res) qErrnoWarning("QWidget::create: Failed to set window style"); - res = SetWindowLongA( window, GWL_WNDPROC, (LONG)QtWndProc ); + res = SetWindowLong( window, GWL_WNDPROC, (LONG)QtWndProc ); if (!res) qErrnoWarning("QWidget::create: Failed to set window procedure"); @@ -267,10 +258,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (!id) { //Create a dummy desktop RECT r; SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0); - const TCHAR *cname = reinterpret_cast (windowClassName.utf16()); - id = CreateWindow(cname, ttitle, style, - r.left, r.top, r.right - r.left, r.bottom - r.top, - 0, 0, appinst, 0); + id = CreateWindow(reinterpret_cast(windowClassName.utf16()), + reinterpret_cast(title.utf16()), style, + r.left, r.top, r.right - r.left, r.bottom - r.top, + 0, 0, appinst, 0); } setWinId(id); } else if (topLevel) { // create top-level widget @@ -303,8 +294,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } } - const TCHAR *cname = reinterpret_cast (windowClassName.utf16()); - id = CreateWindowEx(exsty, cname, ttitle, style, + id = CreateWindowEx(exsty, reinterpret_cast(windowClassName.utf16()), + reinterpret_cast(title.utf16()), style, x, y, w, h, 0, 0, appinst, 0); @@ -314,16 +305,9 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if ((flags & Qt::WindowStaysOnTopHint) || (type == Qt::ToolTip)) SetWindowPos(id, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create child widget - QT_WA({ - const TCHAR *cname = (TCHAR*)windowClassName.utf16(); - id = CreateWindowEx(exsty, cname, ttitle, style, - data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(), - parentw, NULL, appinst, NULL); - } , { - id = CreateWindowExA(exsty, windowClassName.toLatin1(), title95, style, - data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(), + id = CreateWindowEx(exsty, (wchar_t*)windowClassName.utf16(), (wchar_t*)title.utf16(), style, + data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(), parentw, NULL, appinst, NULL); - }); if (!id) qErrnoWarning("QWidget::create: Failed to create window"); SetWindowPos(id, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); @@ -510,7 +494,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) } if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) { if (!(newstate & Qt::WindowMaximized)) { - int style = GetWindowLongW(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION; + int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION; SetWindowLong(internalWinId(), GWL_STYLE, style); SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~ WS_EX_NODRAG); } @@ -535,11 +519,11 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowFullScreen) { if (d->topData()->normalGeometry.width() < 0 && !(oldstate & Qt::WindowMaximized)) d->topData()->normalGeometry = geometry(); - d->topData()->savedFlags = (Qt::WindowFlags) GetWindowLongA(internalWinId(), GWL_STYLE); + d->topData()->savedFlags = (Qt::WindowFlags)GetWindowLong(internalWinId(), GWL_STYLE); UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; if (isVisible()) style |= WS_VISIBLE; - SetWindowLongA(internalWinId(), GWL_STYLE, style); + SetWindowLong(internalWinId(), GWL_STYLE, style); QRect r = qApp->desktop()->screenGeometry(this); UINT swpf = SWP_FRAMECHANGED; if (newstate & Qt::WindowActive) @@ -550,7 +534,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) UINT style = d->topData()->savedFlags; if (isVisible()) style |= WS_VISIBLE; - SetWindowLongA(internalWinId(), GWL_STYLE, style); + SetWindowLong(internalWinId(), GWL_STYLE, style); UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE; if (newstate & Qt::WindowActive) swpf |= SWP_NOACTIVATE; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 664751a..a6ecd4e 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1923,7 +1923,7 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t #ifdef Q_WS_WIN if (ti.fontEngine->type() == QFontEngine::Win) { QFontEngineWin *fe = static_cast(ti.fontEngine); - size = fe->tm.w.tmHeight; + size = fe->tm.tmHeight; } #endif diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index c1edcb3..b267860 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -655,7 +655,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) #ifdef Q_WS_WIN if (ti.fontEngine->type() == QFontEngine::Win) { QFontEngineWin *fe = static_cast(ti.fontEngine); - size = fe->tm.w.tmHeight; + size = fe->tm.tmHeight; } #endif int synthesized = ti.fontEngine->synthesized(); diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index f36028f..7b99e2f 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -199,33 +199,18 @@ bool QWin32PrintEngine::begin(QPaintDevice *pdev) if (d->printToFile && d->fileName.isEmpty()) d->fileName = d->port; - QT_WA({ - d->devModeW()->dmCopies = d->num_copies; - DOCINFO di; - memset(&di, 0, sizeof(DOCINFO)); - di.cbSize = sizeof(DOCINFO); - di.lpszDocName = reinterpret_cast(d->docName.utf16()); - if (d->printToFile && !d->fileName.isEmpty()) - di.lpszOutput = reinterpret_cast(d->fileName.utf16()); - if (ok && StartDoc(d->hdc, &di) == SP_ERROR) { - qErrnoWarning("QWin32PrintEngine::begin: StartDoc failed"); - ok = false; - } - } , { - d->devModeA()->dmCopies = d->num_copies; - DOCINFOA di; - memset(&di, 0, sizeof(DOCINFOA)); - di.cbSize = sizeof(DOCINFOA); - QByteArray docNameA = d->docName.toLocal8Bit(); - di.lpszDocName = docNameA.data(); - QByteArray outfileA = d->fileName.toLocal8Bit(); - if (d->printToFile && !d->fileName.isEmpty()) - di.lpszOutput = outfileA; - if (ok && StartDocA(d->hdc, &di) == SP_ERROR) { - qErrnoWarning("QWin32PrintEngine::begin: StartDoc failed"); - ok = false; - } - }); + d->devMode->dmCopies = d->num_copies; + + DOCINFO di; + memset(&di, 0, sizeof(DOCINFO)); + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = reinterpret_cast(d->docName.utf16()); + if (d->printToFile && !d->fileName.isEmpty()) + di.lpszOutput = reinterpret_cast(d->fileName.utf16()); + if (ok && StartDoc(d->hdc, &di) == SP_ERROR) { + qErrnoWarning("QWin32PrintEngine::begin: StartDoc failed"); + ok = false; + } if (StartPage(d->hdc) <= 0) { qErrnoWarning("QWin32PrintEngine::begin: StartPage failed"); @@ -317,11 +302,6 @@ bool QWin32PrintEngine::newPage() bool success = false; if (d->hdc && d->state == QPrinter::Active) { -// bool restorePainter = false; -// if ((qWinVersion()& Qt::WV_DOS_based) && painter && painter->isActive()) { -// painter->save(); // EndPage/StartPage ruins the DC -// restorePainter = true; -// } if (EndPage(d->hdc) != SP_ERROR) { // reinitialize the DC before StartPage if needed, // because resetdc is disabled between calls to the StartPage and EndPage functions @@ -337,16 +317,10 @@ bool QWin32PrintEngine::newPage() } success = (StartPage(d->hdc) != SP_ERROR); } - if (!success) + if (!success) { d->state = QPrinter::Aborted; - -// if (qWinVersion() & Qt::WV_DOS_based) -// if (restorePainter) { -// painter->restore(); -// } - - if (!success) return false; + } } return true; } @@ -369,7 +343,7 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem QRgb brushColor = state->pen().brush().color().rgb(); bool fallBack = state->pen().brush().style() != Qt::SolidPattern || qAlpha(brushColor) != 0xff - || QT_WA_INLINE(d->txop >= QTransform::TxProject, d->txop >= QTransform::TxScale) + || d->txop >= QTransform::TxProject || ti.fontEngine->type() != QFontEngine::Win; @@ -380,17 +354,10 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem SelectObject(d->hdc, fe->hfont); if (GetDeviceCaps(d->hdc, TECHNOLOGY) != DT_CHARSTREAM) { - QT_WA({ - TCHAR n[64]; - GetTextFaceW(d->hdc, 64, n); - fallBack = QString::fromUtf16((ushort *)n) - != QString::fromUtf16((ushort *)fe->logfont.lfFaceName); - } , { - char an[64]; - GetTextFaceA(d->hdc, 64, an); - fallBack = QString::fromLocal8Bit(an) - != QString::fromLocal8Bit(((LOGFONTA*)(&fe->logfont))->lfFaceName); - }); + wchar_t n[64]; + GetTextFace(d->hdc, 64, n); + fallBack = QString::fromWCharArray(n) + != QString::fromWCharArray(fe->logfont.lfFaceName); } } @@ -983,22 +950,14 @@ void QWin32PrintEnginePrivate::queryDefault() * Strings "windows" and "device" are specified in the MSDN under EnumPrinters() */ QString noPrinters(QLatin1String("qt_no_printers")); - QString output; - QT_WA({ - ushort buffer[256]; - GetProfileStringW(L"windows", L"device", - reinterpret_cast(noPrinters.utf16()), - reinterpret_cast(buffer), 256); - output = QString::fromUtf16(buffer); - if (output.isEmpty() || output == noPrinters) // no printers - return; - }, { - char buffer[256]; - GetProfileStringA("windows", "device", noPrinters.toLatin1(), buffer, 256); - output = QString::fromLocal8Bit(buffer); - if (output.isEmpty() || output == noPrinters) // no printers - return; - }); + wchar_t buffer[256]; + GetProfileString(L"windows", L"device", + reinterpret_cast(noPrinters.utf16()), + buffer, 256); + QString output = QString::fromWCharArray(buffer); + if (output.isEmpty() || output == noPrinters) // no printers + return; + QStringList info = output.split(QLatin1Char(',')); if (info.size() > 0) { if (name.isEmpty()) @@ -1030,13 +989,7 @@ void QWin32PrintEnginePrivate::initialize() txop = QTransform::TxNone; - bool ok; - QT_WA( { - ok = OpenPrinterW((LPWSTR)name.utf16(), (LPHANDLE)&hPrinter, 0); - }, { - ok = OpenPrinterA((LPSTR)name.toLatin1().data(), (LPHANDLE)&hPrinter, 0); - } ); - + bool ok = OpenPrinter((LPWSTR)name.utf16(), (LPHANDLE)&hPrinter, 0); if (!ok) { qErrnoWarning("QWin32PrintEngine::initialize: OpenPrinter failed"); return; @@ -1045,22 +998,10 @@ void QWin32PrintEnginePrivate::initialize() // Fetch the PRINTER_INFO_2 with DEVMODE data containing the // printer settings. DWORD infoSize, numBytes; - ok = true; - QT_WA( { - GetPrinterW(hPrinter, 2, NULL, 0, &infoSize); - hMem = GlobalAlloc(GHND, infoSize); - pInfo = GlobalLock(hMem); - if (!GetPrinterW(hPrinter, 2, (LPBYTE)pInfo, infoSize, &numBytes)) { - ok = false; - } - }, { - GetPrinterA(hPrinter, 2, NULL, 0, &infoSize); - hMem = GlobalAlloc(GHND, infoSize); - pInfo = GlobalLock(hMem); - if (!GetPrinterA(hPrinter, 2, (LPBYTE)pInfo, infoSize, &numBytes)) { - ok = false; - } - }); + GetPrinter(hPrinter, 2, NULL, 0, &infoSize); + hMem = GlobalAlloc(GHND, infoSize); + pInfo = (PRINTER_INFO_2*) GlobalLock(hMem); + ok = GetPrinter(hPrinter, 2, (LPBYTE)pInfo, infoSize, &numBytes); if (!ok) { qErrnoWarning("QWin32PrintEngine::initialize: GetPrinter failed"); @@ -1073,28 +1014,15 @@ void QWin32PrintEnginePrivate::initialize() return; } - QT_WA( { - devMode = pInfoW()->pDevMode; - }, { - devMode = pInfoA()->pDevMode; - } ); - - QT_WA( { - hdc = CreateDC(reinterpret_cast(program.utf16()), - reinterpret_cast(name.utf16()), 0, devModeW()); - }, { - hdc = CreateDCA(program.toLatin1(), name.toLatin1(), 0, devModeA()); - } ); + devMode = pInfo->pDevMode; + hdc = CreateDC(reinterpret_cast(program.utf16()), + reinterpret_cast(name.utf16()), 0, devMode); Q_ASSERT(hPrinter); Q_ASSERT(pInfo); if (devMode) { - QT_WA( { - num_copies = devModeW()->dmCopies; - }, { - num_copies = devModeA()->dmCopies; - } ); + num_copies = devMode->dmCopies; } initHDC(); @@ -1212,28 +1140,18 @@ void QWin32PrintEnginePrivate::release() QList QWin32PrintEnginePrivate::queryResolutions() const { // Read the supported resolutions of the printer. - DWORD numRes; - LONG *enumRes; - DWORD errRes; QList list; - QT_WA({ - numRes = DeviceCapabilities(reinterpret_cast(name.utf16()), - reinterpret_cast(port.utf16()), - DC_ENUMRESOLUTIONS, 0, 0); - if (numRes == (DWORD)-1) - return list; - enumRes = (LONG*)malloc(numRes * 2 * sizeof(LONG)); - errRes = DeviceCapabilities(reinterpret_cast(name.utf16()), - reinterpret_cast(port.utf16()), - DC_ENUMRESOLUTIONS, (LPWSTR)enumRes, 0); - }, { - numRes = DeviceCapabilitiesA(name.toLocal8Bit(), port.toLocal8Bit(), DC_ENUMRESOLUTIONS, 0, 0); - if (numRes == (DWORD)-1) - return list; - enumRes = (LONG*)malloc(numRes * 2 * sizeof(LONG)); - errRes = DeviceCapabilitiesA(name.toLocal8Bit(), port.toLocal8Bit(), DC_ENUMRESOLUTIONS, (LPSTR)enumRes, 0); - }); + DWORD numRes = DeviceCapabilities(reinterpret_cast(name.utf16()), + reinterpret_cast(port.utf16()), + DC_ENUMRESOLUTIONS, 0, 0); + if (numRes == (DWORD)-1) + return list; + + LONG *enumRes = (LONG*)malloc(numRes * 2 * sizeof(LONG)); + DWORD errRes = DeviceCapabilities(reinterpret_cast(name.utf16()), + reinterpret_cast(port.utf16()), + DC_ENUMRESOLUTIONS, (LPWSTR)enumRes, 0); if (errRes == (DWORD)-1) { qErrnoWarning("QWin32PrintEngine::queryResolutions: DeviceCapabilities failed"); @@ -1241,7 +1159,8 @@ QList QWin32PrintEnginePrivate::queryResolutions() const } for (uint i=0; idevMode) break; - short collate = value.toBool() ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; - QT_WA( { d->devModeW()->dmCollate = collate; }, - { d->devModeA()->dmCollate = collate; } ); + d->devMode->dmCollate = value.toBool() ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; d->doReinit(); } break; @@ -1296,8 +1213,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & { if (!d->devMode) break; - int cm = value.toInt() == QPrinter::Color ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; - QT_WA( { d->devModeW()->dmColor = cm; }, { d->devModeA()->dmColor = cm; } ); + d->devMode->dmColor = (value.toInt() == QPrinter::Color) ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; d->doReinit(); } break; @@ -1323,8 +1239,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & if (!d->devMode) break; d->num_copies = value.toInt(); - QT_WA( { d->devModeW()->dmCopies = d->num_copies; }, - { d->devModeA()->dmCopies = d->num_copies; }); + d->devMode->dmCopies = d->num_copies; d->doReinit(); break; @@ -1333,14 +1248,8 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & if (!d->devMode) break; int orientation = value.toInt() == QPrinter::Landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; - int old_orientation; - QT_WA( { - old_orientation = d->devModeW()->dmOrientation; - d->devModeW()->dmOrientation = orientation; - }, { - old_orientation = d->devModeA()->dmOrientation; - d->devModeA()->dmOrientation = orientation; - } ); + int old_orientation = d->devMode->dmOrientation; + d->devMode->dmOrientation = orientation; if (d->has_custom_paper_size && old_orientation != orientation) d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width()); d->doReinit(); @@ -1359,11 +1268,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & case PPK_PaperSize: if (!d->devMode) break; - QT_WA( { - d->devModeW()->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt())); - }, { - d->devModeA()->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt())); - } ); + d->devMode->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt())); d->has_custom_paper_size = (QPrinter::PaperSize(value.toInt()) == QPrinter::Custom); d->doReinit(); break; @@ -1378,11 +1283,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & if (v.contains(value)) dmMapped = mapPaperSourceDevmode(QPrinter::PaperSource(value.toInt())); - QT_WA( { - d->devModeW()->dmDefaultSource = dmMapped; - }, { - d->devModeA()->dmDefaultSource = dmMapped; - } ); + d->devMode->dmDefaultSource = dmMapped; d->doReinit(); } break; @@ -1416,11 +1317,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & if (!d->devMode) break; d->has_custom_paper_size = false; - QT_WA( { - d->devModeW()->dmPaperSize = value.toInt(); - }, { - d->devModeA()->dmPaperSize = value.toInt(); - } ); + d->devMode->dmPaperSize = value.toInt(); d->doReinit(); break; @@ -1430,33 +1327,28 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->paper_size = value.toSizeF(); if (!d->devMode) break; - int orientation; - QT_WA( { - orientation = d->devModeW()->dmOrientation; - DWORD needed = 0; - DWORD returned = 0; - if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) { - BYTE *forms = (BYTE *) malloc(needed); - if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) { - for (DWORD i=0; i< returned; ++i) { - FORM_INFO_1 *formArray = reinterpret_cast(forms); - // the form sizes are specified in 1000th of a mm, - // convert the size to Points - QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0, - (formArray[i].Size.cy * 72/25.4)/1000.0); - if (qAbs(d->paper_size.width() - size.width()) <= 2 - && qAbs(d->paper_size.height() - size.height()) <= 2) - { - d->devModeW()->dmPaperSize = i+1; - break; - } + int orientation = d->devMode->dmOrientation; + DWORD needed = 0; + DWORD returned = 0; + if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) { + BYTE *forms = (BYTE *) malloc(needed); + if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) { + for (DWORD i=0; i< returned; ++i) { + FORM_INFO_1 *formArray = reinterpret_cast(forms); + // the form sizes are specified in 1000th of a mm, + // convert the size to Points + QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0, + (formArray[i].Size.cy * 72/25.4)/1000.0); + if (qAbs(d->paper_size.width() - size.width()) <= 2 + && qAbs(d->paper_size.height() - size.height()) <= 2) + { + d->devMode->dmPaperSize = i + 1; + break; } } - free(forms); } - }, { - orientation = d->devModeA()->dmOrientation; - } ); + free(forms); + } if (orientation != DMORIENT_PORTRAIT) d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width()); break; @@ -1496,13 +1388,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const if (!d->devMode) { value = QPrinter::Color; } else { - int mode; - QT_WA( { - mode = d->devModeW()->dmColor; - }, { - mode = d->devModeA()->dmColor; - } ); - value = mode == DMCOLOR_COLOR ? QPrinter::Color : QPrinter::GrayScale; + value = (d->devMode->dmColor == DMCOLOR_COLOR) ? QPrinter::Color : QPrinter::GrayScale; } } break; @@ -1524,9 +1410,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const if (!d->devMode) { value = QPrinter::Portrait; } else { - int o; - QT_WA( { o = d->devModeW()->dmOrientation; }, { o = d->devModeA()->dmOrientation; } ); - value = o == DMORIENT_LANDSCAPE ? QPrinter::Landscape : QPrinter::Portrait; + value = (d->devMode->dmOrientation == DMORIENT_LANDSCAPE) ? QPrinter::Landscape : QPrinter::Portrait; } } break; @@ -1560,11 +1444,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const if (!d->devMode) { value = QPrinter::A4; } else { - QT_WA( { - value = mapDevmodePaperSize(d->devModeW()->dmPaperSize); - }, { - value = mapDevmodePaperSize(d->devModeA()->dmPaperSize); - } ); + value = mapDevmodePaperSize(d->devMode->dmPaperSize); } } break; @@ -1583,11 +1463,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const if (!d->devMode) { value = QPrinter::Auto; } else { - QT_WA( { - value = mapDevmodePaperSource(d->devModeW()->dmDefaultSource); - }, { - value = mapDevmodePaperSource(d->devModeA()->dmDefaultSource); - } ); + value = mapDevmodePaperSource(d->devMode->dmDefaultSource); } break; @@ -1608,38 +1484,21 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const if (!d->devMode) { value = -1; } else { - QT_WA( { - value = d->devModeW()->dmPaperSize; - }, { - value = d->devModeA()->dmPaperSize; - } ); + value = d->devMode->dmPaperSize; } break; case PPK_PaperSources: { - int available, count; - WORD *data; - - QT_WA({ - available = DeviceCapabilitiesW((const WCHAR *)d->name.utf16(), (const WCHAR *)d->port.utf16(), DC_BINS, 0, - d->devModeW()); - }, { - available = DeviceCapabilitiesA(d->name.toLatin1(), d->port.toLatin1(), DC_BINS, 0, - d->devModeA()); - }); + int available = DeviceCapabilities((const wchar_t *)d->name.utf16(), + (const wchar_t *)d->port.utf16(), DC_BINS, 0, d->devMode); if (available <= 0) break; - data = (WORD *) malloc(available * sizeof(WORD)); - QT_WA({ - count = DeviceCapabilitiesW((const WCHAR *)d->name.utf16(), (const WCHAR *)d->port.utf16(), DC_BINS, (WCHAR *)data, - d->devModeW()); - }, { - count = DeviceCapabilitiesA(d->name.toLatin1(), d->port.toLatin1(), DC_BINS, - (char *) data, d->devModeA()); - }); + wchar_t *data = new wchar_t[available]; + int count = DeviceCapabilities((const wchar_t *)d->name.utf16(), + (const wchar_t *)d->port.utf16(), DC_BINS, data, d->devMode); QList out; for (int i=0; iwDriverOffset = sizeof(DEVNAMES) / sizeof(TCHAR); - dn->wDeviceOffset = dn->wDriverOffset + program.length() + 1; - dn->wOutputOffset = dn->wDeviceOffset + name.length() + 1; + dn->wDriverOffset = sizeof(DEVNAMES) / sizeof(wchar_t); + dn->wDeviceOffset = dn->wDriverOffset + program.length() + 1; + dn->wOutputOffset = dn->wDeviceOffset + name.length() + 1; - memcpy((ushort*)dn + dn->wDriverOffset, program.utf16(), program.length() * 2 + 2); - memcpy((ushort*)dn + dn->wDeviceOffset, name.utf16(), name.length() * 2 + 2); - memcpy((ushort*)dn + dn->wOutputOffset, port.utf16(), port.length() * 2 + 2); - dn->wDefault = 0; + memcpy((ushort*)dn + dn->wDriverOffset, program.utf16(), program.length() * 2 + 2); + memcpy((ushort*)dn + dn->wDeviceOffset, name.utf16(), name.length() * 2 + 2); + memcpy((ushort*)dn + dn->wOutputOffset, port.utf16(), port.length() * 2 + 2); + dn->wDefault = 0; - GlobalUnlock(hGlobal); + GlobalUnlock(hGlobal); // printf("QPrintDialogWinPrivate::createDevNames()\n" // " -> wDriverOffset: %d\n" @@ -1721,89 +1580,46 @@ HGLOBAL *QWin32PrintEnginePrivate::createDevNames() // dn->wOutputOffset); // printf("QPrintDialogWinPrivate::createDevNames(): %s, %s, %s\n", -// QString::fromUtf16((ushort*)(dn) + dn->wDriverOffset).latin1(), -// QString::fromUtf16((ushort*)(dn) + dn->wDeviceOffset).latin1(), -// QString::fromUtf16((ushort*)(dn) + dn->wOutputOffset).latin1()); - - return hGlobal; - }, { - int size = sizeof(DEVNAMES) - + program.length() + 2 - + name.length() + 2 - + port.length() + 2; - HGLOBAL *hGlobal = (HGLOBAL *) GlobalAlloc(GMEM_MOVEABLE, size); - DEVNAMES *dn = (DEVNAMES*) GlobalLock(hGlobal); - - dn->wDriverOffset = sizeof(DEVNAMES); - dn->wDeviceOffset = dn->wDriverOffset + program.length() + 1; - dn->wOutputOffset = dn->wDeviceOffset + name.length() + 1; - - memcpy((char*)dn + dn->wDriverOffset, program.toLatin1(), program.length() + 2); - memcpy((char*)dn + dn->wDeviceOffset, name.toLatin1(), name.length() + 2); - memcpy((char*)dn + dn->wOutputOffset, port.toLatin1(), port.length() + 2); - dn->wDefault = 0; - - GlobalUnlock(hGlobal); - return hGlobal; - } ); +// QString::fromWCharArray((wchar_t*)(dn) + dn->wDriverOffset).latin1(), +// QString::fromWCharArray((wchar_t*)(dn) + dn->wDeviceOffset).latin1(), +// QString::fromWCharArray((wchar_t*)(dn) + dn->wOutputOffset).latin1()); + + return hGlobal; } void QWin32PrintEnginePrivate::readDevnames(HGLOBAL globalDevnames) { if (globalDevnames) { - QT_WA( { - DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevnames); - name = QString::fromUtf16((ushort*)(dn) + dn->wDeviceOffset); - port = QString::fromUtf16((ushort*)(dn) + dn->wOutputOffset); - program = QString::fromUtf16((ushort*)(dn) + dn->wDriverOffset); - GlobalUnlock(globalDevnames); - }, { - DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevnames); - name = QString::fromLatin1((char*)(dn) + dn->wDeviceOffset); - port = QString::fromLatin1((char*)(dn) + dn->wOutputOffset); - program = QString::fromLatin1((char*)(dn) + dn->wDriverOffset); - GlobalUnlock(globalDevnames); - } ); + DEVNAMES *dn = (DEVNAMES*) GlobalLock(globalDevnames); + name = QString::fromWCharArray((wchar_t*)(dn) + dn->wDeviceOffset); + port = QString::fromWCharArray((wchar_t*)(dn) + dn->wOutputOffset); + program = QString::fromWCharArray((wchar_t*)(dn) + dn->wDriverOffset); + GlobalUnlock(globalDevnames); } } void QWin32PrintEnginePrivate::readDevmode(HGLOBAL globalDevmode) { if (globalDevmode) { - QT_WA( { - DEVMODE *dm = (DEVMODE*) GlobalLock(globalDevmode); - release(); - globalDevMode = globalDevmode; - devMode = dm; - hdc = CreateDC(reinterpret_cast(program.utf16()), - reinterpret_cast(name.utf16()), 0, dm); - - num_copies = devModeW()->dmCopies; - if (!OpenPrinterW((LPWSTR)name.utf16(), (LPHANDLE)&hPrinter, 0)) - qWarning("QPrinter: OpenPrinter() failed after reading DEVMODE."); - }, { - DEVMODEA *dm = (DEVMODEA*) GlobalLock(globalDevmode); - release(); - globalDevMode = globalDevmode; - devMode = dm; - hdc = CreateDCA(program.toLatin1(), name.toLatin1(), 0, dm); - - num_copies = devModeA()->dmCopies; - if (!OpenPrinterA((LPSTR)name.toLatin1().data(), (LPHANDLE)&hPrinter, 0)) - qWarning("QPrinter: OpenPrinter() failed after reading DEVMODE."); - } ); + DEVMODE *dm = (DEVMODE*) GlobalLock(globalDevmode); + release(); + globalDevMode = globalDevmode; + devMode = dm; + hdc = CreateDC(reinterpret_cast(program.utf16()), + reinterpret_cast(name.utf16()), 0, dm); + + num_copies = devMode->dmCopies; + if (!OpenPrinter((wchar_t*)name.utf16(), &hPrinter, 0)) + qWarning("QPrinter: OpenPrinter() failed after reading DEVMODE."); } if (hdc) initHDC(); } -static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC hdc, +static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC hdc, bool convertToText, const QTransform &xform, const QPointF &topLeft) { - - // Make sure we translate for systems that can't handle world transforms - QPointF pos(QT_WA_INLINE(_pos, _pos + QPointF(xform.dx(), xform.dy()))); QFontEngine *fe = ti.fontEngine; QPointF baseline_pos = xform.inverted().map(xform.map(pos) - topLeft); @@ -1815,12 +1631,10 @@ static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC HFONT hfont; bool ttf = false; - bool useTextOutA = false; if (winfe) { hfont = winfe->hfont; ttf = winfe->ttf; - useTextOutA = winfe->useTextOutA; } else { hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); } @@ -1830,153 +1644,115 @@ static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC wchar_t *convertedGlyphs = (wchar_t *)ti.chars; QGlyphLayout glyphs = ti.glyphs; - if (!(ti.flags & QTextItem::RightToLeft) && useTextOutA) { - qreal x = pos.x(); - qreal y = pos.y(); - - // hack to get symbol fonts working on Win95. See also QFontEngine constructor - // can only happen if !ttf - for(int i = 0; i < glyphs.numGlyphs; i++) { - QString str(QChar(glyphs.glyphs[i])); - QT_WA({ - TextOutW(hdc, qRound(x + glyphs.offsets[i].x.toReal()), - qRound(y + glyphs.offsets[i].y.toReal()), - (LPWSTR)str.utf16(), str.length()); - } , { - QByteArray cstr = str.toLocal8Bit(); - TextOutA(hdc, qRound(x + glyphs.offsets[i].x.toReal()), - qRound(y + glyphs.offsets[i].y.toReal()), - cstr.data(), cstr.length()); - }); - x += glyphs.effectiveAdvance(i).toReal(); - } - } else { - bool fast = !has_kerning && !(ti.flags & QTextItem::RightToLeft); - for(int i = 0; fast && i < glyphs.numGlyphs; i++) { - if (glyphs.offsets[i].x != 0 || glyphs.offsets[i].y != 0 || glyphs.justifications[i].space_18d6 != 0 - || glyphs.attributes[i].dontPrint) { - fast = false; - break; - } + bool fast = !has_kerning && !(ti.flags & QTextItem::RightToLeft); + for (int i = 0; fast && i < glyphs.numGlyphs; i++) { + if (glyphs.offsets[i].x != 0 || glyphs.offsets[i].y != 0 || glyphs.justifications[i].space_18d6 != 0 + || glyphs.attributes[i].dontPrint) { + fast = false; + break; } + } #if !defined(Q_OS_WINCE) - // Scale, rotate and translate here. This is only valid for systems > Windows Me. - // We should never get here on Windows Me or lower if the transformation specifies - // scaling or rotation. - QT_WA({ - XFORM win_xform; - win_xform.eM11 = xform.m11(); - win_xform.eM12 = xform.m12(); - win_xform.eM21 = xform.m21(); - win_xform.eM22 = xform.m22(); - win_xform.eDx = xform.dx(); - win_xform.eDy = xform.dy(); - SetGraphicsMode(hdc, GM_ADVANCED); - SetWorldTransform(hdc, &win_xform); - }, { - // nothing - }); + // Scale, rotate and translate here. + XFORM win_xform; + win_xform.eM11 = xform.m11(); + win_xform.eM12 = xform.m12(); + win_xform.eM21 = xform.m21(); + win_xform.eM22 = xform.m22(); + win_xform.eDx = xform.dx(); + win_xform.eDy = xform.dy(); + + SetGraphicsMode(hdc, GM_ADVANCED); + SetWorldTransform(hdc, &win_xform); #endif - if (fast) { - // fast path - QVarLengthArray g(glyphs.numGlyphs); - for (int i = 0; i < glyphs.numGlyphs; ++i) - g[i] = glyphs.glyphs[i]; - ExtTextOutW(hdc, - qRound(baseline_pos.x() + glyphs.offsets[0].x.toReal()), - qRound(baseline_pos.y() + glyphs.offsets[0].y.toReal()), - options, 0, convertToText ? convertedGlyphs : g.data(), glyphs.numGlyphs, 0); - } else { - QVarLengthArray positions; - QVarLengthArray _glyphs; - - QTransform matrix = QTransform::fromTranslate(baseline_pos.x(), baseline_pos.y()); - ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, - _glyphs, positions); - if (_glyphs.size() == 0) { - SelectObject(hdc, old_font); - return; - } - - convertToText = convertToText && glyphs.numGlyphs == _glyphs.size(); - - bool outputEntireItem = (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) - && QSysInfo::WindowsVersion != QSysInfo::WV_NT - && _glyphs.size() > 0; + if (fast) { + // fast path + QVarLengthArray g(glyphs.numGlyphs); + for (int i = 0; i < glyphs.numGlyphs; ++i) + g[i] = glyphs.glyphs[i]; + ExtTextOut(hdc, + qRound(baseline_pos.x() + glyphs.offsets[0].x.toReal()), + qRound(baseline_pos.y() + glyphs.offsets[0].y.toReal()), + options, 0, convertToText ? convertedGlyphs : g.data(), glyphs.numGlyphs, 0); + } else { + QVarLengthArray positions; + QVarLengthArray _glyphs; + + QTransform matrix = QTransform::fromTranslate(baseline_pos.x(), baseline_pos.y()); + ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, + _glyphs, positions); + if (_glyphs.size() == 0) { + SelectObject(hdc, old_font); + return; + } - if (outputEntireItem) { - options |= ETO_PDY; - QVarLengthArray glyphDistances(_glyphs.size() * 2); - QVarLengthArray g(_glyphs.size()); - for (int i=0; i<_glyphs.size() - 1; ++i) { - glyphDistances[i * 2] = qRound(positions[i + 1].x) - qRound(positions[i].x); - glyphDistances[i * 2 + 1] = qRound(positions[i + 1].y) - qRound(positions[i].y); - g[i] = _glyphs[i]; - } - glyphDistances[(_glyphs.size() - 1) * 2] = 0; - glyphDistances[(_glyphs.size() - 1) * 2 + 1] = 0; - g[_glyphs.size() - 1] = _glyphs[_glyphs.size() - 1]; - ExtTextOutW(hdc, qRound(positions[0].x), qRound(positions[0].y), options, 0, - convertToText ? convertedGlyphs : g.data(), _glyphs.size(), - glyphDistances.data()); - } else { - int i = 0; - while(i < _glyphs.size()) { - wchar_t g = _glyphs[i]; - - ExtTextOutW(hdc, qRound(positions[i].x), - qRound(positions[i].y), options, 0, - convertToText ? convertedGlyphs + i : &g, 1, 0); - ++i; - } + convertToText = convertToText && glyphs.numGlyphs == _glyphs.size(); + bool outputEntireItem = _glyphs.size() > 0; + + if (outputEntireItem) { + options |= ETO_PDY; + QVarLengthArray glyphDistances(_glyphs.size() * 2); + QVarLengthArray g(_glyphs.size()); + for (int i=0; i<_glyphs.size() - 1; ++i) { + glyphDistances[i * 2] = qRound(positions[i + 1].x) - qRound(positions[i].x); + glyphDistances[i * 2 + 1] = qRound(positions[i + 1].y) - qRound(positions[i].y); + g[i] = _glyphs[i]; + } + glyphDistances[(_glyphs.size() - 1) * 2] = 0; + glyphDistances[(_glyphs.size() - 1) * 2 + 1] = 0; + g[_glyphs.size() - 1] = _glyphs[_glyphs.size() - 1]; + ExtTextOut(hdc, qRound(positions[0].x), qRound(positions[0].y), options, 0, + convertToText ? convertedGlyphs : g.data(), _glyphs.size(), + glyphDistances.data()); + } else { + int i = 0; + while(i < _glyphs.size()) { + wchar_t g = _glyphs[i]; + + ExtTextOut(hdc, qRound(positions[i].x), + qRound(positions[i].y), options, 0, + convertToText ? convertedGlyphs + i : &g, 1, 0); + ++i; } } + } #if !defined(Q_OS_WINCE) - QT_WA({ - XFORM win_xform; - win_xform.eM11 = win_xform.eM22 = 1.0; - win_xform.eM12 = win_xform.eM21 = win_xform.eDx = win_xform.eDy = 0.0; - SetWorldTransform(hdc, &win_xform); - }, { - // nothing - }); + win_xform.eM11 = win_xform.eM22 = 1.0; + win_xform.eM12 = win_xform.eM21 = win_xform.eDx = win_xform.eDy = 0.0; + SetWorldTransform(hdc, &win_xform); #endif - } + SelectObject(hdc, old_font); } void QWin32PrintEnginePrivate::updateCustomPaperSize() { - QT_WA( { - uint paperSize = devModeW()->dmPaperSize; - if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) { - has_custom_paper_size = true; - DWORD needed = 0; - DWORD returned = 0; - if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) { - BYTE *forms = (BYTE *) malloc(needed); - if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) { - if (paperSize <= returned) { - FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms; - int width = formArray[paperSize-1].Size.cx; // 1/1000 of a mm - int height = formArray[paperSize-1].Size.cy; // 1/1000 of a mm - paper_size = QSizeF((width*72/25.4)/1000.0, (height*72/25.4)/1000.0); - } else { - has_custom_paper_size = false; - } + uint paperSize = devMode->dmPaperSize; + if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) { + has_custom_paper_size = true; + DWORD needed = 0; + DWORD returned = 0; + if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) { + BYTE *forms = (BYTE *) malloc(needed); + if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) { + if (paperSize <= returned) { + FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms; + int width = formArray[paperSize - 1].Size.cx; // 1/1000 of a mm + int height = formArray[paperSize - 1].Size.cy; // 1/1000 of a mm + paper_size = QSizeF((width * 72 /25.4) / 1000.0, (height * 72 / 25.4) / 1000.0); + } else { + has_custom_paper_size = false; } - free(forms); } - } else { - has_custom_paper_size = false; + free(forms); } - }, { - // Not supported under Win98 - } ); + } else { + has_custom_paper_size = false; + } } QT_END_NAMESPACE diff --git a/src/gui/painting/qprintengine_win_p.h b/src/gui/painting/qprintengine_win_p.h index 9eb0b69..36a32e8 100644 --- a/src/gui/painting/qprintengine_win_p.h +++ b/src/gui/painting/qprintengine_win_p.h @@ -169,18 +169,8 @@ public: void readDevmode(HGLOBAL globalDevmode); void readDevnames(HGLOBAL globalDevnames); - inline DEVMODEW *devModeW() const { return (DEVMODEW*) devMode; } - inline DEVMODEA *devModeA() const { return (DEVMODEA*) devMode; } - - inline PRINTER_INFO_2W *pInfoW() { return (PRINTER_INFO_2W*) pInfo; }; - inline PRINTER_INFO_2A *pInfoA() { return (PRINTER_INFO_2A*) pInfo; }; - inline bool resetDC() { - QT_WA( { - hdc = ResetDCW(hdc, devModeW()); - }, { - hdc = ResetDCA(hdc, devModeA()); - } ); + hdc = ResetDC(hdc, devMode); return hdc != 0; } @@ -202,8 +192,8 @@ public: HANDLE hPrinter; HGLOBAL globalDevMode; - void *devMode; - void *pInfo; + DEVMODE *devMode; + PRINTER_INFO_2 *pInfo; HGLOBAL hMem; HDC hdc; diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/gui/painting/qprinterinfo_win.cpp index f0352e6..a10cf3f 100644 --- a/src/gui/painting/qprinterinfo_win.cpp +++ b/src/gui/painting/qprinterinfo_win.cpp @@ -79,45 +79,24 @@ QList QPrinterInfo::availablePrinters() DWORD needed = 0; DWORD returned = 0; - QT_WA({ - if (!EnumPrintersW(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, - 4, 0, 0, &needed, &returned)) - { - buffer = new BYTE[needed]; - if (!EnumPrintersW(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS , NULL, - 4, buffer, needed, &needed, &returned)) - { - delete [] buffer; - return printers; - } - PPRINTER_INFO_4 infoList = reinterpret_cast(buffer); - QPrinterInfo defPrn = defaultPrinter(); - for (uint i = 0; i < returned; ++i) { - printers.append(QPrinterInfo(QString::fromUtf16(reinterpret_cast(infoList[i].pPrinterName)))); - if (printers.at(i).printerName() == defPrn.printerName()) - printers[i].d_ptr->m_default = true; - } - delete [] buffer; - } - }, { - // In Windows 98 networked printers are served through the local connection - if (!EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, 0, 0, &needed, &returned)) { - buffer = new BYTE[needed]; - if (!EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, buffer, needed, &needed, &returned)) { - delete [] buffer; - return printers; - } - - PPRINTER_INFO_5 infoList = reinterpret_cast(buffer); - QPrinterInfo defPrn = defaultPrinter(); - for (uint i = 0; i < returned; ++i) { - printers.append(QPrinterInfo(QString::fromLocal8Bit(reinterpret_cast(infoList[i].pPrinterName)))); - if (printers.at(i).printerName() == defPrn.printerName()) - printers[i].d_ptr->m_default = true; - } - delete [] buffer; - } - }); + if ( !EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, 0, 0, &needed, &returned)) + { + buffer = new BYTE[needed]; + if (!EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS , NULL, + 4, buffer, needed, &needed, &returned)) + { + delete [] buffer; + return printers; + } + PPRINTER_INFO_4 infoList = reinterpret_cast(buffer); + QPrinterInfo defPrn = defaultPrinter(); + for (uint i = 0; i < returned; ++i) { + printers.append(QPrinterInfo(QString::fromWCharArray(infoList[i].pPrinterName))); + if (printers.at(i).printerName() == defPrn.printerName()) + printers[i].d_ptr->m_default = true; + } + delete [] buffer; + } return printers; } @@ -125,18 +104,9 @@ QList QPrinterInfo::availablePrinters() QPrinterInfo QPrinterInfo::defaultPrinter() { QString noPrinters(QLatin1String("qt_no_printers")); - QString output; - QT_WA({ - ushort buffer[256]; - GetProfileStringW(L"windows", L"device", - reinterpret_cast(noPrinters.utf16()), - reinterpret_cast(buffer), 256); - output = QString::fromUtf16(buffer); - }, { - char buffer[256]; - GetProfileStringA("windows", "device", noPrinters.toLatin1(), buffer, 256); - output = QString::fromLocal8Bit(buffer); - }); + wchar_t buffer[256]; + GetProfileString(L"windows", L"device", (wchar_t*)noPrinters.utf16(), buffer, 256); + QString output = QString::fromWCharArray(buffer); // Filter out the name of the printer, which should be everything // before a comma. @@ -222,26 +192,16 @@ bool QPrinterInfo::isDefault() const QList QPrinterInfo::supportedPaperSizes() const { const Q_D(QPrinterInfo); - DWORD size; - WORD* papers; QList paperList; - QT_WA({ - size = DeviceCapabilitiesW(reinterpret_cast(d->m_name.utf16()), - NULL, DC_PAPERS, NULL, NULL); - if ((int)size == -1) - return paperList; - papers = new WORD[size]; - size = DeviceCapabilitiesW(reinterpret_cast(d->m_name.utf16()), - NULL, DC_PAPERS, reinterpret_cast(papers), NULL); - }, { - size = DeviceCapabilitiesA(d->m_name.toLatin1().data(), NULL, DC_PAPERS, NULL, NULL); - if ((int)size == -1) - return paperList; - papers = new WORD[size]; - size = DeviceCapabilitiesA(d->m_name.toLatin1().data(), NULL, DC_PAPERS, - reinterpret_cast(papers), NULL); - }); + DWORD size = DeviceCapabilities(reinterpret_cast(d->m_name.utf16()), + NULL, DC_PAPERS, NULL, NULL); + if ((int)size == -1) + return paperList; + + wchar_t *papers = new wchar_t[size]; + size = DeviceCapabilities(reinterpret_cast(d->m_name.utf16()), + NULL, DC_PAPERS, papers, NULL); for (int c = 0; c < (int)size; ++c) { paperList.append(mapDevmodePaperSize(papers[c])); diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 1b7dc1b..762e9e0 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -92,10 +92,6 @@ QT_BEGIN_NAMESPACE Example of using complex regions: \snippet doc/src/snippets/code/src_gui_painting_qregion.cpp 0 - \warning Due to window system limitations, the whole coordinate space for a - region is limited to the points between -32767 and 32767 on Windows - 95/98/ME. You can circumvent this limitation by using a QPainterPath. - \section1 Additional License Information On Embedded Linux, Windows CE and X11 platforms, parts of this class rely on diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index c163d79..22433dd 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -43,6 +43,7 @@ #include // for Q_WS_WIN define (non-PCH) #ifdef Q_WS_WIN +#include #include #endif @@ -67,10 +68,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_WS_WIN -PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect; -#endif - class QRasterWindowSurfacePrivate { public: @@ -82,9 +79,6 @@ public: uint translucentBackground : 1; #endif #endif -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - uint canUseLayeredWindow : 1; -#endif uint inSetGeometry : 1; }; @@ -98,10 +92,6 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window) && window->x11Info().depth() == 32; #endif #endif -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - d_ptr->canUseLayeredWindow = ptrUpdateLayeredWindowIndirect - && (qt_widget_private(window)->data.window_flags & Qt::FramelessWindowHint); -#endif d_ptr->image = 0; d_ptr->inSetGeometry = false; setStaticContentsSupport(true); @@ -130,8 +120,7 @@ void QRasterWindowSurface::beginPaint(const QRegion &rgn) #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) if (!qt_widget_private(window())->isOpaque) { #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied - && d_ptr->canUseLayeredWindow) + if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied) prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); #endif QPainter p(&d_ptr->image->image); @@ -160,7 +149,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi QRect br = rgn.boundingRect(); #ifndef Q_WS_WINCE - if (!qt_widget_private(window())->isOpaque && d->canUseLayeredWindow) { + if (!qt_widget_private(window())->isOpaque) { QRect r = window()->frameGeometry(); QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft(); QRect dirtyRect = br.translated(offset + frameOffset); @@ -168,12 +157,11 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi SIZE size = {r.width(), r.height()}; POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; - Q_BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA}; + BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA}; RECT dirty = {dirtyRect.x(), dirtyRect.y(), dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty}; - - (*ptrUpdateLayeredWindowIndirect)(window()->internalWinId(), &info); + ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info); } else #endif { @@ -308,7 +296,7 @@ void QRasterWindowSurface::setGeometry(const QRect &rect) #ifndef Q_WS_WIN if (d_ptr->translucentBackground) #else - if (!qt_widget_private(window())->isOpaque && d->canUseLayeredWindow) + if (!qt_widget_private(window())->isOpaque) #endif prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); else diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index 897ed8d..996aaef 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -64,13 +64,6 @@ QT_BEGIN_NAMESPACE #define Q_ULW_ALPHA 0x00000002 // copied from ULW_ALPHA in winuser.h #define Q_AC_SRC_ALPHA 0x00000001 // copied from AC_SRC_ALPHA in winuser.h -struct Q_BLENDFUNCTION { - BYTE BlendOp; - BYTE BlendFlags; - BYTE SourceConstantAlpha; - BYTE AlphaFormat; -}; - struct Q_UPDATELAYEREDWINDOWINFO { DWORD cbSize; HDC hdcDst; @@ -79,12 +72,16 @@ struct Q_UPDATELAYEREDWINDOWINFO { HDC hdcSrc; const POINT *pptSrc; COLORREF crKey; - const Q_BLENDFUNCTION *pblend; + const BLENDFUNCTION *pblend; DWORD dwFlags; const RECT *prcDirty; }; +typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst, + const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey, + const BLENDFUNCTION *pblend, DWORD dwflags); typedef BOOL (WINAPI *PtrUpdateLayeredWindowIndirect)(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *pULWInfo); +extern PtrUpdateLayeredWindow ptrUpdateLayeredWindow; extern PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect; #endif diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 997c2ce..4f25e68 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -126,8 +126,6 @@ static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark static const int windowsRightBorder = 15; // right border on windows static const int windowsCheckMarkWidth = 12; // checkmarks width on windows -static bool use2000style = true; - enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight }; /* @@ -269,9 +267,6 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) */ QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate) { -#if defined(Q_OS_WIN32) - use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95; -#endif } /*! @@ -281,9 +276,6 @@ QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate) */ QWindowsStyle::QWindowsStyle(QWindowsStylePrivate &dd) : QCommonStyle(dd) { -#if defined(Q_OS_WIN32) - use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95; -#endif } @@ -1137,12 +1129,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid #endif break; case SH_ItemView_ChangeHighlightOnFocus: -#if defined(Q_WS_WIN) - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) - ret = 1; - else -#endif - ret = 0; + ret = 1; break; case SH_ToolBox_SelectedPageTitleBold: ret = 0; @@ -1150,36 +1137,34 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid #if defined(Q_WS_WIN) case SH_UnderlineShortcut: + { ret = 1; - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 - && QSysInfo::WindowsVersion != QSysInfo::WV_98 - && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - BOOL cues; - SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0); - ret = int(cues); - // Do nothing if we always paint underlines - Q_D(const QWindowsStyle); - if (!ret && widget && d) { + BOOL cues = false; + SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0); + ret = int(cues); + // Do nothing if we always paint underlines + Q_D(const QWindowsStyle); + if (!ret && widget && d) { #ifndef QT_NO_MENUBAR - const QMenuBar *menuBar = qobject_cast(widget); - if (!menuBar && qobject_cast(widget)) { - QWidget *w = QApplication::activeWindow(); - if (w && w != widget) - menuBar = qFindChild(w); - } - // If we paint a menu bar draw underlines if is in the keyboardState - if (menuBar) { - if (menuBar->d_func()->keyboardState || d->altDown()) - ret = 1; - // Otherwise draw underlines if the toplevel widget has seen an alt-press - } else -#endif // QT_NO_MENUBAR - if (d->hasSeenAlt(widget)) { + const QMenuBar *menuBar = qobject_cast(widget); + if (!menuBar && qobject_cast(widget)) { + QWidget *w = QApplication::activeWindow(); + if (w && w != widget) + menuBar = qFindChild(w); + } + // If we paint a menu bar draw underlines if is in the keyboardState + if (menuBar) { + if (menuBar->d_func()->keyboardState || d->altDown()) ret = 1; - } + // Otherwise draw underlines if the toplevel widget has seen an alt-press + } else +#endif // QT_NO_MENUBAR + if (d->hasSeenAlt(widget)) { + ret = 1; } } break; + } #endif #ifndef QT_NO_RUBBERBAND case SH_RubberBand_Mask: @@ -1317,7 +1302,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, if ((!(opt->state & State_Sunken )) && (!(opt->state & State_Enabled) || !(opt->state & State_MouseOver && opt->state & State_AutoRaise)) - && (opt->state & State_On) && use2000style) { + && (opt->state & State_On)) { fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern); stippled = true; } else { @@ -1631,9 +1616,9 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, popupPal.setColor(QPalette::Light, frame->palette.background().color()); popupPal.setColor(QPalette::Midlight, frame->palette.light().color()); } - if (use2000style && pe == PE_Frame && (frame->state & State_Raised)) + if (pe == PE_Frame && (frame->state & State_Raised)) qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken); - else if (use2000style && pe == PE_Frame && (frame->state & State_Sunken)) + else if (pe == PE_Frame && (frame->state & State_Sunken)) { popupPal.setColor(QPalette::Midlight, frame->palette.background().color()); qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken); @@ -1784,13 +1769,12 @@ case PE_FrameDockWidget: break; #endif // QT_NO_PROGRESSBAR - case PE_FrameTabWidget: - if (use2000style) { - QRect rect = opt->rect; - QPalette pal = opt->palette; - qDrawWinButton(p, opt->rect, opt->palette, false, 0); - break; - } + case PE_FrameTabWidget: { + QRect rect = opt->rect; + QPalette pal = opt->palette; + qDrawWinButton(p, opt->rect, opt->palette, false, 0); + break; + } default: QCommonStyle::drawPrimitive(pe, opt, p, w); } @@ -2066,10 +2050,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setPen(light); p->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); p->drawPoint(x1 + 1, y1 + 1); - if (!use2000style) { - p->setPen(midlight); - p->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - } } // Top { @@ -2077,10 +2057,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai int end = x2 - (nextSelected ? 0 : 2); p->setPen(light); p->drawLine(beg, y1, end, y1); - if (!use2000style) { - p->setPen(midlight); - p->drawLine(beg, y1 + 1, end, y1 + 1); - } } // Right if (lastTab || selected || onlyOne || !nextSelected) { @@ -2110,10 +2086,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setPen(light); p->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); p->drawPoint(x1 + 1, y2 - 1); - if (!use2000style) { - p->setPen(midlight); - p->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - } } // Bottom { @@ -2152,10 +2124,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setPen(light); p->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1); p->drawPoint(x1 + 1, y1 + 1); - if (!use2000style) { - p->setPen(midlight); - p->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1); - } } // Left { @@ -2163,10 +2131,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai int end = y2 - (nextSelected ? 0 : 2); p->setPen(light); p->drawLine(x1, beg, x1, end); - if (!use2000style) { - p->setPen(midlight); - p->drawLine(x1 + 1, beg, x1 + 1, end); - } } // Bottom if (lastTab || selected || onlyOne || !nextSelected) { @@ -2198,11 +2162,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setPen(light); p->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1); p->drawPoint(x2 - 1, y1 + 1); - if (!use2000style) { - p->setPen(midlight); - p->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1); - p->drawPoint(x2 - 1, y1); - } } // Right { @@ -2239,7 +2198,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai #ifndef QT_NO_SCROLLBAR case CE_ScrollBarSubLine: case CE_ScrollBarAddLine: { - if (use2000style && (opt->state & State_Sunken)) { + if ((opt->state & State_Sunken)) { p->setPen(opt->palette.dark().color()); p->setBrush(opt->palette.brush(QPalette::Button)); p->drawRect(opt->rect.adjusted(0, 0, -1, -1)); @@ -3027,8 +2986,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp if ((cmb->subControls & SC_ComboBoxFrame)) { if (cmb->frame) { QPalette shadePal = opt->palette; - if (use2000style) - shadePal.setColor(QPalette::Midlight, shadePal.button().color()); + shadePal.setColor(QPalette::Midlight, shadePal.button().color()); qDrawWinPanel(p, opt->rect, shadePal, true, &editBrush); } else { @@ -3104,8 +3062,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp QBrush editBrush = sb->palette.brush(QPalette::Base); QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); QPalette shadePal = sb->palette; - if (use2000style) - shadePal.setColor(QPalette::Midlight, shadePal.button().color()); + shadePal.setColor(QPalette::Midlight, shadePal.button().color()); qDrawWinPanel(p, r, shadePal, true, &editBrush); } @@ -3234,7 +3191,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, + 2 * windowsItemFrame)); } int maxpmw = mi->maxIconWidth; - int tabSpacing = use2000style ? 20 :windowsTabSpacing; + int tabSpacing = 20; if (mi->text.contains(QLatin1Char('\t'))) w += tabSpacing; else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu) diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index b131d39..3e65eef 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -2571,9 +2571,7 @@ void QWindowsVistaStylePrivate::startAnimation(Animation *t) bool QWindowsVistaStylePrivate::transitionsEnabled() const { BOOL animEnabled = false; - if (QT_WA_INLINE(SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0), - SystemParametersInfoA(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0) - )) + if (SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0)) { if (animEnabled) return true; diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 322bfac..9c4afee 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -161,8 +161,7 @@ HTHEME XPThemeData::handle() htheme = QWindowsXPStylePrivate::handleMap->operator[](name); if (!htheme) { - htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), - (TCHAR*)name.utf16()); + htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), (wchar_t*)name.utf16()); if (htheme) { if (!QWindowsXPStylePrivate::handleMap) QWindowsXPStylePrivate::handleMap = new QMap; @@ -1547,11 +1546,11 @@ case PE_Frame: if (widget) { bool useGradient = true; const int maxlength = 256; - WCHAR themeFileName[maxlength]; - WCHAR themeColor[maxlength]; + wchar_t themeFileName[maxlength]; + wchar_t themeColor[maxlength]; // Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it if (pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) { - WCHAR* offset; + wchar_t *offset = 0; if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) { offset++; if (!lstrcmp(offset, L"Luna.msstyles") && !lstrcmp(offset, L"Metallic")) { diff --git a/src/gui/text/qfont_win.cpp b/src/gui/text/qfont_win.cpp index 2c27c9b..2293973 100644 --- a/src/gui/text/qfont_win.cpp +++ b/src/gui/text/qfont_win.cpp @@ -39,11 +39,6 @@ ** ****************************************************************************/ -// the miscrosoft platform SDK says that the Unicode versions of -// TextOut and GetTextExtentsPoint32 are supported on all platforms, so we use them -// exclusively to simplify code, save a lot of conversions into the local encoding -// and have generally better unicode support :) - #include "qfont.h" #include "qfont_p.h" #include "qfontengine_p.h" @@ -67,8 +62,7 @@ extern HDC shared_dc(); // common dc for all fonts // ### maybe move to qapplication_win QFont qt_LOGFONTtoQFont(LOGFONT& lf, bool /*scale*/) { - QString family = QT_WA_INLINE(QString::fromUtf16((ushort*)lf.lfFaceName), - QString::fromLocal8Bit((char*)lf.lfFaceName)); + QString family = QString::fromWCharArray(lf.lfFaceName); QFont qf(family); qf.setItalic(lf.lfItalic); if (lf.lfWeight != FW_DONTCARE) { diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp index 2c0223b..2e8e5e4 100644 --- a/src/gui/text/qfontdatabase_win.cpp +++ b/src/gui/text/qfontdatabase_win.cpp @@ -195,21 +195,12 @@ static QString getEnglishName(const QString &familyName) QString i18n_name; HDC hdc = GetDC( 0 ); - HFONT hfont; - QT_WA( { - LOGFONTW lf; - memset( &lf, 0, sizeof( LOGFONTW ) ); - memcpy( lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.length())*sizeof(QChar) ); - lf.lfCharSet = DEFAULT_CHARSET; - hfont = CreateFontIndirectW( &lf ); - }, { - LOGFONTA lf; - memset( &lf, 0, sizeof( LOGFONTA ) ); - QByteArray lfam = familyName.toLocal8Bit(); - memcpy( lf.lfFaceName, lfam, qMin(LF_FACESIZE, lfam.size()) ); - lf.lfCharSet = DEFAULT_CHARSET; - hfont = CreateFontIndirectA( &lf ); - } ); + LOGFONT lf; + memset(&lf, 0, sizeof(LOGFONT)); + memcpy(lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.length()) * sizeof(wchar_t)); + lf.lfCharSet = DEFAULT_CHARSET; + HFONT hfont = CreateFontIndirect(&lf); + if(!hfont) { ReleaseDC(0, hdc); return QString(); @@ -245,32 +236,6 @@ error: return i18n_name; } -static void getFontSignature(const QString &familyName, - NEWTEXTMETRICEX *textmetric, - FONTSIGNATURE *signature) -{ - QT_WA({ - Q_UNUSED(familyName); - *signature = textmetric->ntmFontSig; - }, { - // the textmetric structure we get from EnumFontFamiliesEx on Win9x has - // a FONTSIGNATURE, but that one is uninitialized and doesn't work. Have to go - // the hard way and load the font to find out. - HDC hdc = GetDC(0); - LOGFONTA lf; - memset(&lf, 0, sizeof(LOGFONTA)); - QByteArray lfam = familyName.toLocal8Bit(); - memcpy(lf.lfFaceName, lfam.data(), qMin(LF_FACESIZE, lfam.length())); - lf.lfCharSet = DEFAULT_CHARSET; - HFONT hfont = CreateFontIndirectA(&lf); - HGDIOBJ oldobj = SelectObject(hdc, hfont); - GetTextCharsetInfo(hdc, signature, 0); - SelectObject(hdc, oldobj); - DeleteObject(hfont); - ReleaseDC(0, hdc); - }); -} - static void addFontToDatabase(QString familyName, const QString &scriptName, TEXTMETRIC *textmetric, @@ -288,26 +253,17 @@ void addFontToDatabase(QString familyName, const QString &scriptName, bool scalable; int size; -// QString escript = QString::fromUtf16((ushort *)f->elfScript); +// QString escript = QString::fromWCharArray(f->elfScript); // qDebug("script=%s", escript.latin1()); - QT_WA({ - NEWTEXTMETRIC *tm = (NEWTEXTMETRIC *)textmetric; - fixed = !(tm->tmPitchAndFamily & TMPF_FIXED_PITCH); - ttf = (tm->tmPitchAndFamily & TMPF_TRUETYPE); - scalable = tm->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE); - size = scalable ? SMOOTH_SCALABLE : tm->tmHeight; - italic = tm->tmItalic; - weight = tm->tmWeight; - } , { - NEWTEXTMETRICA *tm = (NEWTEXTMETRICA *)textmetric; - fixed = !(tm->tmPitchAndFamily & TMPF_FIXED_PITCH); - ttf = (tm->tmPitchAndFamily & TMPF_TRUETYPE); - scalable = tm->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE); - size = scalable ? SMOOTH_SCALABLE : tm->tmHeight; - italic = tm->tmItalic; - weight = tm->tmWeight; - }); + NEWTEXTMETRIC *tm = (NEWTEXTMETRIC *)textmetric; + fixed = !(tm->tmPitchAndFamily & TMPF_FIXED_PITCH); + ttf = (tm->tmPitchAndFamily & TMPF_TRUETYPE); + scalable = tm->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE); + size = scalable ? SMOOTH_SCALABLE : tm->tmHeight; + italic = tm->tmItalic; + weight = tm->tmWeight; + // the "@family" fonts are just the same as "family". Ignore them. if (familyName[0] != QLatin1Char('@') && !familyName.startsWith(QLatin1String("WST_"))) { QtFontStyle::Key styleKey; @@ -420,18 +376,10 @@ static int CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, int type, LPARAM /*p*/) { - QString familyName; - QT_WA({ - familyName = QString::fromUtf16((ushort*)f->elfLogFont.lfFaceName); - },{ - ENUMLOGFONTEXA *fa = (ENUMLOGFONTEXA *)f; - familyName = QString::fromLocal8Bit(fa->elfLogFont.lfFaceName); - }); - QString script = QT_WA_INLINE(QString::fromUtf16((const ushort *)f->elfScript), - QString::fromLocal8Bit((const char *)((ENUMLOGFONTEXA *)f)->elfScript)); - - FONTSIGNATURE signature; - getFontSignature(familyName, textmetric, &signature); + QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); + QString script = QString::fromWCharArray(f->elfScript); + + FONTSIGNATURE signature = textmetric->ntmFontSig; // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is // identical to a TEXTMETRIC except for the last four members, which we don't use @@ -459,33 +407,17 @@ void populate_database(const QString& fam) HDC dummy = GetDC(0); - QT_WA({ - LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; - if (fam.isNull()) { - lf.lfFaceName[0] = 0; - } else { - memcpy(lf.lfFaceName, fam.utf16(), sizeof(TCHAR)*qMin(fam.length()+1,32)); // 32 = Windows hard-coded - } - lf.lfPitchAndFamily = 0; - - EnumFontFamiliesEx(dummy, &lf, - (FONTENUMPROC)storeFont, (LPARAM)privateDb(), 0); - } , { - LOGFONTA lf; - lf.lfCharSet = DEFAULT_CHARSET; - if (fam.isNull()) { - lf.lfFaceName[0] = 0; - } else { - QByteArray lname = fam.toLocal8Bit(); - memcpy(lf.lfFaceName,lname.data(), - qMin(lname.length()+1,32)); // 32 = Windows hard-coded - } - lf.lfPitchAndFamily = 0; + LOGFONT lf; + lf.lfCharSet = DEFAULT_CHARSET; + if (fam.isNull()) { + lf.lfFaceName[0] = 0; + } else { + memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded + } + lf.lfPitchAndFamily = 0; - EnumFontFamiliesExA(dummy, &lf, - (FONTENUMPROCA)storeFont, (LPARAM)privateDb(), 0); - }); + EnumFontFamiliesEx(dummy, &lf, + (FONTENUMPROC)storeFont, (LPARAM)privateDb(), 0); ReleaseDC(0, dummy); @@ -496,21 +428,11 @@ void populate_database(const QString& fam) for (int j = 0; j < fnt.families.count(); ++j) { const QString familyName = fnt.families.at(j); HDC hdc = GetDC(0); - HFONT hfont; - QT_WA({ - LOGFONTW lf; - memset(&lf, 0, sizeof(LOGFONTW)); - memcpy(lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.size())); - lf.lfCharSet = DEFAULT_CHARSET; - hfont = CreateFontIndirectW(&lf); - } , { - LOGFONTA lf; - memset(&lf, 0, sizeof(LOGFONTA)); - QByteArray lfam = familyName.toLocal8Bit(); - memcpy(lf.lfFaceName, lfam.data(), qMin(LF_FACESIZE, lfam.length())); - lf.lfCharSet = DEFAULT_CHARSET; - hfont = CreateFontIndirectA(&lf); - }); + LOGFONT lf; + memset(&lf, 0, sizeof(LOGFONT)); + memcpy(lf.lfFaceName, familyName.utf16(), sizeof(wchar_t) * qMin(LF_FACESIZE, familyName.size())); + lf.lfCharSet = DEFAULT_CHARSET; + HFONT hfont = CreateFontIndirect(&lf); HGDIOBJ oldobj = SelectObject(hdc, hfont); TEXTMETRIC textMetrics; @@ -598,17 +520,10 @@ static void initFontInfo(QFontEngineWin *fe, const QFontDef &request, const QFon HDC dc = ((request.styleStrategy & QFont::PreferDevice) && fp->hdc) ? fp->hdc : shared_dc(); SelectObject(dc, fe->hfont); - QT_WA({ - TCHAR n[64]; - GetTextFaceW(dc, 64, n); - fe->fontDef.family = QString::fromUtf16((ushort*)n); - fe->fontDef.fixedPitch = !(fe->tm.w.tmPitchAndFamily & TMPF_FIXED_PITCH); - } , { - char an[64]; - GetTextFaceA(dc, 64, an); - fe->fontDef.family = QString::fromLocal8Bit(an); - fe->fontDef.fixedPitch = !(fe->tm.a.tmPitchAndFamily & TMPF_FIXED_PITCH); - }); + wchar_t n[64]; + GetTextFace(dc, 64, n); + fe->fontDef.family = QString::fromWCharArray(n); + fe->fontDef.fixedPitch = !(fe->tm.tmPitchAndFamily & TMPF_FIXED_PITCH); if (fe->fontDef.pointSize < 0) { fe->fontDef.pointSize = fe->fontDef.pixelSize * 72. / fp->dpi; } else if (fe->fontDef.pixelSize == -1) { @@ -704,12 +619,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ HFONT hfont = 0; if (fp->rawMode) { // will choose a stock font - int f, deffnt; - // ### why different? - if ((QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) || QSysInfo::WindowsVersion == QSysInfo::WV_32s) - deffnt = SYSTEM_FONT; - else - deffnt = DEFAULT_GUI_FONT; + int f, deffnt = SYSTEM_FONT; QString fam = desc->family->name.toLower(); if (fam == QLatin1String("default")) f = deffnt; @@ -778,11 +688,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ } else if (request.styleStrategy & QFont::PreferDevice) { strat = OUT_DEVICE_PRECIS; } else if (request.styleStrategy & QFont::PreferOutline) { - QT_WA({ - strat = OUT_OUTLINE_PRECIS; - } , { - strat = OUT_TT_PRECIS; - }); + strat = OUT_OUTLINE_PRECIS; } else if (request.styleStrategy & QFont::ForceOutline) { strat = OUT_TT_ONLY_PRECIS; #endif @@ -801,7 +707,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ if (request.styleStrategy & QFont::PreferAntialias) { if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP) { - qual = 5; // == CLEARTYPE_QUALITY; + qual = CLEARTYPE_QUALITY; preferClearTypeAA = true; } else { qual = ANTIALIASED_QUALITY; @@ -827,16 +733,8 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ if (fam == QLatin1String("Courier") && !(request.styleStrategy & QFont::PreferBitmap)) fam = QLatin1String("Courier New"); - QT_WA({ - memcpy(lf.lfFaceName, fam.utf16(), sizeof(TCHAR)*qMin(fam.length()+1,32)); // 32 = Windows hard-coded - hfont = CreateFontIndirect(&lf); - } , { - // LOGFONTA and LOGFONTW are binary compatible - QByteArray lname = fam.toLocal8Bit(); - memcpy(lf.lfFaceName,lname.data(), - qMin(lname.length()+1,32)); // 32 = Windows hard-coded - hfont = CreateFontIndirectA((LOGFONTA*)&lf); - }); + memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded + hfont = CreateFontIndirect(&lf); if (!hfont) qErrnoWarning("QFontEngine::loadEngine: CreateFontIndirect failed"); @@ -845,17 +743,12 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ int avWidth = 0; BOOL res; HGDIOBJ oldObj = SelectObject(hdc, hfont); - QT_WA({ - TEXTMETRICW tm; - res = GetTextMetricsW(hdc, &tm); - avWidth = tm.tmAveCharWidth; - ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE; - } , { - TEXTMETRICA tm; - res = GetTextMetricsA(hdc, &tm); - avWidth = tm.tmAveCharWidth; - ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE; - }); + + TEXTMETRIC tm; + res = GetTextMetrics(hdc, &tm); + avWidth = tm.tmAveCharWidth; + ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE; + SelectObject(hdc, oldObj); if (hfont && (!ttf || request.stretch != 100)) { @@ -863,11 +756,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ if (!res) qErrnoWarning("QFontEngine::loadEngine: GetTextMetrics failed"); lf.lfWidth = avWidth * request.stretch/100; - QT_WA({ - hfont = CreateFontIndirect(&lf); - } , { - hfont = CreateFontIndirectA((LOGFONTA*)&lf); - }); + hfont = CreateFontIndirect(&lf); if (!hfont) qErrnoWarning("QFontEngine::loadEngine: CreateFontIndirect with stretch failed"); } @@ -969,12 +858,6 @@ static QFontEngine *loadWin(const QFontPrivate *d, int script, const QFontDef &r // list of families to try QStringList family_list = familyList(req); - if(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based && req.family.toLower() == QLatin1String("ms sans serif")) { - // small hack for Dos based machines to get the right font for non - // latin text when using the default font. - family_list << QLatin1String("Arial"); - } - const char *stylehint = styleHint(d->request); if (stylehint) family_list << QLatin1String(stylehint); @@ -1165,21 +1048,21 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) HANDLE handle = 0; { -#ifdef QT_NO_TEMPORARYFILE - TCHAR lpBuffer[MAX_PATH]; +#ifdef QT_NO_TEMPORARYFILE + wchar_t lpBuffer[MAX_PATH]; GetTempPath(MAX_PATH, lpBuffer); - QString s = QString::fromUtf16((const ushort *) lpBuffer); + QString s = QString::fromWCharArray(lpBuffer); QFile tempfile(s + QLatin1String("/font") + QString::number(GetTickCount()) + QLatin1String(".ttf")); if (!tempfile.open(QIODevice::ReadWrite)) #else QTemporaryFile tempfile(QLatin1String("XXXXXXXX.ttf")); if (!tempfile.open()) -#endif +#endif // QT_NO_TEMPORARYFILE return; if (tempfile.write(fnt->data) == -1) return; -#ifndef QT_NO_TEMPORARYFILE +#ifndef QT_NO_TEMPORARYFILE tempfile.setAutoRemove(false); #endif fnt->fileName = QFileInfo(tempfile.fileName()).absoluteFilePath(); @@ -1191,13 +1074,11 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) } #else DWORD dummy = 0; - HANDLE handle = ptrAddFontMemResourceEx((void *)fnt->data.constData(), - fnt->data.size(), - 0, - &dummy); + HANDLE handle = ptrAddFontMemResourceEx((void *)fnt->data.constData(), fnt->data.size(), 0, + &dummy); if (handle == 0) return; -#endif +#endif // Q_OS_WINCE fnt->handle = handle; fnt->data = QByteArray(); @@ -1219,12 +1100,10 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) // supported from 2000 on, so no need to deal with the *A variant PtrAddFontResourceExW ptrAddFontResourceExW = (PtrAddFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"), "AddFontResourceExW"); - if (!ptrAddFontResourceExW) + if (!ptrAddFontResourceExW + || ptrAddFontResourceExW((wchar_t*)fnt->fileName.utf16(), FR_PRIVATE, 0) == 0) return; - - if (ptrAddFontResourceExW((LPCWSTR)fnt->fileName.utf16(), FR_PRIVATE, 0) == 0) - return; -#endif +#endif // Q_OS_WINCE fnt->memoryFont = false; } @@ -1250,12 +1129,10 @@ bool QFontDatabase::removeApplicationFont(int handle) #else PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)QLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); - if (!ptrRemoveFontMemResourceEx) - return false; - - if (!ptrRemoveFontMemResourceEx(font.handle)) + if (!ptrRemoveFontMemResourceEx + || !ptrRemoveFontMemResourceEx(font.handle)) return false; -#endif +#endif // Q_OS_WINCE } else { #ifdef Q_OS_WINCE if (!RemoveFontResource((LPCWSTR)font.fileName.utf16())) @@ -1263,12 +1140,10 @@ bool QFontDatabase::removeApplicationFont(int handle) #else PtrRemoveFontResourceExW ptrRemoveFontResourceExW = (PtrRemoveFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"), "RemoveFontResourceExW"); - if (!ptrRemoveFontResourceExW) - return false; - - if (!ptrRemoveFontResourceExW((LPCWSTR)font.fileName.utf16(), FR_PRIVATE, 0)) + if (!ptrRemoveFontResourceExW + || !ptrRemoveFontResourceExW((LPCWSTR)font.fileName.utf16(), FR_PRIVATE, 0)) return false; -#endif +#endif // Q_OS_WINCE } db->invalidate(); diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 9715aef..f4adc9a 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include @@ -85,8 +84,6 @@ ((quint32)(ch1)) \ ) -typedef BOOL (WINAPI *PtrGetCharWidthI)(HDC, UINT, UINT, LPWORD, LPINT); - // common DC for all fonts QT_BEGIN_NAMESPACE @@ -130,6 +127,7 @@ HDC shared_dc() static HFONT stock_sysfont = 0; +typedef BOOL (WINAPI *PtrGetCharWidthI)(HDC, UINT, UINT, LPWORD, LPINT); static PtrGetCharWidthI ptrGetCharWidthI = 0; static bool resolvedGetCharWidthI = false; @@ -141,27 +139,6 @@ static void resolveGetCharWidthI() ptrGetCharWidthI = (PtrGetCharWidthI)QLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI"); } -// Copy a LOGFONTW struct into a LOGFONTA by converting the face name to an 8 bit value. -// This is needed when calling CreateFontIndirect on non-unicode windowses. -inline static void wa_copy_logfont(LOGFONTW *lfw, LOGFONTA *lfa) -{ - lfa->lfHeight = lfw->lfHeight; - lfa->lfWidth = lfw->lfWidth; - lfa->lfEscapement = lfw->lfEscapement; - lfa->lfOrientation = lfw->lfOrientation; - lfa->lfWeight = lfw->lfWeight; - lfa->lfItalic = lfw->lfItalic; - lfa->lfUnderline = lfw->lfUnderline; - lfa->lfCharSet = lfw->lfCharSet; - lfa->lfOutPrecision = lfw->lfOutPrecision; - lfa->lfClipPrecision = lfw->lfClipPrecision; - lfa->lfQuality = lfw->lfQuality; - lfa->lfPitchAndFamily = lfw->lfPitchAndFamily; - - QString fam = QString::fromUtf16((const ushort*)lfw->lfFaceName); - memcpy(lfa->lfFaceName, fam.toLocal8Bit().constData(), fam.length() + 1); -} - // defined in qtextengine_win.cpp typedef void *SCRIPT_CACHE; typedef HRESULT (WINAPI *fScriptFreeCache)(SCRIPT_CACHE *); @@ -187,14 +164,6 @@ static inline quint16 getUShort(unsigned char *p) return val; } -static inline HFONT systemFont() -{ - if (stock_sysfont == 0) - stock_sysfont = (HFONT)GetStockObject(SYSTEM_FONT); - return stock_sysfont; -} - - // general font engine QFixed QFontEngineWin::lineThickness() const @@ -205,33 +174,18 @@ QFixed QFontEngineWin::lineThickness() const return QFontEngine::lineThickness(); } -#if defined(Q_WS_WINCE) -static OUTLINETEXTMETRICW *getOutlineTextMetric(HDC hdc) +static OUTLINETEXTMETRIC *getOutlineTextMetric(HDC hdc) { int size; - size = GetOutlineTextMetricsW(hdc, 0, 0); - OUTLINETEXTMETRICW *otm = (OUTLINETEXTMETRICW *)malloc(size); - GetOutlineTextMetricsW(hdc, size, otm); + size = GetOutlineTextMetrics(hdc, 0, 0); + OUTLINETEXTMETRIC *otm = (OUTLINETEXTMETRIC *)malloc(size); + GetOutlineTextMetrics(hdc, size, otm); return otm; } -#else -static OUTLINETEXTMETRICA *getOutlineTextMetric(HDC hdc) -{ - int size; - size = GetOutlineTextMetricsA(hdc, 0, 0); - OUTLINETEXTMETRICA *otm = (OUTLINETEXTMETRICA *)malloc(size); - GetOutlineTextMetricsA(hdc, size, otm); - return otm; -} -#endif void QFontEngineWin::getCMap() { - QT_WA({ - ttf = (bool)(tm.w.tmPitchAndFamily & TMPF_TRUETYPE); - } , { - ttf = (bool)(tm.a.tmPitchAndFamily & TMPF_TRUETYPE); - }); + ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE); HDC hdc = shared_dc(); SelectObject(hdc, hfont); bool symb = false; @@ -249,11 +203,7 @@ void QFontEngineWin::getCMap() designToDevice = 1; _faceId.index = 0; if(cmap) { -#if defined(Q_WS_WINCE) - OUTLINETEXTMETRICW *otm = getOutlineTextMetric(hdc); -#else - OUTLINETEXTMETRICA *otm = getOutlineTextMetric(hdc); -#endif + OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc); designToDevice = QFixed((int)otm->otmEMSquare)/int(otm->otmTextMetrics.tmHeight); unitsPerEm = otm->otmEMSquare; x_height = (int)otm->otmsXHeight; @@ -263,7 +213,7 @@ void QFontEngineWin::getCMap() fsType = otm->otmfsType; free(otm); } else { - unitsPerEm = tm.w.tmHeight; + unitsPerEm = tm.tmHeight; } } @@ -303,19 +253,14 @@ int QFontEngineWin::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout } } else { #endif - ushort first, last; - QT_WA({ - first = tm.w.tmFirstChar; - last = tm.w.tmLastChar; - }, { - first = tm.a.tmFirstChar; - last = tm.a.tmLastChar; - }); + wchar_t first = tm.tmFirstChar; + wchar_t last = tm.tmLastChar; + for (; i < numChars; ++i, ++glyph_pos) { uint ucs = QChar::mirroredChar(getChar(str, i, numChars)); if ( #ifdef Q_WS_WINCE - tm.w.tmFirstChar > 60000 || // see line 375 + tm.tmFirstChar > 60000 || // see line 375 #endif ucs >= first && ucs <= last) glyphs->glyphs[glyph_pos] = ucs; @@ -341,19 +286,14 @@ int QFontEngineWin::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout } } else { #endif - ushort first, last; - QT_WA({ - first = tm.w.tmFirstChar; - last = tm.w.tmLastChar; - }, { - first = tm.a.tmFirstChar; - last = tm.a.tmLastChar; - }); + wchar_t first = tm.tmFirstChar; + wchar_t last = tm.tmLastChar; + for (; i < numChars; ++i, ++glyph_pos) { uint uc = getChar(str, i, numChars); if ( #ifdef Q_WS_WINCE - tm.w.tmFirstChar > 60000 || // see comment in QFontEngineWin + tm.tmFirstChar > 60000 || // see comment in QFontEngineWin #endif uc >= first && uc <= last) glyphs->glyphs[glyph_pos] = uc; @@ -387,28 +327,14 @@ QFontEngineWin::QFontEngineWin(const QString &name, HFONT _hfont, bool stockFont lineWidth = -1; x_height = -1; - BOOL res; - QT_WA({ - res = GetTextMetricsW(hdc, &tm.w); - } , { - res = GetTextMetricsA(hdc, &tm.a); - }); - fontDef.fixedPitch = !(tm.w.tmPitchAndFamily & TMPF_FIXED_PITCH); + BOOL res = GetTextMetrics(hdc, &tm); + fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH); if (!res) qErrnoWarning("QFontEngineWin: GetTextMetrics failed"); - cache_cost = tm.w.tmHeight * tm.w.tmAveCharWidth * 2000; + cache_cost = tm.tmHeight * tm.tmAveCharWidth * 2000; getCMap(); - useTextOutA = false; -#ifndef Q_OS_WINCE - // TextOutW doesn't work for symbol fonts on Windows 95! - // since we're using glyph indices we don't care for ttfs about this! - if (QSysInfo::WindowsVersion == QSysInfo::WV_95 && !ttf && - (_name == QLatin1String("Marlett") || _name == QLatin1String("Symbol") || - _name == QLatin1String("Webdings") || _name == QLatin1String("Wingdings"))) - useTextOutA = true; -#endif widthCache = 0; widthCacheSize = 0; designAdvances = 0; @@ -427,7 +353,7 @@ QFontEngineWin::~QFontEngineWin() free(widthCache); // make sure we aren't by accident still selected - SelectObject(shared_dc(), systemFont()); + SelectObject(shared_dc(), (HFONT)GetStockObject(SYSTEM_FONT)); if (!stockFont) { if (!DeleteObject(hfont)) @@ -435,39 +361,12 @@ QFontEngineWin::~QFontEngineWin() } } -HGDIOBJ QFontEngineWin::selectDesignFont(QFixed *overhang) const +HGDIOBJ QFontEngineWin::selectDesignFont() const { LOGFONT f = logfont; f.lfHeight = unitsPerEm; - HFONT designFont; - QT_WA({ - designFont = CreateFontIndirectW(&f); - }, { - LOGFONTA fa; - wa_copy_logfont(&f, &fa); - designFont = CreateFontIndirectA(&fa); - }); - HGDIOBJ oldFont = SelectObject(shared_dc(), designFont); - - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - BOOL res; - QT_WA({ - TEXTMETRICW tm; - res = GetTextMetricsW(shared_dc(), &tm); - if (!res) - qErrnoWarning("QFontEngineWin: GetTextMetrics failed"); - *overhang = QFixed((int)tm.tmOverhang) / designToDevice; - } , { - TEXTMETRICA tm; - res = GetTextMetricsA(shared_dc(), &tm); - if (!res) - qErrnoWarning("QFontEngineWin: GetTextMetrics failed"); - *overhang = QFixed((int)tm.tmOverhang) / designToDevice; - }); - } else { - *overhang = 0; - } - return oldFont; + HFONT designFont = CreateFontIndirect(&f); + return SelectObject(shared_dc(), designFont); } bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const @@ -486,8 +385,6 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph HDC hdc = shared_dc(); if (flags & QTextEngine::DesignMetrics) { HGDIOBJ oldFont = 0; - QFixed overhang = 0; - int glyph_pos = 0; for(register int i = 0; i < len; i++) { bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1 @@ -502,9 +399,9 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph } if(designAdvances[glyph] < -999999) { if(!oldFont) - oldFont = selectDesignFont(&overhang); + oldFont = selectDesignFont(); SIZE size = {0, 0}; - GetTextExtentPoint32W(hdc, (wchar_t *)(str+i), surrogate ? 2 : 1, &size); + GetTextExtentPoint32(hdc, (wchar_t *)(str+i), surrogate ? 2 : 1, &size); designAdvances[glyph] = QFixed((int)size.cx)/designToDevice; } glyphs->advances_x[glyph_pos] = designAdvances[glyph]; @@ -538,7 +435,7 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph SIZE size = {0, 0}; if (!oldFont) oldFont = SelectObject(hdc, hfont); - GetTextExtentPoint32W(hdc, (wchar_t *)str + i, surrogate ? 2 : 1, &size); + GetTextExtentPoint32(hdc, (wchar_t *)str + i, surrogate ? 2 : 1, &size); glyphs->advances_x[glyph_pos] = size.cx; // if glyph's within cache range, store it for later if (size.cx > 0 && size.cx < 0x100) @@ -564,8 +461,6 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla HGDIOBJ oldFont = 0; HDC hdc = shared_dc(); if (ttf && (flags & QTextEngine::DesignMetrics)) { - QFixed overhang = 0; - for(int i = 0; i < glyphs->numGlyphs; i++) { unsigned int glyph = glyphs->glyphs[i]; if(int(glyph) >= designAdvancesSize) { @@ -575,35 +470,14 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla designAdvances[i] = -1000000; designAdvancesSize = newSize; } - if(designAdvances[glyph] < -999999) { - if(!oldFont) - oldFont = selectDesignFont(&overhang); + if (designAdvances[glyph] < -999999) { + if (!oldFont) + oldFont = selectDesignFont(); - if (ptrGetCharWidthI) { - int width = 0; + int width = 0; + if (ptrGetCharWidthI) ptrGetCharWidthI(hdc, glyph, 1, 0, &width); - - designAdvances[glyph] = QFixed(width) / designToDevice; - } else { -#ifndef Q_WS_WINCE - GLYPHMETRICS gm; - DWORD res = GDI_ERROR; - MAT2 mat; - mat.eM11.value = mat.eM22.value = 1; - mat.eM11.fract = mat.eM22.fract = 0; - mat.eM21.value = mat.eM12.value = 0; - mat.eM21.fract = mat.eM12.fract = 0; - QT_WA({ - res = GetGlyphOutlineW(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX|GGO_NATIVE, &gm, 0, 0, &mat); - } , { - res = GetGlyphOutlineA(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX|GGO_NATIVE, &gm, 0, 0, &mat); - }); - - if (res != GDI_ERROR) { - designAdvances[glyph] = QFixed(gm.gmCellIncX) / designToDevice; - } -#endif - } + designAdvances[glyph] = QFixed(width) / designToDevice; } glyphs->advances_x[i] = designAdvances[glyph]; glyphs->advances_y[i] = 0; @@ -611,8 +485,6 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla if(oldFont) DeleteObject(SelectObject(hdc, oldFont)); } else { - int overhang = (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) ? tm.a.tmOverhang : 0; - for(int i = 0; i < glyphs->numGlyphs; i++) { unsigned int glyph = glyphs->glyphs[i]; @@ -640,31 +512,10 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla ++chrLen; } SIZE size = {0, 0}; - GetTextExtentPoint32W(hdc, (wchar_t *)ch, chrLen, &size); + GetTextExtentPoint32(hdc, (wchar_t *)ch, chrLen, &size); width = size.cx; } else if (ptrGetCharWidthI) { ptrGetCharWidthI(hdc, glyph, 1, 0, &width); - - width -= overhang; - } else { -#ifndef Q_WS_WINCE - GLYPHMETRICS gm; - DWORD res = GDI_ERROR; - MAT2 mat; - mat.eM11.value = mat.eM22.value = 1; - mat.eM11.fract = mat.eM22.fract = 0; - mat.eM21.value = mat.eM12.value = 0; - mat.eM21.fract = mat.eM12.fract = 0; - QT_WA({ - res = GetGlyphOutlineW(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat); - } , { - res = GetGlyphOutlineA(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat); - }); - - if (res != GDI_ERROR) { - width = gm.gmCellIncX; - } -#endif } glyphs->advances_x[i] = width; // if glyph's within cache range, store it for later @@ -687,7 +538,7 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs) for (int i = 0; i < glyphs.numGlyphs; ++i) w += glyphs.effectiveAdvance(i); - return glyph_metrics_t(0, -tm.w.tmAscent, w, tm.w.tmHeight, w, 0); + return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0); } @@ -705,30 +556,13 @@ glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t) HDC hdc = shared_dc(); SelectObject(hdc, hfont); - if(!ttf) { - SIZE s = {0, 0}; - WCHAR ch = glyph; - int width; - int overhang = 0; - static bool resolved = false; - if (!resolved) { - QLibrary lib(QLatin1String("gdi32")); - qt_GetCharABCWidthsFloat = (pGetCharABCWidthsFloat) lib.resolve("GetCharABCWidthsFloatW"); - resolved = true; - } - if (QT_WA_INLINE(true, false) && qt_GetCharABCWidthsFloat) { - ABCFLOAT abc; - qt_GetCharABCWidthsFloat(hdc, ch, ch, &abc); - width = qRound(abc.abcfB); - } else { - GetTextExtentPoint32W(hdc, &ch, 1, &s); - overhang = (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) ? tm.a.tmOverhang : 0; - width = s.cx; - } + if (!ttf) { + wchar_t ch = glyph; + ABCFLOAT abc; + GetCharABCWidthsFloat(hdc, ch, ch, &abc); + int width = qRound(abc.abcfB); - return glyph_metrics_t(0, -tm.a.tmAscent, - width, tm.a.tmHeight, - width-overhang, 0).transformed(t); + return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t); } else { DWORD res = 0; MAT2 mat; @@ -753,11 +587,8 @@ glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t) SetWorldTransform(hdc, &xform); } - QT_WA({ - res = GetGlyphOutlineW(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat); - } , { - res = GetGlyphOutlineA(hdc, glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat); - }); + res = GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, 0, &mat); + if (t.type() > QTransform::TxTranslate) { XFORM xform; xform.eM11 = xform.eM22 = 1; @@ -793,28 +624,28 @@ glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t) else #endif { // fallback - width = tm.w.tmMaxCharWidth; + width = tm.tmMaxCharWidth; advance = width; } SelectObject(hdc, oldFont); - return glyph_metrics_t(0, -tm.w.tmAscent, width, tm.w.tmHeight, advance, 0).transformed(t); + return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, advance, 0).transformed(t); #endif } QFixed QFontEngineWin::ascent() const { - return tm.w.tmAscent; + return tm.tmAscent; } QFixed QFontEngineWin::descent() const { - return tm.w.tmDescent; + return tm.tmDescent; } QFixed QFontEngineWin::leading() const { - return tm.w.tmExternalLeading; + return tm.tmExternalLeading; } @@ -827,12 +658,12 @@ QFixed QFontEngineWin::xHeight() const QFixed QFontEngineWin::averageCharWidth() const { - return tm.w.tmAveCharWidth; + return tm.tmAveCharWidth; } qreal QFontEngineWin::maxCharWidth() const { - return tm.w.tmMaxCharWidth; + return tm.tmMaxCharWidth; } enum { max_font_count = 256 }; @@ -879,10 +710,10 @@ qreal QFontEngineWin::minRightBearing() const SelectObject(hdc, hfont); if (ttf) { ABC *abc = 0; - int n = QT_WA_INLINE(tm.w.tmLastChar - tm.w.tmFirstChar, tm.a.tmLastChar - tm.a.tmFirstChar); + int n = tm.tmLastChar - tm.tmFirstChar; if (n <= max_font_count) { abc = new ABC[n+1]; - GetCharABCWidths(hdc, tm.w.tmFirstChar, tm.w.tmLastChar, abc); + GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc); } else { abc = new ABC[char_table_entries+1]; for(int i = 0; i < char_table_entries; i++) @@ -898,9 +729,6 @@ qreal QFontEngineWin::minRightBearing() const } } delete [] abc; - } else { - ml = 0; - mr = -tm.a.tmOverhang; } lbearing = ml; rbearing = mr; @@ -915,28 +743,14 @@ qreal QFontEngineWin::minRightBearing() const SelectObject(hdc, hfont); if (ttf) { ABC *abc = 0; - int n = QT_WA_INLINE(tm.w.tmLastChar - tm.w.tmFirstChar, tm.a.tmLastChar - tm.a.tmFirstChar); + int n = tm.tmLastChar - tm.tmFirstChar; if (n <= max_font_count) { abc = new ABC[n+1]; - QT_WA({ - GetCharABCWidths(hdc, tm.w.tmFirstChar, tm.w.tmLastChar, abc); - }, { - GetCharABCWidthsA(hdc,tm.a.tmFirstChar,tm.a.tmLastChar,abc); - }); + GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc); } else { abc = new ABC[char_table_entries+1]; - QT_WA({ - for(int i = 0; i < char_table_entries; i++) - GetCharABCWidths(hdc, char_table[i], char_table[i], abc+i); - }, { - for(int i = 0; i < char_table_entries; i++) { - QByteArray w = QString(QChar(char_table[i])).toLocal8Bit(); - if (w.length() == 1) { - uint ch8 = (uchar)w[0]; - GetCharABCWidthsA(hdc, ch8, ch8, abc+i); - } - } - }); + for(int i = 0; i < char_table_entries; i++) + GetCharABCWidths(hdc, char_table[i], char_table[i], abc + i); n = char_table_entries; } ml = abc[0].abcA; @@ -949,33 +763,28 @@ qreal QFontEngineWin::minRightBearing() const } delete [] abc; } else { - QT_WA({ - ABCFLOAT *abc = 0; - int n = tm.w.tmLastChar - tm.w.tmFirstChar+1; - if (n <= max_font_count) { - abc = new ABCFLOAT[n]; - GetCharABCWidthsFloat(hdc, tm.w.tmFirstChar, tm.w.tmLastChar, abc); - } else { - abc = new ABCFLOAT[char_table_entries]; - for(int i = 0; i < char_table_entries; i++) - GetCharABCWidthsFloat(hdc, char_table[i], char_table[i], abc+i); - n = char_table_entries; - } - float fml = abc[0].abcfA; - float fmr = abc[0].abcfC; - for (int i=1; i string->unicode() || tm.w.tmLastChar < string->unicode()) - return false; - } - }, { - while(len--) { - if (tm.a.tmFirstChar > string->unicode() || tm.a.tmLastChar < string->unicode()) - return false; - } - }); + while(len--) { + if (tm.tmFirstChar > string->unicode() || tm.tmLastChar < string->unicode()) + return false; + } } return true; } @@ -1065,11 +867,7 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, memset(&gMetric, 0, sizeof(GLYPHMETRICS)); int bufferSize = GDI_ERROR; #if !defined(Q_WS_WINCE) - QT_WA( { - bufferSize = GetGlyphOutlineW(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat); - }, { - bufferSize = GetGlyphOutlineA(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat); - }); + bufferSize = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat); #endif if ((DWORD)bufferSize == GDI_ERROR) { return false; @@ -1078,13 +876,7 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, void *dataBuffer = new char[bufferSize]; DWORD ret = GDI_ERROR; #if !defined(Q_WS_WINCE) - QT_WA( { - ret = GetGlyphOutlineW(hdc, glyph, glyphFormat, &gMetric, bufferSize, - dataBuffer, &mat); - }, { - ret = GetGlyphOutlineA(hdc, glyph, glyphFormat, &gMetric, bufferSize, - dataBuffer, &mat); - } ); + ret = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, bufferSize, dataBuffer, &mat); #endif if (ret == GDI_ERROR) { delete [](char *)dataBuffer; @@ -1171,14 +963,7 @@ void QFontEngineWin::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, in // font at the correct pixel size. lf.lfHeight = -unitsPerEm; lf.lfWidth = 0; - HFONT hf; - QT_WA({ - hf = CreateFontIndirectW(&lf); - }, { - LOGFONTA lfa; - wa_copy_logfont(&lf, &lfa); - hf = CreateFontIndirectA(&lfa); - }); + HFONT hf = CreateFontIndirect(&lf); HDC hdc = shared_dc(); HGDIOBJ oldfont = SelectObject(hdc, hf); @@ -1200,7 +985,7 @@ void QFontEngineWin::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyp QPainterPath *path, QTextItem::RenderFlags flags) { #if !defined(Q_WS_WINCE) - if(tm.w.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) { + if(tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) { hasOutline = true; QFontEngine::addOutlineToPath(x, y, glyphs, path, flags); if (hasOutline) { @@ -1234,11 +1019,11 @@ int QFontEngineWin::synthesized() const uchar data[4]; GetFontData(hdc, HEAD, 44, &data, 4); USHORT macStyle = getUShort(data); - if (tm.w.tmItalic && !(macStyle & 2)) + if (tm.tmItalic && !(macStyle & 2)) synthesized_flags = SynthesizedItalic; if (fontDef.stretch != 100 && ttf) synthesized_flags |= SynthesizedStretch; - if (tm.w.tmWeight >= 500 && !(macStyle & 1)) + if (tm.tmWeight >= 500 && !(macStyle & 1)) synthesized_flags |= SynthesizedBold; //qDebug() << "font is" << _name << // "it=" << (macStyle & 2) << fontDef.style << "flags=" << synthesized_flags; @@ -1254,24 +1039,12 @@ QFixed QFontEngineWin::emSquareSize() const QFontEngine::Properties QFontEngineWin::properties() const { - LOGFONT lf = logfont; lf.lfHeight = unitsPerEm; - HFONT hf; - QT_WA({ - hf = CreateFontIndirectW(&lf); - }, { - LOGFONTA lfa; - wa_copy_logfont(&lf, &lfa); - hf = CreateFontIndirectA(&lfa); - }); + HFONT hf = CreateFontIndirect(&lf); HDC hdc = shared_dc(); HGDIOBJ oldfont = SelectObject(hdc, hf); -#if defined(Q_WS_WINCE) - OUTLINETEXTMETRICW *otm = getOutlineTextMetric(hdc); -#else - OUTLINETEXTMETRICA *otm = getOutlineTextMetric(hdc); -#endif + OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc); Properties p; p.emSquare = unitsPerEm; p.italicAngle = otm->otmItalicAngle; @@ -1301,14 +1074,7 @@ void QFontEngineWin::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_m if(flags & SynthesizedItalic) lf.lfItalic = false; lf.lfWidth = 0; - HFONT hf; - QT_WA({ - hf = CreateFontIndirectW(&lf); - }, { - LOGFONTA lfa; - wa_copy_logfont(&lf, &lfa); - hf = CreateFontIndirectA(&lfa); - }); + HFONT hf = CreateFontIndirect(&lf); HDC hdc = shared_dc(); HGDIOBJ oldfont = SelectObject(hdc, hf); QFixedPoint p; @@ -1377,13 +1143,7 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin memset(&mat, 0, sizeof(mat)); mat.eM11.value = mat.eM22.value = 1; - int error = 0; - QT_WA( { - error = GetGlyphOutlineW(hdc, glyph, ggo_options, &tgm, 0, 0, &mat); - }, { - error = GetGlyphOutlineA(hdc, glyph, ggo_options, &tgm, 0, 0, &mat); - } ); - + int error = GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat); if (error == GDI_ERROR) { qWarning("QWinFontEngine: unable to query transformed glyph metrics..."); return 0; @@ -1430,11 +1190,11 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin if (has_transformation) { SetGraphicsMode(hdc, GM_ADVANCED); SetWorldTransform(hdc, &xform); - ExtTextOutW(hdc, 0, 0, options, 0, (LPCWSTR) &glyph, 1, 0); + ExtTextOut(hdc, 0, 0, options, 0, (LPCWSTR) &glyph, 1, 0); } else #endif { - ExtTextOutW(hdc, -gx + margin, -gy + margin, options, 0, (LPCWSTR) &glyph, 1, 0); + ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, (LPCWSTR) &glyph, 1, 0); } SelectObject(hdc, old_font); @@ -1450,7 +1210,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) if (qt_cleartype_enabled) { LOGFONT lf = logfont; lf.lfQuality = ANTIALIASED_QUALITY; - font = CreateFontIndirectW(&lf); + font = CreateFontIndirect(&lf); } QImage::Format mask_format = QNativeImage::systemFormat(); #ifndef Q_OS_WINCE @@ -1557,17 +1317,9 @@ void QFontEngineMultiWin::loadEngine(int at) QString fam = fallbacks.at(at-1); LOGFONT lf = static_cast(engines.at(0))->logfont; - HFONT hfont; - QT_WA({ - memcpy(lf.lfFaceName, fam.utf16(), sizeof(TCHAR)*qMin(fam.length()+1,32)); // 32 = Windows hard-coded - hfont = CreateFontIndirectW(&lf); - } , { - // LOGFONTA and LOGFONTW are binary compatible - QByteArray lname = fam.toLocal8Bit(); - memcpy(lf.lfFaceName,lname.data(), - qMin(lname.length()+1,32)); // 32 = Windows hard-coded - hfont = CreateFontIndirectA((LOGFONTA*)&lf); - }); + memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded + HFONT hfont = CreateFontIndirect(&lf); + bool stockFont = false; if (hfont == 0) { hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h index a8da78a..b86bd00 100644 --- a/src/gui/text/qfontengine_win_p.h +++ b/src/gui/text/qfontengine_win_p.h @@ -80,7 +80,7 @@ public: virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags); - HGDIOBJ selectDesignFont(QFixed *) const; + HGDIOBJ selectDesignFont() const; virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); virtual glyph_metrics_t boundingBox(glyph_t g) { return boundingBox(g, QTransform()); } @@ -109,18 +109,14 @@ public: int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const; void getCMap(); - QString _name; - HFONT hfont; + QString _name; + HFONT hfont; LOGFONT logfont; - uint stockFont : 1; - uint useTextOutA : 1; - uint ttf : 1; + uint stockFont : 1; + uint ttf : 1; uint hasOutline : 1; - union { - TEXTMETRICW w; - TEXTMETRICA a; - } tm; - int lw; + TEXTMETRIC tm; + int lw; const unsigned char *cmap; QByteArray cmapTable; mutable qreal lbearing; diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 2cc478d..e872617 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -62,33 +62,23 @@ QT_BEGIN_NAMESPACE -//#undef UNICODE - static bool openDocument(const QUrl &file) { if (!file.isValid()) return false; - quintptr returnValue; - QT_WA({ - returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *)file.toString().utf16(), 0, 0, SW_SHOWNORMAL); - } , { - returnValue = (quintptr)ShellExecuteA(0, 0, file.toString().toLocal8Bit().constData(), 0, 0, SW_SHOWNORMAL); - }); + quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t*)file.toString().utf16(), 0, 0, SW_SHOWNORMAL); return (returnValue > 32); //ShellExecute returns a value greater than 32 if successful } static QString expandEnvStrings(const QString &command) { - #if defined(Q_OS_WINCE) return command; #else - QByteArray path = command.toLocal8Bit(); - char commandValue[2 * MAX_PATH] = {0}; - DWORD returnValue = ExpandEnvironmentStringsA(path.data(), commandValue, MAX_PATH); - if (returnValue) - return QString::fromLocal8Bit(commandValue); + wchar_t buffer[MAX_PATH]; + if (ExpandEnvironmentStrings((wchar_t*)command.utf16(), buffer, MAX_PATH)) + return QString::fromWCharArray(buffer); else return command; #endif @@ -129,8 +119,9 @@ static bool launchWebBrowser(const QUrl &url) command = QString::fromRawData((QChar*)keyValue, bufferSize); RegCloseKey(handle); - if(returnValue) + if (returnValue) return false; + command = expandEnvStrings(command); command = command.trimmed(); //Make sure the path for the process is in quotes @@ -152,7 +143,7 @@ static bool launchWebBrowser(const QUrl &url) ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); - returnValue = CreateProcess(NULL, (TCHAR*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + returnValue = CreateProcess(NULL, (wchar_t*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); if (!returnValue) return false; @@ -168,9 +159,8 @@ static bool launchWebBrowser(const QUrl &url) if (url.scheme().isEmpty()) return openDocument(url); - quintptr returnValue; - returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *) QString::fromUtf8(url.toEncoded().constData()).utf16(), - 0, 0, SW_SHOWNORMAL); + quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t *)QString::fromUtf8(url.toEncoded().constData()).utf16(), + 0, 0, SW_SHOWNORMAL); return (returnValue > 32); } diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp index d2ce1be..c1b7e7f 100644 --- a/src/gui/util/qsystemtrayicon_win.cpp +++ b/src/gui/util/qsystemtrayicon_win.cpp @@ -41,8 +41,7 @@ #include "qsystemtrayicon_p.h" #ifndef QT_NO_SYSTEMTRAYICON -//#define _WIN32_IE 0x0500 -#define _WIN32_IE 0x0600 //required for NOTIFYICONDATAW_V2_SIZE +#define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE //missing defines for MINGW : #ifndef NIN_BALLOONTIMEOUT @@ -77,25 +76,14 @@ static const UINT q_uNOTIFYICONID = 0; static uint MYWM_TASKBARCREATED = 0; #define MYWM_NOTIFYICON (WM_APP+101) -typedef BOOL (WINAPI *PtrShell_NotifyIcon)(DWORD,PNOTIFYICONDATA); -static PtrShell_NotifyIcon ptrShell_NotifyIcon = 0; +struct Q_NOTIFYICONIDENTIFIER { + DWORD cbSize; + HWND hWnd; + UINT uID; + GUID guidItem; +}; -static void resolveLibs() -{ - static bool triedResolve = false; -#if defined Q_OS_WINCE - QString libName(QLatin1String("coredll")); - const char* funcName = "Shell_NotifyIcon"; -#else - QString libName(QLatin1String("shell32")); - const char* funcName = "Shell_NotifyIconW"; -#endif - if (!triedResolve) { - QLibrary lib(libName); - triedResolve = true; - ptrShell_NotifyIcon = (PtrShell_NotifyIcon) lib.resolve(funcName); - } -} +typedef HRESULT (WINAPI *PtrShell_NotifyIconGetRect)(const Q_NOTIFYICONIDENTIFIER* identifier, RECT* iconLocation); class QSystemTrayIconSys : QWidget { @@ -103,37 +91,26 @@ public: QSystemTrayIconSys(QSystemTrayIcon *object); ~QSystemTrayIconSys(); bool winEvent( MSG *m, long *result ); - bool trayMessageA(DWORD msg); - bool trayMessageW(DWORD msg); bool trayMessage(DWORD msg); bool iconDrawItem(LPDRAWITEMSTRUCT lpdi); - void setIconContentsW(NOTIFYICONDATAW &data); - void setIconContentsA(NOTIFYICONDATAA &data); - bool showMessageW(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs); - bool showMessageA(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs); + void setIconContents(NOTIFYICONDATA &data); + bool showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs); bool allowsMessages(); bool supportsMessages(); QRect findIconGeometry(const int a_iButtonID); - QRect findTrayGeometry(); HBITMAP createIconMask(const QBitmap &bitmap); void createIcon(); - int detectShellVersion() const; HICON hIcon; QPoint globalPos; QSystemTrayIcon *q; private: - uint notifyIconSizeW; - uint notifyIconSizeA; - int currentShellVersion; + uint notifyIconSize; int maxTipLength; }; -// Checks for the shell32 dll version number, since only version -// 5 or later of supports ballon messages bool QSystemTrayIconSys::allowsMessages() { #ifndef QT_NO_SETTINGS - QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Software\\Microsoft" "\\Windows\\CurrentVersion\\Explorer\\Advanced"), QSettings::NativeFormat); return settings.value(QLatin1String("EnableBalloonTips"), true).toBool(); @@ -142,63 +119,28 @@ bool QSystemTrayIconSys::allowsMessages() #endif } -// Checks for the shell32 dll version number, since only version -// 5 or later of supports ballon messages bool QSystemTrayIconSys::supportsMessages() { -#if NOTIFYICON_VERSION >= 3 - if (currentShellVersion >= 5) - return allowsMessages(); - else -#endif - return false; -} - -//Returns the runtime major version of the shell32 dll -int QSystemTrayIconSys::detectShellVersion() const -{ #ifndef Q_OS_WINCE - int shellVersion = 4; //NT 4.0 and W95 - DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)QLibrary::resolve( - QLatin1String("shell32"), "DllGetVersion"); - if (pDllGetVersion) - { - DLLVERSIONINFO dvi; - HRESULT hr; - ZeroMemory(&dvi, sizeof(dvi)); - dvi.cbSize = sizeof(dvi); - hr = (*pDllGetVersion)(&dvi); - if (SUCCEEDED(hr)) { - if (dvi.dwMajorVersion >= 5) - { - shellVersion = dvi.dwMajorVersion; - } - } - } - return shellVersion; + return allowsMessages(); #endif - return 4; //No ballonMessages and MaxTipLength = 64 for WindowsCE + return false; } QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) : hIcon(0), q(object) { - currentShellVersion = detectShellVersion(); - notifyIconSizeA = FIELD_OFFSET(NOTIFYICONDATAA, szTip[64]); // NOTIFYICONDATAA_V1_SIZE - notifyIconSizeW = FIELD_OFFSET(NOTIFYICONDATAW, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; +#ifndef Q_OS_WINCE + notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE; + maxTipLength = 128; +#else + notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; maxTipLength = 64; - -#if NOTIFYICON_VERSION >= 3 - if (currentShellVersion >=5) { - notifyIconSizeA = FIELD_OFFSET(NOTIFYICONDATAA, guidItem); // NOTIFYICONDATAA_V2_SIZE - notifyIconSizeW = FIELD_OFFSET(NOTIFYICONDATAW, guidItem); // NOTIFYICONDATAW_V2_SIZE; - maxTipLength = 128; - } #endif // For restoring the tray icon after explorer crashes if (!MYWM_TASKBARCREATED) { - MYWM_TASKBARCREATED = QT_WA_INLINE(RegisterWindowMessageW(L"TaskbarCreated"),RegisterWindowMessageA("TaskbarCreated")); + MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated"); } } @@ -208,118 +150,60 @@ QSystemTrayIconSys::~QSystemTrayIconSys() DestroyIcon(hIcon); } -void QSystemTrayIconSys::setIconContentsW(NOTIFYICONDATAW &tnd) +void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd) { - tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; + tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; tnd.uCallbackMessage = MYWM_NOTIFYICON; tnd.hIcon = hIcon; QString tip = q->toolTip(); if (!tip.isNull()) { - // Tip is limited to maxTipLength - NULL; lstrcpyn appends a NULL terminator. tip = tip.left(maxTipLength - 1) + QChar(); -#if defined(Q_OS_WINCE) - wcsncpy(tnd.szTip, reinterpret_cast (tip.utf16()), qMin(tip.length()+1, maxTipLength)); -#else - lstrcpynW(tnd.szTip, (TCHAR*)tip.utf16(), qMin(tip.length()+1, maxTipLength)); -#endif - } -} - -void QSystemTrayIconSys::setIconContentsA(NOTIFYICONDATAA &tnd) -{ - tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; - tnd.uCallbackMessage = MYWM_NOTIFYICON; - tnd.hIcon = hIcon; - QString tip = q->toolTip(); - - if (!tip.isNull()) { - // Tip is limited to maxTipLength - NULL; lstrcpyn appends a NULL terminator. - tip = tip.left(maxTipLength - 1) + QChar(); -#if defined(Q_OS_WINCE) - strncpy(tnd.szTip, tip.toLocal8Bit().constData(), qMin(tip.length()+1, maxTipLength)); -#else - lstrcpynA(tnd.szTip, tip.toLocal8Bit().constData(), qMin(tip.length()+1, maxTipLength)); -#endif + memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t)); } } int iconFlag( QSystemTrayIcon::MessageIcon icon ) { - int flag = 0; #if NOTIFYICON_VERSION >= 3 switch (icon) { - case QSystemTrayIcon::NoIcon: - break; - case QSystemTrayIcon::Critical: - flag = NIIF_ERROR; - break; - case QSystemTrayIcon::Warning: - flag = NIIF_WARNING; - break; case QSystemTrayIcon::Information: - default : // fall through - flag = NIIF_INFO; + return NIIF_INFO; + case QSystemTrayIcon::Warning: + return NIIF_WARNING; + case QSystemTrayIcon::Critical: + return NIIF_ERROR; + case QSystemTrayIcon::NoIcon: + return NIIF_NONE; + default: + Q_ASSERT("Invalid QSystemTrayIcon::MessageIcon value", false); + return NIIF_NONE; } #else Q_UNUSED(icon); + return 0; #endif - return flag; } -bool QSystemTrayIconSys::showMessageW(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs) +bool QSystemTrayIconSys::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs) { -#if NOTIFYICON_VERSION>=3 +#if NOTIFYICON_VERSION >= 3 NOTIFYICONDATA tnd; - memset(&tnd, 0, notifyIconSizeW); + memset(&tnd, 0, notifyIconSize); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - setIconContentsW(tnd); -#if defined(Q_OS_WINCE) - wcsncpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256)); - wcsncpy(tnd.szInfoTitle, title.utf16(), qMin(title.length()+1, 64)); -#else - lstrcpynW(tnd.szInfo, (TCHAR*)message.utf16(), qMin(message.length() + 1, 256)); - lstrcpynW(tnd.szInfoTitle, (TCHAR*)title.utf16(), qMin(title.length() + 1, 64)); -#endif - tnd.uID = q_uNOTIFYICONID; - tnd.dwInfoFlags = iconFlag(type); - tnd.cbSize = notifyIconSizeW; - tnd.hWnd = winId(); - tnd.uTimeout = uSecs; - tnd.uFlags = NIF_INFO; - return ptrShell_NotifyIcon(NIM_MODIFY, &tnd); -#else - Q_UNUSED(title); - Q_UNUSED(message); - Q_UNUSED(type); - Q_UNUSED(uSecs); - return false; -#endif -} - -bool QSystemTrayIconSys::showMessageA(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs) -{ -#if NOTIFYICON_VERSION>=3 - NOTIFYICONDATAA tnd; - memset(&tnd, 0, notifyIconSizeA); - Q_ASSERT(testAttribute(Qt::WA_WState_Created)); + setIconContents(tnd); + memcpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256) * sizeof(wchar_t)); + memcpy(tnd.szInfoTitle, title.utf16(), qMin(title.length() + 1, 64) * sizeof(wchar_t)); - setIconContentsA(tnd); -#if defined(Q_OS_WINCE) - strncpy(tnd.szInfo, message.toLocal8Bit().constData(), qMin(message.length() + 1, 256)); - strncpy(tnd.szInfoTitle, title.toLocal8Bit().constData(), qMin(title.length()+1, 64)); -#else - lstrcpynA(tnd.szInfo, message.toLocal8Bit().constData(), qMin(message.length() + 1, 256)); - lstrcpynA(tnd.szInfoTitle, title.toLocal8Bit().constData(), qMin(title.length() + 1, 64)); -#endif tnd.uID = q_uNOTIFYICONID; tnd.dwInfoFlags = iconFlag(type); - tnd.cbSize = notifyIconSizeA; + tnd.cbSize = notifyIconSize; tnd.hWnd = winId(); tnd.uTimeout = uSecs; tnd.uFlags = NIF_INFO; - return Shell_NotifyIconA(NIM_MODIFY, &tnd); + + return Shell_NotifyIcon(NIM_MODIFY, &tnd); #else Q_UNUSED(title); Q_UNUSED(message); @@ -329,53 +213,21 @@ bool QSystemTrayIconSys::showMessageA(const QString &title, const QString &messa #endif } -bool QSystemTrayIconSys::trayMessageA(DWORD msg) +bool QSystemTrayIconSys::trayMessage(DWORD msg) { -#if !defined(Q_WS_WINCE) - NOTIFYICONDATAA tnd; - memset(&tnd, 0, notifyIconSizeA); + NOTIFYICONDATA tnd; + memset(&tnd, 0, notifyIconSize); tnd.uID = q_uNOTIFYICONID; - tnd.cbSize = notifyIconSizeA; + tnd.cbSize = notifyIconSize; tnd.hWnd = winId(); - Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - if (msg != NIM_DELETE) { - setIconContentsA(tnd); - } - return Shell_NotifyIconA(msg, &tnd); -#else - Q_UNUSED(msg); - return false; -#endif -} - -bool QSystemTrayIconSys::trayMessageW(DWORD msg) -{ - NOTIFYICONDATAW tnd; - memset(&tnd, 0, notifyIconSizeW); - tnd.uID = q_uNOTIFYICONID; - tnd.cbSize = notifyIconSizeW; - tnd.hWnd = winId(); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); if (msg != NIM_DELETE) { - setIconContentsW(tnd); + setIconContents(tnd); } - return ptrShell_NotifyIcon(msg, &tnd); -} -bool QSystemTrayIconSys::trayMessage(DWORD msg) -{ - resolveLibs(); - if (!(ptrShell_NotifyIcon)) - return false; - - QT_WA({ - return trayMessageW(msg); - }, - { - return trayMessageA(msg); - }); + return Shell_NotifyIcon(msg, &tnd); } bool QSystemTrayIconSys::iconDrawItem(LPDRAWITEMSTRUCT lpdi) @@ -514,33 +366,6 @@ void QSystemTrayIconPrivate::install_sys() } } -//fallback on win 95/98 -QRect QSystemTrayIconSys::findTrayGeometry() -{ - //Use lower right corner as fallback - QPoint brCorner = QApplication::desktop()->screenGeometry().bottomRight(); - QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10); -#if defined(Q_OS_WINCE) - HWND trayHandle = FindWindowW(L"Shell_TrayWnd", NULL); -#else - HWND trayHandle = FindWindowA("Shell_TrayWnd", NULL); -#endif - if (trayHandle) { -#if defined(Q_OS_WINCE) - trayHandle = FindWindowW(L"TrayNotifyWnd", NULL); -#else - trayHandle = FindWindowExA(trayHandle, NULL, "TrayNotifyWnd", NULL); -#endif - if (trayHandle) { - RECT r; - if (GetWindowRect(trayHandle, &r)) { - ret = QRect(r.left, r.top, r.right- r.left, r.bottom - r.top); - } - } - } - return ret; -} - /* * This function tries to determine the icon geometry from the tray * @@ -548,26 +373,39 @@ QRect QSystemTrayIconSys::findTrayGeometry() */ QRect QSystemTrayIconSys::findIconGeometry(const int iconId) { + static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect = + (PtrShell_NotifyIconGetRect)QLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect"); + + if (Shell_NotifyIconGetRect) { + Q_NOTIFYICONIDENTIFIER nid; + memset(&nid, 0, sizeof(nid)); + nid.cbSize = sizeof(nid); + nid.hWnd = winId(); + nid.uID = iconId; + + RECT rect; + HRESULT hr = Shell_NotifyIconGetRect(&nid, &rect); + if (SUCCEEDED(hr)) { + return QRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + } + } + QRect ret; TBBUTTON buttonData; DWORD processID = 0; -#if defined(Q_OS_WINCE) - HWND trayHandle = FindWindowW(L"Shell_TrayWnd", NULL); -#else - HWND trayHandle = FindWindowA("Shell_TrayWnd", NULL); -#endif + HWND trayHandle = FindWindow(L"Shell_TrayWnd", NULL); //find the toolbar used in the notification area if (trayHandle) { #if defined(Q_OS_WINCE) - trayHandle = FindWindowW(L"TrayNotifyWnd", NULL); + trayHandle = FindWindow(L"TrayNotifyWnd", NULL); #else - trayHandle = FindWindowExA(trayHandle, NULL, "TrayNotifyWnd", NULL); + trayHandle = FindWindowEx(trayHandle, NULL, L"TrayNotifyWnd", NULL); #endif if (trayHandle) { #if defined(Q_OS_WINCE) - HWND hwnd = FindWindowW(L"SysPager", NULL); + HWND hwnd = FindWindow(L"SysPager", NULL); #else HWND hwnd = FindWindowEx(trayHandle, NULL, L"SysPager", NULL); #endif @@ -612,10 +450,10 @@ QRect QSystemTrayIconSys::findIconGeometry(const int iconId) DWORD appData[2] = { 0, 0 }; SendMessage(trayHandle, TB_GETBUTTON, toolbarButton , (LPARAM)data); - if(!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes)) + if (!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes)) continue; - if(!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes)) + if (!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes)) continue; int currentIconId = appData[1]; @@ -646,7 +484,6 @@ QRect QSystemTrayIconSys::findIconGeometry(const int iconId) return ret; } - void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut) { if (!sys || !sys->allowsMessages()) @@ -657,8 +494,6 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString uSecs = 10000; //10 sec default else uSecs = (int)timeOut; - resolveLibs(); - //message is limited to 255 chars + NULL QString messageString; if (message.isEmpty() && !title.isEmpty()) @@ -670,20 +505,12 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString QString titleString = title.left(63) + QChar(); if (sys->supportsMessages()) { - QT_WA({ - sys->showMessageW(titleString, messageString, type, (unsigned int)uSecs); - }, { - sys->showMessageA(titleString, messageString, type, (unsigned int)uSecs); - }); + sys->showMessage(titleString, messageString, type, (unsigned int)uSecs); } else { - //use fallbacks - QRect iconPos = sys->findIconGeometry(0); + //use fallback + QRect iconPos = sys->findIconGeometry(q_uNOTIFYICONID); if (iconPos.isValid()) { QBalloonTip::showBalloon(type, title, message, sys->q, iconPos.center(), uSecs, true); - } else { - QRect trayRect = sys->findTrayGeometry(); - QBalloonTip::showBalloon(type, title, message, sys->q, QPoint(trayRect.left(), - trayRect.center().y()), uSecs, false); } } } @@ -692,7 +519,7 @@ QRect QSystemTrayIconPrivate::geometry_sys() const { if (!sys) return QRect(); - return sys->findIconGeometry(0); + return sys->findIconGeometry(q_uNOTIFYICONID); } void QSystemTrayIconPrivate::remove_sys() diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index 065a2e0..d6d0a16 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -126,10 +126,9 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) QAlphaWidget::~QAlphaWidget() { -#ifdef Q_WS_WIN +#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) // Restore user-defined opacity value - if (widget && QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) - widget->setWindowOpacity(windowOpacity); + widget->setWindowOpacity(windowOpacity); #endif } @@ -160,43 +159,40 @@ void QAlphaWidget::run(int time) checkTime.start(); showWidget = true; -#if defined(Q_OS_WIN) - if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) { - qApp->installEventFilter(this); - widget->setWindowOpacity(0.0); - widget->show(); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + qApp->installEventFilter(this); + widget->setWindowOpacity(0.0); + widget->show(); + connect(&anim, SIGNAL(timeout()), this, SLOT(render())); + anim.start(1); +#else + //This is roughly equivalent to calling setVisible(true) without actually showing the widget + widget->setAttribute(Qt::WA_WState_ExplicitShowHide, true); + widget->setAttribute(Qt::WA_WState_Hidden, false); + + qApp->installEventFilter(this); + + move(widget->geometry().x(),widget->geometry().y()); + resize(widget->size().width(), widget->size().height()); + + frontImage = QPixmap::grabWidget(widget).toImage(); + backImage = QPixmap::grabWindow(QApplication::desktop()->winId(), + widget->geometry().x(), widget->geometry().y(), + widget->geometry().width(), widget->geometry().height()).toImage(); + + if (!backImage.isNull() && checkTime.elapsed() < duration / 2) { + mixedImage = backImage.copy(); + pm = QPixmap::fromImage(mixedImage); + show(); + setEnabled(false); + connect(&anim, SIGNAL(timeout()), this, SLOT(render())); anim.start(1); - } else -#endif - { - //This is roughly equivalent to calling setVisible(true) without actually showing the widget - widget->setAttribute(Qt::WA_WState_ExplicitShowHide, true); - widget->setAttribute(Qt::WA_WState_Hidden, false); - - qApp->installEventFilter(this); - - move(widget->geometry().x(),widget->geometry().y()); - resize(widget->size().width(), widget->size().height()); - - frontImage = QPixmap::grabWidget(widget).toImage(); - backImage = QPixmap::grabWindow(QApplication::desktop()->winId(), - widget->geometry().x(), widget->geometry().y(), - widget->geometry().width(), widget->geometry().height()).toImage(); - - if (!backImage.isNull() && checkTime.elapsed() < duration / 2) { - mixedImage = backImage.copy(); - pm = QPixmap::fromImage(mixedImage); - show(); - setEnabled(false); - - connect(&anim, SIGNAL(timeout()), this, SLOT(render())); - anim.start(1); - } else { - duration = 0; - render(); - } + } else { + duration = 0; + render(); } +#endif } /* @@ -270,19 +266,17 @@ void QAlphaWidget::render() else alpha = 1; -#if defined(Q_OS_WIN) - if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) { - if (alpha >= windowOpacity || !showWidget) { - anim.stop(); - qApp->removeEventFilter(this); - widget->setWindowOpacity(windowOpacity); - q_blend = 0; - deleteLater(); - } else { - widget->setWindowOpacity(alpha); - } - } else -#endif +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + if (alpha >= windowOpacity || !showWidget) { + anim.stop(); + qApp->removeEventFilter(this); + widget->setWindowOpacity(windowOpacity); + q_blend = 0; + deleteLater(); + } else { + widget->setWindowOpacity(alpha); + } +#else if (alpha >= 1 || !showWidget) { anim.stop(); qApp->removeEventFilter(this); @@ -292,7 +286,7 @@ void QAlphaWidget::render() #ifdef Q_WS_WIN setEnabled(true); setFocus(); -#endif +#endif // Q_WS_WIN widget->hide(); } else { //Since we are faking the visibility of the widget @@ -309,6 +303,7 @@ void QAlphaWidget::render() pm = QPixmap::fromImage(mixedImage); repaint(); } +#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE) } /* diff --git a/src/gui/widgets/qframe.cpp b/src/gui/widgets/qframe.cpp index b9e769d..a87ec85 100644 --- a/src/gui/widgets/qframe.cpp +++ b/src/gui/widgets/qframe.cpp @@ -135,7 +135,7 @@ inline void QFramePrivate::init() \value VLine QFrame draws a vertical line that frames nothing (useful as separator) \value WinPanel draws a rectangular panel that can be raised or - sunken like those in Windows 95. Specifying this shape sets + sunken like those in Windows 2000. Specifying this shape sets the line width to 2 pixels. WinPanel is provided for compatibility. For GUI style independence we recommend using StyledPanel instead. diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp index 25bc724..24dea37 100644 --- a/src/gui/widgets/qmdisubwindow.cpp +++ b/src/gui/widgets/qmdisubwindow.cpp @@ -1946,26 +1946,21 @@ QPalette QMdiSubWindowPrivate::desktopPalette() const colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT))); newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT))); - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 - && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - colorsInitialized = true; - BOOL hasGradient; - QT_WA({ - SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0); - } , { - SystemParametersInfoA(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0); - }); - if (hasGradient) { - newPalette.setColor(QPalette::Active, QPalette::Base, - colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); - newPalette.setColor(QPalette::Inactive, QPalette::Base, - colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); - } else { - newPalette.setColor(QPalette::Active, QPalette::Base, - newPalette.color(QPalette::Active, QPalette::Highlight)); - newPalette.setColor(QPalette::Inactive, QPalette::Base, - newPalette.color(QPalette::Inactive, QPalette::Highlight)); - } + + colorsInitialized = true; + BOOL hasGradient = false; + SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0); + + if (hasGradient) { + newPalette.setColor(QPalette::Active, QPalette::Base, + colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); + newPalette.setColor(QPalette::Inactive, QPalette::Base, + colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); + } else { + newPalette.setColor(QPalette::Active, QPalette::Base, + newPalette.color(QPalette::Active, QPalette::Highlight)); + newPalette.setColor(QPalette::Inactive, QPalette::Base, + newPalette.color(QPalette::Inactive, QPalette::Highlight)); } } #endif // Q_WS_WIN diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp index d263b9c..c6aae68 100644 --- a/src/gui/widgets/qsizegrip.cpp +++ b/src/gui/widgets/qsizegrip.cpp @@ -335,8 +335,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) orientation = d->atLeft() ? SZ_SIZETOPLEFT : SZ_SIZETOPRIGHT; ReleaseCapture(); - QT_WA_INLINE(PostMessageW(tlw->winId(), WM_SYSCOMMAND, orientation, 0), - PostMessageA(tlw->winId(), WM_SYSCOMMAND, orientation, 0)); + PostMessage(tlw->winId(), WM_SYSCOMMAND, orientation, 0); return; } #endif // Q_WS_WIN diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index 58ef1e3..2833c08 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -397,21 +397,17 @@ void QWorkspaceTitleBarPrivate::readColors() pal.setColor(QPalette::Inactive, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION))); pal.setColor(QPalette::Active, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT))); pal.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT))); - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - colorsInitialized = true; - BOOL gradient; - QT_WA({ - SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0); - } , { - SystemParametersInfoA(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0); - }); - if (gradient) { - pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); - pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); - } else { - pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight)); - pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight)); - } + + colorsInitialized = true; + BOOL gradient = false; + SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0); + + if (gradient) { + pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); + pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); + } else { + pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight)); + pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight)); } } #endif // Q_WS_WIN -- cgit v0.12 From 48406f5ae81fdcb3ba2a01471678d10213a2caa9 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:49:58 +0200 Subject: src/network: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/network/kernel/qnetworkinterface_win.cpp | 15 +++---- src/network/kernel/qnetworkproxy_win.cpp | 15 +------ src/network/socket/qlocalserver.cpp | 2 - src/network/socket/qlocalserver_win.cpp | 19 ++------- src/network/socket/qlocalsocket.cpp | 2 - src/network/socket/qlocalsocket_win.cpp | 36 +++++----------- src/network/socket/qnativesocketengine_win.cpp | 58 +++++++++++--------------- 7 files changed, 43 insertions(+), 104 deletions(-) diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index 0165385..87902c3 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -66,19 +66,14 @@ static void resolveLibs() if (!done) { done = true; - HINSTANCE iphlpapiHnd; - QT_WA({ - iphlpapiHnd = LoadLibraryW(L"iphlpapi"); - }, { - iphlpapiHnd = LoadLibraryA("iphlpapi"); - }); + HINSTANCE iphlpapiHnd = LoadLibrary(L"iphlpapi"); if (iphlpapiHnd == NULL) - return; // failed to load, probably Windows 95 + return; #if defined(Q_OS_WINCE) - ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddressW(iphlpapiHnd, L"GetAdaptersInfo"); - ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddressW(iphlpapiHnd, L"GetAdaptersAddresses"); - ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddressW(iphlpapiHnd, L"GetNetworkParams"); + ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, L"GetAdaptersInfo"); + ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, L"GetAdaptersAddresses"); + ptrGetNetworkParams = (PtrGetNetworkParams)GetProcAddress(iphlpapiHnd, L"GetNetworkParams"); #else ptrGetAdaptersInfo = (PtrGetAdaptersInfo)GetProcAddress(iphlpapiHnd, "GetAdaptersInfo"); ptrGetAdaptersAddresses = (PtrGetAdaptersAddresses)GetProcAddress(iphlpapiHnd, "GetAdaptersAddresses"); diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 5fda228..7052bcc2 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -43,8 +43,6 @@ #ifndef QT_NO_NETWORKPROXY -#if defined(UNICODE) - #include #include #include @@ -269,15 +267,13 @@ void QWindowsSystemProxy::init() if (initialized) return; initialized = true; - if (QSysInfo::windowsVersion() & QSysInfo::WV_DOS_based) - return; // no point, this library is only available on 2k, XP and up #ifdef Q_OS_WINCE // Windows CE does not have any of the following API return; #else // load the winhttp.dll library - HINSTANCE winhttpHnd = LoadLibraryW(L"winhttp"); + HINSTANCE winhttpHnd = LoadLibrary(L"winhttp"); if (!winhttpHnd) return; // failed to load @@ -401,15 +397,6 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro return parseServerList(query, sp->proxyServerList); } -#else // !UNICODE - -QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &) -{ - return QList() << QNetworkProxy::NoProxy; -} - -#endif - QT_END_NAMESPACE #endif diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index 05ef2e6..1a50dc4 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -78,8 +78,6 @@ QT_BEGIN_NAMESPACE to use it without one. In that case, you must use waitForNewConnection(), which blocks until either a connection is available or a timeout expires. - Note that this feature is not supported on Windows 9x. - \sa QLocalSocket, QTcpServer */ diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp index 6af5ca5..c4f8f3c 100644 --- a/src/network/socket/qlocalserver_win.cpp +++ b/src/network/socket/qlocalserver_win.cpp @@ -62,9 +62,8 @@ bool QLocalServerPrivate::addListener() listeners << Listener(); Listener &listener = listeners.last(); - QT_WA({ - listener.handle = CreateNamedPipeW( - (TCHAR*)fullServerName.utf16(), // pipe name + listener.handle = CreateNamedPipe( + (const wchar_t *)fullServerName.utf16(), // pipe name PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access PIPE_TYPE_MESSAGE | // message type pipe PIPE_READMODE_MESSAGE | // message-read mode @@ -74,19 +73,7 @@ bool QLocalServerPrivate::addListener() BUFSIZE, // input buffer size 3000, // client time-out NULL); - }, { - listener.handle = CreateNamedPipeA( - fullServerName.toLocal8Bit().constData(), // pipe name - PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access - PIPE_TYPE_MESSAGE | // message type pipe - PIPE_READMODE_MESSAGE | // message-read mode - PIPE_WAIT, // blocking mode - PIPE_UNLIMITED_INSTANCES, // max. instances - BUFSIZE, // output buffer size - BUFSIZE, // input buffer size - 3000, // client time-out - NULL); - }); + if (listener.handle == INVALID_HANDLE_VALUE) { setError(QLatin1String("QLocalServerPrivate::addListener")); listeners.removeLast(); diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index acacdf2..c18026b 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -63,8 +63,6 @@ QT_BEGIN_NAMESPACE waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected() which blocks until the operation is complete or the timeout expires. - Note that this feature is not supported on Window 9x. - \sa QLocalServer */ diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 2b8d7e5..b1b69fc 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -137,25 +137,14 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) forever { DWORD permissions = (openMode & QIODevice::ReadOnly) ? GENERIC_READ : 0; permissions |= (openMode & QIODevice::WriteOnly) ? GENERIC_WRITE : 0; - QT_WA({ - localSocket = CreateFileW( - (TCHAR*)d->fullServerName.utf16(), // pipe name - permissions, - 0, // no sharing - NULL, // default security attributes - OPEN_EXISTING, // opens existing pipe - FILE_FLAG_OVERLAPPED, - NULL); // no template file - }, { - localSocket = CreateFileA( - d->fullServerName.toLocal8Bit().constData(), // pipe name - permissions, - 0, // no sharing - NULL, // default security attributes - OPEN_EXISTING, // opens existing pipe - FILE_FLAG_OVERLAPPED, - NULL); // no template file - }); + localSocket = CreateFile((const wchar_t *)d->fullServerName.utf16(), // pipe name + permissions, + 0, // no sharing + NULL, // default security attributes + OPEN_EXISTING, // opens existing pipe + FILE_FLAG_OVERLAPPED, + NULL); // no template file + if (localSocket != INVALID_HANDLE_VALUE) break; DWORD error = GetLastError(); @@ -165,13 +154,8 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) } // All pipe instances are busy, so wait until connected or up to 5 seconds. - QT_WA({ - if (!WaitNamedPipeW((TCHAR*)d->fullServerName.utf16(), 5000)) - break; - }, { - if (!WaitNamedPipeA(d->fullServerName.toLocal8Bit().constData(), 5000)) - break; - }); + if (!WaitNamedPipe((const wchar_t *)d->fullServerName.utf16(), 5000)) + break; } if (localSocket == INVALID_HANDLE_VALUE) { diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 59a3b60..ce8d810 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -918,15 +918,9 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxL int wsaRet = ::WSARecvFrom(socketDescriptor, &buf, 1, &bytesRead, &flags, (struct sockaddr *) &aa, &sz,0,0); if (wsaRet == SOCKET_ERROR) { int err = WSAGetLastError(); - if (err == WSAEMSGSIZE) { - // it is ok the buffer was to small if bytesRead is larger than - // maxLength (win 9x) then assume bytes read is really maxLenth - ret = qint64(bytesRead) > maxLength ? maxLength : qint64(bytesRead); - } else { - WS_ERROR_DEBUG(err); - setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); - ret = -1; - } + WS_ERROR_DEBUG(err); + setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); + ret = -1; } else { ret = qint64(bytesRead); } @@ -955,36 +949,32 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l qt_socket_setPortAndAddress(socketDescriptor, &sockAddrIPv4, &sockAddrIPv6, port, address, &sockAddrPtr, &sockAddrSize); - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based && len > qint64(qt_socket_getMaxMsgSize(socketDescriptor))) { - // WSAEMSGSIZE is not reliable enough (win 9x) so we check max size our self. - setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString); - } else { - WSABUF buf; + WSABUF buf; #if !defined(Q_OS_WINCE) - buf.buf = len ? (char*)data : 0; + buf.buf = len ? (char*)data : 0; #else - char tmp; - buf.buf = len ? (char*)data : &tmp; + char tmp; + buf.buf = len ? (char*)data : &tmp; #endif - buf.len = len; - DWORD flags = 0; - DWORD bytesSent = 0; - if (::WSASendTo(socketDescriptor, &buf, 1, &bytesSent, flags, sockAddrPtr, sockAddrSize, 0,0) == SOCKET_ERROR) { - int err = WSAGetLastError(); - WS_ERROR_DEBUG(err); - switch (err) { - case WSAEMSGSIZE: - setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString); - break; - default: - setError(QAbstractSocket::NetworkError, SendDatagramErrorString); - break; - } - ret = -1; - } else { - ret = qint64(bytesSent); + buf.len = len; + DWORD flags = 0; + DWORD bytesSent = 0; + if (::WSASendTo(socketDescriptor, &buf, 1, &bytesSent, flags, sockAddrPtr, sockAddrSize, 0,0) == SOCKET_ERROR) { + int err = WSAGetLastError(); + WS_ERROR_DEBUG(err); + switch (err) { + case WSAEMSGSIZE: + setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString); + break; + default: + setError(QAbstractSocket::NetworkError, SendDatagramErrorString); + break; } + ret = -1; + } else { + ret = qint64(bytesSent); } + #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeSendDatagram(%p \"%s\", %li, \"%s\", %i) == %li", data, qt_prettyDebug(data, qMin(len, 16), len).data(), 0, address.toString().toLatin1().constData(), -- cgit v0.12 From d4a5ed717ae08034ffbc2377321406720a37bee9 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:50:01 +0200 Subject: src/opengl: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/opengl/qgl_win.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp index 40b0ce7..86dd1d8 100644 --- a/src/opengl/qgl_win.cpp +++ b/src/opengl/qgl_win.cpp @@ -642,14 +642,10 @@ public: QString windowClassName = qt_getRegisteredWndClass(); if (parent && !parent->internalWinId()) parent = parent->nativeParentWidget(); - QT_WA({ - const TCHAR *cname = (TCHAR*)windowClassName.utf16(); - dmy_id = CreateWindow(cname, 0, 0, 0, 0, 1, 1, - parent ? parent->winId() : 0, 0, qWinAppInst(), 0); - } , { - dmy_id = CreateWindowA(windowClassName.toLatin1(), 0, 0, 0, 0, 1, 1, - parent ? parent->winId() : 0, 0, qWinAppInst(), 0); - }); + + dmy_id = CreateWindow((const wchar_t *)windowClassName.utf16(), + 0, 0, 0, 0, 1, 1, + parent ? parent->winId() : 0, 0, qWinAppInst(), 0); dmy_pdc = GetDC(dmy_id); PIXELFORMATDESCRIPTOR dmy_pfd; -- cgit v0.12 From 5db6c3b72d3c28f55f14883767d29db3441b1b66 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:50:04 +0200 Subject: src/sql: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also remove many #ifdef UNICODE blocks Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/sql/drivers/db2/qsql_db2.cpp | 30 +----------------------------- src/sql/drivers/odbc/qsql_odbc.cpp | 9 +-------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 1a82377..e4f564a 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -51,10 +51,6 @@ #include #include -#ifndef UNICODE -#define UNICODE -#endif - #if defined(Q_CC_BOR) // DB2's sqlsystm.h (included through sqlcli1.h) defines the SQL_BIGINT_TYPE // and SQL_BIGUINT_TYPE to wrong the types for Borland; so do the defines to @@ -111,22 +107,14 @@ public: static QString qFromTChar(SQLTCHAR* str) { -#ifdef UNICODE return QString::fromUtf16(str); -#else - return QString::fromLocal8Bit((const char*) str); -#endif } // dangerous!! (but fast). Don't use in functions that // require out parameters! static SQLTCHAR* qToTChar(const QString& str) { -#ifdef UNICODE return (SQLTCHAR*)str.utf16(); -#else - return (unsigned char*) str.ascii(); -#endif } static QString qWarnDB2Handle(int handleType, SQLHANDLE handle) @@ -347,12 +335,8 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool& is while (true) { r = SQLGetData(hStmt, - column+1, -#ifdef UNICODE + column + 1, SQL_C_WCHAR, -#else - SQL_C_CHAR, -#endif (SQLPOINTER)buf, colSize * sizeof(SQLTCHAR), &lengthIndicator); @@ -740,7 +724,6 @@ bool QDB2Result::exec() ind); break; } case QVariant::String: -#ifdef UNICODE { QString str(values.at(i).toString()); if (*ind != SQL_NULL_DATA) @@ -774,8 +757,6 @@ bool QDB2Result::exec() } break; } -#endif - // fall through default: { QByteArray ba = values.at(i).toString().toAscii(); int len = ba.length() + 1; @@ -849,12 +830,9 @@ bool QDB2Result::exec() case QVariant::ByteArray: break; case QVariant::String: -#ifdef UNICODE if (bindValueType(i) & QSql::Out) values[i] = QString::fromUtf16((ushort*)tmpStorage.takeFirst().constData()); break; -#endif - // fall through default: { values[i] = QString::fromAscii(tmpStorage.takeFirst().constData()); break; } @@ -1542,13 +1520,7 @@ bool QDB2Driver::hasFeature(DriverFeature f) const case FinishQuery: return true; case Unicode: - // this is the query that shows the codepage for the types: - // select typename, codepage from syscat.datatypes -#ifdef UNICODE return true; -#else - return false; -#endif } return false; } diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index af0c297..c48c7cd 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1843,14 +1843,7 @@ void QODBCDriverPrivate::checkUnicode() unicode = false; return; #endif -#if defined(Q_WS_WIN) - QT_WA( - {}, - { - unicode = false; - return; - }) -#endif + SQLRETURN r; SQLUINTEGER fFunc; -- cgit v0.12 From 22ab94871c4a924e37eca720a1620da2e1a7259d Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:50:07 +0200 Subject: src/activeqt: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also, buffer sizes passed to Registry APIs were incorrect. Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/activeqt/container/qaxbase.cpp | 58 +++++------ src/activeqt/container/qaxdump.cpp | 4 +- src/activeqt/container/qaxobject.cpp | 4 - src/activeqt/container/qaxscript.cpp | 22 ++--- src/activeqt/container/qaxselect.cpp | 34 +++---- src/activeqt/container/qaxwidget.cpp | 56 +++++------ src/activeqt/control/qaxfactory.cpp | 12 +-- src/activeqt/control/qaxserver.cpp | 18 ++-- src/activeqt/control/qaxserverbase.cpp | 173 +++++++++------------------------ src/activeqt/control/qaxserverdll.cpp | 4 +- src/activeqt/control/qaxservermain.cpp | 15 +-- src/activeqt/shared/qaxtypes.cpp | 13 +-- 12 files changed, 147 insertions(+), 266 deletions(-) diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 62dad6b..4fc9926 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -39,10 +39,6 @@ //#define QAX_NO_CLASSINFO -#ifndef UNICODE -#define UNICODE -#endif - #define QT_CHECK_STATE #include "qaxobject.h" @@ -174,7 +170,7 @@ inline DISPID QAxMetaObject::dispIDofName(const QByteArray &name, IDispatch *dis if (dispid == DISPID_UNKNOWN) { // get the Dispatch ID from the object QString unicodeName = QLatin1String(name); - OLECHAR *names = (TCHAR*)unicodeName.utf16(); + OLECHAR *names = (wchar_t*)unicodeName.utf16(); disp->GetIDsOfNames(IID_NULL, &names, 1, LOCALE_USER_DEFAULT, &dispid); if (dispid != DISPID_UNKNOWN) dispIDs.insert(name, dispid); @@ -638,7 +634,7 @@ QByteArray QAxEventSink::findProperty(DISPID dispID) UINT cNames; typeinfo->GetNames(dispID, &names, 1, &cNames); if (cNames) { - propname = QString::fromUtf16((const ushort *)names).toLatin1(); + propname = QString::fromWCharArray(names).toLatin1(); SysFreeString(names); } typeinfo->Release(); @@ -972,7 +968,7 @@ bool QAxBase::setControl(const QString &c) QUuid uuid(search); if (uuid.isNull()) { CLSID clsid; - HRESULT res = CLSIDFromProgID((WCHAR*)c.utf16(), &clsid); + HRESULT res = CLSIDFromProgID((wchar_t*)c.utf16(), &clsid); if (res == S_OK) search = QUuid(clsid).toString(); else { @@ -1137,7 +1133,7 @@ QStringList QAxBase::verbs() const while (enumVerbs->Next(1, &verb, &c) == S_OK) { if (!verb.lpszVerbName) continue; - QString verbName = QString::fromUtf16((const ushort *)verb.lpszVerbName); + QString verbName = QString::fromWCharArray(verb.lpszVerbName); if (!verbName.isEmpty()) d->verbs.insert(verbName, verb.lVerb); } @@ -1265,7 +1261,7 @@ bool QAxBase::initializeLicensedHelper(void *f, const QString &key, IUnknown **p } else if (licinfo.fRuntimeKeyAvail) { BSTR licenseKey; factory2->RequestLicKey(0, &licenseKey); - QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey); + QString qlicenseKey = QString::fromWCharArray(licenseKey); SysFreeString(licenseKey); qWarning("Use license key is '%s' to create object on unlicensed machine.", qlicenseKey.toLatin1().constData()); @@ -1275,7 +1271,7 @@ bool QAxBase::initializeLicensedHelper(void *f, const QString &key, IUnknown **p if (licinfo.fRuntimeKeyAvail) { BSTR licenseKey; factory2->RequestLicKey(0, &licenseKey); - QString qlicenseKey = QString::fromUtf16((const ushort *)licenseKey); + QString qlicenseKey = QString::fromWCharArray(licenseKey); SysFreeString(licenseKey); if (qlicenseKey != key) @@ -1435,7 +1431,7 @@ bool QAxBase::initializeRemote(IUnknown** ptr) serverInfo.dwReserved1 = 0; serverInfo.dwReserved2 = 0; serverInfo.pAuthInfo = &authInfo; - serverInfo.pwszName = (WCHAR*)server.utf16(); + serverInfo.pwszName = (wchar_t*)server.utf16(); IClassFactory *factory = 0; HRESULT res = CoGetClassObject(QUuid(clsid), CLSCTX_REMOTE_SERVER, &serverInfo, IID_IClassFactory, (void**)&factory); @@ -1747,7 +1743,7 @@ QMetaObject *qax_readInterfaceInfo(ITypeLib *typeLib, ITypeInfo *typeInfo, const if (S_OK != typeInfo->GetDocumentation(-1, &bstr, 0, 0, 0)) return 0; - className = QString::fromUtf16((const ushort *)bstr); + className = QString::fromWCharArray(bstr); SysFreeString(bstr); generator.readEnumInfo(); @@ -1768,7 +1764,7 @@ QMetaObject *qax_readClassInfo(ITypeLib *typeLib, ITypeInfo *classInfo, const QM if (S_OK != classInfo->GetDocumentation(-1, &bstr, 0, 0, 0)) return 0; - className = QString::fromUtf16((const ushort *)bstr); + className = QString::fromWCharArray(bstr); SysFreeString(bstr); generator.readEnumInfo(); @@ -1795,7 +1791,7 @@ QMetaObject *qax_readClassInfo(ITypeLib *typeLib, ITypeInfo *classInfo, const QM continue; interfaceInfo->GetDocumentation(-1, &bstr, 0, 0, 0); - QString interfaceName = QString::fromUtf16((const ushort *)bstr); + QString interfaceName = QString::fromWCharArray(bstr); SysFreeString(bstr); QByteArray key; @@ -1843,7 +1839,7 @@ MetaObjectGenerator::MetaObjectGenerator(ITypeLib *tlib, ITypeInfo *tinfo) typelib->AddRef(); BSTR bstr; typelib->GetDocumentation(-1, &bstr, 0, 0, 0); - current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1(); + current_typelib = QString::fromWCharArray(bstr).toLatin1(); SysFreeString(bstr); } readClassInfo(); @@ -1891,13 +1887,13 @@ QByteArray MetaObjectGenerator::usertypeToString(const TYPEDESC &tdesc, ITypeInf // get type library name BSTR typelibname = 0; usertypelib->GetDocumentation(-1, &typelibname, 0, 0, 0); - QByteArray typeLibName = QString::fromUtf16((const ushort *)typelibname).toLatin1(); + QByteArray typeLibName = QString::fromWCharArray(typelibname).toLatin1(); SysFreeString(typelibname); // get type name BSTR usertypename = 0; usertypelib->GetDocumentation(index, &usertypename, 0, 0, 0); - QByteArray userTypeName = QString::fromUtf16((const ushort *)usertypename).toLatin1(); + QByteArray userTypeName = QString::fromWCharArray(usertypename).toLatin1(); SysFreeString(usertypename); if (hasEnum(userTypeName)) // known enum? @@ -2287,7 +2283,7 @@ void MetaObjectGenerator::readEnumInfo() BSTR enumname; QByteArray enumName; if (typelib->GetDocumentation(i, &enumname, 0, 0, 0) == S_OK) { - enumName = QString::fromUtf16((const ushort *)enumname).toLatin1(); + enumName = QString::fromWCharArray(enumname).toLatin1(); SysFreeString(enumname); } else { enumName = "enum" + QByteArray::number(++enum_serial); @@ -2310,7 +2306,7 @@ void MetaObjectGenerator::readEnumInfo() UINT maxNamesOut; enuminfo->GetNames(memid, &valuename, 1, &maxNamesOut); if (maxNamesOut) { - valueName = QString::fromUtf16((const ushort *)valuename).toLatin1(); + valueName = QString::fromWCharArray(valuename).toLatin1(); SysFreeString(valuename); } else { valueName = "value" + QByteArray::number(valueindex++); @@ -2467,7 +2463,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) QList names; int p; for (p = 0; p < (int)maxNamesOut; ++p) { - names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1(); + names << QString::fromWCharArray(bstrNames[p]).toLatin1(); SysFreeString(bstrNames[p]); } @@ -2594,7 +2590,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) // get function documentation BSTR bstrDocu; info->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0); - QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); + QString strDocu = QString::fromWCharArray(bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) desc += '[' + strDocu + ']'; @@ -2641,7 +2637,7 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars) QByteArray variableName; uint flags = 0; - variableName = QString::fromUtf16((const ushort *)bstrName).toLatin1(); + variableName = QString::fromWCharArray(bstrName).toLatin1(); SysFreeString(bstrName); // get variable type @@ -2677,7 +2673,7 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars) // get function documentation BSTR bstrDocu; info->GetDocumentation(vardesc->memid, 0, &bstrDocu, 0, 0); - QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); + QString strDocu = QString::fromWCharArray(bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) desc += '[' + strDocu + ']'; @@ -2800,7 +2796,7 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo QList names; int p; for (p = 0; p < (int)maxNamesOut; ++p) { - names << QString::fromUtf16((const ushort *)bstrNames[p]).toLatin1(); + names << QString::fromWCharArray(bstrNames[p]).toLatin1(); SysFreeString(bstrNames[p]); } @@ -2824,7 +2820,7 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo // get function documentation BSTR bstrDocu; eventinfo->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0); - QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); + QString strDocu = QString::fromWCharArray(bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) desc += '[' + strDocu + ']'; @@ -2982,7 +2978,7 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co if (typelib) { BSTR bstr; typelib->GetDocumentation(-1, &bstr, 0, 0, 0); - current_typelib = QString::fromUtf16((const ushort *)bstr).toLatin1(); + current_typelib = QString::fromWCharArray(bstr).toLatin1(); SysFreeString(bstr); } if (d->tryCache && tryCache()) @@ -3391,9 +3387,9 @@ static bool checkHRESULT(HRESULT hres, EXCEPINFO *exc, QAxBase *that, const QStr exc->pfnDeferredFillIn(exc); code = exc->wCode ? exc->wCode : exc->scode; - source = QString::fromUtf16((const ushort *)exc->bstrSource); - desc = QString::fromUtf16((const ushort *)exc->bstrDescription); - help = QString::fromUtf16((const ushort *)exc->bstrHelpFile); + source = QString::fromWCharArray(exc->bstrSource); + desc = QString::fromWCharArray(exc->bstrDescription); + help = QString::fromWCharArray(exc->bstrHelpFile); uint helpContext = exc->dwHelpContext; if (helpContext && !help.isEmpty()) @@ -4228,7 +4224,7 @@ public: if (!var) return E_POINTER; - QString property = QString::fromUtf16((const ushort *)name); + QString property = QString::fromWCharArray(name); QVariant qvar = map.value(property); QVariantToVARIANT(qvar, *var); return S_OK; @@ -4237,7 +4233,7 @@ public: { if (!var) return E_POINTER; - QString property = QString::fromUtf16((const ushort *)name); + QString property = QString::fromWCharArray(name); QVariant qvar = VARIANTToQVariant(*var, 0); map[property] = qvar; diff --git a/src/activeqt/container/qaxdump.cpp b/src/activeqt/container/qaxdump.cpp index 39d5121..a654a8f 100644 --- a/src/activeqt/container/qaxdump.cpp +++ b/src/activeqt/container/qaxdump.cpp @@ -66,8 +66,8 @@ QString qax_docuFromName(ITypeInfo *typeInfo, const QString &name) BSTR docStringBstr, helpFileBstr; ulong helpContext; HRESULT hres = typeInfo->GetDocumentation(memId, 0, &docStringBstr, &helpContext, &helpFileBstr); - QString docString = QString::fromUtf16((const ushort *)docStringBstr); - QString helpFile = QString::fromUtf16((const ushort *)helpFileBstr); + QString docString = QString::fromWCharArray(docStringBstr); + QString helpFile = QString::fromWCharArray(helpFileBstr); SysFreeString(docStringBstr); SysFreeString(helpFileBstr); if (hres == S_OK) { diff --git a/src/activeqt/container/qaxobject.cpp b/src/activeqt/container/qaxobject.cpp index 3526f93..412c5b5 100644 --- a/src/activeqt/container/qaxobject.cpp +++ b/src/activeqt/container/qaxobject.cpp @@ -37,10 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - #include "qaxobject.h" #ifndef QT_NO_WIN_ACTIVEQT diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index dcfc84b..2ee08b3 100644 --- a/src/activeqt/container/qaxscript.cpp +++ b/src/activeqt/container/qaxscript.cpp @@ -37,10 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - #include "qaxscript.h" #ifndef QT_NO_WIN_ACTIVEQT @@ -194,7 +190,7 @@ HRESULT WINAPI QAxScriptSite::GetItemInfo(LPCOLESTR pstrName, DWORD mask, IUnkno else if (mask & SCRIPTINFO_ITYPEINFO) return E_POINTER; - QAxBase *object = script->findObject(QString::fromUtf16((const ushort*)pstrName)); + QAxBase *object = script->findObject(QString::fromWCharArray(pstrName)); if (!object) return TYPE_E_ELEMENTNOTFOUND; @@ -236,9 +232,9 @@ HRESULT WINAPI QAxScriptSite::OnScriptTerminate(const VARIANT *result, const EXC emit script->finished(VARIANTToQVariant(*result, 0)); if (exception) emit script->finished(exception->wCode, - QString::fromUtf16((const ushort*)exception->bstrSource), - QString::fromUtf16((const ushort*)exception->bstrDescription), - QString::fromUtf16((const ushort*)exception->bstrHelpFile) + QString::fromWCharArray(exception->bstrSource), + QString::fromWCharArray(exception->bstrDescription), + QString::fromWCharArray(exception->bstrHelpFile) ); return S_OK; } @@ -287,14 +283,14 @@ HRESULT WINAPI QAxScriptSite::OnScriptError(IActiveScriptError *error) error->GetSourcePosition(&context, &lineNumber, &charPos); HRESULT hres = error->GetSourceLineText(&bstrLineText); if (hres == S_OK) { - lineText = QString::fromUtf16((const ushort*)bstrLineText); + lineText = QString::fromWCharArray(bstrLineText); SysFreeString(bstrLineText); } SysFreeString(exception.bstrSource); SysFreeString(exception.bstrDescription); SysFreeString(exception.bstrHelpFile); - emit script->error(exception.wCode, QString::fromUtf16((const ushort*)exception.bstrDescription), lineNumber, lineText); + emit script->error(exception.wCode, QString::fromWCharArray(exception.bstrDescription), lineNumber, lineText); return S_OK; } @@ -463,7 +459,7 @@ bool QAxScriptEngine::initialize(IUnknown **ptr) return false; CLSID clsid; - HRESULT hres = CLSIDFromProgID((WCHAR*)script_language.utf16(), &clsid); + HRESULT hres = CLSIDFromProgID((wchar_t*)script_language.utf16(), &clsid); if(FAILED(hres)) return false; @@ -609,7 +605,7 @@ void QAxScriptEngine::addItem(const QString &name) if (!engine) return; - engine->AddNamedItem((WCHAR*)name.utf16(), SCRIPTITEM_ISSOURCE|SCRIPTITEM_ISVISIBLE); + engine->AddNamedItem((wchar_t*)name.utf16(), SCRIPTITEM_ISSOURCE|SCRIPTITEM_ISVISIBLE); #endif } @@ -1173,7 +1169,7 @@ bool QAxScriptManager::registerEngine(const QString &name, const QString &extens return false; CLSID clsid; - HRESULT hres = CLSIDFromProgID((WCHAR*)name.utf16(), &clsid); + HRESULT hres = CLSIDFromProgID((wchar_t*)name.utf16(), &clsid); if (hres != S_OK) return false; diff --git a/src/activeqt/container/qaxselect.cpp b/src/activeqt/container/qaxselect.cpp index 5de39e4..a0c725d 100644 --- a/src/activeqt/container/qaxselect.cpp +++ b/src/activeqt/container/qaxselect.cpp @@ -52,54 +52,46 @@ public: : QAbstractListModel(parent) { HKEY classes_key; - QT_WA_INLINE( - RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &classes_key), - RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &classes_key)); + RegOpenKeyEx(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &classes_key); if (!classes_key) return; DWORD index = 0; LONG result = 0; - TCHAR buffer[256]; - DWORD szBuffer = sizeof(buffer); + wchar_t buffer[256]; + DWORD szBuffer = sizeof(buffer) / sizeof(wchar_t); FILETIME ft; do { - result = QT_WA_INLINE( - RegEnumKeyExW(classes_key, index, (wchar_t*)&buffer, &szBuffer, 0, 0, 0, &ft), - RegEnumKeyExA(classes_key, index, (char*)&buffer, &szBuffer, 0, 0, 0, &ft)); - szBuffer = sizeof(buffer); + result = RegEnumKeyEx(classes_key, index, buffer, &szBuffer, 0, 0, 0, &ft); + szBuffer = sizeof(buffer) / sizeof(wchar_t); if (result == ERROR_SUCCESS) { HKEY sub_key; - QString clsid = QT_WA_INLINE(QString::fromUtf16((ushort*)buffer), QString::fromLocal8Bit((char*)buffer)); - result = QT_WA_INLINE( - RegOpenKeyExW(classes_key, reinterpret_cast(QString(clsid + "\\Control").utf16()), 0, KEY_READ, &sub_key), - RegOpenKeyA(classes_key, QString(clsid + QLatin1String("\\Control")).toLocal8Bit(), &sub_key)); + QString clsid = QString::fromWCharArray(buffer); + result = RegOpenKeyEx(classes_key, reinterpret_cast(QString(clsid + "\\Control").utf16()), 0, KEY_READ, &sub_key); if (result == ERROR_SUCCESS) { RegCloseKey(sub_key); - QT_WA_INLINE( - RegistryQueryValueW(classes_key, buffer, (LPBYTE)buffer, &szBuffer), - RegQueryValueA(classes_key, (char*)buffer, (char*)buffer, (LONG*)&szBuffer)); - QString name = QT_WA_INLINE(QString::fromUtf16((ushort*)buffer, szBuffer / sizeof(TCHAR)) , QString::fromLocal8Bit((char*)buffer, szBuffer)); + RegistryQueryValue(classes_key, buffer, (LPBYTE)buffer, &szBuffer); + QString name = QString::fromWCharArray(buffer); controls << name; clsids.insert(name, clsid); } result = ERROR_SUCCESS; } - szBuffer = sizeof(buffer); + szBuffer = sizeof(buffer) / sizeof(wchar_t); ++index; } while (result == ERROR_SUCCESS); RegCloseKey(classes_key); controls.sort(); } - LONG RegistryQueryValueW(HKEY hKey, LPCWSTR lpSubKey, LPBYTE lpData, LPDWORD lpcbData) + LONG RegistryQueryValue(HKEY hKey, LPCWSTR lpSubKey, LPBYTE lpData, LPDWORD lpcbData) { LONG ret = ERROR_FILE_NOT_FOUND; HKEY hSubKey = NULL; - RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ, &hSubKey); + RegOpenKeyEx(hKey, lpSubKey, 0, KEY_READ, &hSubKey); if (hSubKey) { - ret = RegQueryValueExW(hSubKey, 0, 0, 0, lpData, lpcbData); + ret = RegQueryValueEx(hSubKey, 0, 0, 0, lpData, lpcbData); RegCloseKey(hSubKey); } return ret; diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index ebec872..615887f 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -37,11 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - - #include "qaxwidget.h" #ifndef QT_NO_WIN_ACTIVEQT @@ -470,7 +465,7 @@ static QAbstractEventDispatcher::EventFilter previous_filter = 0; #if defined(Q_WS_WINCE) static int filter_ref = 0; #else -static const char *qaxatom = "QAxContainer4_Atom"; +static const wchar_t *qaxatom = L"QAxContainer4_Atom"; #endif // The filter procedure listening to user interaction on the control @@ -714,7 +709,7 @@ bool QAxClientSite::activateObject(bool initialized, const QByteArray &data) BSTR userType; HRESULT result = m_spOleObject->GetUserType(USERCLASSTYPE_SHORT, &userType); if (result == S_OK) { - widget->setWindowTitle(QString::fromUtf16((const ushort *)userType)); + widget->setWindowTitle(QString::fromWCharArray(userType)); CoTaskMemFree(userType); } } else { @@ -984,10 +979,7 @@ HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModif eventTranslated = false; if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam) return S_OK; - QT_WA_INLINE( - SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam), - SendMessageA(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam) - ); + SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam); return S_OK; } @@ -1173,15 +1165,15 @@ HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPW #endif } -static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &text, QPixmap &/*icon*/) +static int menuItemEntry(HMENU menu, int index, MENUITEMINFO item, QString &text, QPixmap &/*icon*/) { if (item.fType == MFT_STRING && item.cch) { - char *titlebuf = new char[item.cch+1]; + wchar_t *titlebuf = new wchar_t[item.cch + 1]; item.dwTypeData = titlebuf; item.cch++; - ::GetMenuItemInfoA(menu, index, true, &item); - text = QString::fromLocal8Bit(titlebuf); - delete []titlebuf; + ::GetMenuItemInfo(menu, index, true, &item); + text = QString::fromWCharArray(titlebuf); + delete [] titlebuf; return MFT_STRING; } #if 0 @@ -1191,7 +1183,7 @@ static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &tex GetBitmapDimensionEx(hbm, &bmsize); QPixmap pixmap(1,1); QSize sz(MAP_LOGHIM_TO_PIX(bmsize.cx, pixmap.logicalDpiX()), - MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY())); + MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY())); pixmap.resize(bmsize.cx, bmsize.cy); if (!pixmap.isNull()) { @@ -1215,11 +1207,11 @@ QMenu *QAxClientSite::generatePopup(HMENU subMenu, QWidget *parent) if (count) popup = new QMenu(parent); for (int i = 0; i < count; ++i) { - MENUITEMINFOA item; - memset(&item, 0, sizeof(MENUITEMINFOA)); - item.cbSize = sizeof(MENUITEMINFOA); + MENUITEMINFO item; + memset(&item, 0, sizeof(MENUITEMINFO)); + item.cbSize = sizeof(MENUITEMINFO); item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; - ::GetMenuItemInfoA(subMenu, i, true, &item); + ::GetMenuItemInfo(subMenu, i, true, &item); QAction *action = 0; QMenu *popupMenu = 0; @@ -1295,11 +1287,11 @@ HRESULT WINAPI QAxClientSite::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND int count = GetMenuItemCount(hmenuShared); for (int i = 0; i < count; ++i) { - MENUITEMINFOA item; - memset(&item, 0, sizeof(MENUITEMINFOA)); - item.cbSize = sizeof(MENUITEMINFOA); + MENUITEMINFO item; + memset(&item, 0, sizeof(MENUITEMINFO)); + item.cbSize = sizeof(MENUITEMINFO); item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; - ::GetMenuItemInfoA(hmenuShared, i, true, &item); + ::GetMenuItemInfo(hmenuShared, i, true, &item); QAction *action = 0; QMenu *popupMenu = 0; @@ -1379,7 +1371,7 @@ int QAxClientSite::qt_metacall(QMetaObject::Call call, int isignal, void **argv) OleMenuItem oleItem = menuItemMap.value(action); if (oleItem.hMenu) - ::PostMessageA(m_menuOwner, WM_COMMAND, oleItem.id, 0); + ::PostMessage(m_menuOwner, WM_COMMAND, oleItem.id, 0); return -1; #endif } @@ -1404,7 +1396,7 @@ HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU /*hmenuShared*/) HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText) { - QStatusTipEvent tip(QString::fromUtf16((const ushort *)(BSTR)pszStatusText)); + QStatusTipEvent tip(QString::fromWCharArray(pszStatusText)); QApplication::sendEvent(widget, &tip); return S_OK; } @@ -1513,7 +1505,7 @@ HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveOb AX_DEBUG(QAxClientSite::SetActiveObject); if (pszObjName && widget) - widget->setWindowTitle(QString::fromUtf16((const ushort *)(BSTR)pszObjName)); + widget->setWindowTitle(QString::fromWCharArray(pszObjName)); if (m_spInPlaceActiveObject) { if (!inPlaceModelessEnabled) @@ -1952,12 +1944,12 @@ bool QAxWidget::createHostWindow(bool initialized, const QByteArray &data) container->activateObject(initialized, data); #if !defined(Q_OS_WINCE) - ATOM filter_ref = FindAtomA(qaxatom); + ATOM filter_ref = FindAtom(qaxatom); #endif if (!filter_ref) previous_filter = QAbstractEventDispatcher::instance()->setEventFilter(axc_FilterProc); #if !defined(Q_OS_WINCE) - AddAtomA(qaxatom); + AddAtom(qaxatom); #else ++filter_ref; #endif @@ -1992,10 +1984,10 @@ void QAxWidget::clear() return; if (!control().isEmpty()) { #if !defined(Q_OS_WINCE) - ATOM filter_ref = FindAtomA(qaxatom); + ATOM filter_ref = FindAtom(qaxatom); if (filter_ref) DeleteAtom(filter_ref); - filter_ref = FindAtomA(qaxatom); + filter_ref = FindAtom(qaxatom); if (!filter_ref) { #else if (!filter_ref && !--filter_ref) { diff --git a/src/activeqt/control/qaxfactory.cpp b/src/activeqt/control/qaxfactory.cpp index c65fbb8..742e93e 100644 --- a/src/activeqt/control/qaxfactory.cpp +++ b/src/activeqt/control/qaxfactory.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -extern char qAxModuleFilename[MAX_PATH]; +extern wchar_t qAxModuleFilename[MAX_PATH]; /*! \class QAxFactory @@ -277,7 +277,7 @@ bool QAxFactory::validateLicenseKey(const QString &key, const QString &licenseKe return true; if (licenseKey.isEmpty()) { - QString licFile(QFile::decodeName(qAxModuleFilename)); + QString licFile(QString::fromWCharArray(qAxModuleFilename)); int lastDot = licFile.lastIndexOf(QLatin1Char('.')); licFile = licFile.left(lastDot) + QLatin1String(".lic"); if (QFile::exists(licFile)) @@ -360,7 +360,7 @@ bool QAxFactory::isServer() return qAxIsServer; } -extern char qAxModuleFilename[MAX_PATH]; +extern wchar_t qAxModuleFilename[MAX_PATH]; /*! Returns the directory that contains the server binary. @@ -372,7 +372,7 @@ extern char qAxModuleFilename[MAX_PATH]; */ QString QAxFactory::serverDirPath() { - return QFileInfo(QString::fromLocal8Bit(qAxModuleFilename)).absolutePath(); + return QFileInfo(QString::fromWCharArray(qAxModuleFilename)).absolutePath(); } /*! @@ -384,7 +384,7 @@ QString QAxFactory::serverDirPath() */ QString QAxFactory::serverFilePath() { - return QString::fromLocal8Bit(qAxModuleFilename); + return QString::fromWCharArray(qAxModuleFilename); } /*! @@ -492,7 +492,7 @@ bool QAxFactory::registerActiveObject(QObject *object) if (qstricmp(object->metaObject()->classInfo(object->metaObject()->indexOfClassInfo("RegisterObject")).value(), "yes")) return false; - if (!QString::fromLocal8Bit(qAxModuleFilename).toLower().endsWith(QLatin1String(".exe"))) + if (!QString::fromWCharArray(qAxModuleFilename).toLower().endsWith(QLatin1String(".exe"))) return false; ActiveObject *active = new ActiveObject(object, qAxFactory()); diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index a9b3271..e6b0c17 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE bool qAxIsServer = false; HANDLE qAxInstance = 0; ITypeLib *qAxTypeLibrary = 0; -char qAxModuleFilename[MAX_PATH]; +wchar_t qAxModuleFilename[MAX_PATH]; bool qAxOutProcServer = false; // The QAxFactory instance @@ -116,19 +116,19 @@ QString qAxInit() InitializeCriticalSection(&qAxModuleSection); - libFile = QString::fromLocal8Bit(qAxModuleFilename); + libFile = QString::fromWCharArray(qAxModuleFilename); libFile = libFile.toLower(); - if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK) + if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK) return libFile; int lastDot = libFile.lastIndexOf(QLatin1Char('.')); libFile = libFile.left(lastDot) + QLatin1String(".tlb"); - if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK) + if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK) return libFile; lastDot = libFile.lastIndexOf(QLatin1Char('.')); libFile = libFile.left(lastDot) + QLatin1String(".olb"); - if (LoadTypeLibEx((TCHAR*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK) + if (LoadTypeLibEx((wchar_t*)libFile.utf16(), REGKIND_NONE, &qAxTypeLibrary) == S_OK) return libFile; libFile = QString(); @@ -207,7 +207,7 @@ QString qax_clean_type(const QString &type, const QMetaObject *mo) HRESULT UpdateRegistry(BOOL bRegister) { qAxIsServer = false; - QString file = QString::fromLocal8Bit(qAxModuleFilename); + QString file = QString::fromWCharArray(qAxModuleFilename); QString path = file.left(file.lastIndexOf(QLatin1Char('\\'))+1); QString module = file.right(file.length() - path.length()); module = module.left(module.lastIndexOf(QLatin1Char('.'))); @@ -229,7 +229,7 @@ HRESULT UpdateRegistry(BOOL bRegister) typeLibVersion = QString::number((uint)major) + QLatin1Char('.') + QString::number((uint)minor); if (bRegister) - RegisterTypeLib(qAxTypeLibrary, (TCHAR*)libFile.utf16(), 0); + RegisterTypeLib(qAxTypeLibrary, (wchar_t*)libFile.utf16(), 0); else UnRegisterTypeLib(libAttr->guid, libAttr->wMajorVerNum, libAttr->wMinorVerNum, libAttr->lcid, libAttr->syskind); @@ -1071,7 +1071,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) QFile file(outfile); file.remove(); - QString filebase = QString::fromLocal8Bit(qAxModuleFilename); + QString filebase = QString::fromWCharArray(qAxModuleFilename); filebase = filebase.left(filebase.lastIndexOf(QLatin1Char('.'))); QString appID = qAxFactory()->appID().toString().toUpper(); @@ -1107,7 +1107,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) out << "/****************************************************************************" << endl; out << "** Interface definition generated for ActiveQt project" << endl; out << "**" << endl; - out << "** '" << qAxModuleFilename << '\'' << endl; + out << "** '" << QString::fromWCharArray(qAxModuleFilename) << '\'' << endl; out << "**" << endl; out << "** Created: " << QDateTime::currentDateTime().toString() << endl; out << "**" << endl; diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 2cac004..d7a8e07 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -788,17 +788,9 @@ bool qax_winEventFilter(void *message) QAxServerBase *axbase = 0; while (!axbase && baseHwnd) { #ifdef GWLP_USERDATA - QT_WA({ - axbase = (QAxServerBase*)GetWindowLongPtrW(baseHwnd, GWLP_USERDATA); - }, { - axbase = (QAxServerBase*)GetWindowLongPtrA(baseHwnd, GWLP_USERDATA); - }); + axbase = (QAxServerBase*)GetWindowLongPtr(baseHwnd, GWLP_USERDATA); #else - QT_WA({ - axbase = (QAxServerBase*)GetWindowLongW(baseHwnd, GWL_USERDATA); - }, { - axbase = (QAxServerBase*)GetWindowLongA(baseHwnd, GWL_USERDATA); - }); + axbase = (QAxServerBase*)GetWindowLong(baseHwnd, GWL_USERDATA); #endif baseHwnd = ::GetParent(baseHwnd); @@ -905,11 +897,7 @@ public: // hook into eventloop; this allows a server to create his own QApplication object if (!qax_hhook && qax_ownQApp) { - QT_WA({ - qax_hhook = SetWindowsHookExW(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId()); - }, { - qax_hhook = SetWindowsHookExA(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId()); - }); + qax_hhook = SetWindowsHookEx(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId()); } HRESULT res; @@ -983,7 +971,7 @@ public: HRESULT WINAPI CreateInstanceLic(IUnknown *pUnkOuter, IUnknown *pUnkReserved, REFIID iid, BSTR bKey, PVOID *ppObject) { - QString licenseKey = QString::fromUtf16((const ushort *)bKey); + QString licenseKey = QString::fromWCharArray(bKey); if (!qAxFactory()->validateLicenseKey(className, licenseKey)) return CLASS_E_NOTLICENSED; return CreateInstanceHelper(pUnkOuter, iid, ppObject); @@ -1303,15 +1291,11 @@ bool QAxServerBase::internalCreate() internalBind(); if (isWidget) { - if (!stayTopLevel) { - QEvent e(QEvent::EmbeddingControl); - QApplication::sendEvent(qt.widget, &e); - QT_WA({ - ::SetWindowLongW(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - }, { - ::SetWindowLongA(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - }); - } + if (!stayTopLevel) { + QEvent e(QEvent::EmbeddingControl); + QApplication::sendEvent(qt.widget, &e); + ::SetWindowLong(qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + } qt.widget->setAttribute(Qt::WA_QuitOnClose, false); qt.widget->move(0, 0); @@ -1368,52 +1352,26 @@ class HackWidget : public QWidget LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_CREATE) { - QAxServerBase *that; - QT_WA({ - CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam; - that = (QAxServerBase*)cs->lpCreateParams; - }, { - CREATESTRUCTA *cs = (CREATESTRUCTA*)lParam; - that = (QAxServerBase*)cs->lpCreateParams; - }); + CREATESTRUCT *cs = (CREATESTRUCT*)lParam; + QAxServerBase *that = (QAxServerBase*)cs->lpCreateParams; #ifdef GWLP_USERDATA - QT_WA({ - SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)that); - }, { - SetWindowLongPtrA(hWnd, GWLP_USERDATA, (LONG_PTR)that); - }); + SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)that); #else - QT_WA({ - SetWindowLongW(hWnd, GWL_USERDATA, (LONG)that); - }, { - SetWindowLongA(hWnd, GWL_USERDATA, (LONG)that); - }); + SetWindowLong(hWnd, GWL_USERDATA, (LONG)that); #endif - that->m_hWnd = hWnd; + that->m_hWnd = hWnd; - QT_WA({ - return ::DefWindowProcW(hWnd, uMsg, wParam, lParam); - }, { - return ::DefWindowProcA(hWnd, uMsg, wParam, lParam); - }); + return ::DefWindowProc(hWnd, uMsg, wParam, lParam); } QAxServerBase *that = 0; #ifdef GWLP_USERDATA - QT_WA({ - that = (QAxServerBase*)GetWindowLongPtrW(hWnd, GWLP_USERDATA); - }, { - that = (QAxServerBase*)GetWindowLongPtrA(hWnd, GWLP_USERDATA); - }); + that = (QAxServerBase*)GetWindowLongPtr(hWnd, GWLP_USERDATA); #else - QT_WA({ - that = (QAxServerBase*)GetWindowLongW(hWnd, GWL_USERDATA); - }, { - that = (QAxServerBase*)GetWindowLongA(hWnd, GWL_USERDATA); - }); + that = (QAxServerBase*)GetWindowLong(hWnd, GWL_USERDATA); #endif if (that) { @@ -1563,11 +1521,7 @@ LRESULT CALLBACK QAxServerBase::ActiveXProc(HWND hWnd, UINT uMsg, WPARAM wParam, } } - QT_WA({ - return ::DefWindowProcW(hWnd, uMsg, wParam, lParam); - }, { - return ::DefWindowProcA(hWnd, uMsg, wParam, lParam); - }); + return ::DefWindowProc(hWnd, uMsg, wParam, lParam); } /*! @@ -1583,54 +1537,29 @@ HWND QAxServerBase::create(HWND hWndParent, RECT& rcPos) QString cn(QLatin1String("QAxControl")); cn += QString::number((int)ActiveXProc); if (!atom) { - QT_WA({ - WNDCLASSW wcTemp; - wcTemp.style = CS_DBLCLKS; - wcTemp.cbClsExtra = 0; - wcTemp.cbWndExtra = 0; - wcTemp.hbrBackground = 0; - wcTemp.hCursor = 0; - wcTemp.hIcon = 0; - wcTemp.hInstance = hInst; - wcTemp.lpszClassName = (wchar_t*)cn.utf16(); - wcTemp.lpszMenuName = 0; - wcTemp.lpfnWndProc = ActiveXProc; - - atom = RegisterClassW(&wcTemp); - }, { - QByteArray cna = cn.toLatin1(); - WNDCLASSA wcTemp; - wcTemp.style = CS_DBLCLKS; - wcTemp.cbClsExtra = 0; - wcTemp.cbWndExtra = 0; - wcTemp.hbrBackground = 0; - wcTemp.hCursor = 0; - wcTemp.hIcon = 0; - wcTemp.hInstance = hInst; - wcTemp.lpszClassName = cna.data(); - wcTemp.lpszMenuName = 0; - wcTemp.lpfnWndProc = ActiveXProc; - - atom = RegisterClassA(&wcTemp); - }); + WNDCLASS wcTemp; + wcTemp.style = CS_DBLCLKS; + wcTemp.cbClsExtra = 0; + wcTemp.cbWndExtra = 0; + wcTemp.hbrBackground = 0; + wcTemp.hCursor = 0; + wcTemp.hIcon = 0; + wcTemp.hInstance = hInst; + wcTemp.lpszClassName = (wchar_t*)cn.utf16(); + wcTemp.lpszMenuName = 0; + wcTemp.lpfnWndProc = ActiveXProc; + + atom = RegisterClass(&wcTemp); } LeaveCriticalSection(&createWindowSection); if (!atom && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) return 0; Q_ASSERT(!m_hWnd); - HWND hWnd = 0; - QT_WA({ - hWnd = ::CreateWindowW((wchar_t*)cn.utf16(), 0, - WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, - rcPos.left, rcPos.top, rcPos.right - rcPos.left, - rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this); - }, { - hWnd = ::CreateWindowA(cn.toLatin1().data(), 0, - WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, - rcPos.left, rcPos.top, rcPos.right - rcPos.left, - rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this); - }); + HWND hWnd = ::CreateWindow((wchar_t*)cn.utf16(), 0, + WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, + rcPos.left, rcPos.top, rcPos.right - rcPos.left, + rcPos.bottom - rcPos.top, hWndParent, 0, hInst, this); Q_ASSERT(m_hWnd == hWnd); @@ -1676,11 +1605,7 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu) actionMap.remove(itemId); actionMap.insert(itemId, action); } - QT_WA({ - AppendMenuW(popupMenu, flags, itemId, (TCHAR*)action->text().utf16()); - }, { - AppendMenuA(popupMenu, flags, itemId, action->text().toLocal8Bit()); - }); + AppendMenu(popupMenu, flags, itemId, (const wchar_t *)action->text().utf16()); } if (oldMenu) DrawMenuBar(hwndMenuOwner); @@ -1726,11 +1651,7 @@ void QAxServerBase::createMenu(QMenuBar *menuBar) itemId = static_cast(reinterpret_cast(action)); actionMap.insert(itemId, action); } - QT_WA({ - AppendMenuW(hmenuShared, flags, itemId, (TCHAR*)action->text().utf16()); - } , { - AppendMenuA(hmenuShared, flags, itemId, action->text().toLocal8Bit()); - }); + AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16()); } OLEMENUGROUPWIDTHS menuWidths = {0,edit,0,object,0,help}; @@ -2397,7 +2318,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, if (!cname) return res; - name = QString::fromUtf16((const ushort *)bname).toLatin1(); + name = QString::fromWCharArray(bname).toLatin1(); SysFreeString(bname); } } @@ -2799,7 +2720,7 @@ HRESULT WINAPI QAxServerBase::Load(IStream *pStm) bool openAsText = false; QByteArray qtarray; if (hres == S_OK) { - QString streamName = QString::fromUtf16((const ushort *)stat.pwcsName); + QString streamName = QString::fromWCharArray(stat.pwcsName); CoTaskMemFree(stat.pwcsName); openAsText = streamName == QLatin1String("SomeStreamName"); if (stat.cbSize.HighPart) // more than 4GB - too large! @@ -2940,7 +2861,7 @@ HRESULT WINAPI QAxServerBase::Load(IStorage *pStg) */ streamName += QLatin1String("_Stream4.2"); - pStg->OpenStream((const WCHAR *)streamName.utf16(), 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream); + pStg->OpenStream((const wchar_t *)streamName.utf16(), 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream); if (!spStream) // support for streams saved with 4.1 and earlier pStg->OpenStream(L"SomeStreamName", 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &spStream); if (!spStream) @@ -2963,7 +2884,7 @@ HRESULT WINAPI QAxServerBase::Save(IStorage *pStg, BOOL fSameAsLoad) */ streamName += QLatin1String("_Stream4.2"); - pStg->CreateStream((const WCHAR *)streamName.utf16(), STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &spStream); + pStg->CreateStream((const wchar_t *)streamName.utf16(), STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &spStream); if (!spStream) return E_FAIL; @@ -3079,7 +3000,7 @@ HRESULT WINAPI QAxServerBase::SaveCompleted(LPCOLESTR fileName) if (qt.object->metaObject()->indexOfClassInfo("MIME") == -1) return E_NOTIMPL; - currentFileName = QString::fromUtf16(reinterpret_cast(fileName)); + currentFileName = QString::fromWCharArray(fileName); return S_OK; } @@ -3097,7 +3018,7 @@ HRESULT WINAPI QAxServerBase::GetCurFile(LPOLESTR *currentFile) if (!malloc) return E_OUTOFMEMORY; - *currentFile = static_cast(malloc->Alloc(currentFileName.length() * 2)); + *currentFile = static_cast(malloc->Alloc(currentFileName.length() * 2)); malloc->Release(); memcpy(*currentFile, currentFileName.unicode(), currentFileName.length() * 2); @@ -3117,7 +3038,7 @@ HRESULT WINAPI QAxServerBase::Load(LPCOLESTR fileName, DWORD mode) return E_NOTIMPL; } - QString loadFileName = QString::fromUtf16(reinterpret_cast(fileName)); + QString loadFileName = QString::fromWCharArray(fileName); QString fileExtension = loadFileName.mid(loadFileName.lastIndexOf(QLatin1Char('.')) + 1); QFile file(loadFileName); @@ -3162,7 +3083,7 @@ HRESULT WINAPI QAxServerBase::Save(LPCOLESTR fileName, BOOL fRemember) return E_NOTIMPL; } - QString saveFileName = QString::fromUtf16(reinterpret_cast(fileName)); + QString saveFileName = QString::fromWCharArray(fileName); QString fileExtension = saveFileName.mid(saveFileName.lastIndexOf(QLatin1Char('.')) + 1); QFile file(saveFileName); @@ -3220,7 +3141,7 @@ HRESULT WINAPI QAxServerBase::Draw(DWORD dwAspect, LONG lindex, void *pvAspect, bool bDeleteDC = false; if (!hicTargetDev) { - hicTargetDev = ::CreateDCA("DISPLAY", NULL, NULL, NULL); + hicTargetDev = ::CreateDC(L"DISPLAY", NULL, NULL, NULL); bDeleteDC = (hicTargetDev != hdcDraw); } @@ -3383,7 +3304,7 @@ HRESULT WINAPI QAxServerBase::OnAmbientPropertyChange(DISPID dispID) case DISPID_AMBIENT_DISPLAYNAME: if (var.vt != VT_BSTR || !isWidget) break; - qt.widget->setWindowTitle(QString::fromUtf16((const ushort *)var.bstrVal)); + qt.widget->setWindowTitle(QString::fromWCharArray(var.bstrVal)); break; case DISPID_AMBIENT_FONT: if (var.vt != VT_DISPATCH || !isWidget) diff --git a/src/activeqt/control/qaxserverdll.cpp b/src/activeqt/control/qaxserverdll.cpp index 375028d..512c408 100644 --- a/src/activeqt/control/qaxserverdll.cpp +++ b/src/activeqt/control/qaxserverdll.cpp @@ -50,7 +50,7 @@ bool qax_ownQApp = false; HHOOK qax_hhook = 0; // in qaxserver.cpp -extern char qAxModuleFilename[MAX_PATH]; +extern wchar_t qAxModuleFilename[MAX_PATH]; extern bool qAxIsServer; extern ITypeLib *qAxTypeLibrary; extern unsigned long qAxLockCount(); @@ -120,7 +120,7 @@ STDAPI DllCanUnloadNow() EXTERN_C BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) { - GetModuleFileNameA(hInstance, qAxModuleFilename, MAX_PATH-1); + GetModuleFileName(hInstance, qAxModuleFilename, MAX_PATH); qAxInstance = hInstance; qAxIsServer = true; diff --git a/src/activeqt/control/qaxservermain.cpp b/src/activeqt/control/qaxservermain.cpp index 8f20d97..d465746 100644 --- a/src/activeqt/control/qaxservermain.cpp +++ b/src/activeqt/control/qaxservermain.cpp @@ -66,7 +66,7 @@ extern bool qAxActivity; extern HANDLE qAxInstance; extern bool qAxIsServer; extern bool qAxOutProcServer; -extern char qAxModuleFilename[MAX_PATH]; +extern wchar_t qAxModuleFilename[MAX_PATH]; extern QString qAxInit(); extern void qAxCleanup(); extern HRESULT UpdateRegistry(BOOL bRegister); @@ -105,7 +105,7 @@ static DWORD WINAPI MonitorProc(void* pv) static bool StartMonitor() { dwThreadID = GetCurrentThreadId(); - hEventShutdown = CreateEventA(0, false, false, 0); + hEventShutdown = CreateEvent(0, false, false, 0); if (hEventShutdown == 0) return false; DWORD dwThreadID; @@ -203,17 +203,10 @@ EXTERN_C int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, QT_USE_NAMESPACE qAxOutProcServer = true; - GetModuleFileNameA(0, qAxModuleFilename, MAX_PATH-1); + GetModuleFileName(0, qAxModuleFilename, MAX_PATH); qAxInstance = hInstance; - QByteArray cmdParam; - QT_WA({ - LPTSTR cmdline = GetCommandLineW(); - cmdParam = QString::fromUtf16((const ushort *)cmdline).toLocal8Bit(); - }, { - cmdParam = GetCommandLineA(); - }); - + QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit(); QList cmds = cmdParam.split(' '); QByteArray unprocessed; diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index 916fcca..49aa99c 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -37,11 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - - #include #include @@ -123,7 +118,7 @@ static QFont IFontToQFont(IFont *f) f->get_Strikethrough(&strike); f->get_Underline(&underline); f->get_Weight(&weight); - QFont font(QString::fromUtf16((const ushort *)name), size.Lo/9750, weight / 97, italic); + QFont font(QString::fromWCharArray(name), size.Lo/9750, weight / 97, italic); font.setBold(bold); font.setStrikeOut(strike); font.setUnderline(underline); @@ -925,10 +920,10 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint QVariant var; switch(arg.vt) { case VT_BSTR: - var = QString::fromUtf16((const ushort *)arg.bstrVal); + var = QString::fromWCharArray(arg.bstrVal); break; case VT_BSTR|VT_BYREF: - var = QString::fromUtf16((const ushort *)*arg.pbstrVal); + var = QString::fromWCharArray(*arg.pbstrVal); break; case VT_BOOL: var = QVariant((bool)arg.boolVal); @@ -1245,7 +1240,7 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint for (long i = lBound; i <= uBound; ++i) { BSTR bstr; SafeArrayGetElement(array, &i, &bstr); - strings << QString::fromUtf16((const ushort *)bstr); + strings << QString::fromWCharArray(bstr); SysFreeString(bstr); } -- cgit v0.12 From 8a7fb1881afe6b358a35cec71247d7e6681efe0a Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:50:10 +0200 Subject: src/qt3support: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/corelib/global/qt_windows.h | 9 + src/qt3support/dialogs/q3filedialog.cpp | 206 ++----------- src/qt3support/dialogs/q3filedialog_win.cpp | 430 +++++++--------------------- src/qt3support/network/q3dns.cpp | 70 ++--- src/qt3support/other/q3dragobject.cpp | 7 +- src/qt3support/other/q3process_win.cpp | 152 ++++------ src/qt3support/widgets/q3datetimeedit.cpp | 48 +--- src/qt3support/widgets/q3titlebar.cpp | 33 +-- 8 files changed, 231 insertions(+), 724 deletions(-) diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index 27c06e5..4f2bcf6 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -99,6 +99,9 @@ #ifndef SPI_GETKEYBOARDCUES #define SPI_GETKEYBOARDCUES 0x100A #endif +#ifndef SPI_GETGRADIENTCAPTIONS +#define SPI_GETGRADIENTCAPTIONS 0x1008 +#endif #ifndef IDC_HAND #define IDC_HAND MAKEINTRESOURCE(32649) #endif @@ -111,6 +114,12 @@ #ifndef ETO_PDY #define ETO_PDY 0x2000 #endif +#ifndef COLOR_GRADIENTACTIVECAPTION +#define COLOR_GRADIENTACTIVECAPTION 27 +#endif +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif // already defined when compiled with WINVER >= 0x0600 #ifndef SPI_GETFLATMENU diff --git a/src/qt3support/dialogs/q3filedialog.cpp b/src/qt3support/dialogs/q3filedialog.cpp index 031170e..a285fd8 100644 --- a/src/qt3support/dialogs/q3filedialog.cpp +++ b/src/qt3support/dialogs/q3filedialog.cpp @@ -507,45 +507,7 @@ static void updateLastSize(Q3FileDialog *that) lastHeight = that->height() - extHeight; } -// Don't remove the lines below! -// -// resolving the W methods manually is needed, because Windows 95 doesn't include -// these methods in Shell32.lib (not even stubs!), so you'd get an unresolved symbol -// when Qt calls getEsistingDirectory(), etc. #if defined(Q_WS_WIN) - -typedef UINT (WINAPI *PtrExtractIconEx)(LPCTSTR,int,HICON*,HICON*,UINT); -static PtrExtractIconEx ptrExtractIconEx = 0; - -static void resolveLibs() -{ -#ifndef Q_OS_WINCE - static bool triedResolve = false; - - if (!triedResolve) { -#ifndef QT_NO_THREAD - // protect initialization - QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve)); - // check triedResolve again, since another thread may have already - // done the initialization - if (triedResolve) { - // another thread did initialize the security function pointers, - // so we shouldn't do it again. - return; - } -#endif - triedResolve = true; - if (qt_winUnicode()) { - QLibrary lib(QLatin1String("shell32")); - ptrExtractIconEx = (PtrExtractIconEx) lib.resolve("ExtractIconExW"); - } - } -#endif -} -#ifdef Q_OS_WINCE -#define PtrExtractIconEx ExtractIconEx -#endif - class QWindowsIconProvider : public Q3FileIconProvider { public: @@ -2566,11 +2528,7 @@ void Q3FileDialog::init() d->modeButtons->insert(d->previewInfo); d->previewContents = new QToolButton(this, "preview info view"); -#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE) - if ((qWinVersion() & Qt::WV_NT_based) > Qt::WV_NT) -#else if (!qstrcmp(style()->className(), "QWindowsStyle")) -#endif { d->goBack->setAutoRaise(true); d->cdToParent->setAutoRaise(true); @@ -4878,33 +4836,20 @@ Q3FileIconProvider * Q3FileDialog::iconProvider() static QString getWindowsRegString(HKEY key, const QString &subKey) { QString s; - QT_WA({ - char buf[1024]; - DWORD bsz = sizeof(buf); - int r = RegQueryValueEx(key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)buf, &bsz); - if (r == ERROR_SUCCESS) { - s = QString::fromUcs2((unsigned short *)buf); - } else if (r == ERROR_MORE_DATA) { - char *ptr = new char[bsz+1]; - r = RegQueryValueEx(key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)ptr, &bsz); - if (r == ERROR_SUCCESS) - s = QLatin1String(ptr); - delete [] ptr; - } - } , { - char buf[512]; - DWORD bsz = sizeof(buf); - int r = RegQueryValueExA(key, subKey.local8Bit(), 0, 0, (LPBYTE)buf, &bsz); - if (r == ERROR_SUCCESS) { - s = QLatin1String(buf); - } else if (r == ERROR_MORE_DATA) { - char *ptr = new char[bsz+1]; - r = RegQueryValueExA(key, subKey.local8Bit(), 0, 0, (LPBYTE)ptr, &bsz); - if (r == ERROR_SUCCESS) - s = QLatin1String(ptr); - delete [] ptr; - } - }); + + wchar_t buf[1024]; + DWORD bsz = sizeof(buf) / sizeof(wchar_t); + int r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)buf, &bsz); + if (r == ERROR_SUCCESS) { + s = QString::fromWCharArray(buf); + } else if (r == ERROR_MORE_DATA) { + char *ptr = new char[bsz+1]; + r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)ptr, &bsz); + if (r == ERROR_SUCCESS) + s = QLatin1String(ptr); + delete [] ptr; + } + return s; } @@ -4925,22 +4870,13 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name) HKEY k; HICON si; - int r; QString s; UINT res = 0; // ---------- get default folder pixmap const wchar_t iconFolder[] = L"folder\\DefaultIcon"; // workaround for Borland - QT_WA({ - r = RegOpenKeyEx(HKEY_CLASSES_ROOT, - iconFolder, - 0, KEY_READ, &k); - } , { - r = RegOpenKeyExA(HKEY_CLASSES_ROOT, - "folder\\DefaultIcon", - 0, KEY_READ, &k); - }); - resolveLibs(); + int r = RegOpenKeyEx(HKEY_CLASSES_ROOT, iconFolder, 0, KEY_READ, &k); + if (r == ERROR_SUCCESS) { s = getWindowsRegString(k, QString()); RegCloseKey(k); @@ -4948,21 +4884,7 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name) QStringList lst = QStringList::split(QLatin1String(","), s); if (lst.count() >= 2) { // don't just assume that lst has two entries -#ifndef Q_OS_WINCE - QT_WA({ - res = ptrExtractIconEx((TCHAR*)lst[0].simplifyWhiteSpace().ucs2(), - lst[1].simplifyWhiteSpace().toInt(), - 0, &si, 1); - } , { - res = ExtractIconExA(lst[0].simplifyWhiteSpace().local8Bit(), - lst[1].simplifyWhiteSpace().toInt(), - 0, &si, 1); - }); -#else - res = (UINT)ExtractIconEx((TCHAR*)lst[0].simplifyWhiteSpace().ucs2(), - lst[1].simplifyWhiteSpace().toInt(), - 0, &si, 1); -#endif + res = ExtractIconEx((wchar_t*)lst[0].simplifyWhiteSpace().utf16(), lst[1].simplifyWhiteSpace().toInt(), 0, &si, 1); } if (res) { @@ -4978,18 +4900,7 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name) } //------------------------------- get default file pixmap -#ifndef Q_OS_WINCE - QT_WA({ - res = ptrExtractIconEx(L"shell32.dll", - 0, 0, &si, 1); - } , { - res = ExtractIconExA("shell32.dll", - 0, 0, &si, 1); - }); -#else - res = (UINT)ExtractIconEx(L"shell32.dll", - 0, 0, &si, 1); -#endif + res = ExtractIconEx(L"shell32.dll", 0, 0, &si, 1); if (res) { defaultFile = fromHICON(si); @@ -5002,16 +4913,9 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name) //------------------------------- get default exe pixmap #ifndef Q_OS_WINCE - QT_WA({ - res = ptrExtractIconEx(L"shell32.dll", - 2, 0, &si, 1); - } , { - res = ExtractIconExA("shell32.dll", - 2, 0, &si, 1); - }); + res = ExtractIconEx(L"shell32.dll", 2, 0, &si, 1); #else - res = (UINT)ExtractIconEx(L"ceshell.dll", - 10, 0, &si, 1); + res = ExtractIconEx(L"ceshell.dll", 10, 0, &si, 1); #endif if (res) { @@ -5050,14 +4954,7 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi) return &(*it); HKEY k, k2; - int r; - QT_WA({ - r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (TCHAR*)ext.ucs2(), - 0, KEY_READ, &k); - } , { - r = RegOpenKeyExA(HKEY_CLASSES_ROOT, ext.local8Bit(), - 0, KEY_READ, &k); - }); + int r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (wchar_t*)ext.utf16(), 0, KEY_READ, &k); QString s; if (r == ERROR_SUCCESS) { s = getWindowsRegString(k, QString()); @@ -5068,13 +4965,8 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi) } RegCloseKey(k); - QT_WA({ - r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (TCHAR*)QString(s + QLatin1String("\\DefaultIcon")).ucs2(), - 0, KEY_READ, &k2); - } , { - r = RegOpenKeyExA(HKEY_CLASSES_ROOT, QString(s + QLatin1String("\\DefaultIcon")).local8Bit() , - 0, KEY_READ, &k2); - }); + r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (wchar_t*)QString(s + QLatin1String("\\DefaultIcon")).utf16(), + 0, KEY_READ, &k2); if (r == ERROR_SUCCESS) { s = getWindowsRegString(k2, QString()); } else { @@ -5104,19 +4996,7 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi) if (filepath[0] == QLatin1Char('"') && filepath[(int)filepath.length()-1] == QLatin1Char('"')) filepath = filepath.mid(1, filepath.length()-2); - resolveLibs(); -#ifndef Q_OS_WINCE - QT_WA({ - res = ptrExtractIconEx((TCHAR*)filepath.ucs2(), lst[1].stripWhiteSpace().toInt(), - 0, &si, 1); - } , { - res = ExtractIconExA(filepath.local8Bit(), lst[1].stripWhiteSpace().toInt(), - 0, &si, 1); - }); -#else - res = (UINT)ExtractIconEx((TCHAR*)filepath.ucs2(), lst[1].stripWhiteSpace().toInt(), - 0, &si, 1); -#endif + res = ExtractIconEx((wchar_t*)filepath.utf16(), lst[1].stripWhiteSpace().toInt(), 0, &si, 1); } } if (res) { @@ -5133,32 +5013,9 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi) HICON si; UINT res = 0; if (!fi.absFilePath().isEmpty()) { -#ifndef Q_OS_WINCE - QT_WA({ - res = ptrExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), -1, - 0, 0, 1); - } , { - res = ExtractIconExA(fi.absFilePath().local8Bit(), -1, - 0, 0, 1); - }); - - if (res) { - QT_WA({ - res = ptrExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), res - 1, - 0, &si, 1); - } , { - res = ExtractIconExA(fi.absFilePath().local8Bit(), res - 1, - 0, &si, 1); - }); - } -#else - res = (UINT)ExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), -1, - 0, 0, 1); - if (res) - res = (UINT)ExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), res - 1, - 0, &si, 1); -#endif - + res = ExtractIconEx((wchar_t*)fi.absFilePath().utf16(), -1, 0, 0, 1); + if (res) + res = ExtractIconEx((wchar_t*)fi.absFilePath().utf16(), res - 1, 0, &si, 1); } if (res) { @@ -5760,13 +5617,8 @@ void Q3FileDialog::insertEntry(const Q3ValueList &lst, Q3NetworkOperat if (!file.endsWith(QLatin1Char('/'))) file.append(QLatin1Char('/')); file += inf.name(); - QT_WA({ - if (GetFileAttributesW((TCHAR*)file.ucs2()) & FILE_ATTRIBUTE_HIDDEN) - continue; - } , { - if (GetFileAttributesA(file.local8Bit()) & FILE_ATTRIBUTE_HIDDEN) - continue; - }); + if (GetFileAttributes((wchar_t*)file.utf16()) & FILE_ATTRIBUTE_HIDDEN) + continue; } else { if (inf.name() != QLatin1String("..") && inf.name()[0] == QLatin1Char('.')) continue; diff --git a/src/qt3support/dialogs/q3filedialog_win.cpp b/src/qt3support/dialogs/q3filedialog_win.cpp index ed86fa2..487097a 100644 --- a/src/qt3support/dialogs/q3filedialog_win.cpp +++ b/src/qt3support/dialogs/q3filedialog_win.cpp @@ -64,49 +64,6 @@ QT_BEGIN_NAMESPACE -// Don't remove the lines below! -// -// resolving the W methods manually is needed, because Windows 95 doesn't include -// these methods in Shell32.lib (not even stubs!), so you'd get an unresolved symbol -// when Qt calls getEsistingDirectory(), etc. -typedef LPITEMIDLIST (WINAPI *PtrSHBrowseForFolder)(BROWSEINFO*); -static PtrSHBrowseForFolder ptrSHBrowseForFolder = 0; -typedef BOOL (WINAPI *PtrSHGetPathFromIDList)(LPITEMIDLIST,LPWSTR); -static PtrSHGetPathFromIDList ptrSHGetPathFromIDList = 0; - -static void resolveLibs() -{ -#ifndef Q_OS_WINCE - static bool triedResolve = false; - - if (!triedResolve) { -#ifndef QT_NO_THREAD - // protect initialization - QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve)); - // check triedResolve again, since another thread may have already - // done the initialization - if (triedResolve) { - // another thread did initialize the security function pointers, - // so we shouldn't do it again. - return; - } -#endif - - triedResolve = true; - if (qt_winUnicode()) { - QLibrary lib(QLatin1String("shell32")); - ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW"); - ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW"); - } - } -#endif -} -#ifdef Q_OS_WINCE -#define PtrSHBrowseForFolder SHBrowseForFolder ; -#define PtrSHGetPathFromIDList SHGetPathFromIDList; -#endif - - extern const char qt3_file_dialog_filter_reg_exp[]; // defined in qfiledialog.cpp const int maxNameLen = 1023; @@ -168,80 +125,8 @@ static QString selFilter(const QString& filter, DWORD idx) return filterLst[(int)idx - 1]; } -#ifndef Q_OS_WINCE -// Static vars for OFNA funcs: -static QByteArray aInitDir; -static QByteArray aInitSel; -static QByteArray aTitle; -static QByteArray aFilter; -// Use ANSI strings and API - -// If you change this, then make sure you change makeOFN (below) too -static -OPENFILENAMEA* makeOFNA(QWidget* parent, - const QString& initialSelection, - const QString& initialDirectory, - const QString& title, - const QString& filters, - Q3FileDialog::Mode mode) -{ - if (parent) - parent = parent->window(); - else - parent = qApp->activeWindow(); - - aTitle = title.local8Bit(); - aInitDir = QDir::toNativeSeparators(initialDirectory).local8Bit(); - if (initialSelection.isEmpty()) - aInitSel = ""; - else - aInitSel = QDir::toNativeSeparators(initialSelection).local8Bit(); - int maxLen = mode == Q3FileDialog::ExistingFiles ? maxMultiLen : maxNameLen; - aInitSel.resize(maxLen + 1); // make room for return value - aFilter = filters.local8Bit(); - - OPENFILENAMEA* ofn = new OPENFILENAMEA; - memset(ofn, 0, sizeof(OPENFILENAMEA)); - -#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500) - // according to the MSDN, this should also be necessary for MSVC, but - // OPENFILENAME_SIZE_VERSION_400A is in not Microsoft header, as it seems - if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) { - ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400A; - } else { - ofn->lStructSize= sizeof(OPENFILENAMEA); - } -#else - ofn->lStructSize = sizeof(OPENFILENAMEA); -#endif - ofn->hwndOwner = parent ? parent->winId() : 0; - ofn->lpstrFilter = aFilter; - ofn->lpstrFile = aInitSel.data(); - ofn->nMaxFile = maxLen; - ofn->lpstrInitialDir = aInitDir.data(); - ofn->lpstrTitle = aTitle.data(); - ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY); - - if (mode == Q3FileDialog::ExistingFile || - mode == Q3FileDialog::ExistingFiles) - ofn->Flags |= (OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST); - if (mode == Q3FileDialog::ExistingFiles) - ofn->Flags |= (OFN_ALLOWMULTISELECT | OFN_EXPLORER); - - return ofn; -} - -static void cleanUpOFNA(OPENFILENAMEA** ofn) -{ - delete *ofn; - *ofn = 0; -} -#endif - static QString tFilters, tTitle, tInitDir; -#ifdef UNICODE -// If you change this, then make sure you change makeOFNA (above) too static OPENFILENAME* makeOFN(QWidget* parent, const QString& initialSelection, @@ -261,33 +146,23 @@ OPENFILENAME* makeOFN(QWidget* parent, QString initSel = QDir::toNativeSeparators(initialSelection); int maxLen = mode == Q3FileDialog::ExistingFiles ? maxMultiLen : maxNameLen; - TCHAR *tInitSel = new TCHAR[maxLen+1]; + wchar_t *tInitSel = new wchar_t[maxLen+1]; if (initSel.length() > 0 && initSel.length() <= maxLen) - memcpy(tInitSel, initSel.ucs2(), (initSel.length()+1)*sizeof(QChar)); + memcpy(tInitSel, initSel.utf16(), (initSel.length() + 1) * sizeof(wchar_t)); else tInitSel[0] = 0; OPENFILENAME* ofn = new OPENFILENAME; memset(ofn, 0, sizeof(OPENFILENAME)); -#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500) - // according to the MSDN, this should also be necessary for MSVC, but - // OPENFILENAME_SIZE_VERSION_400 is in not Microsoft header, as it seems - if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) { - ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400; - } else { - ofn->lStructSize = sizeof(OPENFILENAME); - } -#else - ofn->lStructSize = sizeof(OPENFILENAME); -#endif - ofn->hwndOwner = parent ? parent->winId() : 0; - ofn->lpstrFilter = (TCHAR *)tFilters.ucs2(); - ofn->lpstrFile = tInitSel; + ofn->lStructSize = sizeof(OPENFILENAME); + ofn->hwndOwner = parent ? parent->winId() : 0; + ofn->lpstrFilter = (wchar_t*)tFilters.utf16(); + ofn->lpstrFile = tInitSel; ofn->nMaxFile = maxLen; - ofn->lpstrInitialDir = (TCHAR *)tInitDir.ucs2(); - ofn->lpstrTitle = (TCHAR *)tTitle.ucs2(); - ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY); + ofn->lpstrInitialDir = (wchar_t*)tInitDir.utf16(); + ofn->lpstrTitle = (wchar_t*)tTitle.utf16(); + ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY); if (mode == Q3FileDialog::ExistingFile || mode == Q3FileDialog::ExistingFiles) @@ -298,7 +173,6 @@ OPENFILENAME* makeOFN(QWidget* parent, return ofn; } - static void cleanUpOFN(OPENFILENAME** ofn) { delete (*ofn)->lpstrFile; @@ -306,8 +180,6 @@ static void cleanUpOFN(OPENFILENAME** ofn) *ofn = 0; } -#endif // UNICODE - QString Q3FileDialog::winGetOpenFileName(const QString &initialSelection, const QString &filter, QString* initialDirectory, @@ -349,31 +221,18 @@ QString Q3FileDialog::winGetOpenFileName(const QString &initialSelection, QApplication::sendEvent(parent, &e); QApplicationPrivate::enterModal(parent); } - QT_WA({ - // Use Unicode strings and API - OPENFILENAME* ofn = makeOFN(parent, isel, - *initialDirectory, title, - winFilter(filter), ExistingFile); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileName(ofn)) { - result = QString::fromUcs2((ushort*)ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - cleanUpOFN(&ofn); - } , { - // Use ANSI strings and API - OPENFILENAMEA* ofn = makeOFNA(parent, isel, - *initialDirectory, title, - winFilter(filter), ExistingFile); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileNameA(ofn)) { - result = QString::fromLocal8Bit(ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - cleanUpOFNA(&ofn); - }); + + OPENFILENAME* ofn = makeOFN(parent, isel, + *initialDirectory, title, + winFilter(filter), ExistingFile); + if (idx) + ofn->nFilterIndex = idx + 1; + if (GetOpenFileName(ofn)) { + result = QString::fromWCharArray(ofn->lpstrFile); + selFilIdx = ofn->nFilterIndex; + } + cleanUpOFN(&ofn); + if (parent) { QApplicationPrivate::leaveModal(parent); QEvent e(QEvent::WindowUnblocked); @@ -433,31 +292,18 @@ QString Q3FileDialog::winGetSaveFileName(const QString &initialSelection, QApplication::sendEvent(parent, &e); QApplicationPrivate::enterModal(parent); } - QT_WA({ - // Use Unicode strings and API - OPENFILENAME* ofn = makeOFN(parent, isel, - *initialDirectory, title, - winFilter(filter), AnyFile); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetSaveFileName(ofn)) { - result = QString::fromUcs2((ushort*)ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - cleanUpOFN(&ofn); - } , { - // Use ANSI strings and API - OPENFILENAMEA* ofn = makeOFNA(parent, isel, - *initialDirectory, title, - winFilter(filter), AnyFile); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetSaveFileNameA(ofn)) { - result = QString::fromLocal8Bit(ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - } - cleanUpOFNA(&ofn); - }); + + OPENFILENAME* ofn = makeOFN(parent, isel, + *initialDirectory, title, + winFilter(filter), AnyFile); + if (idx) + ofn->nFilterIndex = idx + 1; + if (GetSaveFileName(ofn)) { + result = QString::fromWCharArray(ofn->lpstrFile); + selFilIdx = ofn->nFilterIndex; + } + cleanUpOFN(&ofn); + if (parent) { QApplicationPrivate::leaveModal(parent); QEvent e(QEvent::WindowUnblocked); @@ -519,69 +365,38 @@ QStringList Q3FileDialog::winGetOpenFileNames(const QString &filter, QApplication::sendEvent(parent, &e); QApplicationPrivate::enterModal(parent); } - QT_WA({ - OPENFILENAME* ofn = makeOFN(parent, isel, - *initialDirectory, title, - winFilter(filter), ExistingFiles); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileName(ofn)) { - QString fileOrDir = QString::fromUcs2((ushort*)ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - int offset = fileOrDir.length() + 1; - if (ofn->lpstrFile[offset] == 0) { - // Only one file selected; has full path - fi.setFile(fileOrDir); - QString res = fi.absFilePath(); - if (!res.isEmpty()) - result.append(res); - } - else { - // Several files selected; first string is path - dir.setPath(fileOrDir); - QString f; - while(!(f = QString::fromUcs2((ushort*)ofn->lpstrFile+offset)).isEmpty()) { - fi.setFile(dir, f); - QString res = fi.absFilePath(); - if (!res.isEmpty()) - result.append(res); - offset += f.length() + 1; - } - } + + OPENFILENAME* ofn = makeOFN(parent, isel, + *initialDirectory, title, + winFilter(filter), ExistingFiles); + if (idx) + ofn->nFilterIndex = idx + 1; + if (GetOpenFileName(ofn)) { + QString fileOrDir = QString::fromWCharArray(ofn->lpstrFile); + selFilIdx = ofn->nFilterIndex; + int offset = fileOrDir.length() + 1; + if (ofn->lpstrFile[offset] == 0) { + // Only one file selected; has full path + fi.setFile(fileOrDir); + QString res = fi.absFilePath(); + if (!res.isEmpty()) + result.append(res); } - cleanUpOFN(&ofn); - } , { - OPENFILENAMEA* ofn = makeOFNA(parent, isel, - *initialDirectory, title, - winFilter(filter), ExistingFiles); - if (idx) - ofn->nFilterIndex = idx + 1; - if (GetOpenFileNameA(ofn)) { - QByteArray fileOrDir(ofn->lpstrFile); - selFilIdx = ofn->nFilterIndex; - int offset = fileOrDir.length() + 1; - if (ofn->lpstrFile[offset] == '\0') { - // Only one file selected; has full path - fi.setFile(QString::fromLocal8Bit(fileOrDir)); + else { + // Several files selected; first string is path + dir.setPath(fileOrDir); + QString f; + while (!(f = QString::fromWCharArray(ofn->lpstrFile + offset)).isEmpty()) { + fi.setFile(dir, f); QString res = fi.absFilePath(); if (!res.isEmpty()) result.append(res); + offset += f.length() + 1; } - else { - // Several files selected; first string is path - dir.setPath(QString::fromLocal8Bit(fileOrDir)); - QByteArray f; - while(!(f = QByteArray(ofn->lpstrFile + offset)).isEmpty()) { - fi.setFile(dir, QString::fromLocal8Bit(f)); - QString res = fi.absFilePath(); - if (!res.isEmpty()) - result.append(res); - offset += f.length() + 1; - } - } - cleanUpOFNA(&ofn); } - }); + } + cleanUpOFN(&ofn); + if (parent) { QApplicationPrivate::leaveModal(parent); QEvent e(QEvent::WindowUnblocked); @@ -607,34 +422,17 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd, if (uMsg == BFFM_INITIALIZED && lpData != 0) { QString *initDir = (QString *)(lpData); if (!initDir->isEmpty()) { - // ### Lars asks: is this correct for the A version???? - QT_WA({ - SendMessage(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->ucs2())); - } , { - SendMessageA(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->ucs2())); - }); + SendMessage(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->utf16())); } } else if (uMsg == BFFM_SELCHANGED) { - QT_WA({ - resolveLibs(); - TCHAR path[MAX_PATH]; - ptrSHGetPathFromIDList(LPITEMIDLIST(lParam), path); - QString tmpStr = QString::fromUcs2((ushort*)path); - if (!tmpStr.isEmpty()) - SendMessage(hwnd, BFFM_ENABLEOK, 1, 1); - else - SendMessage(hwnd, BFFM_ENABLEOK, 0, 0); - SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path)); - } , { - char path[MAX_PATH]; - SHGetPathFromIDListA(LPITEMIDLIST(lParam), path); - QString tmpStr = QString::fromLocal8Bit(path); - if (!tmpStr.isEmpty()) - SendMessageA(hwnd, BFFM_ENABLEOK, 1, 1); - else - SendMessageA(hwnd, BFFM_ENABLEOK, 0, 0); - SendMessageA(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path)); - }); + wchar_t path[MAX_PATH]; + SHGetPathFromIDList(LPITEMIDLIST(lParam), path); + QString tmpStr = QString::fromWCharArray(path); + if (!tmpStr.isEmpty()) + SendMessage(hwnd, BFFM_ENABLEOK, 1, 1); + else + SendMessage(hwnd, BFFM_ENABLEOK, 0, 0); + SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path)); } #endif return 0; @@ -666,76 +464,42 @@ QString Q3FileDialog::winGetExistingDirectory(const QString& initialDirectory, QApplication::sendEvent(parent, &e); QApplicationPrivate::enterModal(parent); } - QT_WA({ - resolveLibs(); - QString initDir = QDir::toNativeSeparators(initialDirectory); - TCHAR path[MAX_PATH]; - TCHAR initPath[MAX_PATH]; - initPath[0] = 0; - path[0] = 0; - tTitle = title; - BROWSEINFO bi; - bi.hwndOwner = (parent ? parent->winId() : 0); - bi.pidlRoot = NULL; - bi.lpszTitle = (TCHAR*)tTitle.ucs2(); - bi.pszDisplayName = initPath; - bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; - bi.lpfn = winGetExistDirCallbackProc; - bi.lParam = Q_ULONG(&initDir); - LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder(&bi); - if (pItemIDList) { - ptrSHGetPathFromIDList(pItemIDList, path); - IMalloc *pMalloc; - if (SHGetMalloc(&pMalloc) != NOERROR) - result.clear(); - else { - pMalloc->Free(pItemIDList); - pMalloc->Release(); - result = QString::fromUcs2((ushort*)path); - } - } else - result.clear(); - tTitle.clear(); - } , { - QString initDir = QDir::toNativeSeparators(initialDirectory); - char path[MAX_PATH]; - char initPath[MAX_PATH]; - QByteArray ctitle = title.toLocal8Bit(); - initPath[0]=0; - path[0]=0; - BROWSEINFOA bi; - bi.hwndOwner = (parent ? parent->winId() : 0); - bi.pidlRoot = NULL; - bi.lpszTitle = ctitle; - bi.pszDisplayName = initPath; - bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; - bi.lpfn = winGetExistDirCallbackProc; - bi.lParam = Q_ULONG(&initDir); - LPITEMIDLIST pItemIDList = SHBrowseForFolderA(&bi); - if (pItemIDList) { - SHGetPathFromIDListA(pItemIDList, path); - IMalloc *pMalloc; - if (SHGetMalloc(&pMalloc) != NOERROR) - result.clear(); - else { - pMalloc->Free(pItemIDList); - pMalloc->Release(); - result = QString::fromLocal8Bit(path); - } - } else + + QString initDir = QDir::toNativeSeparators(initialDirectory); + wchar_t path[MAX_PATH]; + wchar_t initPath[MAX_PATH]; + initPath[0] = 0; + path[0] = 0; + tTitle = title; + BROWSEINFO bi; + bi.hwndOwner = (parent ? parent->winId() : 0); + bi.pidlRoot = NULL; + bi.lpszTitle = (wchar_t*)tTitle.utf16(); + bi.pszDisplayName = initPath; + bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; + bi.lpfn = winGetExistDirCallbackProc; + bi.lParam = Q_ULONG(&initDir); + LPITEMIDLIST pItemIDList = SHBrowseForFolder(&bi); + if (pItemIDList) { + SHGetPathFromIDList(pItemIDList, path); + IMalloc *pMalloc; + if (SHGetMalloc(&pMalloc) != NOERROR) result.clear(); - }); + else { + pMalloc->Free(pItemIDList); + pMalloc->Release(); + result = QString::fromWCharArray(path); + } + } else + result.clear(); + tTitle.clear(); + if (parent) { QApplicationPrivate::leaveModal(parent); QEvent e(QEvent::WindowUnblocked); QApplication::sendEvent(parent, &e); } - // Due to a bug on Windows Me, we need to reset the current - // directory - if ((qWinVersion() == Qt::WV_98 || qWinVersion() == Qt::WV_Me) && QDir::currentDirPath() != currentDir) - QDir::setCurrent(currentDir); - if (!result.isEmpty()) result.replace(QLatin1Char('\\'), QLatin1Char('/')); return result; diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp index b80b76b..6d514c1 100644 --- a/src/qt3support/network/q3dns.cpp +++ b/src/qt3support/network/q3dns.cpp @@ -2242,53 +2242,31 @@ typedef struct { typedef DWORD (WINAPI *GNP)( PFIXED_INFO, PULONG ); // ### FIXME: this code is duplicated in qfiledialog.cpp -static QString getWindowsRegString( HKEY key, const QString &subKey ) +static QString getWindowsRegString(HKEY key, const QString &subKey) { QString s; - QT_WA( { - char buf[1024]; - DWORD bsz = sizeof(buf); - int r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)buf, &bsz ); - if ( r == ERROR_SUCCESS ) { - s = QString::fromUcs2( (unsigned short *)buf ); - } else if ( r == ERROR_MORE_DATA ) { - char *ptr = new char[bsz+1]; - r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)ptr, &bsz ); - if ( r == ERROR_SUCCESS ) - s = QLatin1String(ptr); - delete [] ptr; - } - } , { - char buf[512]; - DWORD bsz = sizeof(buf); - int r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)buf, &bsz ); - if ( r == ERROR_SUCCESS ) { - s = QLatin1String(buf); - } else if ( r == ERROR_MORE_DATA ) { - char *ptr = new char[bsz+1]; - r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)ptr, &bsz ); - if ( r == ERROR_SUCCESS ) - s = QLatin1String(ptr); - delete [] ptr; - } - } ); + + wchar_t buf[1024]; + DWORD bsz = sizeof(buf) / sizeof(wchar_t); + int r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)buf, &bsz); + if (r == ERROR_SUCCESS) { + s = QString::fromWCharArray(buf); + } else if (r == ERROR_MORE_DATA) { + char *ptr = new char[bsz+1]; + r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)ptr, &bsz); + if (r == ERROR_SUCCESS) + s = QLatin1String(ptr); + delete [] ptr; + } + return s; } static bool getDnsParamsFromRegistry( const QString &path, - QString *domainName, QString *nameServer, QString *searchList ) + QString *domainName, QString *nameServer, QString *searchList ) { HKEY k; - int r; - QT_WA( { - r = RegOpenKeyEx( HKEY_LOCAL_MACHINE, - (TCHAR*)path.ucs2(), - 0, KEY_READ, &k ); - } , { - r = RegOpenKeyExA( HKEY_LOCAL_MACHINE, - path.latin1(), - 0, KEY_READ, &k ); - } ); + int r = RegOpenKeyEx( HKEY_LOCAL_MACHINE, (wchar_t*)path.utf16(), 0, KEY_READ, &k ); if ( r == ERROR_SUCCESS ) { *domainName = getWindowsRegString( k, QLatin1String("DhcpDomain") ); @@ -2321,14 +2299,10 @@ void Q3Dns::doResInit() bool gotNetworkParams = false; // try the API call GetNetworkParams() first and use registry lookup only // as a fallback -#ifdef Q_OS_WINCE - HINSTANCE hinstLib = LoadLibraryW( L"iphlpapi" ); -#else - HINSTANCE hinstLib = LoadLibraryA( "iphlpapi" ); -#endif + HINSTANCE hinstLib = LoadLibrary( L"iphlpapi" ); if ( hinstLib != 0 ) { #ifdef Q_OS_WINCE - GNP getNetworkParams = (GNP) GetProcAddressW( hinstLib, L"GetNetworkParams" ); + GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, L"GetNetworkParams" ); #else GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, "GetNetworkParams" ); #endif @@ -2362,13 +2336,7 @@ void Q3Dns::doResInit() if ( getDnsParamsFromRegistry( QLatin1String("System\\CurrentControlSet\\Services\\Tcpip\\Parameters"), &domainName, &nameServer, &searchList )) { - // for NT separator = ' '; - } else if ( getDnsParamsFromRegistry( - QLatin1String("System\\CurrentControlSet\\Services\\VxD\\MSTCP"), - &domainName, &nameServer, &searchList )) { - // for Windows 98 - separator = ','; } else { // Could not access the TCP/IP parameters domainName = QLatin1String(""); diff --git a/src/qt3support/other/q3dragobject.cpp b/src/qt3support/other/q3dragobject.cpp index 0c17e0c..93a6079 100644 --- a/src/qt3support/other/q3dragobject.cpp +++ b/src/qt3support/other/q3dragobject.cpp @@ -191,8 +191,7 @@ Q3DragObject::~Q3DragObject() Set the pixmap, \a pm, to display while dragging the object. The platform-specific implementation will use this where it can - so provide a small masked pixmap, and do not assume that the user - will actually see it. For example, cursors on Windows 95 are of - limited size. + will actually see it. The \a hotspot is the point on (or off) the pixmap that should be under the cursor as it is dragged. It is relative to the top-left @@ -553,10 +552,6 @@ QTextCodec* qt_findcharset(const QByteArray& mimetype) i = cs.indexOf(';'); if (i >= 0) cs = cs.left(i); - // win98 often has charset=utf16, and we need to get the correct codec for - // it to be able to get Unicode text drops. - if (cs == "utf16") - cs = "ISO-10646-UCS-2"; // May return 0 if unknown charset return QTextCodec::codecForName(cs); } diff --git a/src/qt3support/other/q3process_win.cpp b/src/qt3support/other/q3process_win.cpp index 352e497..0952663 100644 --- a/src/qt3support/other/q3process_win.cpp +++ b/src/qt3support/other/q3process_win.cpp @@ -308,108 +308,60 @@ bool Q3Process::start( QStringList *env ) // CreateProcess() bool success; d->newPid(); -#ifdef UNICODE - if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) { - STARTUPINFOW startupInfo = { - sizeof( STARTUPINFO ), 0, 0, 0, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, - STARTF_USESTDHANDLES, - 0, 0, 0, - d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1] - }; - TCHAR *applicationName; - if ( appName.isNull() ) - applicationName = 0; - else - applicationName = _wcsdup( (TCHAR*)appName.ucs2() ); - TCHAR *commandLine = _wcsdup( (TCHAR*)args.ucs2() ); - QByteArray envlist; - if ( env != 0 ) { - int pos = 0; - // add PATH if necessary (for DLL loading) - QByteArray path = qgetenv( "PATH" ); - if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) { - QString tmp = QString::fromLatin1("PATH=%1").arg(QLatin1String(path.constData())); - uint tmpSize = sizeof(TCHAR) * (tmp.length()+1); - envlist.resize( envlist.size() + tmpSize ); - memcpy( envlist.data()+pos, tmp.ucs2(), tmpSize ); - pos += tmpSize; - } - // add the user environment - for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) { - QString tmp = *it; - uint tmpSize = sizeof(TCHAR) * (tmp.length()+1); - envlist.resize( envlist.size() + tmpSize ); - memcpy( envlist.data()+pos, tmp.ucs2(), tmpSize ); - pos += tmpSize; - } - // add the 2 terminating 0 (actually 4, just to be on the safe side) - envlist.resize( envlist.size()+4 ); - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - } - success = CreateProcessW( applicationName, commandLine, - 0, 0, TRUE, ( comms==0 ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW ) + + STARTUPINFOW startupInfo = { + sizeof( STARTUPINFO ), 0, 0, 0, + (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, + 0, 0, 0, + STARTF_USESTDHANDLES, + 0, 0, 0, + d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1] + }; + wchar_t *applicationName; + if ( appName.isNull() ) + applicationName = 0; + else + applicationName = _wcsdup( (wchar_t*)appName.utf16() ); + wchar_t *commandLine = _wcsdup( (wchar_t*)args.utf16() ); + QByteArray envlist; + if ( env != 0 ) { + int pos = 0; + // add PATH if necessary (for DLL loading) + QByteArray path = qgetenv( "PATH" ); + if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) { + QString tmp = QString::fromLatin1("PATH=%1").arg(QLatin1String(path.constData())); + uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); + envlist.resize( envlist.size() + tmpSize ); + memcpy( envlist.data() + pos, tmp.utf16(), tmpSize ); + pos += tmpSize; + } + // add the user environment + for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) { + QString tmp = *it; + uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); + envlist.resize( envlist.size() + tmpSize ); + memcpy( envlist.data() + pos, tmp.utf16(), tmpSize ); + pos += tmpSize; + } + // add the 2 terminating 0 (actually 4, just to be on the safe side) + envlist.resize( envlist.size()+4 ); + envlist[pos++] = 0; + envlist[pos++] = 0; + envlist[pos++] = 0; + envlist[pos++] = 0; + } + success = CreateProcess( applicationName, commandLine, + 0, 0, TRUE, ( comms == 0 ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW ) #ifndef Q_OS_WINCE - | CREATE_UNICODE_ENVIRONMENT + | CREATE_UNICODE_ENVIRONMENT #endif - , env==0 ? 0 : envlist.data(), - (TCHAR*)QDir::toNativeSeparators(workingDir.absPath()).ucs2(), - &startupInfo, d->pid ); - free( applicationName ); - free( commandLine ); - } else -#endif // UNICODE - { -#ifndef Q_OS_WINCE - STARTUPINFOA startupInfo = { sizeof( STARTUPINFOA ), 0, 0, 0, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, - STARTF_USESTDHANDLES, - 0, 0, 0, - d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1] - }; - QByteArray envlist; - if ( env != 0 ) { - int pos = 0; - // add PATH if necessary (for DLL loading) - QByteArray path = qgetenv( "PATH" ); - if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) { - Q3CString tmp = QString::fromLatin1("PATH=%1").arg(QString::fromLatin1(path.constData())).local8Bit(); - uint tmpSize = tmp.length() + 1; - envlist.resize( envlist.size() + tmpSize ); - memcpy( envlist.data()+pos, tmp.data(), tmpSize ); - pos += tmpSize; - } - // add the user environment - for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) { - Q3CString tmp = (*it).local8Bit(); - uint tmpSize = tmp.length() + 1; - envlist.resize( envlist.size() + tmpSize ); - memcpy( envlist.data()+pos, tmp.data(), tmpSize ); - pos += tmpSize; - } - // add the terminating 0 (actually 2, just to be on the safe side) - envlist.resize( envlist.size()+2 ); - envlist[pos++] = 0; - envlist[pos++] = 0; - } - char *applicationName; - if ( appName.isNull() ) - applicationName = 0; - else - applicationName = const_cast(appName.toLocal8Bit().data()); - success = CreateProcessA( applicationName, - const_cast(args.toLocal8Bit().data()), - 0, 0, TRUE, comms==0 ? CREATE_NEW_CONSOLE : DETACHED_PROCESS, - env==0 ? 0 : envlist.data(), - (const char*)QDir::toNativeSeparators(workingDir.absPath()).local8Bit(), - &startupInfo, d->pid ); -#endif // Q_OS_WINCE - } + , env == 0 ? 0 : envlist.data(), + (wchar_t*)QDir::toNativeSeparators(workingDir.absPath()).utf16(), + &startupInfo, d->pid ); + + free( applicationName ); + free( commandLine ); + if ( !success ) { d->deletePid(); return false; diff --git a/src/qt3support/widgets/q3datetimeedit.cpp b/src/qt3support/widgets/q3datetimeedit.cpp index b6e303c..4872642 100644 --- a/src/qt3support/widgets/q3datetimeedit.cpp +++ b/src/qt3support/widgets/q3datetimeedit.cpp @@ -114,39 +114,21 @@ static void readLocaleSettings() lTimeSep = new QString(); #if defined(Q_WS_WIN) - QT_WA({ - TCHAR data[10]; - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10); - *lDateSep = QString::fromUtf16((ushort*)data); - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10); - *lTimeSep = QString::fromUtf16((ushort*)data); - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10); - lAMPM = QString::fromUtf16((ushort*)data).toInt()==0; - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10); - QString am = QString::fromUtf16((ushort*)data); - if (!am.isEmpty()) - lAM = new QString(am); - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10); - QString pm = QString::fromUtf16((ushort*)data); - if (!pm.isEmpty() ) - lPM = new QString(pm); - } , { - char data[10]; - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDATE, (char*)&data, 10); - *lDateSep = QString::fromLocal8Bit(data); - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STIME, (char*)&data, 10); - *lTimeSep = QString::fromLocal8Bit(data); - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ITIME, (char*)&data, 10); - lAMPM = QString::fromLocal8Bit(data).toInt()==0; - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S1159, (char*)&data, 10); - QString am = QString::fromLocal8Bit(data); - if (!am.isEmpty()) - lAM = new QString(am); - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S2359, (char*)&data, 10); - QString pm = QString::fromLocal8Bit(data); - if (!pm.isEmpty()) - lPM = new QString(pm); - }); + wchar_t data[10]; + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10); + *lDateSep = QString::fromWCharArray(data); + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10); + *lTimeSep = QString::fromWCharArray(data); + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10); + lAMPM = QString::fromWCharArray(data).toInt() == 0; + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10); + QString am = QString::fromWCharArray(data); + if (!am.isEmpty()) + lAM = new QString(am); + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10); + QString pm = QString::fromWCharArray(data); + if (!pm.isEmpty() ) + lPM = new QString(pm); #else *lDateSep = QLatin1Char('-'); *lTimeSep = QLatin1Char(':'); diff --git a/src/qt3support/widgets/q3titlebar.cpp b/src/qt3support/widgets/q3titlebar.cpp index a05e4e5..ee3decf 100644 --- a/src/qt3support/widgets/q3titlebar.cpp +++ b/src/qt3support/widgets/q3titlebar.cpp @@ -173,35 +173,20 @@ void Q3TitleBarPrivate::readColors() bool colorsInitialized = false; #ifdef Q_WS_WIN // ask system properties on windows -#ifndef SPI_GETGRADIENTCAPTIONS -#define SPI_GETGRADIENTCAPTIONS 0x1008 -#endif -#ifndef COLOR_GRADIENTACTIVECAPTION -#define COLOR_GRADIENTACTIVECAPTION 27 -#endif -#ifndef COLOR_GRADIENTINACTIVECAPTION -#define COLOR_GRADIENTINACTIVECAPTION 28 -#endif if (QApplication::desktopSettingsAware()) { pal.setColor(QPalette::Active, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION))); pal.setColor(QPalette::Inactive, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION))); pal.setColor(QPalette::Active, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT))); pal.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT))); - if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) { - colorsInitialized = true; - BOOL gradient; - QT_WA({ - SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0); - } , { - SystemParametersInfoA(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0); - }); - if (gradient) { - pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); - pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); - } else { - pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight)); - pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight)); - } + colorsInitialized = true; + BOOL gradient = false; + SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0); + if (gradient) { + pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); + pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); + } else { + pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight)); + pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight)); } } #endif // Q_WS_WIN -- cgit v0.12 From 70d033d033b34ed9c0dde38889062bfd8420366c Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 1 Jul 2009 11:50:13 +0200 Subject: src/testlib: LPCWSTR -> wchar_t* Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/testlib/qplaintestlogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 3047326..071b55e 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -151,7 +151,7 @@ namespace QTest { int length = strlen(str); for (int pos = 0; pos < length; pos +=255) { QString uniText = QString::fromLatin1(str + pos, 255); - OutputDebugStringW((const LPCWSTR) uniText.utf16()); + OutputDebugString((wchar_t*)uniText.utf16()); } if (QTestLog::outputFileName()) #elif defined(Q_OS_WIN) -- cgit v0.12 From 7ae4e3c1827138cc47d14dd0f128b5999ccb30ce Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:50:16 +0200 Subject: src/tools/idc: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/tools/idc/main.cpp | 69 ++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 53 deletions(-) diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp index 48ce9cc..8fe8a70 100644 --- a/src/tools/idc/main.cpp +++ b/src/tools/idc/main.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include -#include #include #include #include @@ -87,37 +86,19 @@ static bool runWithQtInEnvironment(const QString &cmd) static bool attachTypeLibrary(const QString &applicationName, int resource, const QByteArray &data, QString *errorMessage) { - HANDLE hExe = 0; - QT_WA({ - TCHAR *resourceName = MAKEINTRESOURCEW(resource); - hExe = BeginUpdateResourceW((TCHAR*)applicationName.utf16(), false); - if (hExe == 0) { - if (errorMessage) - *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName); - return false; - } - if (!UpdateResourceW(hExe,L"TYPELIB",resourceName,0,(void*)data.data(),data.count())) { - EndUpdateResource(hExe, true); - if (errorMessage) - *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName); - return false; - } - }, { - char *resourceName = MAKEINTRESOURCEA(resource); - hExe = BeginUpdateResourceA(applicationName.toLocal8Bit(), false); - if (hExe == 0) { - if (errorMessage) - *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName); - return false; - } - if (!UpdateResourceA(hExe,"TYPELIB",resourceName,0,(void*)data.data(),data.count())) { - EndUpdateResource(hExe, true); - if (errorMessage) - *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName); - return false; - } - }); - + HANDLE hExe = BeginUpdateResource((const wchar_t *)applicationName.utf16(), false); + if (hExe == 0) { + if (errorMessage) + *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not open file.").arg(applicationName); + return false; + } + if (!UpdateResource(hExe, L"TYPELIB", MAKEINTRESOURCE(resource), 0, (void*)data.data(), data.count())) { + EndUpdateResource(hExe, true); + if (errorMessage) + *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not update file.").arg(applicationName); + return false; + } + if (!EndUpdateResource(hExe,false)) { if (errorMessage) *errorMessage = QString::fromLatin1("Failed to attach type library to binary %1 - could not write file.").arg(applicationName); @@ -135,12 +116,7 @@ static bool registerServer(const QString &input) if (input.endsWith(QLatin1String(".exe"))) { ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -regserver")); } else { - HMODULE hdll = 0; - QT_WA({ - hdll = LoadLibraryW((TCHAR*)input.utf16()); - }, { - hdll = LoadLibraryA(input.toLocal8Bit()); - }); + HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16()); if (!hdll) { fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data()); return false; @@ -162,12 +138,7 @@ static bool unregisterServer(const QString &input) if (input.endsWith(QLatin1String(".exe"))) { ok = runWithQtInEnvironment(quotePath(input) + QLatin1String(" -unregserver")); } else { - HMODULE hdll = 0; - QT_WA({ - hdll = LoadLibraryW((TCHAR*)input.utf16()); - }, { - hdll = LoadLibraryA(input.toLocal8Bit()); - }); + HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16()); if (!hdll) { fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data()); return false; @@ -191,12 +162,7 @@ static HRESULT dumpIdl(const QString &input, const QString &idlfile, const QStri if (runWithQtInEnvironment(quotePath(input) + QLatin1String(" -dumpidl ") + idlfile + QLatin1String(" -version ") + version)) res = S_OK; } else { - HMODULE hdll = 0; - QT_WA({ - hdll = LoadLibraryW((TCHAR*)input.utf16()); - }, { - hdll = LoadLibraryA(input.toLocal8Bit()); - }); + HMODULE hdll = LoadLibrary((const wchar_t *)input.utf16()); if (!hdll) { fprintf(stderr, "Couldn't load library file %s\n", (const char*)input.toLocal8Bit().data()); return 3; @@ -254,9 +220,6 @@ int runIdc(int argc, char **argv) else version = QLatin1String(argv[i]); } else if (p == QLatin1String("/tlb") || p == QLatin1String("-tlb")) { - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) - fprintf(stderr, "IDC requires Windows NT/2000/XP!\n"); - ++i; if (i > argc) { error = QLatin1String("Missing name for type library file!"); -- cgit v0.12 From 24e7a5f983ead3fe722703851cf59cd0943e3964 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:50:19 +0200 Subject: src/3rdparty/phonon: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/3rdparty/phonon/ds9/qaudiocdreader.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp index b9f9fd6..d5bdce2 100644 --- a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp +++ b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp @@ -154,10 +154,7 @@ namespace Phonon path = QString::fromLatin1("\\\\.\\%1:").arg(drive); } - m_cddrive = QT_WA_INLINE ( - ::CreateFile( (TCHAR*)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ), - ::CreateFileA( path.toLocal8Bit().constData(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ) - ); + m_cddrive = ::CreateFile((const wchar_t *)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); qMemSet(m_toc, 0, sizeof(CDROM_TOC)); //read the TOC -- cgit v0.12 From 5ea86cfac34f65b2321ceeeb651e4e7099bf59a0 Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 1 Jul 2009 11:50:23 +0200 Subject: tools: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also QString::fromUtf16() -> QString::fromWCharArray() Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- tools/activeqt/dumpcpp/main.cpp | 6 +- tools/configure/configure.pro | 2 +- tools/configure/configureapp.cpp | 19 +- tools/configure/environment.cpp | 218 ++++++--------------- tools/configure/tools.cpp | 4 +- .../src/plugins/activeqt/qaxwidgettaskmenu.cpp | 2 +- tools/linguist/shared/profileevaluator.cpp | 4 +- .../qtestlib/wince/cetest/activesyncconnection.cpp | 10 +- tools/xmlpatterns/main.cpp | 2 +- 9 files changed, 78 insertions(+), 189 deletions(-) diff --git a/tools/activeqt/dumpcpp/main.cpp b/tools/activeqt/dumpcpp/main.cpp index 0a4aa06..de3ec57 100644 --- a/tools/activeqt/dumpcpp/main.cpp +++ b/tools/activeqt/dumpcpp/main.cpp @@ -969,7 +969,7 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O QString libName; BSTR nameString; typelib->GetDocumentation(-1, &nameString, 0, 0, 0); - libName = QString::fromUtf16((const ushort *)nameString); + libName = QString::fromWCharArray(nameString); SysFreeString(nameString); if (!nameSpace.isEmpty()) libName = QString(nameSpace); @@ -1086,7 +1086,7 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O BSTR bstr; if (S_OK != typeinfo->GetDocumentation(-1, &bstr, 0, 0, 0)) break; - className = QString::fromUtf16((const ushort *)bstr).toLatin1(); + className = QString::fromWCharArray(bstr).toLatin1(); SysFreeString(bstr); switch (typekind) { case TKIND_RECORD: @@ -1227,7 +1227,7 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O BSTR bstr; if (S_OK != typeinfo->GetDocumentation(-1, &bstr, 0, 0, 0)) break; - className = QString::fromUtf16((const ushort *)bstr).toLatin1(); + className = QString::fromWCharArray(bstr).toLatin1(); SysFreeString(bstr); declOut << "// stub for vtable-only interface" << endl; diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 1ce9a1b..fdeab29 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -3,7 +3,7 @@ DESTDIR = ../.. CONFIG += console flat CONFIG -= moc qt -DEFINES = QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_BUILD_QMAKE QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE +DEFINES = UNICODE QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_BUILD_QMAKE QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE win32 : LIBS += -lole32 -ladvapi32 diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 597cd0e..509444b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -116,16 +116,9 @@ Configure::Configure( int& argc, char** argv ) // Get the path to the executable - QFileInfo sourcePathInfo; - QT_WA({ - unsigned short module_name[256]; - GetModuleFileNameW(0, reinterpret_cast(module_name), sizeof(module_name)); - sourcePathInfo = QString::fromUtf16(module_name); - }, { - char module_name[256]; - GetModuleFileNameA(0, module_name, sizeof(module_name)); - sourcePathInfo = QString::fromLocal8Bit(module_name); - }); + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t)); + QFileInfo sourcePathInfo = QString::fromWCharArray(module_name); sourcePath = sourcePathInfo.absolutePath(); sourceDir = sourcePathInfo.dir(); buildPath = QDir::currentPath(); @@ -2733,7 +2726,7 @@ void Configure::generateConfigfiles() tmpFile.flush(); // Replace old qconfig.h with new one - ::SetFileAttributesA(outName.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL); + ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL); QFile::remove(outName); tmpFile.copy(outName); tmpFile.close(); @@ -2769,7 +2762,7 @@ void Configure::generateConfigfiles() } outName = defSpec + "/qmake.conf"; - ::SetFileAttributesA(outName.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL ); + ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL ); QFile qmakeConfFile(outName); if (qmakeConfFile.open(QFile::Append | QFile::WriteOnly | QFile::Text)) { QTextStream qmakeConfStream; @@ -2837,7 +2830,7 @@ void Configure::generateConfigfiles() tmpFile2.flush(); // Replace old qconfig.cpp with new one - ::SetFileAttributesA(outName.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL ); + ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL ); QFile::remove( outName ); tmpFile2.copy(outName); tmpFile2.close(); diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 6dc8940..b4c61f8 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -146,26 +146,14 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey) QString rSubkeyPath = keyPath(rSubkey); HKEY handle = 0; - LONG res; - QT_WA( { - res = RegOpenKeyExW(parentHandle, (WCHAR*)rSubkeyPath.utf16(), - 0, KEY_READ, &handle); - } , { - res = RegOpenKeyExA(parentHandle, rSubkeyPath.toLocal8Bit(), - 0, KEY_READ, &handle); - } ); - + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); if (res != ERROR_SUCCESS) return QString(); // get the size and type of the value DWORD dataType; DWORD dataSize; - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -173,13 +161,8 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the value QByteArray data(dataSize, 0); - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, + reinterpret_cast(data.data()), &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -189,11 +172,7 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey) switch (dataType) { case REG_EXPAND_SZ: case REG_SZ: { - QT_WA( { - result = QString::fromUtf16(((const ushort*)data.constData())); - }, { - result = QString::fromLatin1(data.constData()); - } ); + result = QString::fromWCharArray(((const wchar_t *)data.constData())); break; } @@ -201,29 +180,20 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey) QStringList l; int i = 0; for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLatin1(data.constData() + i); - } ); + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); i += s.length() + 1; if (s.isEmpty()) break; l.append(s); } - result = l.join(", "); + result = l.join(", "); break; } case REG_NONE: case REG_BINARY: { - QT_WA( { - result = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - result = QString::fromLatin1(data.constData(), data.size()); - } ); + result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); break; } @@ -232,7 +202,7 @@ QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey) Q_ASSERT(data.size() == sizeof(int)); int i; memcpy((char*)&i, data.constData(), sizeof(int)); - result = QString::number(i); + result = QString::number(i); break; } @@ -350,29 +320,14 @@ bool Environment::detectExecutable(const QString &executable) PROCESS_INFORMATION procInfo; memset(&procInfo, 0, sizeof(procInfo)); - bool couldExecute; - QT_WA({ - // Unicode version - STARTUPINFOW startInfo; - memset(&startInfo, 0, sizeof(startInfo)); - startInfo.cb = sizeof(startInfo); - - couldExecute = CreateProcessW(0, (WCHAR*)executable.utf16(), - 0, 0, false, - CREATE_NO_WINDOW | CREATE_SUSPENDED, - 0, 0, &startInfo, &procInfo); - - }, { - // Ansi version - STARTUPINFOA startInfo; - memset(&startInfo, 0, sizeof(startInfo)); - startInfo.cb = sizeof(startInfo); + STARTUPINFO startInfo; + memset(&startInfo, 0, sizeof(startInfo)); + startInfo.cb = sizeof(startInfo); - couldExecute = CreateProcessA(0, executable.toLocal8Bit().data(), + bool couldExecute = CreateProcess(0, (wchar_t*)executable.utf16(), 0, 0, false, CREATE_NO_WINDOW | CREATE_SUSPENDED, 0, 0, &startInfo, &procInfo); - }) if (couldExecute) { CloseHandle(procInfo.hThread); @@ -421,61 +376,38 @@ static QString qt_create_commandline(const QString &program, const QStringList & } /*! - Creates a QByteArray of the \a environment in either UNICODE or - ansi representation. + Creates a QByteArray of the \a environment. */ static QByteArray qt_create_environment(const QStringList &environment) { QByteArray envlist; - if (!environment.isEmpty()) { - int pos = 0; - // add PATH if necessary (for DLL loading) - QByteArray path = qgetenv("PATH"); - QT_WA({ - if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() - && !path.isNull()) { - QString tmp = QString(QLatin1String("PATH=%1")).arg(QString::fromLocal8Bit(path)); - uint tmpSize = sizeof(TCHAR) * (tmp.length()+1); - envlist.resize(envlist.size() + tmpSize ); - memcpy(envlist.data()+pos, tmp.utf16(), tmpSize); - pos += tmpSize; - } - // add the user environment - for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) { - QString tmp = *it; - uint tmpSize = sizeof(TCHAR) * (tmp.length()+1); - envlist.resize(envlist.size() + tmpSize); - memcpy(envlist.data()+pos, tmp.utf16(), tmpSize); - pos += tmpSize; - } - // add the 2 terminating 0 (actually 4, just to be on the safe side) - envlist.resize( envlist.size()+4 ); - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - envlist[pos++] = 0; - }, { - if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() && !path.isNull()) { - QByteArray tmp = QString("PATH=%1").arg(QString::fromLocal8Bit(path)).toLocal8Bit(); - uint tmpSize = tmp.length() + 1; - envlist.resize(envlist.size() + tmpSize); - memcpy(envlist.data()+pos, tmp.data(), tmpSize); - pos += tmpSize; - } - // add the user environment - for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++) { - QByteArray tmp = (*it).toLocal8Bit(); - uint tmpSize = tmp.length() + 1; - envlist.resize(envlist.size() + tmpSize); - memcpy(envlist.data()+pos, tmp.data(), tmpSize); - pos += tmpSize; - } - // add the terminating 0 (actually 2, just to be on the safe side) - envlist.resize(envlist.size()+2); - envlist[pos++] = 0; - envlist[pos++] = 0; - }) + if (environment.isEmpty()) + return envlist; + + int pos = 0; + // add PATH if necessary (for DLL loading) + QByteArray path = qgetenv("PATH"); + if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() && !path.isNull()) { + QString tmp = QString(QLatin1String("PATH=%1")).arg(QString::fromLocal8Bit(path)); + uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); + envlist.resize(envlist.size() + tmpSize); + memcpy(envlist.data() + pos, tmp.utf16(), tmpSize); + pos += tmpSize; } + // add the user environment + for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) { + QString tmp = *it; + uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); + envlist.resize(envlist.size() + tmpSize); + memcpy(envlist.data() + pos, tmp.utf16(), tmpSize); + pos += tmpSize; + } + // add the 2 terminating 0 (actually 4, just to be on the safe side) + envlist.resize(envlist.size() + 4); + envlist[pos++] = 0; + envlist[pos++] = 0; + envlist[pos++] = 0; + envlist[pos++] = 0; return envlist; } @@ -501,46 +433,24 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv qDebug() << " " << additionalEnv; qDebug() << " " << removeEnv; #endif -// GetEnvironmentStrings is defined to GetEnvironmentStringsW when -// UNICODE is defined. We cannot use that, since we need to -// destinguish between unicode and ansi versions of the functions. -#if defined(UNICODE) && defined(GetEnvironmentStrings) -#undef GetEnvironmentStrings -#endif - // Create the full environment from the current environment and // the additionalEnv strings, then remove all variables defined // in removeEnv QMap fullEnvMap; - QT_WA({ - LPWSTR envStrings = GetEnvironmentStringsW(); - if (envStrings) { - int strLen = 0; - for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) { - strLen = wcslen(envString); - QString str = QString((const QChar*)envString, strLen); - if (!str.startsWith("=")) { // These are added by the system - int sepIndex = str.indexOf('='); - fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1)); - } - } - } - FreeEnvironmentStringsW(envStrings); - }, { - LPSTR envStrings = GetEnvironmentStrings(); - if (envStrings) { - int strLen = 0; - for (LPSTR envString = envStrings; *(envString); envString += strLen + 1) { - strLen = strlen(envString); - QString str = QLatin1String(envString); - if (!str.startsWith("=")) { // These are added by the system - int sepIndex = str.indexOf('='); - fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1)); - } + LPWSTR envStrings = GetEnvironmentStrings(); + if (envStrings) { + int strLen = 0; + for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) { + strLen = wcslen(envString); + QString str = QString((const QChar*)envString, strLen); + if (!str.startsWith("=")) { // These are added by the system + int sepIndex = str.indexOf('='); + fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1)); } } - FreeEnvironmentStringsA(envStrings); - }) + } + FreeEnvironmentStrings(envStrings); + // Add additionalEnv variables for (int i = 0; i < additionalEnv.count(); ++i) { const QString &str = additionalEnv.at(i); @@ -569,28 +479,14 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv PROCESS_INFORMATION procInfo; memset(&procInfo, 0, sizeof(procInfo)); - bool couldExecute; - QT_WA({ - // Unicode version - STARTUPINFOW startInfo; - memset(&startInfo, 0, sizeof(startInfo)); - startInfo.cb = sizeof(startInfo); + STARTUPINFO startInfo; + memset(&startInfo, 0, sizeof(startInfo)); + startInfo.cb = sizeof(startInfo); - couldExecute = CreateProcessW(0, (WCHAR*)args.utf16(), + bool couldExecute = CreateProcess(0, (wchar_t*)args.utf16(), 0, 0, true, CREATE_UNICODE_ENVIRONMENT, envlist.isEmpty() ? 0 : envlist.data(), 0, &startInfo, &procInfo); - }, { - // Ansi version - STARTUPINFOA startInfo; - memset(&startInfo, 0, sizeof(startInfo)); - startInfo.cb = sizeof(startInfo); - - couldExecute = CreateProcessA(0, args.toLocal8Bit().data(), - 0, 0, true, 0, - envlist.isEmpty() ? 0 : envlist.data(), - 0, &startInfo, &procInfo); - }) if (couldExecute) { WaitForSingleObject(procInfo.hProcess, INFINITE); @@ -654,7 +550,7 @@ bool Environment::cpdir(const QString &srcDir, const QString &destDir) #endif QFile::remove(destFile); intermediate = QFile::copy(entry.absoluteFilePath(), destFile); - SetFileAttributesA(destFile.toLocal8Bit(), FILE_ATTRIBUTE_NORMAL); + SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); } if(!intermediate) { qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir(); diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index f60f72c..708a537 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -201,8 +201,8 @@ void Tools::checkLicense(QMap &dictionary, QMapRelease(); diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index ef59543..47c1ec2 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1949,9 +1949,9 @@ QStringList ProFileEvaluator::Private::values(const QString &variableName, ret = QLatin1String("Windows"); } else if (type == QLatin1String("name")) { DWORD name_length = 1024; - TCHAR name[1024]; + wchar_t name[1024]; if (GetComputerName(name, &name_length)) - ret = QString::fromUtf16((ushort*)name, name_length); + ret = QString::fromWCharArray(name); } else if (type == QLatin1String("version") || type == QLatin1String("version_string")) { QSysInfo::WinVersion ver = QSysInfo::WindowsVersion; if (type == QLatin1String("version")) diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp index f047b79..e8ca8f2 100644 --- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp +++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp @@ -270,8 +270,8 @@ bool ActiveSyncConnection::copyDirectoryFromDevice(const QString &deviceSource, } do { - QString srcFile = deviceSource + "\\" + QString::fromUtf16(data.cFileName); - QString destFile = localDest + "\\" + QString::fromUtf16(data.cFileName); + QString srcFile = deviceSource + "\\" + QString::fromWCharArray(data.cFileName); + QString destFile = localDest + "\\" + QString::fromWCharArray(data.cFileName); if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { if (recursive && !copyDirectoryFromDevice(srcFile, destFile, recursive)) { wprintf(L"Copy of subdirectory(%s) failed\n", srcFile.utf16()); @@ -306,8 +306,8 @@ bool ActiveSyncConnection::copyDirectory(const QString &srcDirectory, const QStr } do { - QString srcFile = srcDirectory + "\\" + QString::fromUtf16(data.cFileName); - QString destFile = destDirectory + "\\" + QString::fromUtf16(data.cFileName); + QString srcFile = srcDirectory + "\\" + QString::fromWCharArray(data.cFileName); + QString destFile = destDirectory + "\\" + QString::fromWCharArray(data.cFileName); if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { if (recursive && !copyDirectory(srcFile, destFile, recursive)) { wprintf(L"Copy of subdirectory(%s) failed\n", srcFile.utf16()); @@ -341,7 +341,7 @@ bool ActiveSyncConnection::deleteDirectory(const QString &directory, bool recurs return false; do { - QString FileName = directory + "\\" + QString::fromUtf16(FindFileData.cFileName); + QString FileName = directory + "\\" + QString::fromWCharArray(FindFileData.cFileName); if((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { if (recursive) if (!deleteDirectory(FileName, recursive, failIfContentExists)) diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp index a5c2c41..2405d5d 100644 --- a/tools/xmlpatterns/main.cpp +++ b/tools/xmlpatterns/main.cpp @@ -194,7 +194,7 @@ protected: /* If we don't open stdout in "binary" mode on Windows, it will translate * 0xA into 0xD 0xA. See Trolltech task 173619, for an example. */ _setmode(_fileno(stdout), _O_BINARY); - m_stdout = QT_WA_INLINE(_wfdopen(_fileno(stdout), L"wb"),_fdopen(_fileno(stdout), "wb")); + m_stdout = _wfdopen(_fileno(stdout), L"wb"); out->open(m_stdout, QIODevice::WriteOnly); #else out->open(stdout, QIODevice::WriteOnly); -- cgit v0.12 From c447ce31632e25fdd40404cc96b6980aa0adcef8 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 1 Jul 2009 11:50:26 +0200 Subject: qmake: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Also, QString::fromUtf16() -> QString::fromWCharArray() Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- qmake/generators/win32/msvc_vcproj.cpp | 43 ++++++---------------------------- qmake/option.cpp | 13 +++------- qmake/project.cpp | 6 ++--- 3 files changed, 13 insertions(+), 49 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 079aa9f..50f78d7 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -120,14 +120,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QString rSubkeyPath = keyPath(rSubkey); HKEY handle = 0; - LONG res; - QT_WA( { - res = RegOpenKeyExW(parentHandle, (WCHAR*)rSubkeyPath.utf16(), - 0, KEY_READ, &handle); - } , { - res = RegOpenKeyExA(parentHandle, rSubkeyPath.toLocal8Bit(), - 0, KEY_READ, &handle); - } ); + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); if (res != ERROR_SUCCESS) return QString(); @@ -135,11 +128,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the size and type of the value DWORD dataType; DWORD dataSize; - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -147,13 +136,8 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the value QByteArray data(dataSize, 0); - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, + reinterpret_cast(data.data()), &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -163,11 +147,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) switch (dataType) { case REG_EXPAND_SZ: case REG_SZ: { - QT_WA( { - result = QString::fromUtf16(((const ushort*)data.constData())); - }, { - result = QString::fromLatin1(data.constData()); - } ); + result = QString::fromWCharArray(((const wchar_t *)data.constData())); break; } @@ -175,12 +155,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QStringList l; int i = 0; for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLatin1(data.constData() + i); - } ); + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); i += s.length() + 1; if (s.isEmpty()) @@ -193,11 +168,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) case REG_NONE: case REG_BINARY: { - QT_WA( { - result = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - result = QString::fromLatin1(data.constData(), data.size()); - } ); + result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); break; } diff --git a/qmake/option.cpp b/qmake/option.cpp index 0e4a608..5f8c4f4 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -716,16 +716,9 @@ QString qmake_libraryInfoFile() { QString ret; #if defined( Q_OS_WIN ) - QFileInfo filePath; - QT_WA({ - unsigned short module_name[256]; - GetModuleFileNameW(0, reinterpret_cast(module_name), sizeof(module_name)); - filePath = QString::fromUtf16(module_name); - }, { - char module_name[256]; - GetModuleFileNameA(0, module_name, sizeof(module_name)); - filePath = QString::fromLocal8Bit(module_name); - }); + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, MAX_PATH); + QFileInfo filePath = QString::fromWCharArray(module_name); ret = filePath.filePath(); #else QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0)); diff --git a/qmake/project.cpp b/qmake/project.cpp index 047a5e3..704d8a6 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3117,9 +3117,9 @@ QStringList &QMakeProject::values(const QString &_var, QMap Date: Wed, 1 Jul 2009 11:50:29 +0200 Subject: tests: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 6 +- tests/auto/qapplication/tst_qapplication.cpp | 6 +- tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp | 2 +- tests/auto/qfile/tst_qfile.cpp | 91 +++++----------- tests/auto/qfileinfo/tst_qfileinfo.cpp | 31 ++---- tests/auto/qitemview/tst_qitemview.cpp | 2 +- tests/auto/qlocale/tst_qlocale.cpp | 31 +----- tests/auto/qpixmap/tst_qpixmap.cpp | 7 +- tests/auto/qsettings/tst_qsettings.cpp | 6 -- tests/auto/qsharedmemory/src/qsystemlock_win.cpp | 26 ++--- tests/auto/qstring/tst_qstring.cpp | 8 +- tests/auto/qstyle/tst_qstyle.cpp | 2 +- tests/auto/qtcpserver/tst_qtcpserver.cpp | 120 +++++++++------------ tests/auto/qtimer/tst_qtimer.cpp | 2 +- tests/auto/qwidget/tst_qwidget.cpp | 8 +- .../qwineventnotifier/tst_qwineventnotifier.cpp | 7 +- .../auto/windowsmobile/test/tst_windowsmobile.cpp | 2 +- tests/benchmarks/qdiriterator/main.cpp | 2 +- .../qdiriterator/qfilesystemiterator.cpp | 19 +--- tests/benchmarks/qfile/main.cpp | 12 +-- 20 files changed, 133 insertions(+), 257 deletions(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index a87d02f..8a88b59 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -53,12 +53,12 @@ #include "QtTest/qtestaccessible.h" #if defined(Q_OS_WINCE) -extern "C" bool SystemParametersInfoW(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni); +extern "C" bool SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni); #define SPI_GETPLATFORMTYPE 257 inline bool IsValidCEPlatform() { wchar_t tszPlatform[64]; - if (SystemParametersInfoW(SPI_GETPLATFORMTYPE, sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) { - QString platform = QString::fromUtf16(tszPlatform); + if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform) / sizeof(*tszPlatform), tszPlatform, 0)) { + QString platform = QString::fromWCharArray(tszPlatform); if ((platform == QLatin1String("PocketPC")) || (platform == QLatin1String("Smartphone"))) return false; } diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp index 2fa7584..85494af 100644 --- a/tests/auto/qapplication/tst_qapplication.cpp +++ b/tests/auto/qapplication/tst_qapplication.cpp @@ -755,9 +755,9 @@ void tst_QApplication::libraryPaths() // current Path. Therefore we need to identify it ourselves // here for the test. QFileInfo filePath; - wchar_t module_name[256]; - GetModuleFileNameW(0, module_name, sizeof(module_name) / sizeof(wchar_t)); - filePath = QString::fromUtf16((ushort *)module_name); + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, MAX_PATH); + filePath = QString::fromWCharArray(module_name); QString testDir = filePath.path() + "/test"; #endif QApplication::setLibraryPaths(QStringList() << testDir); diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp index 6c73fd6..ab98d1d 100644 --- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp @@ -102,7 +102,7 @@ Q_DECLARE_METATYPE(QList); #if defined(Q_OS_WINCE) bool qt_wince_is_platform(const QString &platformString) { - TCHAR tszPlatform[64]; + wchar_t tszPlatform[64]; if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) if (0 == _tcsicmp(reinterpret_cast (platformString.utf16()), tszPlatform)) diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index d7e9dff..8d9c2be 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -994,57 +994,32 @@ static QString getWorkingDirectoryForLink(const QString &linkFileName) { bool neededCoInit = false; QString ret; - QT_WA({ - IShellLink *psl; - HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - if (hres == CO_E_NOTINITIALIZED) { // COM was not initialized - neededCoInit = true; - CoInitialize(NULL); - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - } - if (SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface. - IPersistFile *ppf; - hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf); - if (SUCCEEDED(hres)) { - hres = ppf->Load((LPOLESTR)linkFileName.utf16(), STGM_READ); - //The original path of the link is retrieved. If the file/folder - //was moved, the return value still have the old path. - if(SUCCEEDED(hres)) { - wchar_t szGotPath[MAX_PATH]; - if (psl->GetWorkingDirectory(szGotPath, MAX_PATH) == NOERROR) - ret = QString::fromUtf16((ushort*)szGotPath); - } - ppf->Release(); - } - psl->Release(); - } - },{ - IShellLinkA *psl; - HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - if (hres == CO_E_NOTINITIALIZED) { // COM was not initialized - neededCoInit = true; - CoInitialize(NULL); - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); - } + IShellLink *psl; + HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); + if (hres == CO_E_NOTINITIALIZED) { // COM was not initialized + neededCoInit = true; + CoInitialize(NULL); + hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); + } - if (SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface. - IPersistFile *ppf; - hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf); - if (SUCCEEDED(hres)) { - hres = ppf->Load((LPOLESTR)linkFileName.utf16(), STGM_READ); - //The original path of the link is retrieved. If the file/folder - //was moved, the return value still have the old path. - if(SUCCEEDED(hres)) { - char szGotPath[MAX_PATH]; - if (psl->GetWorkingDirectory(szGotPath, MAX_PATH) == NOERROR) - ret = QString::fromLocal8Bit(szGotPath); - } - ppf->Release(); + if (SUCCEEDED(hres)) { // Get pointer to the IPersistFile interface. + IPersistFile *ppf; + hres = psl->QueryInterface(IID_IPersistFile, (LPVOID *)&ppf); + if (SUCCEEDED(hres)) { + hres = ppf->Load((LPOLESTR)linkFileName.utf16(), STGM_READ); + //The original path of the link is retrieved. If the file/folder + //was moved, the return value still have the old path. + if(SUCCEEDED(hres)) { + wchar_t szGotPath[MAX_PATH]; + if (psl->GetWorkingDirectory(szGotPath, MAX_PATH) == NOERROR) + ret = QString::fromWCharArray(szGotPath); } - psl->Release(); + ppf->Release(); } - }); + psl->Release(); + } + if (neededCoInit) { CoUninitialize(); } @@ -1538,13 +1513,8 @@ void tst_QFile::largeFileSupport() qlonglong freespace = qlonglong(0); #ifdef Q_WS_WIN _ULARGE_INTEGER free; - if (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) { - if (::GetDiskFreeSpaceExW((wchar_t *)QDir::currentPath().utf16(), &free, 0, 0)) - freespace = free.QuadPart; - } else { - if (::GetDiskFreeSpaceExA(QDir::currentPath().local8Bit(), &free, 0, 0)) - freespace = free.QuadPart; - } + if (::GetDiskFreeSpaceEx((wchar_t*)QDir::currentPath().utf16(), &free, 0, 0)) + freespace = free.QuadPart; if (freespace != 0) { #elif defined(Q_OS_IRIX) struct statfs info; @@ -1662,16 +1632,9 @@ void tst_QFile::longFileName() } { QFile file(fileName); -#if defined(Q_WS_WIN) -#if !defined(Q_OS_WINCE) - QT_WA({ if (false) ; }, { - QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort); - QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort); - }); -#else - QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort); - QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort); -#endif +#if defined(Q_OS_WINCE) + QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort); + QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort); #endif QVERIFY(file.open(QFile::WriteOnly | QFile::Text)); QTextStream ts(&file); diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 1a73948..48dc357 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -862,11 +862,6 @@ void tst_QFileInfo::fileTimes() #if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE) QVERIFY(fileInfo.created() < beforeWrite); #endif -#ifdef Q_OS_WIN - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - QVERIFY(fileInfo.lastRead().addDays(1) > beforeRead); - } else -#endif //In Vista the last-access timestamp is not updated when the file is accessed/touched (by default). //To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate //is set to 0, in the test machine. @@ -897,26 +892,14 @@ void tst_QFileInfo::fileTimes_oldFile() // WriteOnly can create files, ReadOnly cannot. DWORD creationDisp = OPEN_ALWAYS; - HANDLE fileHandle; - // Create the file handle. - QT_WA({ - fileHandle = CreateFileW(L"oldfile.txt", - accessRights, - shareMode, - &securityAtts, - creationDisp, - flagsAndAtts, - NULL); - }, { - fileHandle = CreateFileA("oldfile.txt", - accessRights, - shareMode, - &securityAtts, - creationDisp, - flagsAndAtts, - NULL); - }); + HANDLE fileHandle = CreateFile(L"oldfile.txt", + accessRights, + shareMode, + &securityAtts, + creationDisp, + flagsAndAtts, + NULL); // Set file times back to 1601. FILETIME ctime; diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp index 6bfd1e8..73c08d1 100644 --- a/tests/auto/qitemview/tst_qitemview.cpp +++ b/tests/auto/qitemview/tst_qitemview.cpp @@ -55,7 +55,7 @@ #if defined(Q_OS_WINCE) bool qt_wince_is_platform(const QString &platformString) { - TCHAR tszPlatform[64]; + wchar_t tszPlatform[64]; if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) if (0 == _tcsicmp(reinterpret_cast (platformString.utf16()), tszPlatform)) diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 8ac6ef0..9ef7f1d 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -1093,12 +1093,7 @@ void tst_QLocale::macDefaultLocale() static QString getWinLocaleInfo(LCTYPE type) { LCID id = GetThreadLocale(); - int cnt = 0; - QT_WA({ - cnt = GetLocaleInfoW(id, type, 0, 0)*2; - } , { - cnt = GetLocaleInfoA(id, type, 0, 0); - }); + int cnt = GetLocaleInfo(id, type, 0, 0) * 2; if (cnt == 0) { qWarning("QLocale: empty windows locale info (%d)", type); @@ -1107,38 +1102,20 @@ static QString getWinLocaleInfo(LCTYPE type) QByteArray buff(cnt, 0); - QT_WA({ - cnt = GetLocaleInfoW(id, type, - reinterpret_cast(buff.data()), - buff.size()/2); - } , { - cnt = GetLocaleInfoA(id, type, - buff.data(), buff.size()); - }); + cnt = GetLocaleInfo(id, type, reinterpret_cast(buff.data()), buff.size() / 2); if (cnt == 0) { qWarning("QLocale: empty windows locale info (%d)", type); return QString(); } - QString result; - QT_WA({ - result = QString::fromUtf16(reinterpret_cast(buff.data())); - } , { - result = QString::fromLocal8Bit(buff.data()); - }); - return result; + return QString::fromWCharArray(reinterpret_cast(buff.data())); } static void setWinLocaleInfo(LCTYPE type, const QString &value) { LCID id = GetThreadLocale(); - - QT_WA({ - SetLocaleInfoW(id, type, reinterpret_cast(value.utf16())); - } , { - SetLocaleInfoA(id, type, value.toLocal8Bit()); - }); + SetLocaleInfo(id, type, reinterpret_cast(value.utf16())); } class RestoreLocaleHelper { diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index f52d44e..b3736ab 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -854,12 +854,7 @@ void tst_QPixmap::toWinHBITMAP() BITMAP bitmap_info; memset(&bitmap_info, 0, sizeof(BITMAP)); - int res; - QT_WA({ - res = GetObjectW(bitmap, sizeof(BITMAP), &bitmap_info); - } , { - res = GetObjectA(bitmap, sizeof(BITMAP), &bitmap_info); - }); + int res = GetObject(bitmap, sizeof(BITMAP), &bitmap_info); QVERIFY(res); QCOMPARE(100, (int) bitmap_info.bmWidth); diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp index f682d37..f0f446d 100644 --- a/tests/auto/qsettings/tst_qsettings.cpp +++ b/tests/auto/qsettings/tst_qsettings.cpp @@ -3010,12 +3010,6 @@ void tst_QSettings::oldWriteEntry_QString_QString() QSettings readSettings("software.org", "KillerAPP"); QFETCH( QString, s ); bool ok = FALSE; -#ifdef Q_OS_WIN - if (qWinVersion() & Qt::WV_DOS_based) { - QEXPECT_FAIL("data2", "Windows 9x does not support unicode characters in the registry", Abort); - QEXPECT_FAIL("data5", "Windows 9x does not support unicode characters in the registry", Abort); - } -#endif QCOMPARE( readSettings.readEntry( "/Trolltech/QSettingsTesting/String", QString::null, &ok ), s ); QVERIFY( ok ); } diff --git a/tests/auto/qsharedmemory/src/qsystemlock_win.cpp b/tests/auto/qsharedmemory/src/qsystemlock_win.cpp index 94d90ce..a50b77b 100644 --- a/tests/auto/qsharedmemory/src/qsystemlock_win.cpp +++ b/tests/auto/qsharedmemory/src/qsystemlock_win.cpp @@ -75,32 +75,24 @@ HANDLE QSystemLockPrivate::handle() // Create it if it doesn't already exists. if (semaphore == 0) { QString safeName = makeKeyFileName(); - QT_WA({ - semaphore = CreateSemaphoreW(0, MAX_LOCKS, MAX_LOCKS, (TCHAR*)safeName.utf16()); - }, { - semaphore = CreateSemaphoreA(0, MAX_LOCKS, MAX_LOCKS, safeName.toLocal8Bit().constData()); - }); + semaphore = CreateSemaphore(0, MAX_LOCKS, MAX_LOCKS, (wchar_t*)safeName.utf16()); if (semaphore == 0) { setErrorString(QLatin1String("QSystemLockPrivate::handle")); - return 0; - } + return 0; + } } if (semaphoreLock == 0) { - QString safeLockName = QSharedMemoryPrivate::makePlatformSafeKey(key + QLatin1String("lock"), QLatin1String("qipc_systemlock_")); - QT_WA({ - semaphoreLock = CreateSemaphoreW(0, - 1, 1, (TCHAR*)safeLockName.utf16()); - }, { - semaphoreLock = CreateSemaphoreA(0, - 1, 1, safeLockName.toLocal8Bit().constData()); - }); + QString safeLockName = QSharedMemoryPrivate::makePlatformSafeKey(key + QLatin1String("lock"), QLatin1String("qipc_systemlock_")); + semaphoreLock = CreateSemaphore(0, 1, 1, (wchar_t*)safeLockName.utf16()); + if (semaphoreLock == 0) { setErrorString(QLatin1String("QSystemLockPrivate::handle")); - return 0; - } + return 0; + } } + return semaphore; } diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index e172c33..85dbda0 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -3997,15 +3997,15 @@ void tst_QString::localeAwareCompare() # if defined(Q_OS_WINCE) DWORD oldLcid = GetUserDefaultLCID(); SetUserDefaultLCID(locale); - if (locale != GetUserDefaultLCID()) { + + QCOMPARE(locale, GetUserDefaultLCID()); # else DWORD oldLcid = GetThreadLocale(); SetThreadLocale(locale); - if (locale != GetThreadLocale()) { + QCOMPARE(locale, GetThreadLocale()); # endif - QSKIP("SetThreadLocale() not supported on Win9x", SkipSingle); - } + #elif defined (Q_WS_MAC) QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)", SkipAll); #else diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index 4009e66..2cb5080 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -91,7 +91,7 @@ #include static bool qt_wince_is_smartphone() { - TCHAR tszPlatform[64]; + wchar_t tszPlatform[64]; if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) if (0 == _tcsicmp(reinterpret_cast (QString::fromLatin1("Smartphone").utf16()), tszPlatform)) diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index a06c871..5c82cbb 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -274,42 +274,35 @@ void tst_QTcpServer::ipv4LoopbackPerformanceTest() QTcpSocket *clientB = server.nextPendingConnection(); QVERIFY(clientB); -#if defined(Q_WS_WIN) - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - QSKIP("Dont run performance tests on QSysInfo::WV_DOS_based systems, overloads the system", SkipAll); - } else -#endif - { - QByteArray buffer(16384, '@'); - QTime stopWatch; - stopWatch.start(); - qlonglong totalWritten = 0; - while (stopWatch.elapsed() < 5000) { - QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0); - clientA.flush(); - totalWritten += buffer.size(); - while (clientB->waitForReadyRead(100)) { - if (clientB->bytesAvailable() == 16384) - break; - } - clientB->read(buffer.data(), buffer.size()); - clientB->write(buffer.data(), buffer.size()); - clientB->flush(); - totalWritten += buffer.size(); - while (clientA.waitForReadyRead(100)) { - if (clientA.bytesAvailable() == 16384) - break; - } - clientA.read(buffer.data(), buffer.size()); + QByteArray buffer(16384, '@'); + QTime stopWatch; + stopWatch.start(); + qlonglong totalWritten = 0; + while (stopWatch.elapsed() < 5000) { + QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0); + clientA.flush(); + totalWritten += buffer.size(); + while (clientB->waitForReadyRead(100)) { + if (clientB->bytesAvailable() == 16384) + break; } + clientB->read(buffer.data(), buffer.size()); + clientB->write(buffer.data(), buffer.size()); + clientB->flush(); + totalWritten += buffer.size(); + while (clientA.waitForReadyRead(100)) { + if (clientA.bytesAvailable() == 16384) + break; + } + clientA.read(buffer.data(), buffer.size()); + } - qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", - server.serverAddress().toString().toLatin1().constData(), - totalWritten / (1024.0 * 1024.0), - stopWatch.elapsed() / 1000.0, - (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", + server.serverAddress().toString().toLatin1().constData(), + totalWritten / (1024.0 * 1024.0), + stopWatch.elapsed() / 1000.0, + (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); - } delete clientB; } @@ -378,42 +371,35 @@ void tst_QTcpServer::ipv4PerformanceTest() QTcpSocket *clientB = server.nextPendingConnection(); QVERIFY(clientB); -#if defined(Q_WS_WIN) - if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) { - QSKIP("Dont run performance tests on QSysInfo::WV_DOS_based systems, overloads the system", SkipAll); - } else -#endif - { - - QByteArray buffer(16384, '@'); - QTime stopWatch; - stopWatch.start(); - qlonglong totalWritten = 0; - while (stopWatch.elapsed() < 5000) { - qlonglong writtenA = clientA.write(buffer.data(), buffer.size()); - clientA.flush(); - totalWritten += buffer.size(); - while (clientB->waitForReadyRead(100)) { - if (clientB->bytesAvailable() == writtenA) - break; - } - clientB->read(buffer.data(), buffer.size()); - qlonglong writtenB = clientB->write(buffer.data(), buffer.size()); - clientB->flush(); - totalWritten += buffer.size(); - while (clientA.waitForReadyRead(100)) { - if (clientA.bytesAvailable() == writtenB) - break; - } - clientA.read(buffer.data(), buffer.size()); + QByteArray buffer(16384, '@'); + QTime stopWatch; + stopWatch.start(); + qlonglong totalWritten = 0; + while (stopWatch.elapsed() < 5000) { + qlonglong writtenA = clientA.write(buffer.data(), buffer.size()); + clientA.flush(); + totalWritten += buffer.size(); + while (clientB->waitForReadyRead(100)) { + if (clientB->bytesAvailable() == writtenA) + break; } - - qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", - probeSocket.localAddress().toString().toLatin1().constData(), - totalWritten / (1024.0 * 1024.0), - stopWatch.elapsed() / 1000.0, - (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + clientB->read(buffer.data(), buffer.size()); + qlonglong writtenB = clientB->write(buffer.data(), buffer.size()); + clientB->flush(); + totalWritten += buffer.size(); + while (clientA.waitForReadyRead(100)) { + if (clientA.bytesAvailable() == writtenB) + break; + } + clientA.read(buffer.data(), buffer.size()); } + + qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", + probeSocket.localAddress().toString().toLatin1().constData(), + totalWritten / (1024.0 * 1024.0), + stopWatch.elapsed() / 1000.0, + (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + delete clientB; } diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 5fb62a5..43b7553 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -253,7 +253,7 @@ void tst_QTimer::livelock() QEXPECT_FAIL("non-zero timer", "", Continue); #elif defined(Q_OS_WIN) if (QSysInfo::WindowsVersion < QSysInfo::WV_XP) - QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Win2K/9x", Continue); + QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue); #endif QVERIFY(tester.postEventAtRightTime); } diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 1430146..04ec77d 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -106,7 +106,7 @@ // taken from qguifunctions_wce.cpp #define SPI_GETPLATFORMTYPE 257 bool qt_wince_is_platform(const QString &platformString) { - TCHAR tszPlatform[64]; + wchar_t tszPlatform[64]; if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) if (0 == _tcsicmp(reinterpret_cast (platformString.utf16()), tszPlatform)) @@ -3433,9 +3433,9 @@ static QString visibleWindowTitle(QWidget *window, Qt::WindowState state = Qt::W #ifdef Q_WS_WIN Q_UNUSED(state); const size_t maxTitleLength = 256; - WCHAR title[maxTitleLength]; - GetWindowTextW(window->winId(), title, maxTitleLength); - vTitle = QString::fromUtf16((ushort *)title); + wchar_t title[maxTitleLength]; + GetWindowText(window->winId(), title, maxTitleLength); + vTitle = QString::fromWCharArray(title); #elif defined(Q_WS_X11) /* We can't check what the window manager displays, but we can diff --git a/tests/auto/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/qwineventnotifier/tst_qwineventnotifier.cpp index 24d28c5..4b00773 100644 --- a/tests/auto/qwineventnotifier/tst_qwineventnotifier.cpp +++ b/tests/auto/qwineventnotifier/tst_qwineventnotifier.cpp @@ -110,12 +110,9 @@ void tst_QWinEventNotifier::simple_timerSet() void tst_QWinEventNotifier::simple() { - QT_WA({ - simpleHEvent = CreateEventW(0, TRUE, FALSE, 0); - }, { - simpleHEvent = CreateEventA(0, TRUE, FALSE, 0); - }); + simpleHEvent = CreateEvent(0, TRUE, FALSE, 0); QVERIFY(simpleHEvent); + QWinEventNotifier n(simpleHEvent); QObject::connect(&n, SIGNAL(activated(HANDLE)), this, SLOT(simple_activated())); simpleActivated = false; diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp index 8c7c021..654e19f 100644 --- a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp +++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp @@ -72,7 +72,7 @@ public: #ifdef Q_OS_WINCE_WM bool qt_wince_is_platform(const QString &platformString) { - TCHAR tszPlatform[64]; + wchar_t tszPlatform[64]; if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) if (0 == _tcsicmp(reinterpret_cast (platformString.utf16()), tszPlatform)) diff --git a/tests/benchmarks/qdiriterator/main.cpp b/tests/benchmarks/qdiriterator/main.cpp index 13128f7..1a5ffbb 100644 --- a/tests/benchmarks/qdiriterator/main.cpp +++ b/tests/benchmarks/qdiriterator/main.cpp @@ -107,7 +107,7 @@ static int posix_helper(const wchar_t *dirpath) wchar_t appendedPath[MAX_PATH]; wcscpy(appendedPath, dirpath); wcscat(appendedPath, L"\\*"); - hSearch = FindFirstFileW(appendedPath, &fd); + hSearch = FindFirstFile(appendedPath, &fd); appendedPath[origDirPathLength] = 0; if (hSearch == INVALID_HANDLE_VALUE) { diff --git a/tests/benchmarks/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/qdiriterator/qfilesystemiterator.cpp index 1ef600b..47720f1 100644 --- a/tests/benchmarks/qdiriterator/qfilesystemiterator.cpp +++ b/tests/benchmarks/qdiriterator/qfilesystemiterator.cpp @@ -108,17 +108,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_WIN -inline QString convertString(TCHAR* sz) -{ -#ifdef UNICODE - return QString::fromUtf16(sz); -#else - return QString::fromLocal8Bit(sz); -#endif -} -#endif - class QFileSystemIteratorPrivate { public: @@ -202,7 +191,7 @@ QFileSystemIteratorPrivate::~QFileSystemIteratorPrivate() } #ifdef Q_OS_WIN -static bool isDotOrDotDot(const TCHAR* name) +static bool isDotOrDotDot(const wchar_t* name) { if (name[0] == L'.' && name[1] == 0) return true; @@ -339,7 +328,7 @@ bool QFileSystemIteratorPrivate::advanceHelper() if (m_entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { QByteArray ba = m_dirPaths.top(); ba += '\\'; - ba += convertString(m_entry->cFileName); + ba += QString::fromWCharArray(m_entry->cFileName); pushSubDirectory(ba); } #else @@ -634,7 +623,7 @@ QString QFileSystemIterator::fileName() const if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDotDir) return QLatin1String("@@"); #ifdef Q_OS_WIN - return convertString(d->m_entry->cFileName); + return QString::fromWCharArray(d->m_entry->cFileName); #else return QString::fromLocal8Bit(d->m_entry->d_name); #endif @@ -659,7 +648,7 @@ QString QFileSystemIterator::filePath() const else if (d->m_entry) { ba += '/'; #ifdef Q_OS_WIN - ba += convertString(d->m_entry->cFileName); + ba += QString::fromWCharArray(d->m_entry->cFileName); #else ba += d->m_entry->d_name; #endif diff --git a/tests/benchmarks/qfile/main.cpp b/tests/benchmarks/qfile/main.cpp index 2fa425d..5360eb5 100644 --- a/tests/benchmarks/qfile/main.cpp +++ b/tests/benchmarks/qfile/main.cpp @@ -275,11 +275,11 @@ void tst_qfile::readBigFile() HANDLE hndl; // ensure we don't account string conversion - TCHAR* cfilename = (TCHAR*)filename.utf16(); + wchar_t* cfilename = (wchar_t*)filename.utf16(); hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); Q_ASSERT(hndl); - TCHAR* nativeBuffer = new TCHAR[BUFSIZE]; + wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; QBENCHMARK { @@ -358,7 +358,7 @@ void tst_qfile::seek() HANDLE hndl; // ensure we don't account string conversion - TCHAR* cfilename = (TCHAR*)filename.utf16(); + wchar_t* cfilename = (wchar_t*)filename.utf16(); hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); Q_ASSERT(hndl); @@ -441,7 +441,7 @@ void tst_qfile::open() HANDLE hndl; // ensure we don't account string conversion - TCHAR* cfilename = (TCHAR*)filename.utf16(); + wchar_t* cfilename = (wchar_t*)filename.utf16(); QBENCHMARK { hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); @@ -620,11 +620,11 @@ void tst_qfile::readSmallFiles() HANDLE hndl; // ensure we don't account string conversion - TCHAR* cfilename = (TCHAR*)filename.utf16(); + wchar_t* cfilename = (wchar_t*)filename.utf16(); hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); Q_ASSERT(hndl); - TCHAR* nativeBuffer = new TCHAR[BUFSIZE]; + wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; DWORD numberOfBytesRead; QBENCHMARK { do { -- cgit v0.12 From a69160c5f4ef146f5e9922161bcff9c6fed213c7 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 1 Jul 2009 11:50:33 +0200 Subject: examples: QString::fromUtf16() -> QString::fromWCharArray() Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- examples/activeqt/dotnet/wrapper/lib/tools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/activeqt/dotnet/wrapper/lib/tools.cpp b/examples/activeqt/dotnet/wrapper/lib/tools.cpp index 856b5c8..eac2d78 100644 --- a/examples/activeqt/dotnet/wrapper/lib/tools.cpp +++ b/examples/activeqt/dotnet/wrapper/lib/tools.cpp @@ -56,6 +56,6 @@ String *QStringToString(const QString &qstring) QString StringToQString(String *string) { const wchar_t __pin *chars = PtrToStringChars(string); - return QString::fromUtf16((const ushort *)chars); + return QString::fromWCharArray(chars); } //! [1] -- cgit v0.12 From a6e32ae1c84984041107a83db9307caffbda9849 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 1 Jul 2009 11:50:36 +0200 Subject: Make the macros QT_WA & QT_WA_INLINE only use the unicode part Merge-request: 604 Reviewed-by: Marius Storm-Olsen --- src/corelib/global/qglobal.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 00a9466..a522bcf 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1420,17 +1420,9 @@ inline QT3_SUPPORT bool qt_winUnicode() { return true; } inline QT3_SUPPORT int qWinVersion() { return QSysInfo::WindowsVersion; } #endif -#ifdef Q_OS_WINCE -#define QT_WA(uni, ansi) uni -#define QT_WA_INLINE(uni, ansi) (uni) -#elif defined(UNICODE) -#define QT_WA(uni, ansi) if (!(QSysInfo::windowsVersion() & QSysInfo::WV_DOS_based)) { uni } else { ansi } +#define QT_WA(unicode, ansi) unicode +#define QT_WA_INLINE(unicode, ansi) (unicode) -#define QT_WA_INLINE(uni, ansi) (!(QSysInfo::windowsVersion() & QSysInfo::WV_DOS_based) ? uni : ansi) -#else -#define QT_WA(uni, ansi) ansi -#define QT_WA_INLINE(uni, ansi) ansi -#endif #endif /* Q_WS_WIN */ #ifndef Q_OUTOFLINE_TEMPLATE -- cgit v0.12 From 16e84b77571cb5dc97312ae613d96d7cd28ab4d2 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 1 Jul 2009 10:52:28 +0200 Subject: Fixed the license header that the unicode table generated uses. Also made sure that the generated code will not have trailing whitespaces. Reviewed-by: Thiago Macieira --- util/unicode/main.cpp | 93 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 8 deletions(-) diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index f1b4641..3c32e6d 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -1911,6 +1911,8 @@ static QByteArray createPropertyInfo() out += " // 0x" + QByteArray::number(BMP_END, 16); for (int i = 0; i < BMP_END/BMP_BLOCKSIZE; ++i) { if (!(i % 8)) { + if (out.endsWith(' ')) + out.chop(1); if (!((i*BMP_BLOCKSIZE) % 0x1000)) out += "\n"; out += "\n "; @@ -1918,9 +1920,13 @@ static QByteArray createPropertyInfo() out += QByteArray::number(blockMap.at(i) + blockMap.size()); out += ", "; } + if (out.endsWith(' ')) + out.chop(1); out += "\n\n // 0x" + QByteArray::number(BMP_END, 16) + " - 0x" + QByteArray::number(SMP_END, 16) + "\n";; for (int i = BMP_END/BMP_BLOCKSIZE; i < blockMap.size(); ++i) { if (!(i % 8)) { + if (out.endsWith(' ')) + out.chop(1); if (!(i % (0x10000/SMP_BLOCKSIZE))) out += "\n"; out += "\n "; @@ -1928,14 +1934,21 @@ static QByteArray createPropertyInfo() out += QByteArray::number(blockMap.at(i) + blockMap.size()); out += ", "; } + if (out.endsWith(' ')) + out.chop(1); out += "\n"; // write the data for (int i = 0; i < blocks.size(); ++i) { + if (out.endsWith(' ')) + out.chop(1); out += "\n"; const PropertyBlock &b = blocks.at(i); for (int j = 0; j < b.properties.size(); ++j) { - if (!(j % 8)) + if (!(j % 8)) { + if (out.endsWith(' ')) + out.chop(1); out += "\n "; + } out += QByteArray::number(b.properties.at(j)); out += ", "; } @@ -1948,6 +1961,8 @@ static QByteArray createPropertyInfo() Q_ASSERT(maxTitleCaseDiff < (1<<14)); Q_ASSERT(maxCaseFoldDiff < (1<<14)); + if (out.endsWith(' ')) + out.chop(1); out += "\n};\n\n" "#define GET_PROP_INDEX(ucs4) \\\n" @@ -2204,6 +2219,8 @@ static QByteArray createCompositionInfo() out += " // 0 - 0x" + QByteArray::number(BMP_END, 16); for (int i = 0; i < BMP_END/BMP_BLOCKSIZE; ++i) { if (!(i % 8)) { + if (out.endsWith(' ')) + out.chop(1); if (!((i*BMP_BLOCKSIZE) % 0x1000)) out += "\n"; out += "\n "; @@ -2211,9 +2228,13 @@ static QByteArray createCompositionInfo() out += QByteArray::number(blockMap.at(i) + blockMap.size()); out += ", "; } + if (out.endsWith(' ')) + out.chop(1); out += "\n\n // 0x" + QByteArray::number(BMP_END, 16) + " - 0x" + QByteArray::number(SMP_END, 16) + "\n";; for (int i = BMP_END/BMP_BLOCKSIZE; i < blockMap.size(); ++i) { if (!(i % 8)) { + if (out.endsWith(' ')) + out.chop(1); if (!(i % (0x10000/SMP_BLOCKSIZE))) out += "\n"; out += "\n "; @@ -2221,19 +2242,28 @@ static QByteArray createCompositionInfo() out += QByteArray::number(blockMap.at(i) + blockMap.size()); out += ", "; } + if (out.endsWith(' ')) + out.chop(1); out += "\n"; // write the data for (int i = 0; i < blocks.size(); ++i) { + if (out.endsWith(' ')) + out.chop(1); out += "\n"; const DecompositionBlock &b = blocks.at(i); for (int j = 0; j < b.decompositionPositions.size(); ++j) { - if (!(j % 8)) + if (!(j % 8)) { + if (out.endsWith(' ')) + out.chop(1); out += "\n "; + } out += "0x" + QByteArray::number(b.decompositionPositions.at(j), 16); out += ", "; } } + if (out.endsWith(' ')) + out.chop(1); out += "\n};\n\n" "#define GET_DECOMPOSITION_INDEX(ucs4) \\\n" @@ -2250,12 +2280,16 @@ static QByteArray createCompositionInfo() for (int i = 0; i < decompositions.size(); ++i) { if (!(i % 8)) { + if (out.endsWith(' ')) + out.chop(1); out += "\n "; } out += "0x" + QByteArray::number(decompositions.at(i), 16); out += ", "; } + if (out.endsWith(' ')) + out.chop(1); out += "\n};\n\n"; return out; @@ -2328,6 +2362,8 @@ static QByteArray createLigatureInfo() out += " // 0 - 0x" + QByteArray::number(BMP_END, 16); for (int i = 0; i < BMP_END/BMP_BLOCKSIZE; ++i) { if (!(i % 8)) { + if (out.endsWith(' ')) + out.chop(1); if (!((i*BMP_BLOCKSIZE) % 0x1000)) out += "\n"; out += "\n "; @@ -2335,18 +2371,27 @@ static QByteArray createLigatureInfo() out += QByteArray::number(blockMap.at(i) + blockMap.size()); out += ", "; } + if (out.endsWith(' ')) + out.chop(1); out += "\n"; // write the data for (int i = 0; i < blocks.size(); ++i) { + if (out.endsWith(' ')) + out.chop(1); out += "\n"; const DecompositionBlock &b = blocks.at(i); for (int j = 0; j < b.decompositionPositions.size(); ++j) { - if (!(j % 8)) + if (!(j % 8)) { + if (out.endsWith(' ')) + out.chop(1); out += "\n "; + } out += "0x" + QByteArray::number(b.decompositionPositions.at(j), 16); out += ", "; } } + if (out.endsWith(' ')) + out.chop(1); out += "\n};\n\n" "#define GET_LIGATURE_INDEX(u2) " @@ -2358,12 +2403,16 @@ static QByteArray createLigatureInfo() for (int i = 0; i < ligatures.size(); ++i) { if (!(i % 8)) { + if (out.endsWith(' ')) + out.chop(1); out += "\n "; } out += "0x" + QByteArray::number(ligatures.at(i), 16); out += ", "; } + if (out.endsWith(' ')) + out.chop(1); out += "\n};\n\n"; return out; @@ -2420,18 +2469,46 @@ int main(int, char **) "/****************************************************************************\n" "**\n" "** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n" + "** Contact: Nokia Corporation (qt-info@nokia.com)\n" + "**\n" + "** This file is part of the QtCore module of the Qt Toolkit.\n" "**\n" - "** This file is part of the $MODULE$ of the Qt Toolkit.\n" + "** $QT_BEGIN_LICENSE:LGPL$\n" + "** No Commercial Usage\n" + "** This file contains pre-release code and may not be distributed.\n" + "** You may use this file in accordance with the terms and conditions\n" + "** contained in the either Technology Preview License Agreement or the\n" + "** Beta Release License Agreement.\n" "**\n" - "** $TROLLTECH_DUAL_LICENSE$\n" + "** GNU Lesser General Public License Usage\n" + "** Alternatively, this file may be used under the terms of the GNU Lesser\n" + "** General Public License version 2.1 as published by the Free Software\n" + "** Foundation and appearing in the file LICENSE.LGPL included in the\n" + "** packaging of this file. Please review the following information to\n" + "** ensure the GNU Lesser General Public License version 2.1 requirements\n" + "** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n" "**\n" - "** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\n" - "** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n" + "** In addition, as a special exception, Nokia gives you certain\n" + "** additional rights. These rights are described in the Nokia Qt LGPL\n" + "** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this\n" + "** package.\n" + "**\n" + "** GNU General Public License Usage\n" + "** Alternatively, this file may be used under the terms of the GNU\n" + "** General Public License version 3.0 as published by the Free Software\n" + "** Foundation and appearing in the file LICENSE.GPL included in the\n" + "** packaging of this file. Please review the following information to\n" + "** ensure the GNU General Public License version 3.0 requirements will be\n" + "** met: http://www.gnu.org/copyleft/gpl.html.\n" + "**\n" + "** If you are unsure which license is appropriate for your use, please\n" + "** contact the sales department at http://www.qtsoftware.com/contact.\n" + "** $QT_END_LICENSE$\n" "**\n" "****************************************************************************/\n\n" "/* This file is autogenerated from the Unicode 5.0 database. Do not edit */\n\n"; - + QByteArray warning = "//\n" "// W A R N I N G\n" -- cgit v0.12 From 3b9f9c1abaee60e94031e0a46f46c67410dc3d2f Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 1 Jul 2009 10:55:01 +0200 Subject: Regenerated unicode tables after the fix in the generator. This is related to the following fix: 70137e0601549af1056082cdfbb4f141c70befab Reviewed-by: trustme --- src/corelib/tools/qunicodetables.cpp | 13383 +++++++++++++++++---------------- src/corelib/tools/qunicodetables_p.h | 4 +- 2 files changed, 6694 insertions(+), 6693 deletions(-) diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp index 11ae801..0387181 100644 --- a/src/corelib/tools/qunicodetables.cpp +++ b/src/corelib/tools/qunicodetables.cpp @@ -46,3374 +46,3374 @@ QT_BEGIN_NAMESPACE static const unsigned short uc_property_trie[] = { // 0x11000 - 6256, 6288, 6320, 6352, 6384, 6416, 6448, 6480, - 6512, 6544, 6576, 6608, 6640, 6672, 6704, 6736, - 6768, 6800, 6832, 6864, 6896, 6928, 6960, 6992, - 7024, 7056, 7088, 7120, 7152, 7184, 7216, 7248, - 7280, 7312, 7344, 6512, 7376, 6512, 7408, 7440, - 7472, 7504, 7536, 7568, 7600, 7632, 7664, 7696, - 7728, 7760, 7792, 7824, 7856, 7888, 7920, 7952, - 7984, 8016, 8048, 8080, 8112, 8144, 8176, 8208, - 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, - 8272, 8304, 8336, 8368, 8400, 8432, 8464, 8496, - 8528, 8560, 8592, 8624, 8656, 8688, 8720, 8752, - 8400, 8784, 8816, 8848, 8880, 8912, 8944, 8976, - 9008, 9040, 9072, 9104, 9136, 9168, 9200, 9232, - 9136, 9264, 9296, 9104, 9328, 9360, 9392, 9424, - 9456, 9488, 9520, 9552, 9584, 9616, 9648, 9552, - 9680, 9712, 9744, 9776, 9808, 9840, 9872, 9552, - - 9904, 9936, 9968, 9552, 9552, 10000, 10032, 10064, - 10096, 10096, 10128, 10160, 10160, 10192, 10224, 10256, - 10288, 10320, 10352, 10320, 10384, 10416, 10448, 10480, - 10512, 10320, 10544, 10576, 10608, 10320, 10320, 10640, - 10672, 10320, 10320, 10320, 10320, 10320, 10320, 10320, - 10320, 10320, 10320, 10320, 10320, 10320, 10320, 10320, - 10320, 10320, 10320, 10704, 10736, 10320, 10320, 10768, - 10800, 10832, 10864, 10896, 9904, 10928, 10960, 10992, - 11024, 10320, 11056, 11088, 10320, 11120, 9552, 9552, - 11152, 11184, 11216, 11248, 11280, 11312, 11344, 11376, - 11408, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 11440, 11472, 11504, 11536, 9552, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 11568, 11600, 11632, 11664, 11696, 11728, 11760, 11792, - 6512, 6512, 6512, 6512, 11824, 6512, 6512, 11856, - 11888, 11920, 11952, 11984, 12016, 12048, 12080, 12112, - - 12144, 12176, 12208, 12240, 12272, 12304, 12336, 12368, - 12400, 12432, 12464, 12496, 12528, 12560, 12592, 12624, - 12656, 12688, 12720, 12752, 12784, 12816, 12848, 12880, - 12912, 12944, 12976, 13008, 13040, 13072, 13104, 13136, - 13168, 13200, 13232, 13264, 13296, 13328, 13360, 13392, - 13168, 13168, 13168, 13168, 13424, 13456, 13488, 13520, - 13552, 13168, 13168, 13584, 13616, 13648, 9552, 9552, - 13680, 13712, 13744, 13776, 13808, 13840, 13872, 13904, - 13936, 13936, 13936, 13936, 13936, 13936, 13936, 13936, - 13968, 13968, 13968, 13968, 14000, 14032, 14064, 14096, - 13968, 14128, 13968, 14160, 14192, 14224, 14256, 14288, - 14320, 14352, 9552, 9552, 9552, 9552, 9552, 9552, - 14384, 14416, 14448, 14480, 14512, 14512, 14512, 14544, - 14576, 14608, 14640, 14672, 14704, 14736, 14736, 9552, - 14768, 9552, 9552, 9552, 14800, 14832, 14832, 14864, - 14832, 14832, 14832, 14832, 14832, 14832, 14896, 14928, - - 14960, 14992, 15024, 15056, 15088, 15120, 15152, 15184, - 15216, 15248, 15280, 15280, 15312, 15344, 15376, 15408, - 15440, 15472, 15504, 15536, 15472, 15568, 15600, 15632, - 15664, 15664, 15664, 15696, 15664, 15664, 15728, 15760, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, - 15792, 15792, 15792, 15792, 15792, 15824, 11376, 11376, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 15856, 15856, 15856, 15856, 15888, 9552, 9552, - - 15920, 15952, 15952, 15952, 15952, 15952, 15952, 15952, - 15952, 15952, 15952, 15952, 15952, 15952, 15952, 15952, - 15952, 15952, 15952, 15952, 15952, 15952, 15952, 15952, - 15952, 15952, 15952, 15952, 15952, 15952, 15952, 15952, - 15952, 15952, 15952, 15952, 15984, 16016, 16048, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 16080, 16112, 9552, 9552, 9552, 9552, 9552, 9552, - 16144, 16176, 16208, 16240, 9552, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, - 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, - 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, - 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, - - 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, - 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, - 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, - 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, - 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, - 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, - 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, - 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, - 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, - 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, - 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, - 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, - 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, - 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, - 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, - 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, - - 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, - 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, - 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, - 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, - 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, - 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, - 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, - 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, - 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, - 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, - 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, - 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, - 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, - 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, - 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, - 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, - - 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, - 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, - 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, - 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, - 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, - 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, - 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, - 16304, 16336, 16368, 16400, 16432, 16496, 9552, 9552, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, - - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, - 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, - 15856, 16592, 16624, 16656, 16688, 16688, 16720, 9552, - 16752, 16784, 16816, 16848, 16848, 16880, 16912, 16848, - 16848, 16848, 16848, 16848, 16848, 16848, 16848, 16848, - 16848, 16944, 16976, 16848, 17008, 16848, 17040, 17072, - 17104, 17136, 17168, 17200, 16848, 16848, 16848, 17232, - 17264, 17296, 17328, 17360, 17392, 17424, 17456, 17488, - - 17520, 17552, 17584, 9552, 17616, 17616, 17616, 17648, - 17680, 17712, 17744, 17776, 17808, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 17840, 17872, 17904, 9552, 17936, 14640, 17968, 9552, - 18000, 18032, 18064, 17616, 18096, 18128, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, - 18160, 18192, 8240, 8240, 8240, 8240, 8240, 8240, - 18224, 8240, 8240, 8240, 8240, 8240, 8240, 8240, - 18256, 18288, 18320, 8240, 8240, 8240, 8240, 8240, - 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, - 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, - 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, - 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, - 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, + 6256, 6288, 6320, 6352, 6384, 6416, 6448, 6480, + 6512, 6544, 6576, 6608, 6640, 6672, 6704, 6736, + 6768, 6800, 6832, 6864, 6896, 6928, 6960, 6992, + 7024, 7056, 7088, 7120, 7152, 7184, 7216, 7248, + 7280, 7312, 7344, 6512, 7376, 6512, 7408, 7440, + 7472, 7504, 7536, 7568, 7600, 7632, 7664, 7696, + 7728, 7760, 7792, 7824, 7856, 7888, 7920, 7952, + 7984, 8016, 8048, 8080, 8112, 8144, 8176, 8208, + 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, + 8272, 8304, 8336, 8368, 8400, 8432, 8464, 8496, + 8528, 8560, 8592, 8624, 8656, 8688, 8720, 8752, + 8400, 8784, 8816, 8848, 8880, 8912, 8944, 8976, + 9008, 9040, 9072, 9104, 9136, 9168, 9200, 9232, + 9136, 9264, 9296, 9104, 9328, 9360, 9392, 9424, + 9456, 9488, 9520, 9552, 9584, 9616, 9648, 9552, + 9680, 9712, 9744, 9776, 9808, 9840, 9872, 9552, + + 9904, 9936, 9968, 9552, 9552, 10000, 10032, 10064, + 10096, 10096, 10128, 10160, 10160, 10192, 10224, 10256, + 10288, 10320, 10352, 10320, 10384, 10416, 10448, 10480, + 10512, 10320, 10544, 10576, 10608, 10320, 10320, 10640, + 10672, 10320, 10320, 10320, 10320, 10320, 10320, 10320, + 10320, 10320, 10320, 10320, 10320, 10320, 10320, 10320, + 10320, 10320, 10320, 10704, 10736, 10320, 10320, 10768, + 10800, 10832, 10864, 10896, 9904, 10928, 10960, 10992, + 11024, 10320, 11056, 11088, 10320, 11120, 9552, 9552, + 11152, 11184, 11216, 11248, 11280, 11312, 11344, 11376, + 11408, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 11440, 11472, 11504, 11536, 9552, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 11568, 11600, 11632, 11664, 11696, 11728, 11760, 11792, + 6512, 6512, 6512, 6512, 11824, 6512, 6512, 11856, + 11888, 11920, 11952, 11984, 12016, 12048, 12080, 12112, + + 12144, 12176, 12208, 12240, 12272, 12304, 12336, 12368, + 12400, 12432, 12464, 12496, 12528, 12560, 12592, 12624, + 12656, 12688, 12720, 12752, 12784, 12816, 12848, 12880, + 12912, 12944, 12976, 13008, 13040, 13072, 13104, 13136, + 13168, 13200, 13232, 13264, 13296, 13328, 13360, 13392, + 13168, 13168, 13168, 13168, 13424, 13456, 13488, 13520, + 13552, 13168, 13168, 13584, 13616, 13648, 9552, 9552, + 13680, 13712, 13744, 13776, 13808, 13840, 13872, 13904, + 13936, 13936, 13936, 13936, 13936, 13936, 13936, 13936, + 13968, 13968, 13968, 13968, 14000, 14032, 14064, 14096, + 13968, 14128, 13968, 14160, 14192, 14224, 14256, 14288, + 14320, 14352, 9552, 9552, 9552, 9552, 9552, 9552, + 14384, 14416, 14448, 14480, 14512, 14512, 14512, 14544, + 14576, 14608, 14640, 14672, 14704, 14736, 14736, 9552, + 14768, 9552, 9552, 9552, 14800, 14832, 14832, 14864, + 14832, 14832, 14832, 14832, 14832, 14832, 14896, 14928, + + 14960, 14992, 15024, 15056, 15088, 15120, 15152, 15184, + 15216, 15248, 15280, 15280, 15312, 15344, 15376, 15408, + 15440, 15472, 15504, 15536, 15472, 15568, 15600, 15632, + 15664, 15664, 15664, 15696, 15664, 15664, 15728, 15760, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15792, 15792, 15792, + 15792, 15792, 15792, 15792, 15792, 15824, 11376, 11376, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 15856, 15856, 15856, 15856, 15888, 9552, 9552, + + 15920, 15952, 15952, 15952, 15952, 15952, 15952, 15952, + 15952, 15952, 15952, 15952, 15952, 15952, 15952, 15952, + 15952, 15952, 15952, 15952, 15952, 15952, 15952, 15952, + 15952, 15952, 15952, 15952, 15952, 15952, 15952, 15952, + 15952, 15952, 15952, 15952, 15984, 16016, 16048, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 16080, 16112, 9552, 9552, 9552, 9552, 9552, 9552, + 16144, 16176, 16208, 16240, 9552, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, + 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, + 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, + 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, + + 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, + 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, + 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, + 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, + 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, + 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, + 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, + 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, + 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, + 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, + 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, + 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, + 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, + 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, + 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, + 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, + + 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, + 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, + 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, + 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, + 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, + 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, + 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, + 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, + 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, + 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, + 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, + 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, + 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, + 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, + 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, + 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, + + 16304, 16336, 16368, 16400, 16432, 16464, 16272, 16304, + 16336, 16368, 16400, 16432, 16464, 16272, 16304, 16336, + 16368, 16400, 16432, 16464, 16272, 16304, 16336, 16368, + 16400, 16432, 16464, 16272, 16304, 16336, 16368, 16400, + 16432, 16464, 16272, 16304, 16336, 16368, 16400, 16432, + 16464, 16272, 16304, 16336, 16368, 16400, 16432, 16464, + 16272, 16304, 16336, 16368, 16400, 16432, 16464, 16272, + 16304, 16336, 16368, 16400, 16432, 16496, 9552, 9552, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + 16528, 16528, 16528, 16528, 16528, 16528, 16528, 16528, + + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 16560, 16560, 16560, 16560, 16560, 16560, 16560, 16560, + 15856, 15856, 15856, 15856, 15856, 15856, 15856, 15856, + 15856, 16592, 16624, 16656, 16688, 16688, 16720, 9552, + 16752, 16784, 16816, 16848, 16848, 16880, 16912, 16848, + 16848, 16848, 16848, 16848, 16848, 16848, 16848, 16848, + 16848, 16944, 16976, 16848, 17008, 16848, 17040, 17072, + 17104, 17136, 17168, 17200, 16848, 16848, 16848, 17232, + 17264, 17296, 17328, 17360, 17392, 17424, 17456, 17488, + + 17520, 17552, 17584, 9552, 17616, 17616, 17616, 17648, + 17680, 17712, 17744, 17776, 17808, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 17840, 17872, 17904, 9552, 17936, 14640, 17968, 9552, + 18000, 18032, 18064, 17616, 18096, 18128, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 9552, 9552, 9552, 9552, 9552, 9552, 9552, 9552, + 18160, 18192, 8240, 8240, 8240, 8240, 8240, 8240, + 18224, 8240, 8240, 8240, 8240, 8240, 8240, 8240, + 18256, 18288, 18320, 8240, 8240, 8240, 8240, 8240, + 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, + 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, + 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, + 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, + 8240, 8240, 8240, 8240, 8240, 8240, 8240, 8240, // 0x11000 - 0x110000 - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18608, 18608, 18608, 18864, 19120, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 19376, 19632, 19888, 20144, 20400, 20656, 20912, 21168, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, - 21680, 21680, 21680, 21680, 21680, 21680, 21936, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 21680, 21680, 22192, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 22448, 22704, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, - 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 23216, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, - 22960, 22960, 22960, 22960, 22960, 22960, 22960, 23216, - - - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 2, 3, 4, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 6, 6, 7, - - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 14, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 9, - - 14, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 39, 40, 41, 42, 43, - - 42, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 39, 45, 41, 36, 0, - - 0, 0, 0, 0, 0, 46, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - 47, 14, 48, 12, 12, 12, 49, 49, - 42, 49, 50, 51, 36, 52, 49, 42, - 53, 54, 55, 56, 57, 58, 49, 59, - 42, 60, 50, 61, 62, 62, 62, 14, - - 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 36, - 38, 38, 38, 38, 38, 38, 38, 63, - - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 36, - 44, 44, 44, 44, 44, 44, 44, 64, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 67, 68, 65, 66, 65, 66, 65, 66, - 50, 65, 66, 65, 66, 65, 66, 65, - - 66, 65, 66, 65, 66, 65, 66, 65, - 66, 69, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 70, 65, 66, 65, 66, 65, 66, 71, - - 72, 73, 65, 66, 65, 66, 74, 65, - 66, 75, 75, 65, 66, 50, 76, 77, - 78, 65, 66, 75, 79, 80, 81, 82, - 65, 66, 83, 50, 81, 84, 85, 86, - - 65, 66, 65, 66, 65, 66, 87, 65, - 66, 87, 50, 50, 65, 66, 87, 65, - 66, 88, 88, 65, 66, 65, 66, 89, - 65, 66, 50, 90, 65, 66, 50, 91, - - 90, 90, 90, 90, 92, 93, 94, 92, - 93, 94, 92, 93, 94, 65, 66, 65, - 66, 65, 66, 65, 66, 65, 66, 65, - 66, 65, 66, 65, 66, 95, 65, 66, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 96, 92, 93, 94, 65, 66, 97, 98, - 99, 100, 65, 66, 65, 66, 65, 66, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 99, 100, 99, 100, 99, 100, 99, 100, - - 101, 102, 99, 100, 99, 100, 99, 100, - 99, 100, 99, 100, 99, 100, 99, 100, - 99, 100, 99, 100, 102, 102, 102, 103, - 103, 103, 104, 105, 106, 107, 108, 103, - - 103, 105, 109, 110, 111, 112, 113, 109, - 113, 109, 113, 109, 113, 109, 113, 109, - 50, 50, 50, 114, 115, 50, 116, 116, - 50, 117, 50, 118, 50, 50, 50, 50, - - 116, 50, 50, 119, 50, 50, 50, 50, - 120, 121, 50, 122, 50, 50, 50, 121, - 50, 50, 123, 50, 50, 124, 50, 50, - 50, 50, 50, 50, 50, 125, 50, 50, - - 126, 50, 50, 126, 50, 50, 50, 50, - 126, 127, 128, 128, 129, 50, 50, 50, - 50, 50, 130, 50, 90, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, - - 50, 50, 50, 50, 50, 50, 50, 50, - 50, 131, 131, 131, 131, 131, 102, 102, - 132, 132, 132, 132, 132, 132, 132, 132, - 132, 133, 133, 134, 134, 134, 134, 134, - - 132, 132, 42, 42, 42, 42, 133, 133, - 135, 133, 133, 133, 135, 133, 133, 133, - 134, 134, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 136, - - 132, 132, 132, 132, 132, 42, 42, 42, - 42, 42, 136, 136, 136, 136, 137, 138, - 138, 138, 138, 138, 138, 138, 138, 138, - 138, 138, 138, 138, 138, 138, 138, 138, - - 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 140, 141, 141, - 141, 141, 140, 142, 141, 141, 141, 141, - - 141, 143, 143, 141, 141, 141, 141, 143, - 143, 141, 141, 141, 141, 141, 141, 141, - 141, 141, 141, 141, 144, 144, 144, 144, - 144, 141, 141, 141, 141, 139, 139, 139, - - 139, 139, 139, 139, 139, 145, 146, 147, - 147, 147, 146, 146, 146, 147, 147, 148, - 149, 149, 149, 150, 150, 150, 150, 149, - 151, 152, 152, 153, 154, 155, 155, 156, - - 157, 157, 158, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, - 160, 160, 160, 160, 42, 42, 160, 160, - 160, 160, 132, 161, 161, 161, 34, 160, - - 160, 160, 160, 160, 42, 42, 162, 14, - 163, 163, 163, 160, 164, 160, 165, 165, - 166, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, - - 38, 38, 160, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 167, 168, 168, 168, - 169, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - - 44, 44, 170, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 171, 172, 172, 160, - 173, 174, 175, 175, 175, 176, 177, 131, - 178, 179, 65, 100, 65, 100, 65, 100, - - 65, 100, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 180, 181, 182, 50, 183, 184, 185, 186, - 187, 188, 186, 187, 103, 189, 189, 189, - - 190, 191, 191, 191, 191, 191, 191, 191, - 191, 191, 191, 191, 191, 190, 191, 191, - 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, - - 38, 38, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - - 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, - 192, 181, 181, 181, 181, 181, 181, 181, - 181, 181, 181, 181, 181, 192, 181, 181, - - 65, 66, 193, 139, 139, 139, 139, 160, - 194, 194, 178, 179, 99, 100, 99, 100, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - - 195, 65, 66, 65, 66, 178, 179, 65, - 66, 178, 179, 65, 66, 178, 179, 196, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 99, 100, 65, 66, - 65, 66, 65, 66, 65, 66, 105, 106, - 65, 66, 113, 109, 113, 109, 113, 109, - - 178, 179, 178, 179, 178, 179, 178, 179, - 178, 179, 178, 179, 178, 179, 178, 179, - 113, 109, 113, 109, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, - - 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 160, - 160, 134, 198, 198, 199, 198, 199, 198, - - 160, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, - - 200, 200, 200, 200, 200, 200, 200, 201, - 160, 202, 203, 160, 160, 160, 160, 160, - 204, 205, 206, 206, 206, 206, 205, 206, - 206, 206, 207, 205, 206, 206, 206, 206, - - 206, 206, 152, 205, 205, 205, 205, 205, - 206, 206, 205, 206, 206, 207, 208, 206, - 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, - - 225, 226, 227, 225, 206, 152, 228, 229, - 204, 204, 204, 204, 204, 204, 204, 204, - 230, 230, 230, 230, 230, 230, 230, 230, - 230, 230, 230, 230, 230, 230, 230, 230, - - 230, 230, 230, 230, 230, 230, 230, 230, - 230, 230, 230, 204, 204, 204, 204, 204, - 230, 230, 230, 231, 232, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - - 233, 233, 233, 233, 234, 234, 234, 234, - 234, 234, 234, 235, 236, 237, 238, 238, - 149, 149, 149, 149, 149, 149, 234, 234, - 234, 234, 234, 239, 234, 234, 240, 241, - - 234, 242, 243, 243, 243, 243, 244, 243, - 244, 243, 244, 244, 244, 244, 244, 243, - 243, 243, 243, 244, 244, 244, 244, 244, - 244, 244, 244, 234, 234, 234, 234, 234, - - 245, 244, 244, 244, 244, 244, 244, 244, - 243, 244, 244, 246, 247, 248, 249, 250, - 251, 252, 253, 146, 146, 147, 150, 149, - 149, 153, 153, 153, 152, 153, 153, 234, - - 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 265, 266, 267, 267, - 268, 243, 243, 243, 242, 243, 243, 243, - 244, 244, 244, 244, 244, 244, 244, 244, - - 244, 244, 244, 244, 244, 244, 244, 244, - 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 244, 244, 244, 244, 244, 244, - - 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, - 269, 269, 244, 244, 244, 244, 244, 269, - - 243, 244, 244, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 244, 243, 244, 270, - 244, 244, 243, 243, 241, 243, 139, 139, - 139, 139, 139, 139, 139, 271, 272, 139, - - 139, 139, 139, 141, 139, 273, 273, 139, - 139, 49, 141, 139, 139, 141, 274, 274, - 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 269, 269, 269, 275, 275, 276, - - 277, 277, 277, 278, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 234, 279, - 270, 280, 269, 269, 269, 270, 270, 270, - 270, 270, 269, 269, 269, 269, 270, 269, - - 269, 269, 269, 269, 269, 269, 269, 269, - 270, 269, 270, 269, 270, 276, 276, 274, - 146, 147, 146, 146, 147, 146, 146, 147, - 147, 147, 146, 147, 147, 146, 147, 146, - - 146, 146, 147, 146, 147, 146, 147, 146, - 147, 146, 146, 234, 234, 274, 276, 276, - 281, 281, 281, 281, 281, 281, 281, 281, - 281, 282, 282, 282, 281, 281, 281, 281, - - 281, 281, 281, 281, 281, 281, 281, 281, - 281, 281, 281, 282, 282, 281, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - 283, 283, 283, 283, 283, 283, 283, 283, - - 283, 283, 283, 283, 283, 283, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, - 284, 285, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - - 286, 287, 288, 289, 290, 291, 292, 293, - 294, 295, 296, 296, 296, 296, 296, 296, - 296, 296, 296, 296, 296, 296, 296, 296, - 296, 296, 296, 296, 296, 296, 296, 296, - - 296, 296, 296, 296, 296, 296, 296, 296, - 296, 296, 296, 297, 297, 297, 297, 297, - 297, 297, 298, 297, 299, 299, 300, 301, - 302, 303, 304, 204, 204, 204, 204, 204, - - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, - - 160, 305, 305, 306, 307, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 160, 160, 308, 90, 306, 306, - - 306, 305, 305, 305, 305, 305, 305, 305, - 305, 306, 306, 306, 306, 309, 160, 160, - 90, 139, 141, 139, 139, 160, 160, 160, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 305, 305, 310, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 198, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 321, 321, 322, 321, 321, - - 160, 305, 306, 306, 160, 90, 90, 90, - 90, 90, 90, 90, 90, 160, 160, 90, - 90, 160, 160, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 160, 160, 160, 90, 90, - 90, 90, 160, 160, 308, 307, 323, 306, - - 306, 305, 305, 305, 305, 160, 160, 306, - 306, 160, 160, 306, 306, 309, 322, 160, - 160, 160, 160, 160, 160, 160, 160, 323, - 160, 160, 160, 160, 90, 90, 160, 90, - - 90, 90, 305, 305, 160, 160, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 90, 90, 12, 12, 324, 324, 324, 324, - 324, 324, 193, 160, 160, 160, 160, 160, - - 160, 325, 305, 326, 160, 90, 90, 90, - 90, 90, 90, 160, 160, 160, 160, 90, - 90, 160, 160, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 160, 90, 90, 160, - 90, 90, 160, 160, 308, 160, 306, 306, - - 306, 305, 305, 160, 160, 160, 160, 305, - 305, 160, 160, 305, 305, 309, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 90, 90, 90, 90, 160, 90, 160, - - 160, 160, 160, 160, 160, 160, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 305, 305, 90, 90, 90, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 305, 305, 306, 160, 90, 90, 90, - 90, 90, 90, 90, 307, 90, 160, 90, - 90, 90, 160, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 160, 90, 90, 90, - 90, 90, 160, 160, 308, 90, 306, 306, - - 306, 305, 305, 305, 305, 305, 160, 305, - 305, 306, 160, 306, 306, 309, 160, 160, - 90, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 90, 307, 325, 325, 160, 160, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 160, 327, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 160, 307, 90, 90, - 90, 90, 160, 160, 308, 90, 323, 305, - - 306, 305, 305, 305, 160, 160, 160, 306, - 306, 160, 160, 306, 306, 309, 160, 160, - 160, 160, 160, 160, 160, 160, 305, 323, - 160, 160, 160, 160, 90, 90, 160, 90, - - 90, 90, 160, 160, 160, 160, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 193, 307, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 305, 90, 160, 90, 90, 90, - 90, 90, 90, 160, 160, 160, 90, 90, - 90, 160, 90, 90, 90, 90, 160, 160, - 160, 90, 90, 160, 90, 160, 90, 90, - - 160, 160, 160, 90, 90, 160, 160, 160, - 90, 90, 90, 160, 160, 160, 90, 90, - 90, 90, 90, 90, 90, 90, 322, 90, - 90, 90, 160, 160, 160, 160, 323, 306, - - 305, 306, 306, 160, 160, 160, 306, 306, - 306, 160, 306, 306, 306, 309, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 323, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 160, 160, 160, 160, 328, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 324, 324, 324, 238, 238, 238, 238, 238, - 238, 327, 238, 160, 160, 160, 160, 160, - - 160, 306, 306, 306, 160, 90, 90, 90, - 90, 90, 90, 90, 90, 160, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 160, 90, 90, 90, - 90, 90, 160, 160, 160, 160, 305, 305, - - 305, 306, 306, 306, 306, 160, 305, 305, - 305, 160, 305, 305, 305, 309, 160, 160, - 160, 160, 160, 160, 160, 329, 330, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 90, 90, 160, 160, 160, 160, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 306, 306, 160, 90, 90, 90, - 90, 90, 90, 90, 90, 160, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 160, 90, 90, 90, - 90, 90, 160, 160, 331, 307, 306, 332, - - 306, 306, 323, 306, 306, 160, 332, 306, - 306, 160, 306, 306, 305, 309, 160, 160, - 160, 160, 160, 160, 160, 323, 323, 160, - 160, 160, 160, 160, 160, 160, 90, 160, - - 90, 90, 333, 333, 160, 160, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, - 160, 300, 300, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 160, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 160, 160, 160, 160, 323, 306, - - 306, 305, 305, 305, 160, 160, 306, 306, - 306, 160, 306, 306, 306, 309, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 323, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 334, 334, 160, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 160, - 160, 160, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 160, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 160, 335, 160, 160, - - 335, 335, 335, 335, 335, 335, 335, 160, - 160, 160, 336, 160, 160, 160, 160, 337, - 334, 334, 284, 284, 284, 160, 284, 160, - 334, 334, 334, 334, 334, 334, 334, 337, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 334, 334, 338, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 339, 339, 339, 339, 339, 339, 339, - 339, 339, 339, 339, 339, 339, 339, 339, - 339, 339, 339, 339, 339, 339, 339, 339, - 339, 339, 339, 339, 339, 339, 339, 339, - - 339, 339, 339, 339, 339, 339, 339, 339, - 339, 339, 339, 339, 339, 339, 339, 339, - 339, 340, 339, 339, 340, 340, 340, 340, - 341, 341, 342, 160, 160, 160, 160, 12, - - 339, 339, 339, 339, 339, 339, 343, 340, - 344, 344, 344, 344, 340, 340, 340, 198, - 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 345, 345, 160, 160, 160, 160, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 339, 339, 160, 339, 160, 160, 339, - 339, 160, 339, 160, 160, 339, 160, 160, - 160, 160, 160, 160, 339, 339, 339, 339, - 160, 339, 339, 339, 339, 339, 339, 339, - - 160, 339, 339, 339, 160, 339, 160, 339, - 160, 160, 339, 339, 160, 339, 339, 339, - 339, 340, 339, 339, 340, 340, 340, 340, - 346, 346, 160, 340, 340, 339, 160, 160, - - 339, 339, 339, 339, 339, 160, 343, 160, - 347, 347, 347, 347, 340, 340, 160, 160, - 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 160, 160, 339, 339, 160, 160, - - 348, 349, 349, 349, 350, 351, 350, 350, - 352, 350, 350, 353, 352, 354, 354, 354, - 354, 354, 352, 355, 356, 355, 355, 355, - 205, 205, 355, 355, 355, 355, 355, 355, - - 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 368, 205, 355, 205, - 355, 369, 370, 371, 370, 371, 372, 372, - - 348, 348, 348, 348, 348, 348, 348, 348, - 160, 348, 348, 348, 348, 348, 348, 348, - 348, 348, 348, 348, 348, 348, 348, 348, - 348, 348, 348, 348, 348, 348, 348, 348, - - 348, 348, 348, 348, 348, 348, 348, 348, - 348, 348, 335, 160, 160, 160, 160, 160, - 160, 373, 374, 375, 376, 375, 375, 375, - 375, 375, 374, 374, 374, 374, 375, 377, - - 374, 375, 206, 206, 378, 353, 206, 206, - 348, 348, 348, 348, 160, 160, 160, 160, - 375, 375, 375, 375, 375, 375, 284, 375, - 160, 375, 375, 375, 375, 375, 375, 375, - - 375, 375, 375, 375, 375, 375, 375, 375, - 375, 375, 375, 375, 375, 375, 284, 284, - 284, 375, 375, 375, 375, 375, 375, 375, - 284, 375, 284, 284, 284, 160, 379, 379, - - 380, 380, 380, 380, 380, 380, 147, 380, - 380, 380, 380, 380, 380, 160, 160, 380, - 381, 381, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 382, 382, 382, 382, 382, 382, 382, 382, - 382, 382, 382, 382, 382, 382, 382, 382, - 382, 382, 382, 382, 382, 382, 382, 382, - 382, 382, 382, 382, 382, 382, 382, 382, - - 382, 382, 160, 382, 382, 382, 382, 382, - 160, 382, 382, 160, 383, 384, 384, 384, - 384, 383, 384, 160, 160, 160, 384, 385, - 383, 386, 160, 160, 160, 160, 160, 160, - - 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 397, 338, 338, 338, 338, - 382, 382, 382, 382, 382, 382, 383, 383, - 384, 384, 160, 160, 160, 160, 160, 160, - - 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, - - 398, 398, 398, 398, 398, 398, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 399, - 399, 322, 322, 198, 400, 160, 160, 160, - - 401, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 401, 401, 401, 401, 401, 401, - - 401, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 160, 160, 160, 160, 160, 401, - - 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, - - 402, 402, 402, 160, 160, 160, 160, 160, - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, - - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, - - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 160, 160, 160, 160, 160, 160, - - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 160, 335, 335, 335, 335, 160, 160, - 335, 335, 335, 335, 335, 335, 335, 160, - 335, 160, 335, 335, 335, 335, 160, 160, - - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 160, 335, 335, 335, 335, 160, 160, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 160, 335, 335, 335, 335, 160, 160, - 335, 335, 335, 335, 335, 335, 335, 160, - - 335, 160, 335, 335, 335, 335, 160, 160, - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 335, 335, 335, 335, 335, 335, 160, - 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 160, 335, 335, 335, 335, 160, 160, - 335, 335, 335, 335, 335, 335, 335, 322, - - 335, 335, 335, 335, 335, 335, 335, 322, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 160, 160, 160, 160, 153, - - 404, 405, 406, 338, 338, 338, 338, 406, - 406, 407, 408, 409, 410, 411, 412, 413, - 414, 415, 416, 416, 416, 416, 416, 416, - 416, 416, 416, 416, 416, 160, 160, 160, - - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 160, 160, 160, 160, 160, 160, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 338, 406, 335, - 335, 335, 335, 335, 335, 335, 335, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 418, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 419, 420, 160, 160, 160, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 405, 405, 405, 421, 421, - 421, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 399, 399, 399, 399, 399, 399, 399, 399, - 399, 399, 399, 399, 399, 160, 399, 399, - 399, 399, 422, 422, 423, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 399, 399, 399, 399, 399, 399, 399, 399, - 399, 399, 399, 399, 399, 399, 399, 399, - 399, 399, 422, 422, 423, 424, 424, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 399, 399, 399, 399, 399, 399, 399, 399, - 399, 399, 399, 399, 399, 399, 399, 399, - 399, 399, 422, 422, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 399, 399, 399, 399, 399, 399, 399, 399, - 399, 399, 399, 399, 399, 160, 399, 399, - 399, 160, 422, 422, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 382, 382, 382, 382, 382, 382, 382, 382, - 382, 382, 382, 382, 382, 382, 382, 382, - 382, 382, 382, 382, 425, 425, 383, 384, - 384, 384, 384, 384, 384, 384, 383, 383, - - 383, 383, 383, 383, 383, 383, 384, 383, - 383, 384, 384, 384, 384, 384, 384, 384, - 384, 384, 386, 384, 405, 405, 426, 427, - 405, 338, 405, 428, 382, 429, 160, 160, - - 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 160, 160, 160, 160, 160, 160, - 430, 430, 430, 430, 430, 430, 430, 430, - 430, 430, 160, 160, 160, 160, 160, 160, - - 431, 431, 432, 433, 432, 432, 434, 431, - 432, 433, 431, 284, 284, 284, 435, 160, - 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 160, 160, 160, 160, 160, 160, - - 335, 335, 335, 137, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 335, 335, 335, 335, 335, 335, 335, - 160, 160, 160, 160, 160, 160, 160, 160, - - 335, 335, 335, 335, 335, 335, 335, 335, - 335, 436, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 160, 160, 160, - - 325, 325, 325, 326, 326, 326, 326, 325, - 325, 437, 437, 437, 160, 160, 160, 160, - 326, 326, 325, 326, 326, 326, 326, 326, - 326, 438, 149, 150, 160, 160, 160, 160, - - 238, 160, 160, 160, 439, 439, 440, 441, - 442, 443, 444, 445, 446, 447, 448, 449, - 450, 450, 450, 450, 450, 450, 450, 450, - 450, 450, 450, 450, 450, 450, 450, 450, - - 450, 450, 450, 450, 450, 450, 450, 450, - 450, 450, 450, 450, 450, 450, 160, 160, - 450, 450, 450, 450, 450, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 451, 451, 451, 451, 451, 451, 451, 451, - 451, 451, 451, 451, 451, 451, 451, 451, - 451, 451, 451, 451, 451, 451, 451, 451, - 451, 451, 451, 451, 451, 451, 451, 451, - - 451, 451, 451, 451, 451, 451, 451, 451, - 451, 451, 160, 160, 160, 160, 160, 160, - 452, 452, 452, 452, 452, 452, 452, 452, - 452, 452, 452, 452, 452, 452, 452, 452, - - 452, 451, 451, 451, 451, 451, 451, 451, - 452, 452, 160, 160, 160, 160, 160, 160, - 328, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 160, 160, 160, 160, 462, 462, - - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 153, - 152, 463, 463, 463, 160, 160, 464, 465, - - 333, 333, 333, 333, 466, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 467, 466, 333, 333, - 333, 333, 333, 466, 333, 466, 466, 466, - - 466, 466, 333, 466, 468, 321, 321, 321, - 321, 321, 321, 321, 160, 160, 160, 160, - 469, 470, 471, 472, 473, 474, 475, 476, - 477, 478, 479, 479, 480, 480, 479, 479, - - 480, 481, 481, 481, 481, 481, 481, 481, - 481, 481, 481, 297, 298, 297, 297, 297, - 297, 297, 297, 297, 481, 481, 481, 481, - 481, 481, 481, 481, 481, 160, 160, 160, - - 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, - - 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 482, 482, 482, 482, - 482, 482, 482, 482, 482, 482, 482, 482, - 482, 482, 482, 482, 482, 482, 482, 482, - - 482, 482, 482, 482, 482, 482, 482, 482, - 482, 482, 482, 482, 482, 482, 482, 482, - 482, 482, 482, 482, 482, 482, 482, 482, - 482, 482, 482, 482, 482, 482, 482, 482, - - 482, 482, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, - 483, 103, 103, 103, 103, 484, 103, 103, - - 103, 103, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 483, 483, 483, 483, 483, - - 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, - - 153, 153, 152, 153, 297, 297, 297, 297, - 297, 297, 298, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 297, 298, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 485, 486, - 487, 488, 489, 490, 160, 160, 160, 160, - - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 65, 66, 65, 66, 65, 66, - 65, 66, 160, 160, 160, 160, 160, 160, - - 491, 491, 491, 491, 491, 491, 491, 491, - 492, 492, 492, 492, 492, 492, 492, 492, - 491, 491, 491, 491, 491, 491, 160, 160, - 492, 492, 492, 492, 492, 492, 160, 160, - - 491, 491, 491, 491, 491, 491, 491, 491, - 492, 492, 492, 492, 492, 492, 492, 492, - 491, 491, 491, 491, 491, 491, 491, 491, - 492, 492, 492, 492, 492, 492, 492, 492, - - 491, 491, 491, 491, 491, 491, 160, 160, - 492, 492, 492, 492, 492, 492, 160, 160, - 493, 491, 494, 491, 495, 491, 496, 491, - 160, 492, 160, 492, 160, 492, 160, 492, - - 491, 491, 491, 491, 491, 491, 491, 491, - 492, 492, 492, 492, 492, 492, 492, 492, - 497, 497, 498, 498, 498, 498, 499, 499, - 500, 500, 501, 501, 502, 502, 160, 160, - - 503, 504, 505, 506, 507, 508, 509, 510, - 511, 512, 513, 514, 515, 516, 517, 518, - 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 532, 533, 534, - - 535, 536, 537, 538, 539, 540, 541, 542, - 543, 544, 545, 546, 547, 548, 549, 550, - 491, 491, 551, 552, 553, 160, 554, 555, - 492, 492, 556, 556, 557, 42, 558, 42, - - 42, 42, 559, 560, 561, 160, 562, 563, - 564, 564, 564, 564, 565, 42, 42, 42, - 491, 491, 566, 567, 160, 160, 568, 569, - 492, 492, 570, 570, 160, 42, 42, 42, - - 491, 491, 571, 572, 573, 182, 574, 575, - 492, 492, 576, 576, 577, 42, 42, 42, - 160, 160, 578, 579, 580, 160, 581, 582, - 583, 583, 584, 584, 585, 42, 42, 160, - - 586, 586, 586, 586, 586, 586, 586, 587, - 586, 586, 586, 588, 589, 590, 591, 592, - 593, 594, 593, 593, 595, 596, 14, 14, - 597, 598, 599, 600, 597, 601, 599, 600, - - 14, 14, 14, 14, 602, 602, 602, 603, - 604, 605, 606, 607, 608, 609, 610, 611, - 13, 13, 13, 13, 13, 612, 612, 612, - 14, 597, 601, 14, 613, 613, 14, 43, - - 43, 14, 14, 14, 614, 16, 17, 615, - 616, 616, 431, 431, 431, 431, 617, 617, - 617, 617, 185, 618, 619, 620, 621, 617, - 621, 621, 621, 621, 620, 621, 621, 622, - - 623, 624, 624, 624, 160, 160, 160, 160, - 160, 160, 625, 625, 625, 625, 625, 625, - 626, 627, 160, 160, 628, 629, 630, 631, - 632, 633, 634, 634, 36, 16, 17, 50, - - 626, 60, 55, 56, 628, 629, 630, 631, - 632, 633, 634, 634, 36, 16, 17, 160, - 483, 483, 483, 483, 483, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 12, 12, 12, 12, 12, 12, 12, 48, - 12, 12, 12, 635, 636, 428, 428, 428, - 637, 637, 638, 638, 638, 638, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 139, 139, 144, 144, 139, 139, 139, 139, - 144, 144, 144, 139, 139, 272, 272, 272, - - 272, 139, 194, 194, 639, 640, 640, 159, - 641, 159, 640, 642, 298, 298, 298, 298, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 49, 49, 175, 643, 49, 49, 49, 175, - 49, 643, 50, 175, 175, 175, 50, 50, - 175, 175, 175, 50, 49, 175, 644, 49, - 49, 175, 175, 175, 175, 175, 49, 49, - - 49, 49, 49, 49, 175, 49, 645, 49, - 175, 49, 646, 647, 175, 175, 648, 50, - 175, 175, 649, 175, 50, 90, 90, 90, - 90, 131, 650, 238, 103, 627, 651, 651, - - 185, 185, 185, 185, 185, 651, 627, 627, - 627, 627, 652, 185, 417, 300, 653, 160, - 160, 160, 160, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, - - 654, 654, 654, 654, 654, 654, 654, 654, - 654, 654, 654, 654, 654, 654, 654, 654, - 655, 655, 655, 655, 655, 655, 655, 655, - 655, 655, 655, 655, 655, 655, 655, 655, - - 656, 656, 656, 99, 109, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 36, 36, 36, 36, 36, 49, 49, 49, - 49, 49, 36, 36, 49, 49, 49, 49, - - 36, 49, 49, 36, 49, 49, 36, 49, - 49, 49, 49, 49, 49, 49, 36, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 36, 36, - 49, 49, 36, 49, 36, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 650, 650, 650, 650, 650, - 650, 650, 650, 650, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - - 36, 36, 36, 36, 36, 36, 36, 36, - 657, 657, 657, 658, 658, 658, 36, 36, - 36, 36, 18, 54, 36, 659, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 660, 661, 36, 36, - - 36, 36, 36, 662, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 660, 661, 660, 661, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - - 36, 36, 36, 36, 660, 661, 660, 661, - 660, 661, 660, 661, 36, 36, 660, 661, - 660, 661, 660, 661, 660, 661, 660, 661, - 660, 661, 660, 661, 660, 661, 660, 661, - - 660, 661, 660, 661, 660, 661, 660, 661, - 660, 661, 660, 661, 36, 36, 36, 660, - 661, 660, 661, 36, 36, 36, 36, 36, - 663, 36, 36, 36, 36, 36, 36, 36, - - 36, 36, 660, 661, 36, 36, 664, 36, - 665, 666, 36, 666, 36, 36, 36, 36, - 660, 661, 660, 661, 660, 661, 660, 661, - 36, 36, 36, 36, 36, 36, 36, 36, - - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 660, 661, 660, 661, 667, 36, 36, - 660, 661, 36, 36, 36, 36, 660, 661, - 660, 661, 660, 661, 660, 661, 660, 661, - - 660, 661, 660, 661, 660, 661, 660, 661, - 660, 661, 660, 661, 660, 661, 36, 36, - 660, 661, 668, 668, 668, 185, 669, 669, - 185, 185, 670, 670, 670, 671, 671, 185, - - 49, 650, 49, 49, 49, 49, 49, 49, - 660, 661, 660, 661, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - - 36, 36, 49, 49, 49, 49, 49, 49, - 49, 16, 17, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, - - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, - - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 650, 185, 650, 650, 650, - - 650, 650, 650, 650, 650, 650, 650, 650, - 650, 650, 650, 650, 650, 650, 650, 650, - 650, 650, 650, 650, 650, 380, 650, 650, - 650, 650, 650, 185, 185, 185, 185, 185, - - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 652, 652, 652, 652, - 652, 652, 652, 652, 652, 652, 652, 652, - - 652, 652, 652, 652, 652, 652, 652, 652, - 652, 652, 652, 652, 652, 652, 652, 238, - 238, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 672, 672, 672, 672, - - 672, 672, 300, 300, 300, 300, 300, 300, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 650, 650, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 673, 674, 675, 676, 677, 678, 679, 680, - 681, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 673, 674, 675, 676, - 677, 678, 679, 680, 681, 62, 62, 62, - - 62, 62, 62, 62, 62, 62, 62, 62, - 60, 55, 56, 628, 629, 630, 631, 632, - 633, 682, 682, 682, 682, 682, 682, 682, - 682, 682, 682, 682, 193, 193, 193, 193, - - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 683, 683, - 683, 683, 683, 683, 683, 683, 683, 683, - - 683, 683, 683, 683, 683, 683, 683, 683, - 683, 683, 683, 683, 683, 683, 683, 683, - 684, 684, 684, 684, 684, 684, 684, 684, - 684, 684, 684, 684, 684, 684, 684, 684, - - 684, 684, 684, 684, 684, 684, 684, 684, - 684, 684, 685, 686, 686, 686, 686, 686, - 686, 686, 686, 686, 686, 687, 688, 689, - 690, 691, 692, 693, 694, 695, 686, 696, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 652, 652, - 652, 652, 652, 652, 652, 652, 652, 652, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 36, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 36, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 650, 650, 650, 650, 650, 650, 650, 650, - 185, 185, 185, 185, 185, 185, 185, 185, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 238, 238, 652, 652, - 417, 650, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 36, - 650, 650, 652, 652, 652, 652, 652, 652, - 652, 652, 652, 652, 652, 652, 417, 417, - - 652, 652, 652, 652, 652, 652, 652, 652, - 652, 652, 238, 238, 238, 238, 238, 238, - 238, 238, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 160, 160, 160, - - 238, 238, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 404, 417, 417, 417, - 417, 417, 300, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 49, 49, 49, 49, 160, 49, 49, - 49, 49, 160, 160, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 49, 49, 49, - 160, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 160, 49, 160, 49, - 49, 49, 49, 160, 160, 160, 49, 160, - 49, 49, 49, 697, 697, 697, 697, 160, - - 160, 49, 698, 698, 49, 49, 49, 49, - 699, 700, 699, 700, 699, 700, 699, 700, - 699, 700, 699, 700, 699, 700, 673, 674, - 675, 676, 677, 678, 679, 680, 681, 62, - - 673, 674, 675, 676, 677, 678, 679, 680, - 681, 62, 673, 674, 675, 676, 677, 678, - 679, 680, 681, 62, 49, 160, 160, 160, - 49, 49, 49, 49, 49, 49, 49, 49, - - 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, - 160, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 160, - - 701, 701, 701, 702, 703, 704, 705, 672, - 672, 672, 672, 160, 160, 160, 160, 160, - 185, 185, 185, 185, 185, 706, 707, 185, - 185, 185, 185, 185, 185, 706, 707, 185, - - 185, 185, 706, 707, 706, 707, 699, 700, - 699, 700, 699, 700, 160, 160, 160, 160, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - - 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, - 380, 380, 380, 380, 380, 380, 380, 380, - - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - - 185, 185, 185, 699, 700, 699, 700, 699, - 700, 699, 700, 699, 700, 708, 709, 710, - 711, 699, 700, 699, 700, 699, 700, 699, - 700, 185, 185, 185, 185, 185, 185, 185, - - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 712, 185, 185, 185, 185, 185, 185, 185, - - 706, 707, 185, 185, 706, 707, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 706, - 707, 706, 707, 185, 706, 707, 185, 185, - 699, 700, 699, 700, 185, 185, 185, 185, - - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 713, 185, 185, - 706, 707, 185, 185, 699, 700, 185, 185, - - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 706, 707, 706, 707, 185, - 185, 185, 185, 185, 706, 707, 185, 185, - 185, 185, 185, 185, 706, 707, 185, 185, - - 185, 185, 185, 185, 706, 707, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, - 185, 706, 707, 185, 185, 706, 707, 706, - - 707, 706, 707, 706, 707, 185, 185, 185, - 185, 185, 185, 706, 707, 185, 185, 185, - 185, 706, 707, 706, 707, 706, 707, 706, - 707, 706, 707, 706, 707, 185, 185, 185, - - 185, 706, 707, 185, 185, 185, 706, 707, - 706, 707, 706, 707, 706, 707, 185, 706, - 707, 185, 185, 706, 707, 185, 185, 185, - 185, 185, 185, 706, 707, 706, 707, 706, - - 707, 706, 707, 706, 707, 706, 707, 185, - 185, 185, 185, 185, 185, 706, 707, 706, - 707, 706, 707, 706, 707, 706, 707, 185, - 185, 185, 185, 185, 185, 185, 714, 185, - - 185, 185, 185, 715, 716, 715, 185, 185, - 185, 185, 185, 185, 706, 707, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 706, - 707, 706, 707, 185, 185, 185, 185, 185, - - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 417, 417, - 417, 417, 417, 417, 300, 300, 300, 300, - 300, 300, 300, 160, 160, 160, 160, 160, - - 300, 300, 300, 300, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 717, 717, 717, 717, 717, 717, 717, 717, - 717, 717, 717, 717, 717, 717, 717, 717, - 717, 717, 717, 717, 717, 717, 717, 717, - 717, 717, 717, 717, 717, 717, 717, 717, - - 717, 717, 717, 717, 717, 717, 717, 717, - 717, 717, 717, 717, 717, 717, 717, 160, - 718, 718, 718, 718, 718, 718, 718, 718, - 718, 718, 718, 718, 718, 718, 718, 718, - - 718, 718, 718, 718, 718, 718, 718, 718, - 718, 718, 718, 718, 718, 718, 718, 718, - 718, 718, 718, 718, 718, 718, 718, 718, - 718, 718, 718, 718, 718, 718, 718, 160, - - 113, 109, 719, 720, 721, 722, 723, 113, - 109, 113, 109, 113, 109, 160, 160, 160, - 160, 160, 160, 160, 724, 113, 109, 724, - 160, 160, 160, 160, 160, 160, 160, 160, - - 105, 106, 105, 106, 105, 106, 105, 106, - 105, 106, 105, 106, 105, 106, 105, 106, - 105, 106, 105, 106, 105, 106, 105, 106, - 105, 106, 105, 106, 105, 106, 105, 106, - - 105, 106, 105, 106, 103, 417, 417, 417, - 417, 417, 417, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 621, 621, 621, 621, 725, 621, 621, - - 726, 726, 726, 726, 726, 726, 726, 726, - 726, 726, 726, 726, 726, 726, 726, 726, - 726, 726, 726, 726, 726, 726, 726, 726, - 726, 726, 726, 726, 726, 726, 726, 726, - - 726, 726, 726, 726, 726, 726, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - - 322, 322, 322, 322, 322, 322, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 400, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 322, 322, 322, 322, 322, 322, 322, 160, - 322, 322, 322, 322, 322, 322, 322, 160, - 322, 322, 322, 322, 322, 322, 322, 160, - 322, 322, 322, 322, 322, 322, 322, 160, - - 727, 727, 728, 729, 728, 729, 727, 727, - 727, 728, 729, 727, 728, 729, 621, 621, - 621, 621, 621, 621, 621, 621, 620, 730, - 160, 160, 160, 160, 728, 729, 160, 160, - - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 160, 731, 731, 731, 731, 731, - - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 160, 160, 160, 160, - - 732, 733, 734, 735, 736, 737, 738, 739, - 16, 17, 16, 17, 16, 17, 16, 17, - 16, 17, 736, 736, 16, 17, 16, 17, - 16, 17, 16, 17, 740, 16, 17, 741, - - 736, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 742, 743, 140, 744, 745, 745, - 746, 747, 747, 747, 747, 747, 736, 736, - 748, 748, 748, 749, 750, 751, 731, 736, - - 160, 752, 738, 752, 738, 752, 738, 752, - 738, 752, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - - 738, 738, 738, 752, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - - 738, 738, 738, 752, 738, 752, 738, 752, - 738, 738, 738, 738, 738, 738, 752, 738, - 738, 738, 738, 738, 738, 753, 753, 160, - 160, 754, 754, 755, 755, 756, 756, 757, - - 758, 759, 760, 759, 760, 759, 760, 759, - 760, 759, 760, 760, 760, 760, 760, 760, - 760, 760, 760, 760, 760, 760, 760, 760, - 760, 760, 760, 760, 760, 760, 760, 760, - - 760, 760, 760, 759, 760, 760, 760, 760, - 760, 760, 760, 760, 760, 760, 760, 760, - 760, 760, 760, 760, 760, 760, 760, 760, - 760, 760, 760, 760, 760, 760, 760, 760, - - 760, 760, 760, 759, 760, 759, 760, 759, - 760, 760, 760, 760, 760, 760, 759, 760, - 760, 760, 760, 760, 760, 759, 759, 760, - 760, 760, 760, 761, 762, 762, 762, 763, - - 160, 160, 160, 160, 160, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, - - 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 160, 160, 160, - 160, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, - - 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 764, - - 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 764, 764, 764, 160, - 765, 765, 766, 766, 766, 766, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 767, 767, 767, - 160, 160, 160, 160, 160, 160, 160, 160, - - 768, 768, 768, 768, 768, 768, 768, 768, - 768, 768, 768, 768, 768, 768, 768, 768, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 769, 769, 769, 769, 769, 769, 769, 769, - 769, 769, 769, 769, 769, 769, 769, 769, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 770, 770, 160, - - 766, 766, 766, 766, 766, 766, 766, 766, - 766, 766, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - - 765, 765, 765, 765, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 770, 771, 771, 771, 771, 771, 771, 771, - 771, 771, 771, 771, 771, 771, 771, 771, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 770, 770, 768, 765, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 771, 771, 771, 771, 771, 771, 771, - 771, 771, 771, 771, 771, 771, 771, 771, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 770, 770, 770, 770, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 160, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 770, - 770, 770, 770, 765, 765, 765, 765, 765, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 770, 770, - - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 770, - - 772, 772, 772, 772, 772, 772, 772, 772, - 772, 772, 772, 772, 772, 772, 772, 772, - 772, 772, 772, 772, 772, 772, 772, 772, - 772, 772, 772, 772, 772, 772, 772, 772, - - 772, 772, 772, 772, 772, 772, 772, 772, - 772, 772, 772, 772, 772, 772, 772, 772, - 772, 772, 772, 772, 772, 772, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, - - 738, 738, 738, 738, 738, 738, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 160, 160, 160, 160, - - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 774, 767, 767, - 767, 767, 767, 767, 767, 767, 767, 767, - - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 767, 767, 767, - - 767, 767, 767, 767, 767, 767, 767, 767, - 767, 767, 767, 767, 767, 160, 160, 160, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - - 731, 731, 775, 775, 731, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - 731, 731, 731, 731, 775, 731, 731, 731, - 731, 731, 731, 731, 731, 731, 731, 731, - - 731, 775, 731, 731, 731, 775, 731, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 776, 776, 776, 776, 776, 776, 776, 776, - 776, 776, 776, 776, 776, 776, 776, 776, - 776, 776, 776, 776, 776, 776, 776, 777, - 777, 777, 777, 160, 160, 160, 160, 160, - - 778, 778, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 322, 322, 779, 322, 322, 322, 780, 322, - 322, 322, 322, 781, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, - - 322, 322, 322, 463, 463, 781, 781, 463, - 417, 417, 417, 417, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 782, 782, 303, 303, - 160, 160, 160, 160, 160, 160, 160, 160, - - 783, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 783, 784, 784, 784, - - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 783, 784, 784, 784, 784, 784, 784, 784, - - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 783, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 783, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 783, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - - 784, 784, 784, 784, 784, 784, 784, 784, - 783, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - - 784, 784, 784, 784, 783, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 784, - - 784, 784, 784, 784, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 785, 785, 785, 785, 785, 785, 785, 785, - 785, 785, 785, 785, 785, 785, 785, 785, - 785, 785, 785, 785, 785, 785, 785, 785, - 785, 785, 785, 785, 785, 785, 785, 785, - - 786, 786, 786, 786, 786, 786, 786, 786, - 786, 786, 786, 786, 786, 786, 786, 786, - 786, 786, 786, 786, 786, 786, 786, 786, - 786, 786, 786, 786, 786, 786, 786, 786, - - 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 160, 160, - 787, 787, 787, 787, 787, 787, 787, 787, - 787, 787, 787, 787, 787, 787, 787, 787, - - 787, 787, 787, 787, 787, 787, 787, 787, - 787, 787, 787, 787, 787, 787, 787, 787, - 787, 787, 787, 787, 787, 787, 787, 787, - 787, 787, 787, 787, 787, 787, 787, 787, - - 787, 787, 787, 787, 787, 787, 787, 787, - 787, 787, 787, 160, 160, 160, 160, 160, - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, - 773, 773, 160, 160, 160, 160, 160, 160, - - 788, 789, 790, 791, 792, 793, 794, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 795, 796, 797, 798, 799, - 160, 160, 160, 160, 160, 800, 801, 230, - - 230, 230, 230, 230, 230, 230, 230, 230, - 230, 634, 230, 230, 230, 230, 230, 230, - 230, 230, 230, 230, 230, 230, 230, 204, - 230, 230, 230, 230, 230, 204, 230, 204, - - 230, 230, 204, 230, 230, 204, 230, 230, - 230, 230, 230, 230, 230, 230, 230, 230, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - - 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 599, 741, - - 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 234, 234, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, - 234, 234, 234, 234, 234, 234, 234, 234, - 802, 802, 802, 802, 802, 802, 802, 802, - 802, 802, 802, 802, 802, 802, 802, 802, - - 802, 802, 802, 802, 802, 802, 802, 802, - 802, 802, 802, 802, 802, 802, 802, 802, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 803, 238, 234, 234, - - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 804, 805, 805, 804, 804, 806, 806, 807, - 808, 809, 160, 160, 160, 160, 160, 160, - - 139, 139, 139, 139, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 735, 746, 746, 810, 810, 599, 741, 599, - 741, 599, 741, 599, 741, 599, 741, 599, - - 741, 599, 741, 599, 741, 751, 751, 811, - 812, 735, 735, 735, 735, 810, 810, 810, - 813, 735, 814, 160, 761, 815, 9, 9, - 746, 16, 17, 16, 17, 16, 17, 816, - - 735, 735, 817, 818, 819, 820, 821, 160, - 735, 12, 13, 735, 160, 160, 160, 160, - 242, 242, 242, 285, 242, 234, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 234, 234, 822, - - 160, 9, 735, 816, 12, 13, 735, 735, - 16, 17, 735, 817, 813, 818, 814, 823, - 824, 825, 826, 827, 828, 829, 830, 831, - 832, 833, 815, 761, 834, 821, 835, 9, - - 735, 836, 836, 836, 836, 836, 836, 836, - 836, 836, 836, 836, 836, 836, 836, 836, - 836, 836, 836, 836, 836, 836, 836, 836, - 836, 836, 836, 39, 735, 41, 837, 810, - - 837, 838, 838, 838, 838, 838, 838, 838, - 838, 838, 838, 838, 838, 838, 838, 838, - 838, 838, 838, 838, 838, 838, 838, 838, - 838, 838, 838, 39, 821, 41, 821, 699, - - 700, 734, 16, 17, 733, 761, 839, 759, - 759, 759, 759, 759, 759, 759, 759, 759, - 762, 839, 839, 839, 839, 839, 839, 839, - 839, 839, 839, 839, 839, 839, 839, 839, - - 839, 839, 839, 839, 839, 839, 839, 839, - 839, 839, 839, 839, 839, 839, 839, 839, - 839, 839, 839, 839, 839, 839, 839, 839, - 839, 839, 839, 839, 839, 839, 762, 762, - - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 160, - - 160, 160, 90, 90, 90, 90, 90, 90, - 160, 160, 90, 90, 90, 90, 90, 90, - 160, 160, 90, 90, 90, 90, 90, 90, - 160, 160, 90, 90, 90, 160, 160, 160, - - 48, 12, 821, 837, 736, 12, 12, 160, - 49, 36, 36, 36, 36, 49, 49, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 840, 840, 840, 841, 49, 842, 842, - - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 160, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - - 307, 307, 307, 307, 307, 307, 307, 160, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 160, 307, 307, 160, 307, - - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 160, 160, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 160, 160, - - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 160, 160, 160, 160, 160, - - 843, 844, 845, 160, 160, 160, 160, 846, - 846, 846, 846, 846, 846, 846, 846, 846, - 846, 846, 846, 846, 846, 846, 846, 846, - 846, 846, 846, 846, 846, 846, 846, 846, - - 846, 846, 846, 846, 846, 846, 846, 846, - 846, 846, 846, 846, 846, 846, 846, 846, - 846, 846, 846, 846, 160, 160, 160, 847, - 847, 847, 847, 847, 847, 847, 847, 847, - - 848, 848, 848, 848, 848, 848, 848, 848, - 848, 848, 848, 848, 848, 848, 848, 848, - 848, 848, 848, 848, 848, 848, 848, 848, - 848, 848, 848, 848, 848, 848, 848, 848, - - 848, 848, 848, 848, 848, 848, 848, 848, - 848, 848, 848, 848, 848, 848, 848, 848, - 848, 848, 848, 848, 848, 725, 725, 725, - 725, 417, 417, 417, 417, 417, 417, 417, - - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 725, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 849, 849, 849, 849, 849, 849, 849, 849, - 849, 849, 849, 849, 849, 849, 849, 849, - 849, 849, 849, 849, 849, 849, 849, 849, - 849, 849, 849, 849, 849, 849, 849, 160, - - 850, 850, 850, 850, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 849, 849, 849, 849, 849, 849, 849, 849, - 849, 849, 849, 849, 849, 849, 849, 849, - - 849, 851, 849, 849, 849, 849, 849, 849, - 849, 849, 851, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 160, 843, - - 322, 322, 322, 322, 160, 160, 160, 160, - 322, 322, 322, 322, 322, 322, 322, 322, - 464, 852, 852, 852, 852, 852, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 853, 853, 853, 853, 853, 853, 853, 853, - 853, 853, 853, 853, 853, 853, 853, 853, - 853, 853, 853, 853, 853, 853, 853, 853, - 853, 853, 853, 853, 853, 853, 853, 853, - - 853, 853, 853, 853, 853, 853, 854, 854, - 855, 855, 855, 855, 855, 855, 855, 855, - 855, 855, 855, 855, 855, 855, 855, 855, - 855, 855, 855, 855, 855, 855, 855, 855, - - 855, 855, 855, 855, 855, 855, 855, 855, - 855, 855, 855, 855, 855, 855, 856, 856, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 160, 160, - - 440, 441, 442, 443, 444, 445, 446, 447, - 448, 449, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 857, 857, 857, 857, 857, 857, 204, 204, - 857, 204, 857, 857, 857, 857, 857, 857, - 857, 857, 857, 857, 857, 857, 857, 857, - 857, 857, 857, 857, 857, 857, 857, 857, - - 857, 857, 857, 857, 857, 857, 857, 857, - 857, 857, 857, 857, 857, 857, 857, 857, - 857, 857, 857, 857, 857, 857, 204, 857, - 857, 204, 204, 204, 857, 204, 204, 857, - - 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 859, 859, - 859, 859, 204, 204, 204, 204, 204, 860, - - 861, 781, 781, 781, 204, 781, 781, 204, - 204, 204, 204, 204, 781, 152, 781, 153, - 861, 861, 861, 861, 204, 861, 861, 861, - 204, 861, 861, 861, 861, 861, 861, 861, - - 861, 861, 861, 861, 861, 861, 861, 861, - 861, 861, 861, 861, 861, 861, 861, 861, - 861, 861, 861, 861, 204, 204, 204, 204, - 153, 642, 152, 204, 204, 204, 204, 780, - - 862, 863, 864, 865, 866, 866, 866, 866, - 204, 204, 204, 204, 204, 204, 204, 204, - 867, 867, 867, 867, 867, 867, 867, 867, - 868, 204, 204, 204, 204, 204, 204, 204, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 869, 869, 869, 869, 869, - 869, 869, 869, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 480, 480, 480, 480, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 160, - 160, 160, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 871, 872, 873, - 873, 873, 870, 870, 870, 874, 871, 871, - 871, 871, 871, 875, 875, 875, 875, 875, - 875, 875, 875, 876, 876, 876, 876, 876, - 876, 876, 876, 870, 870, 877, 877, 877, - 877, 877, 876, 876, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 877, 877, 877, 877, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 870, 870, - 870, 870, 870, 870, 870, 870, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 417, 417, 417, 417, 417, 417, - 417, 417, 153, 153, 153, 417, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 878, 878, 878, 878, 878, 878, 878, 878, - 878, 878, 878, 878, 878, 878, 878, 878, - 878, 878, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 880, 880, - 880, 880, 880, 880, 880, 160, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 879, 160, 879, 879, - 160, 160, 879, 160, 160, 879, 879, 160, - 160, 879, 879, 879, 879, 160, 879, 879, - 879, 879, 879, 879, 879, 879, 880, 880, - 880, 880, 160, 880, 160, 880, 880, 880, - 880, 102, 880, 880, 160, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - - 880, 880, 880, 880, 879, 879, 160, 879, - 879, 879, 879, 160, 160, 879, 879, 879, - 879, 879, 879, 879, 879, 160, 879, 879, - 879, 879, 879, 879, 879, 160, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 879, 879, 160, 879, 879, 879, 879, 160, - 879, 879, 879, 879, 879, 160, 879, 160, - 160, 160, 879, 879, 879, 879, 879, 879, - 879, 160, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - - 880, 880, 880, 880, 880, 880, 880, 880, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 103, 103, 160, 160, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 881, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 881, 880, 880, 880, 880, - 880, 880, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 881, 880, 880, 880, 880, - - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 881, 880, 880, - 880, 880, 880, 880, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 881, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 881, - 880, 880, 880, 880, 880, 880, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 881, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 881, 880, 880, 880, 880, 880, 880, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 879, 879, 879, 879, 879, 879, 879, - 879, 881, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 881, 880, 880, 880, 880, - 880, 880, 882, 724, 160, 160, 883, 884, - 885, 886, 887, 888, 889, 890, 891, 892, - 883, 884, 885, 886, 887, 888, 889, 890, - 891, 892, 883, 884, 885, 886, 887, 888, - 889, 890, 891, 892, 883, 884, 885, 886, - 887, 888, 889, 890, 891, 892, 883, 884, - 885, 886, 887, 888, 889, 890, 891, 892, - - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 893, 893, - - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 160, 875, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 875, 875, 875, 875, 875, 875, 875, 875, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, - 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, - - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 895, 895, - 895, 895, 895, 895, 895, 895, 893, 893, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18608, 18608, 18608, 18864, 19120, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 19376, 19632, 19888, 20144, 20400, 20656, 20912, 21168, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21680, 21680, + 21680, 21680, 21680, 21680, 21680, 21680, 21936, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 21680, 21680, 22192, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 22448, 22704, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 18352, + 18352, 18352, 18352, 18352, 18352, 18352, 18352, 21424, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 23216, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 22960, + 22960, 22960, 22960, 22960, 22960, 22960, 22960, 23216, + + + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 2, 3, 4, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 6, 7, + + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 14, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 9, + + 14, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 39, 40, 41, 42, 43, + + 42, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 39, 45, 41, 36, 0, + + 0, 0, 0, 0, 0, 46, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + + 47, 14, 48, 12, 12, 12, 49, 49, + 42, 49, 50, 51, 36, 52, 49, 42, + 53, 54, 55, 56, 57, 58, 49, 59, + 42, 60, 50, 61, 62, 62, 62, 14, + + 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 36, + 38, 38, 38, 38, 38, 38, 38, 63, + + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 36, + 44, 44, 44, 44, 44, 44, 44, 64, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 67, 68, 65, 66, 65, 66, 65, 66, + 50, 65, 66, 65, 66, 65, 66, 65, + + 66, 65, 66, 65, 66, 65, 66, 65, + 66, 69, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 70, 65, 66, 65, 66, 65, 66, 71, + + 72, 73, 65, 66, 65, 66, 74, 65, + 66, 75, 75, 65, 66, 50, 76, 77, + 78, 65, 66, 75, 79, 80, 81, 82, + 65, 66, 83, 50, 81, 84, 85, 86, + + 65, 66, 65, 66, 65, 66, 87, 65, + 66, 87, 50, 50, 65, 66, 87, 65, + 66, 88, 88, 65, 66, 65, 66, 89, + 65, 66, 50, 90, 65, 66, 50, 91, + + 90, 90, 90, 90, 92, 93, 94, 92, + 93, 94, 92, 93, 94, 65, 66, 65, + 66, 65, 66, 65, 66, 65, 66, 65, + 66, 65, 66, 65, 66, 95, 65, 66, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 96, 92, 93, 94, 65, 66, 97, 98, + 99, 100, 65, 66, 65, 66, 65, 66, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 99, 100, 99, 100, 99, 100, 99, 100, + + 101, 102, 99, 100, 99, 100, 99, 100, + 99, 100, 99, 100, 99, 100, 99, 100, + 99, 100, 99, 100, 102, 102, 102, 103, + 103, 103, 104, 105, 106, 107, 108, 103, + + 103, 105, 109, 110, 111, 112, 113, 109, + 113, 109, 113, 109, 113, 109, 113, 109, + 50, 50, 50, 114, 115, 50, 116, 116, + 50, 117, 50, 118, 50, 50, 50, 50, + + 116, 50, 50, 119, 50, 50, 50, 50, + 120, 121, 50, 122, 50, 50, 50, 121, + 50, 50, 123, 50, 50, 124, 50, 50, + 50, 50, 50, 50, 50, 125, 50, 50, + + 126, 50, 50, 126, 50, 50, 50, 50, + 126, 127, 128, 128, 129, 50, 50, 50, + 50, 50, 130, 50, 90, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, + + 50, 50, 50, 50, 50, 50, 50, 50, + 50, 131, 131, 131, 131, 131, 102, 102, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 133, 133, 134, 134, 134, 134, 134, + + 132, 132, 42, 42, 42, 42, 133, 133, + 135, 133, 133, 133, 135, 133, 133, 133, + 134, 134, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 136, + + 132, 132, 132, 132, 132, 42, 42, 42, + 42, 42, 136, 136, 136, 136, 137, 138, + 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, + + 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 140, 141, 141, + 141, 141, 140, 142, 141, 141, 141, 141, + + 141, 143, 143, 141, 141, 141, 141, 143, + 143, 141, 141, 141, 141, 141, 141, 141, + 141, 141, 141, 141, 144, 144, 144, 144, + 144, 141, 141, 141, 141, 139, 139, 139, + + 139, 139, 139, 139, 139, 145, 146, 147, + 147, 147, 146, 146, 146, 147, 147, 148, + 149, 149, 149, 150, 150, 150, 150, 149, + 151, 152, 152, 153, 154, 155, 155, 156, + + 157, 157, 158, 159, 159, 159, 159, 159, + 159, 159, 159, 159, 159, 159, 159, 159, + 160, 160, 160, 160, 42, 42, 160, 160, + 160, 160, 132, 161, 161, 161, 34, 160, + + 160, 160, 160, 160, 42, 42, 162, 14, + 163, 163, 163, 160, 164, 160, 165, 165, + 166, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + + 38, 38, 160, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 167, 168, 168, 168, + 169, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + + 44, 44, 170, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 171, 172, 172, 160, + 173, 174, 175, 175, 175, 176, 177, 131, + 178, 179, 65, 100, 65, 100, 65, 100, + + 65, 100, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 180, 181, 182, 50, 183, 184, 185, 186, + 187, 188, 186, 187, 103, 189, 189, 189, + + 190, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 190, 191, 191, + 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + + 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + + 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, + 192, 193, 193, 193, 193, 193, 193, 193, + 193, 193, 193, 193, 193, 192, 193, 193, + + 65, 66, 194, 139, 139, 139, 139, 160, + 195, 195, 178, 179, 99, 100, 99, 100, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + + 196, 65, 66, 65, 66, 178, 179, 65, + 66, 178, 179, 65, 66, 178, 179, 197, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 99, 100, 65, 66, + 65, 66, 65, 66, 65, 66, 105, 106, + 65, 66, 113, 109, 113, 109, 113, 109, + + 178, 179, 178, 179, 178, 179, 178, 179, + 178, 179, 178, 179, 178, 179, 178, 179, + 113, 109, 113, 109, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 160, + 160, 134, 199, 199, 200, 199, 200, 199, + + 160, 201, 201, 201, 201, 201, 201, 201, + 201, 201, 201, 201, 201, 201, 201, 201, + 201, 201, 201, 201, 201, 201, 201, 201, + 201, 201, 201, 201, 201, 201, 201, 201, + + 201, 201, 201, 201, 201, 201, 201, 202, + 160, 203, 204, 160, 160, 160, 160, 160, + 205, 206, 207, 207, 207, 207, 206, 207, + 207, 207, 208, 206, 207, 207, 207, 207, + + 207, 207, 152, 206, 206, 206, 206, 206, + 207, 207, 206, 207, 207, 208, 209, 207, + 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, + + 226, 227, 228, 226, 207, 152, 229, 230, + 205, 205, 205, 205, 205, 205, 205, 205, + 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, + + 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 205, 205, 205, 205, 205, + 231, 231, 231, 232, 233, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, + + 234, 234, 234, 234, 235, 235, 235, 235, + 235, 235, 235, 236, 237, 238, 239, 239, + 149, 149, 149, 149, 149, 149, 235, 235, + 235, 235, 235, 240, 235, 235, 241, 242, + + 235, 243, 244, 244, 244, 244, 245, 244, + 245, 244, 245, 245, 245, 245, 245, 244, + 244, 244, 244, 245, 245, 245, 245, 245, + 245, 245, 245, 235, 235, 235, 235, 235, + + 246, 245, 245, 245, 245, 245, 245, 245, + 244, 245, 245, 247, 248, 249, 250, 251, + 252, 253, 254, 146, 146, 147, 150, 149, + 149, 153, 153, 153, 152, 153, 153, 235, + + 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 266, 267, 268, 268, + 269, 244, 244, 244, 243, 244, 244, 244, + 245, 245, 245, 245, 245, 245, 245, 245, + + 245, 245, 245, 245, 245, 245, 245, 245, + 244, 244, 244, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 244, 244, 244, 244, + 244, 244, 245, 245, 245, 245, 245, 245, + + 245, 245, 245, 245, 245, 245, 245, 245, + 245, 245, 245, 245, 245, 245, 245, 245, + 245, 245, 245, 245, 245, 245, 245, 245, + 270, 270, 245, 245, 245, 245, 245, 270, + + 244, 245, 245, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 245, 244, 245, 271, + 245, 245, 244, 244, 242, 244, 139, 139, + 139, 139, 139, 139, 139, 272, 273, 139, + + 139, 139, 139, 141, 139, 274, 274, 139, + 139, 49, 141, 139, 139, 141, 275, 275, + 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 270, 270, 270, 276, 276, 277, + + 278, 278, 278, 279, 279, 279, 279, 279, + 279, 279, 279, 279, 279, 279, 235, 280, + 271, 281, 270, 270, 270, 271, 271, 271, + 271, 271, 270, 270, 270, 270, 271, 270, + + 270, 270, 270, 270, 270, 270, 270, 270, + 271, 270, 271, 270, 271, 277, 277, 275, + 146, 147, 146, 146, 147, 146, 146, 147, + 147, 147, 146, 147, 147, 146, 147, 146, + + 146, 146, 147, 146, 147, 146, 147, 146, + 147, 146, 146, 235, 235, 275, 277, 277, + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 283, 283, 283, 282, 282, 282, 282, + + 282, 282, 282, 282, 282, 282, 282, 282, + 282, 282, 282, 283, 283, 282, 235, 235, + 235, 235, 235, 235, 235, 235, 235, 235, + 235, 235, 235, 235, 235, 235, 235, 235, + + 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, + + 284, 284, 284, 284, 284, 284, 285, 285, + 285, 285, 285, 285, 285, 285, 285, 285, + 285, 286, 235, 235, 235, 235, 235, 235, + 235, 235, 235, 235, 235, 235, 235, 235, + + 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 297, 297, 297, 297, 297, + 297, 297, 297, 297, 297, 297, 297, 297, + 297, 297, 297, 297, 297, 297, 297, 297, + + 297, 297, 297, 297, 297, 297, 297, 297, + 297, 297, 297, 298, 298, 298, 298, 298, + 298, 298, 299, 298, 300, 300, 301, 302, + 303, 304, 305, 205, 205, 205, 205, 205, + + 205, 205, 205, 205, 205, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, + + 160, 306, 306, 307, 308, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 160, 160, 309, 90, 307, 307, + + 307, 306, 306, 306, 306, 306, 306, 306, + 306, 307, 307, 307, 307, 310, 160, 160, + 90, 139, 141, 139, 139, 160, 160, 160, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 306, 306, 311, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 199, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 322, 322, 323, 322, 322, + + 160, 306, 307, 307, 160, 90, 90, 90, + 90, 90, 90, 90, 90, 160, 160, 90, + 90, 160, 160, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 160, 160, 160, 90, 90, + 90, 90, 160, 160, 309, 308, 324, 307, + + 307, 306, 306, 306, 306, 160, 160, 307, + 307, 160, 160, 307, 307, 310, 323, 160, + 160, 160, 160, 160, 160, 160, 160, 324, + 160, 160, 160, 160, 90, 90, 160, 90, + + 90, 90, 306, 306, 160, 160, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 90, 90, 12, 12, 325, 325, 325, 325, + 325, 325, 194, 160, 160, 160, 160, 160, + + 160, 326, 306, 327, 160, 90, 90, 90, + 90, 90, 90, 160, 160, 160, 160, 90, + 90, 160, 160, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 160, 90, 90, 160, + 90, 90, 160, 160, 309, 160, 307, 307, + + 307, 306, 306, 160, 160, 160, 160, 306, + 306, 160, 160, 306, 306, 310, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 90, 90, 90, 90, 160, 90, 160, + + 160, 160, 160, 160, 160, 160, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 306, 306, 90, 90, 90, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 306, 306, 307, 160, 90, 90, 90, + 90, 90, 90, 90, 308, 90, 160, 90, + 90, 90, 160, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 160, 90, 90, 90, + 90, 90, 160, 160, 309, 90, 307, 307, + + 307, 306, 306, 306, 306, 306, 160, 306, + 306, 307, 160, 307, 307, 310, 160, 160, + 90, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 90, 308, 326, 326, 160, 160, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 160, 328, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 160, 308, 90, 90, + 90, 90, 160, 160, 309, 90, 324, 306, + + 307, 306, 306, 306, 160, 160, 160, 307, + 307, 160, 160, 307, 307, 310, 160, 160, + 160, 160, 160, 160, 160, 160, 306, 324, + 160, 160, 160, 160, 90, 90, 160, 90, + + 90, 90, 160, 160, 160, 160, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 194, 308, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 306, 90, 160, 90, 90, 90, + 90, 90, 90, 160, 160, 160, 90, 90, + 90, 160, 90, 90, 90, 90, 160, 160, + 160, 90, 90, 160, 90, 160, 90, 90, + + 160, 160, 160, 90, 90, 160, 160, 160, + 90, 90, 90, 160, 160, 160, 90, 90, + 90, 90, 90, 90, 90, 90, 323, 90, + 90, 90, 160, 160, 160, 160, 324, 307, + + 306, 307, 307, 160, 160, 160, 307, 307, + 307, 160, 307, 307, 307, 310, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 324, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 329, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 325, 325, 325, 239, 239, 239, 239, 239, + 239, 328, 239, 160, 160, 160, 160, 160, + + 160, 307, 307, 307, 160, 90, 90, 90, + 90, 90, 90, 90, 90, 160, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 160, 90, 90, 90, + 90, 90, 160, 160, 160, 160, 306, 306, + + 306, 307, 307, 307, 307, 160, 306, 306, + 306, 160, 306, 306, 306, 310, 160, 160, + 160, 160, 160, 160, 160, 330, 331, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 90, 90, 160, 160, 160, 160, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 307, 307, 160, 90, 90, 90, + 90, 90, 90, 90, 90, 160, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 160, 90, 90, 90, + 90, 90, 160, 160, 332, 308, 307, 333, + + 307, 307, 324, 307, 307, 160, 333, 307, + 307, 160, 307, 307, 306, 310, 160, 160, + 160, 160, 160, 160, 160, 324, 324, 160, + 160, 160, 160, 160, 160, 160, 90, 160, + + 90, 90, 334, 334, 160, 160, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, + 160, 301, 301, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 160, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 160, 160, 160, 160, 324, 307, + + 307, 306, 306, 306, 160, 160, 307, 307, + 307, 160, 307, 307, 307, 310, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 324, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 335, 335, 160, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 160, + 160, 160, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 160, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 160, 336, 160, 160, + + 336, 336, 336, 336, 336, 336, 336, 160, + 160, 160, 337, 160, 160, 160, 160, 338, + 335, 335, 285, 285, 285, 160, 285, 160, + 335, 335, 335, 335, 335, 335, 335, 338, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 335, 335, 339, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 341, 340, 340, 341, 341, 341, 341, + 342, 342, 343, 160, 160, 160, 160, 12, + + 340, 340, 340, 340, 340, 340, 344, 341, + 345, 345, 345, 345, 341, 341, 341, 199, + 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 346, 346, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 340, 340, 160, 340, 160, 160, 340, + 340, 160, 340, 160, 160, 340, 160, 160, + 160, 160, 160, 160, 340, 340, 340, 340, + 160, 340, 340, 340, 340, 340, 340, 340, + + 160, 340, 340, 340, 160, 340, 160, 340, + 160, 160, 340, 340, 160, 340, 340, 340, + 340, 341, 340, 340, 341, 341, 341, 341, + 347, 347, 160, 341, 341, 340, 160, 160, + + 340, 340, 340, 340, 340, 160, 344, 160, + 348, 348, 348, 348, 341, 341, 160, 160, + 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 160, 160, 340, 340, 160, 160, + + 349, 350, 350, 350, 351, 352, 351, 351, + 353, 351, 351, 354, 353, 355, 355, 355, + 355, 355, 353, 356, 357, 356, 356, 356, + 206, 206, 356, 356, 356, 356, 356, 356, + + 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 369, 206, 356, 206, + 356, 370, 371, 372, 371, 372, 373, 373, + + 349, 349, 349, 349, 349, 349, 349, 349, + 160, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, + + 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 336, 160, 160, 160, 160, 160, + 160, 374, 375, 376, 377, 376, 376, 376, + 376, 376, 375, 375, 375, 375, 376, 378, + + 375, 376, 207, 207, 379, 354, 207, 207, + 349, 349, 349, 349, 160, 160, 160, 160, + 376, 376, 376, 376, 376, 376, 285, 376, + 160, 376, 376, 376, 376, 376, 376, 376, + + 376, 376, 376, 376, 376, 376, 376, 376, + 376, 376, 376, 376, 376, 376, 285, 285, + 285, 376, 376, 376, 376, 376, 376, 376, + 285, 376, 285, 285, 285, 160, 380, 380, + + 381, 381, 381, 381, 381, 381, 147, 381, + 381, 381, 381, 381, 381, 160, 160, 381, + 382, 382, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 383, 383, 383, 383, 383, 383, 383, 383, + 383, 383, 383, 383, 383, 383, 383, 383, + 383, 383, 383, 383, 383, 383, 383, 383, + 383, 383, 383, 383, 383, 383, 383, 383, + + 383, 383, 160, 383, 383, 383, 383, 383, + 160, 383, 383, 160, 384, 385, 385, 385, + 385, 384, 385, 160, 160, 160, 385, 386, + 384, 387, 160, 160, 160, 160, 160, 160, + + 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 398, 339, 339, 339, 339, + 383, 383, 383, 383, 383, 383, 384, 384, + 385, 385, 160, 160, 160, 160, 160, 160, + + 399, 399, 399, 399, 399, 399, 399, 399, + 399, 399, 399, 399, 399, 399, 399, 399, + 399, 399, 399, 399, 399, 399, 399, 399, + 399, 399, 399, 399, 399, 399, 399, 399, + + 399, 399, 399, 399, 399, 399, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 400, + 400, 323, 323, 199, 401, 160, 160, 160, + + 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, + + 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 160, 160, 160, 160, 160, 402, + + 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, + + 403, 403, 403, 160, 160, 160, 160, 160, + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, + + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, + + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, + 404, 404, 160, 160, 160, 160, 160, 160, + + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 160, 336, 336, 336, 336, 160, 160, + 336, 336, 336, 336, 336, 336, 336, 160, + 336, 160, 336, 336, 336, 336, 160, 160, + + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 160, 336, 336, 336, 336, 160, 160, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 160, 336, 336, 336, 336, 160, 160, + 336, 336, 336, 336, 336, 336, 336, 160, + + 336, 160, 336, 336, 336, 336, 160, 160, + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 336, 336, 336, 336, 336, 336, 160, + 336, 336, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 160, 336, 336, 336, 336, 160, 160, + 336, 336, 336, 336, 336, 336, 336, 323, + + 336, 336, 336, 336, 336, 336, 336, 323, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 160, 160, 160, 160, 153, + + 405, 406, 407, 339, 339, 339, 339, 407, + 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 417, 417, 417, 417, 417, + 417, 417, 417, 417, 417, 160, 160, 160, + + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 160, 160, 160, 160, 160, 160, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 339, 407, 336, + 336, 336, 336, 336, 336, 336, 336, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 419, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 420, 421, 160, 160, 160, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 406, 406, 406, 422, 422, + 422, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 400, 400, 400, 160, 400, 400, + 400, 400, 423, 423, 424, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 423, 423, 424, 425, 425, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 423, 423, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 400, 400, 400, 400, 400, 400, 400, 400, + 400, 400, 400, 400, 400, 160, 400, 400, + 400, 160, 423, 423, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 383, 383, 383, 383, 383, 383, 383, 383, + 383, 383, 383, 383, 383, 383, 383, 383, + 383, 383, 383, 383, 426, 426, 384, 385, + 385, 385, 385, 385, 385, 385, 384, 384, + + 384, 384, 384, 384, 384, 384, 385, 384, + 384, 385, 385, 385, 385, 385, 385, 385, + 385, 385, 387, 385, 406, 406, 427, 428, + 406, 339, 406, 429, 383, 430, 160, 160, + + 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 160, 160, 160, 160, 160, 160, + 431, 431, 431, 431, 431, 431, 431, 431, + 431, 431, 160, 160, 160, 160, 160, 160, + + 432, 432, 433, 434, 433, 433, 435, 432, + 433, 434, 432, 285, 285, 285, 436, 160, + 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 160, 160, 160, 160, 160, 160, + + 336, 336, 336, 137, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 336, 336, 336, 336, 336, 336, 336, + 160, 160, 160, 160, 160, 160, 160, 160, + + 336, 336, 336, 336, 336, 336, 336, 336, + 336, 437, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 160, 160, 160, + + 326, 326, 326, 327, 327, 327, 327, 326, + 326, 438, 438, 438, 160, 160, 160, 160, + 327, 327, 326, 327, 327, 327, 327, 327, + 327, 439, 149, 150, 160, 160, 160, 160, + + 239, 160, 160, 160, 440, 440, 441, 442, + 443, 444, 445, 446, 447, 448, 449, 450, + 451, 451, 451, 451, 451, 451, 451, 451, + 451, 451, 451, 451, 451, 451, 451, 451, + + 451, 451, 451, 451, 451, 451, 451, 451, + 451, 451, 451, 451, 451, 451, 160, 160, + 451, 451, 451, 451, 451, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 452, 452, 452, 452, 452, 452, + + 452, 452, 452, 452, 452, 452, 452, 452, + 452, 452, 160, 160, 160, 160, 160, 160, + 453, 453, 453, 453, 453, 453, 453, 453, + 453, 453, 453, 453, 453, 453, 453, 453, + + 453, 452, 452, 452, 452, 452, 452, 452, + 453, 453, 160, 160, 160, 160, 160, 160, + 329, 454, 455, 456, 457, 458, 459, 460, + 461, 462, 160, 160, 160, 160, 463, 463, + + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 153, + 152, 464, 464, 464, 160, 160, 465, 466, + + 334, 334, 334, 334, 467, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 468, 467, 334, 334, + 334, 334, 334, 467, 334, 467, 467, 467, + + 467, 467, 334, 467, 469, 322, 322, 322, + 322, 322, 322, 322, 160, 160, 160, 160, + 470, 471, 472, 473, 474, 475, 476, 477, + 478, 479, 480, 480, 481, 481, 480, 480, + + 481, 482, 482, 482, 482, 482, 482, 482, + 482, 482, 482, 298, 299, 298, 298, 298, + 298, 298, 298, 298, 482, 482, 482, 482, + 482, 482, 482, 482, 482, 160, 160, 160, + + 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 102, 102, 102, 102, + + 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 483, 483, 483, 483, + 483, 483, 483, 483, 483, 483, 483, 483, + 483, 483, 483, 483, 483, 483, 483, 483, + + 483, 483, 483, 483, 483, 483, 483, 483, + 483, 483, 483, 483, 483, 483, 483, 483, + 483, 483, 483, 483, 483, 483, 483, 483, + 483, 483, 483, 483, 483, 483, 483, 483, + + 483, 483, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 103, 103, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, + 484, 103, 103, 103, 103, 485, 103, 103, + + 103, 103, 103, 103, 103, 103, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, + 103, 103, 103, 484, 484, 484, 484, 484, + + 484, 484, 484, 484, 484, 484, 484, 484, + 484, 484, 484, 484, 484, 484, 484, 484, + 484, 484, 484, 484, 484, 484, 484, 484, + 484, 484, 484, 484, 484, 484, 484, 484, + + 153, 153, 152, 153, 298, 298, 298, 298, + 298, 298, 299, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 298, 299, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 486, 487, + 488, 489, 490, 491, 160, 160, 160, 160, + + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 65, 66, 65, 66, 65, 66, + 65, 66, 160, 160, 160, 160, 160, 160, + + 492, 492, 492, 492, 492, 492, 492, 492, + 493, 493, 493, 493, 493, 493, 493, 493, + 492, 492, 492, 492, 492, 492, 160, 160, + 493, 493, 493, 493, 493, 493, 160, 160, + + 492, 492, 492, 492, 492, 492, 492, 492, + 493, 493, 493, 493, 493, 493, 493, 493, + 492, 492, 492, 492, 492, 492, 492, 492, + 493, 493, 493, 493, 493, 493, 493, 493, + + 492, 492, 492, 492, 492, 492, 160, 160, + 493, 493, 493, 493, 493, 493, 160, 160, + 494, 492, 495, 492, 496, 492, 497, 492, + 160, 493, 160, 493, 160, 493, 160, 493, + + 492, 492, 492, 492, 492, 492, 492, 492, + 493, 493, 493, 493, 493, 493, 493, 493, + 498, 498, 499, 499, 499, 499, 500, 500, + 501, 501, 502, 502, 503, 503, 160, 160, + + 504, 505, 506, 507, 508, 509, 510, 511, + 512, 513, 514, 515, 516, 517, 518, 519, + 520, 521, 522, 523, 524, 525, 526, 527, + 528, 529, 530, 531, 532, 533, 534, 535, + + 536, 537, 538, 539, 540, 541, 542, 543, + 544, 545, 546, 547, 548, 549, 550, 551, + 492, 492, 552, 553, 554, 160, 555, 556, + 493, 493, 557, 557, 558, 42, 559, 42, + + 42, 42, 560, 561, 562, 160, 563, 564, + 565, 565, 565, 565, 566, 42, 42, 42, + 492, 492, 567, 568, 160, 160, 569, 570, + 493, 493, 571, 571, 160, 42, 42, 42, + + 492, 492, 572, 573, 574, 182, 575, 576, + 493, 493, 577, 577, 578, 42, 42, 42, + 160, 160, 579, 580, 581, 160, 582, 583, + 584, 584, 585, 585, 586, 42, 42, 160, + + 587, 587, 587, 587, 587, 587, 587, 588, + 587, 587, 587, 589, 590, 591, 592, 593, + 594, 595, 594, 594, 596, 597, 14, 14, + 598, 599, 600, 601, 598, 602, 600, 601, + + 14, 14, 14, 14, 603, 603, 603, 604, + 605, 606, 607, 608, 609, 610, 611, 612, + 13, 13, 13, 13, 13, 613, 613, 613, + 14, 598, 602, 14, 614, 614, 14, 43, + + 43, 14, 14, 14, 615, 16, 17, 616, + 617, 617, 432, 432, 432, 432, 618, 618, + 618, 618, 185, 619, 620, 621, 622, 618, + 622, 622, 622, 622, 621, 622, 622, 623, + + 624, 625, 625, 625, 160, 160, 160, 160, + 160, 160, 626, 626, 626, 626, 626, 626, + 627, 628, 160, 160, 629, 630, 631, 632, + 633, 634, 635, 635, 36, 16, 17, 50, + + 627, 60, 55, 56, 629, 630, 631, 632, + 633, 634, 635, 635, 36, 16, 17, 160, + 484, 484, 484, 484, 484, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 12, 12, 12, 12, 12, 12, 12, 48, + 12, 12, 12, 636, 637, 429, 429, 429, + 638, 638, 639, 639, 639, 639, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 139, 139, 144, 144, 139, 139, 139, 139, + 144, 144, 144, 139, 139, 273, 273, 273, + + 273, 139, 195, 195, 640, 641, 641, 159, + 642, 159, 641, 643, 299, 299, 299, 299, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 49, 49, 175, 644, 49, 49, 49, 175, + 49, 644, 50, 175, 175, 175, 50, 50, + 175, 175, 175, 50, 49, 175, 645, 49, + 49, 175, 175, 175, 175, 175, 49, 49, + + 49, 49, 49, 49, 175, 49, 646, 49, + 175, 49, 647, 648, 175, 175, 649, 50, + 175, 175, 650, 175, 50, 90, 90, 90, + 90, 131, 651, 239, 103, 628, 652, 652, + + 185, 185, 185, 185, 185, 652, 628, 628, + 628, 628, 653, 185, 418, 301, 654, 160, + 160, 160, 160, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 62, + + 655, 655, 655, 655, 655, 655, 655, 655, + 655, 655, 655, 655, 655, 655, 655, 655, + 656, 656, 656, 656, 656, 656, 656, 656, + 656, 656, 656, 656, 656, 656, 656, 656, + + 657, 657, 657, 99, 109, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 36, 36, 36, 36, 36, 49, 49, 49, + 49, 49, 36, 36, 49, 49, 49, 49, + + 36, 49, 49, 36, 49, 49, 36, 49, + 49, 49, 49, 49, 49, 49, 36, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 36, 36, + 49, 49, 36, 49, 36, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 651, 651, 651, 651, 651, + 651, 651, 651, 651, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + + 36, 36, 36, 36, 36, 36, 36, 36, + 658, 658, 658, 659, 659, 659, 36, 36, + 36, 36, 18, 54, 36, 660, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 661, 662, 36, 36, + + 36, 36, 36, 663, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 661, 662, 661, 662, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + + 36, 36, 36, 36, 661, 662, 661, 662, + 661, 662, 661, 662, 36, 36, 661, 662, + 661, 662, 661, 662, 661, 662, 661, 662, + 661, 662, 661, 662, 661, 662, 661, 662, + + 661, 662, 661, 662, 661, 662, 661, 662, + 661, 662, 661, 662, 36, 36, 36, 661, + 662, 661, 662, 36, 36, 36, 36, 36, + 664, 36, 36, 36, 36, 36, 36, 36, + + 36, 36, 661, 662, 36, 36, 665, 36, + 666, 667, 36, 667, 36, 36, 36, 36, + 661, 662, 661, 662, 661, 662, 661, 662, + 36, 36, 36, 36, 36, 36, 36, 36, + + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 661, 662, 661, 662, 668, 36, 36, + 661, 662, 36, 36, 36, 36, 661, 662, + 661, 662, 661, 662, 661, 662, 661, 662, + + 661, 662, 661, 662, 661, 662, 661, 662, + 661, 662, 661, 662, 661, 662, 36, 36, + 661, 662, 669, 669, 669, 185, 670, 670, + 185, 185, 671, 671, 671, 672, 672, 185, + + 49, 651, 49, 49, 49, 49, 49, 49, + 661, 662, 661, 662, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + + 36, 36, 49, 49, 49, 49, 49, 49, + 49, 16, 17, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, + + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, + + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 651, 185, 651, 651, 651, + + 651, 651, 651, 651, 651, 651, 651, 651, + 651, 651, 651, 651, 651, 651, 651, 651, + 651, 651, 651, 651, 651, 381, 651, 651, + 651, 651, 651, 185, 185, 185, 185, 185, + + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 653, 653, 653, 653, + 653, 653, 653, 653, 653, 653, 653, 653, + + 653, 653, 653, 653, 653, 653, 653, 653, + 653, 653, 653, 653, 653, 653, 653, 239, + 239, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 673, 673, 673, 673, + + 673, 673, 301, 301, 301, 301, 301, 301, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 651, 651, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 674, 675, 676, 677, 678, 679, 680, 681, + 682, 62, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 674, 675, 676, 677, + 678, 679, 680, 681, 682, 62, 62, 62, + + 62, 62, 62, 62, 62, 62, 62, 62, + 60, 55, 56, 629, 630, 631, 632, 633, + 634, 683, 683, 683, 683, 683, 683, 683, + 683, 683, 683, 683, 194, 194, 194, 194, + + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 684, 684, + 684, 684, 684, 684, 684, 684, 684, 684, + + 684, 684, 684, 684, 684, 684, 684, 684, + 684, 684, 684, 684, 684, 684, 684, 684, + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 685, 685, 685, 685, 685, 685, + + 685, 685, 685, 685, 685, 685, 685, 685, + 685, 685, 686, 687, 687, 687, 687, 687, + 687, 687, 687, 687, 687, 688, 689, 690, + 691, 692, 693, 694, 695, 696, 687, 697, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 653, 653, + 653, 653, 653, 653, 653, 653, 653, 653, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 36, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 36, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 651, 651, 651, 651, 651, 651, 651, 651, + 185, 185, 185, 185, 185, 185, 185, 185, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 239, 239, 653, 653, + 418, 651, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 36, + 651, 651, 653, 653, 653, 653, 653, 653, + 653, 653, 653, 653, 653, 653, 418, 418, + + 653, 653, 653, 653, 653, 653, 653, 653, + 653, 653, 239, 239, 239, 239, 239, 239, + 239, 239, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 160, 160, 160, + + 239, 239, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 405, 418, 418, 418, + 418, 418, 301, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 49, 49, 49, 49, 160, 49, 49, + 49, 49, 160, 160, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, + 160, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 160, 49, 160, 49, + 49, 49, 49, 160, 160, 160, 49, 160, + 49, 49, 49, 698, 698, 698, 698, 160, + + 160, 49, 699, 699, 49, 49, 49, 49, + 700, 701, 700, 701, 700, 701, 700, 701, + 700, 701, 700, 701, 700, 701, 674, 675, + 676, 677, 678, 679, 680, 681, 682, 62, + + 674, 675, 676, 677, 678, 679, 680, 681, + 682, 62, 674, 675, 676, 677, 678, 679, + 680, 681, 682, 62, 49, 160, 160, 160, + 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, + 160, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 160, + + 702, 702, 702, 703, 704, 705, 706, 673, + 673, 673, 673, 160, 160, 160, 160, 160, + 185, 185, 185, 185, 185, 707, 708, 185, + 185, 185, 185, 185, 185, 707, 708, 185, + + 185, 185, 707, 708, 707, 708, 700, 701, + 700, 701, 700, 701, 160, 160, 160, 160, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + + 381, 381, 381, 381, 381, 381, 381, 381, + 381, 381, 381, 381, 381, 381, 381, 381, + 381, 381, 381, 381, 381, 381, 381, 381, + 381, 381, 381, 381, 381, 381, 381, 381, + + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + + 185, 185, 185, 700, 701, 700, 701, 700, + 701, 700, 701, 700, 701, 709, 710, 711, + 712, 700, 701, 700, 701, 700, 701, 700, + 701, 185, 185, 185, 185, 185, 185, 185, + + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 713, 185, 185, 185, 185, 185, 185, 185, + + 707, 708, 185, 185, 707, 708, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 707, + 708, 707, 708, 185, 707, 708, 185, 185, + 700, 701, 700, 701, 185, 185, 185, 185, + + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 714, 185, 185, + 707, 708, 185, 185, 700, 701, 185, 185, + + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 707, 708, 707, 708, 185, + 185, 185, 185, 185, 707, 708, 185, 185, + 185, 185, 185, 185, 707, 708, 185, 185, + + 185, 185, 185, 185, 707, 708, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, + 185, 707, 708, 185, 185, 707, 708, 707, + + 708, 707, 708, 707, 708, 185, 185, 185, + 185, 185, 185, 707, 708, 185, 185, 185, + 185, 707, 708, 707, 708, 707, 708, 707, + 708, 707, 708, 707, 708, 185, 185, 185, + + 185, 707, 708, 185, 185, 185, 707, 708, + 707, 708, 707, 708, 707, 708, 185, 707, + 708, 185, 185, 707, 708, 185, 185, 185, + 185, 185, 185, 707, 708, 707, 708, 707, + + 708, 707, 708, 707, 708, 707, 708, 185, + 185, 185, 185, 185, 185, 707, 708, 707, + 708, 707, 708, 707, 708, 707, 708, 185, + 185, 185, 185, 185, 185, 185, 715, 185, + + 185, 185, 185, 716, 717, 716, 185, 185, + 185, 185, 185, 185, 707, 708, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 707, + 708, 707, 708, 185, 185, 185, 185, 185, + + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 418, 418, + 418, 418, 418, 418, 301, 301, 301, 301, + 301, 301, 301, 160, 160, 160, 160, 160, + + 301, 301, 301, 301, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 718, 718, 718, 718, 718, 718, 718, 718, + 718, 718, 718, 718, 718, 718, 718, 718, + 718, 718, 718, 718, 718, 718, 718, 718, + 718, 718, 718, 718, 718, 718, 718, 718, + + 718, 718, 718, 718, 718, 718, 718, 718, + 718, 718, 718, 718, 718, 718, 718, 160, + 719, 719, 719, 719, 719, 719, 719, 719, + 719, 719, 719, 719, 719, 719, 719, 719, + + 719, 719, 719, 719, 719, 719, 719, 719, + 719, 719, 719, 719, 719, 719, 719, 719, + 719, 719, 719, 719, 719, 719, 719, 719, + 719, 719, 719, 719, 719, 719, 719, 160, + + 113, 109, 720, 721, 722, 723, 724, 113, + 109, 113, 109, 113, 109, 160, 160, 160, + 160, 160, 160, 160, 725, 113, 109, 725, + 160, 160, 160, 160, 160, 160, 160, 160, + + 105, 106, 105, 106, 105, 106, 105, 106, + 105, 106, 105, 106, 105, 106, 105, 106, + 105, 106, 105, 106, 105, 106, 105, 106, + 105, 106, 105, 106, 105, 106, 105, 106, + + 105, 106, 105, 106, 103, 418, 418, 418, + 418, 418, 418, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 622, 622, 622, 622, 726, 622, 622, + + 727, 727, 727, 727, 727, 727, 727, 727, + 727, 727, 727, 727, 727, 727, 727, 727, + 727, 727, 727, 727, 727, 727, 727, 727, + 727, 727, 727, 727, 727, 727, 727, 727, + + 727, 727, 727, 727, 727, 727, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + + 323, 323, 323, 323, 323, 323, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 401, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 323, 323, 323, 323, 323, 323, 323, 160, + 323, 323, 323, 323, 323, 323, 323, 160, + 323, 323, 323, 323, 323, 323, 323, 160, + 323, 323, 323, 323, 323, 323, 323, 160, + + 728, 728, 729, 730, 729, 730, 728, 728, + 728, 729, 730, 728, 729, 730, 622, 622, + 622, 622, 622, 622, 622, 622, 621, 731, + 160, 160, 160, 160, 729, 730, 160, 160, + + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 160, 732, 732, 732, 732, 732, + + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 160, 160, 160, 160, + + 733, 734, 735, 736, 737, 738, 739, 740, + 16, 17, 16, 17, 16, 17, 16, 17, + 16, 17, 737, 737, 16, 17, 16, 17, + 16, 17, 16, 17, 741, 16, 17, 742, + + 737, 740, 740, 740, 740, 740, 740, 740, + 740, 740, 743, 744, 140, 745, 746, 746, + 747, 748, 748, 748, 748, 748, 737, 737, + 749, 749, 749, 750, 751, 752, 732, 737, + + 160, 753, 739, 753, 739, 753, 739, 753, + 739, 753, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + + 739, 739, 739, 753, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + + 739, 739, 739, 753, 739, 753, 739, 753, + 739, 739, 739, 739, 739, 739, 753, 739, + 739, 739, 739, 739, 739, 754, 754, 160, + 160, 755, 755, 756, 756, 757, 757, 758, + + 759, 760, 761, 760, 761, 760, 761, 760, + 761, 760, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + + 761, 761, 761, 760, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + + 761, 761, 761, 760, 761, 760, 761, 760, + 761, 761, 761, 761, 761, 761, 760, 761, + 761, 761, 761, 761, 761, 760, 760, 761, + 761, 761, 761, 762, 763, 763, 763, 764, + + 160, 160, 160, 160, 160, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, + + 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 160, 160, 160, + 160, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, + + 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 765, + + 765, 765, 765, 765, 765, 765, 765, 765, + 765, 765, 765, 765, 765, 765, 765, 160, + 766, 766, 767, 767, 767, 767, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 768, 768, 768, + 160, 160, 160, 160, 160, 160, 160, 160, + + 769, 769, 769, 769, 769, 769, 769, 769, + 769, 769, 769, 769, 769, 769, 769, 769, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 770, 770, 770, 770, 770, 770, 770, 770, + 770, 770, 770, 770, 770, 770, 770, 770, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 771, 771, 160, + + 767, 767, 767, 767, 767, 767, 767, 767, + 767, 767, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + + 766, 766, 766, 766, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 771, 772, 772, 772, 772, 772, 772, 772, + 772, 772, 772, 772, 772, 772, 772, 772, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 771, 771, 769, 766, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 772, 772, 772, 772, 772, 772, 772, + 772, 772, 772, 772, 772, 772, 772, 772, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 771, 771, 771, 771, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 160, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 771, + 771, 771, 771, 766, 766, 766, 766, 766, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 771, 771, + + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 766, + 766, 766, 766, 766, 766, 766, 766, 771, + + 773, 773, 773, 773, 773, 773, 773, 773, + 773, 773, 773, 773, 773, 773, 773, 773, + 773, 773, 773, 773, 773, 773, 773, 773, + 773, 773, 773, 773, 773, 773, 773, 773, + + 773, 773, 773, 773, 773, 773, 773, 773, + 773, 773, 773, 773, 773, 773, 773, 773, + 773, 773, 773, 773, 773, 773, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 739, 739, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 739, 739, + + 739, 739, 739, 739, 739, 739, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 160, 160, 160, 160, + + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 775, 768, 768, + 768, 768, 768, 768, 768, 768, 768, 768, + + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 768, 768, 768, + + 768, 768, 768, 768, 768, 768, 768, 768, + 768, 768, 768, 768, 768, 160, 160, 160, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + + 732, 732, 776, 776, 732, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + 732, 732, 732, 732, 776, 732, 732, 732, + 732, 732, 732, 732, 732, 732, 732, 732, + + 732, 776, 732, 732, 732, 776, 732, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 778, + 778, 778, 778, 160, 160, 160, 160, 160, + + 779, 779, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 323, 323, 780, 323, 323, 323, 781, 323, + 323, 323, 323, 782, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, + + 323, 323, 323, 464, 464, 782, 782, 464, + 418, 418, 418, 418, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 783, 783, 304, 304, + 160, 160, 160, 160, 160, 160, 160, 160, + + 784, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 784, 785, 785, 785, + + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 784, 785, 785, 785, 785, 785, 785, 785, + + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 784, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 784, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 784, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + + 785, 785, 785, 785, 785, 785, 785, 785, + 784, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + + 785, 785, 785, 785, 784, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + 785, 785, 785, 785, 785, 785, 785, 785, + + 785, 785, 785, 785, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 786, 786, 786, 786, 786, 786, 786, 786, + 786, 786, 786, 786, 786, 786, 786, 786, + 786, 786, 786, 786, 786, 786, 786, 786, + 786, 786, 786, 786, 786, 786, 786, 786, + + 787, 787, 787, 787, 787, 787, 787, 787, + 787, 787, 787, 787, 787, 787, 787, 787, + 787, 787, 787, 787, 787, 787, 787, 787, + 787, 787, 787, 787, 787, 787, 787, 787, + + 739, 739, 739, 739, 739, 739, 739, 739, + 739, 739, 739, 739, 739, 739, 160, 160, + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 160, 160, 160, 160, 160, + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 774, 774, 774, 774, 774, 774, + 774, 774, 160, 160, 160, 160, 160, 160, + + 789, 790, 791, 792, 793, 794, 795, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 796, 797, 798, 799, 800, + 160, 160, 160, 160, 160, 801, 802, 231, + + 231, 231, 231, 231, 231, 231, 231, 231, + 231, 635, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 205, + 231, 231, 231, 231, 231, 205, 231, 205, + + 231, 231, 205, 231, 231, 205, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 235, 235, 235, 235, 235, 235, + 235, 235, 235, 235, 235, 235, 235, 235, + + 235, 235, 235, 235, 235, 235, 235, 235, + 235, 235, 235, 235, 235, 235, 235, 235, + 235, 235, 235, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 600, 742, + + 235, 235, 235, 235, 235, 235, 235, 235, + 235, 235, 235, 235, 235, 235, 235, 235, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 235, 235, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + + 243, 243, 243, 243, 243, 243, 243, 243, + 235, 235, 235, 235, 235, 235, 235, 235, + 803, 803, 803, 803, 803, 803, 803, 803, + 803, 803, 803, 803, 803, 803, 803, 803, + + 803, 803, 803, 803, 803, 803, 803, 803, + 803, 803, 803, 803, 803, 803, 803, 803, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 804, 239, 235, 235, + + 423, 423, 423, 423, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 423, 423, + 805, 806, 806, 805, 805, 807, 807, 808, + 809, 810, 160, 160, 160, 160, 160, 160, + + 139, 139, 139, 139, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 736, 747, 747, 811, 811, 600, 742, 600, + 742, 600, 742, 600, 742, 600, 742, 600, + + 742, 600, 742, 600, 742, 752, 752, 812, + 813, 736, 736, 736, 736, 811, 811, 811, + 814, 736, 815, 160, 762, 816, 9, 9, + 747, 16, 17, 16, 17, 16, 17, 817, + + 736, 736, 818, 819, 820, 821, 822, 160, + 736, 12, 13, 736, 160, 160, 160, 160, + 243, 243, 243, 286, 243, 235, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 235, 235, 823, + + 160, 9, 736, 817, 12, 13, 736, 736, + 16, 17, 736, 818, 814, 819, 815, 824, + 825, 826, 827, 828, 829, 830, 831, 832, + 833, 834, 816, 762, 835, 822, 836, 9, + + 736, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 39, 736, 41, 838, 811, + + 838, 839, 839, 839, 839, 839, 839, 839, + 839, 839, 839, 839, 839, 839, 839, 839, + 839, 839, 839, 839, 839, 839, 839, 839, + 839, 839, 839, 39, 822, 41, 822, 700, + + 701, 735, 16, 17, 734, 762, 840, 760, + 760, 760, 760, 760, 760, 760, 760, 760, + 763, 840, 840, 840, 840, 840, 840, 840, + 840, 840, 840, 840, 840, 840, 840, 840, + + 840, 840, 840, 840, 840, 840, 840, 840, + 840, 840, 840, 840, 840, 840, 840, 840, + 840, 840, 840, 840, 840, 840, 840, 840, + 840, 840, 840, 840, 840, 840, 763, 763, + + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 160, + + 160, 160, 90, 90, 90, 90, 90, 90, + 160, 160, 90, 90, 90, 90, 90, 90, + 160, 160, 90, 90, 90, 90, 90, 90, + 160, 160, 90, 90, 90, 160, 160, 160, + + 48, 12, 822, 838, 737, 12, 12, 160, + 49, 36, 36, 36, 36, 49, 49, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 841, 841, 841, 842, 49, 843, 843, + + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 160, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + + 308, 308, 308, 308, 308, 308, 308, 160, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 160, 308, 308, 160, 308, + + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 160, 160, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 160, 160, + + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 160, 160, 160, 160, 160, + + 844, 845, 846, 160, 160, 160, 160, 847, + 847, 847, 847, 847, 847, 847, 847, 847, + 847, 847, 847, 847, 847, 847, 847, 847, + 847, 847, 847, 847, 847, 847, 847, 847, + + 847, 847, 847, 847, 847, 847, 847, 847, + 847, 847, 847, 847, 847, 847, 847, 847, + 847, 847, 847, 847, 160, 160, 160, 848, + 848, 848, 848, 848, 848, 848, 848, 848, + + 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, + + 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 726, 726, 726, + 726, 418, 418, 418, 418, 418, 418, 418, + + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 726, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 850, 850, 850, 850, 850, 850, 850, 850, + 850, 850, 850, 850, 850, 850, 850, 850, + 850, 850, 850, 850, 850, 850, 850, 850, + 850, 850, 850, 850, 850, 850, 850, 160, + + 851, 851, 851, 851, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 850, 850, 850, 850, 850, 850, 850, 850, + 850, 850, 850, 850, 850, 850, 850, 850, + + 850, 852, 850, 850, 850, 850, 850, 850, + 850, 850, 852, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 160, 844, + + 323, 323, 323, 323, 160, 160, 160, 160, + 323, 323, 323, 323, 323, 323, 323, 323, + 465, 853, 853, 853, 853, 853, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 854, 854, 854, 854, 854, 854, 854, 854, + 854, 854, 854, 854, 854, 854, 854, 854, + 854, 854, 854, 854, 854, 854, 854, 854, + 854, 854, 854, 854, 854, 854, 854, 854, + + 854, 854, 854, 854, 854, 854, 855, 855, + 856, 856, 856, 856, 856, 856, 856, 856, + 856, 856, 856, 856, 856, 856, 856, 856, + 856, 856, 856, 856, 856, 856, 856, 856, + + 856, 856, 856, 856, 856, 856, 856, 856, + 856, 856, 856, 856, 856, 856, 857, 857, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 160, 160, + + 441, 442, 443, 444, 445, 446, 447, 448, + 449, 450, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 858, 858, 858, 858, 858, 858, 205, 205, + 858, 205, 858, 858, 858, 858, 858, 858, + 858, 858, 858, 858, 858, 858, 858, 858, + 858, 858, 858, 858, 858, 858, 858, 858, + + 858, 858, 858, 858, 858, 858, 858, 858, + 858, 858, 858, 858, 858, 858, 858, 858, + 858, 858, 858, 858, 858, 858, 205, 858, + 858, 205, 205, 205, 858, 205, 205, 858, + + 859, 859, 859, 859, 859, 859, 859, 859, + 859, 859, 859, 859, 859, 859, 859, 859, + 859, 859, 859, 859, 859, 859, 860, 860, + 860, 860, 205, 205, 205, 205, 205, 861, + + 862, 782, 782, 782, 205, 782, 782, 205, + 205, 205, 205, 205, 782, 152, 782, 153, + 862, 862, 862, 862, 205, 862, 862, 862, + 205, 862, 862, 862, 862, 862, 862, 862, + + 862, 862, 862, 862, 862, 862, 862, 862, + 862, 862, 862, 862, 862, 862, 862, 862, + 862, 862, 862, 862, 205, 205, 205, 205, + 153, 643, 152, 205, 205, 205, 205, 781, + + 863, 864, 865, 866, 867, 867, 867, 867, + 205, 205, 205, 205, 205, 205, 205, 205, + 868, 868, 868, 868, 868, 868, 868, 868, + 869, 205, 205, 205, 205, 205, 205, 205, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 322, 322, 322, 322, 322, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 870, 870, 870, 870, 870, + 870, 870, 870, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 481, 481, 481, 481, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 160, + 160, 160, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 872, 873, 874, + 874, 874, 871, 871, 871, 875, 872, 872, + 872, 872, 872, 876, 876, 876, 876, 876, + 876, 876, 876, 877, 877, 877, 877, 877, + 877, 877, 877, 871, 871, 878, 878, 878, + 878, 878, 877, 877, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 878, 878, 878, 878, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 871, 871, + 871, 871, 871, 871, 871, 871, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 153, 153, 153, 418, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 879, 879, 879, 879, 879, 879, 879, 879, + 879, 879, 879, 879, 879, 879, 879, 879, + 879, 879, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 881, 881, + 881, 881, 881, 881, 881, 160, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 880, 160, 880, 880, + 160, 160, 880, 160, 160, 880, 880, 160, + 160, 880, 880, 880, 880, 160, 880, 880, + 880, 880, 880, 880, 880, 880, 881, 881, + 881, 881, 160, 881, 160, 881, 881, 881, + 881, 102, 881, 881, 160, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + + 881, 881, 881, 881, 880, 880, 160, 880, + 880, 880, 880, 160, 160, 880, 880, 880, + 880, 880, 880, 880, 880, 160, 880, 880, + 880, 880, 880, 880, 880, 160, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 880, 880, 160, 880, 880, 880, 880, 160, + 880, 880, 880, 880, 880, 160, 880, 160, + 160, 160, 880, 880, 880, 880, 880, 880, + 880, 160, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + + 881, 881, 881, 881, 881, 881, 881, 881, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 103, 103, 160, 160, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 882, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 882, 881, 881, 881, 881, + 881, 881, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 882, 881, 881, 881, 881, + + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 882, 881, 881, + 881, 881, 881, 881, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 882, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 882, + 881, 881, 881, 881, 881, 881, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 882, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 882, 881, 881, 881, 881, 881, 881, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 880, 880, 880, 880, 880, 880, 880, + 880, 882, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 881, 881, 881, 881, 881, + 881, 881, 881, 882, 881, 881, 881, 881, + 881, 881, 883, 725, 160, 160, 884, 885, + 886, 887, 888, 889, 890, 891, 892, 893, + 884, 885, 886, 887, 888, 889, 890, 891, + 892, 893, 884, 885, 886, 887, 888, 889, + 890, 891, 892, 893, 884, 885, 886, 887, + 888, 889, 890, 891, 892, 893, 884, 885, + 886, 887, 888, 889, 890, 891, 892, 893, + + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 894, 894, + + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 160, 876, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 876, 876, 876, 876, 876, 876, 876, 876, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, + 160, 160, 160, 160, 160, 160, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, + + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 894, 894, }; #define GET_PROP_INDEX(ucs4) \ @@ -3618,6 +3618,7 @@ static const QUnicodeTables::Properties uc_properties [] = { { 15, 11, 0, 0, 0, -1, 4, 0, 0, 0, 0, 0, 80, 0, 0, 80, 0, 3, 5}, { 15, 11, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 80, 0, 0, 80, 0, 3, 5}, { 16, 11, 0, 0, 0, -1, 4, 0, 0, 0, 0, 0, 0, -80, -80, 0, 0, 3, 4}, + { 16, 11, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, -80, -80, 0, 0, 3, 4}, { 30, 11, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 3, 19, 17, 0, 0, -1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0}, { 15, 11, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 15, 0, 0, 15, 0, 3, 5}, @@ -4335,13 +4336,13 @@ static inline const QUnicodeTables::Properties *qGetProp(ushort ucs2) return uc_properties + index; } -Q_CORE_EXPORT const QUnicodeTables::Properties* QT_FASTCALL QUnicodeTables::properties(uint ucs4) +Q_CORE_EXPORT const QUnicodeTables::Properties *QUnicodeTables::properties(uint ucs4) { int index = GET_PROP_INDEX(ucs4); return uc_properties + index; } -Q_CORE_EXPORT const QUnicodeTables::Properties* QT_FASTCALL QUnicodeTables::properties(ushort ucs2) +Q_CORE_EXPORT const QUnicodeTables::Properties *QUnicodeTables::properties(ushort ucs2) { int index = GET_PROP_INDEX_UCS2(ucs2); return uc_properties + index; @@ -4382,1446 +4383,1446 @@ static const ushort specialCaseMap [] = { static const unsigned short uc_decomposition_trie[] = { // 0 - 0x3400 - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1564, 1580, 1596, 1612, 1628, 1644, - 1660, 1676, 1692, 1708, 1724, 1740, 1756, 1772, - 1548, 1548, 1788, 1804, 1820, 1836, 1852, 1868, - 1884, 1900, 1916, 1932, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1948, 1548, 1964, 1980, 1548, - 1548, 1548, 1548, 1548, 1996, 1548, 1548, 2012, - 2028, 2044, 2060, 2076, 2092, 2108, 1548, 2124, - 2140, 2156, 1548, 2172, 1548, 2188, 1548, 2204, - 1548, 1548, 1548, 1548, 2220, 2236, 2252, 2268, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 2284, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 2300, 1548, 1548, 1548, 1548, 2316, - 1548, 1548, 1548, 1548, 2332, 2348, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 2364, 2380, 1548, 2396, 1548, 1548, - 1548, 1548, 1548, 1548, 2412, 2428, 1548, 1548, - 1548, 1548, 1548, 2444, 1548, 2460, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 2476, 2492, 1548, 1548, - 1548, 2508, 1548, 1548, 2524, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 2540, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 2556, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 2572, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 2588, 1548, 1548, - 1548, 1548, 1548, 2604, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 2620, 1548, 2636, 1548, 1548, - 2652, 1548, 1548, 1548, 2668, 2684, 2700, 2716, - 2732, 2748, 2764, 2780, 1548, 1548, 1548, 1548, - - 1548, 1548, 2796, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 2812, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 2828, 2844, 1548, 2860, 2876, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 2892, 2908, 2924, 2940, 2956, 2972, - 1548, 2988, 3004, 3020, 1548, 1548, 1548, 1548, - 3036, 3052, 3068, 3084, 3100, 3116, 3132, 3148, - 3164, 3180, 3196, 3212, 3228, 3244, 3260, 3276, - 3292, 3308, 3324, 3340, 3356, 3372, 3388, 3404, - 3420, 3436, 3452, 3468, 3484, 3500, 3516, 3532, - - 3548, 3564, 3580, 3596, 3612, 3628, 1548, 3644, - 3660, 3676, 3692, 1548, 1548, 1548, 1548, 1548, - 3708, 3724, 3740, 3756, 3772, 3788, 3804, 3820, - 1548, 3836, 3852, 1548, 3868, 1548, 1548, 1548, - 3884, 1548, 3900, 3916, 3932, 1548, 3948, 3964, - 3980, 1548, 3996, 1548, 1548, 1548, 4012, 1548, - 1548, 1548, 4028, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 4044, 4060, - 4076, 4092, 4108, 4124, 4140, 4156, 4172, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 4188, 1548, 1548, 1548, 1548, 1548, 1548, 4204, - 1548, 1548, 1548, 1548, 1548, 4220, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 4236, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, - 1548, 4252, 1548, 1548, 1548, 1548, 1548, 4268, - 4284, 4300, 4316, 4332, 4348, 4364, 4380, 4396, - 4412, 4428, 4444, 4460, 4476, 4492, 1548, 1548, - - 4508, 1548, 1548, 4524, 4540, 4556, 4572, 4588, - 1548, 4604, 4620, 4636, 4652, 4668, 1548, 4684, - 1548, 1548, 1548, 4700, 4716, 4732, 4748, 4764, - 4780, 4796, 1548, 1548, 1548, 1548, 1548, 1548, - 4812, 4828, 4844, 4860, 4876, 4892, 4908, 4924, - 4940, 4956, 4972, 4988, 5004, 5020, 5036, 5052, - 5068, 5084, 5100, 5116, 5132, 5148, 5164, 5180, - 5196, 5212, 5228, 5244, 5260, 5276, 5292, 5308, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1564, 1580, 1596, 1612, 1628, 1644, + 1660, 1676, 1692, 1708, 1724, 1740, 1756, 1772, + 1548, 1548, 1788, 1804, 1820, 1836, 1852, 1868, + 1884, 1900, 1916, 1932, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1948, 1548, 1964, 1980, 1548, + 1548, 1548, 1548, 1548, 1996, 1548, 1548, 2012, + 2028, 2044, 2060, 2076, 2092, 2108, 1548, 2124, + 2140, 2156, 1548, 2172, 1548, 2188, 1548, 2204, + 1548, 1548, 1548, 1548, 2220, 2236, 2252, 2268, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 2284, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 2300, 1548, 1548, 1548, 1548, 2316, + 1548, 1548, 1548, 1548, 2332, 2348, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 2364, 2380, 1548, 2396, 1548, 1548, + 1548, 1548, 1548, 1548, 2412, 2428, 1548, 1548, + 1548, 1548, 1548, 2444, 1548, 2460, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 2476, 2492, 1548, 1548, + 1548, 2508, 1548, 1548, 2524, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 2540, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 2556, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 2572, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 2588, 1548, 1548, + 1548, 1548, 1548, 2604, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 2620, 1548, 2636, 1548, 1548, + 2652, 1548, 1548, 1548, 2668, 2684, 2700, 2716, + 2732, 2748, 2764, 2780, 1548, 1548, 1548, 1548, + + 1548, 1548, 2796, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 2812, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 2828, 2844, 1548, 2860, 2876, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 2892, 2908, 2924, 2940, 2956, 2972, + 1548, 2988, 3004, 3020, 1548, 1548, 1548, 1548, + 3036, 3052, 3068, 3084, 3100, 3116, 3132, 3148, + 3164, 3180, 3196, 3212, 3228, 3244, 3260, 3276, + 3292, 3308, 3324, 3340, 3356, 3372, 3388, 3404, + 3420, 3436, 3452, 3468, 3484, 3500, 3516, 3532, + + 3548, 3564, 3580, 3596, 3612, 3628, 1548, 3644, + 3660, 3676, 3692, 1548, 1548, 1548, 1548, 1548, + 3708, 3724, 3740, 3756, 3772, 3788, 3804, 3820, + 1548, 3836, 3852, 1548, 3868, 1548, 1548, 1548, + 3884, 1548, 3900, 3916, 3932, 1548, 3948, 3964, + 3980, 1548, 3996, 1548, 1548, 1548, 4012, 1548, + 1548, 1548, 4028, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 4044, 4060, + 4076, 4092, 4108, 4124, 4140, 4156, 4172, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 4188, 1548, 1548, 1548, 1548, 1548, 1548, 4204, + 1548, 1548, 1548, 1548, 1548, 4220, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 4236, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 1548, 1548, 1548, 1548, 1548, 1548, 1548, + 1548, 4252, 1548, 1548, 1548, 1548, 1548, 4268, + 4284, 4300, 4316, 4332, 4348, 4364, 4380, 4396, + 4412, 4428, 4444, 4460, 4476, 4492, 1548, 1548, + + 4508, 1548, 1548, 4524, 4540, 4556, 4572, 4588, + 1548, 4604, 4620, 4636, 4652, 4668, 1548, 4684, + 1548, 1548, 1548, 4700, 4716, 4732, 4748, 4764, + 4780, 4796, 1548, 1548, 1548, 1548, 1548, 1548, + 4812, 4828, 4844, 4860, 4876, 4892, 4908, 4924, + 4940, 4956, 4972, 4988, 5004, 5020, 5036, 5052, + 5068, 5084, 5100, 5116, 5132, 5148, 5164, 5180, + 5196, 5212, 5228, 5244, 5260, 5276, 5292, 5308, // 0x3400 - 0x30000 - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - - 5324, 5324, 5324, 5324, 5324, 5580, 5836, 6092, - 6348, 6604, 6860, 7116, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 7372, 5324, 5324, - 7628, 7884, 8140, 8396, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, - - 5324, 5324, 5324, 5324, 8652, 8908, 9164, 5324, - 5324, 5324, 5324, 5324, - - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0x0, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x2, 0xffff, 0x5, 0xffff, 0xffff, 0xffff, 0xffff, 0x7, - - 0xffff, 0xffff, 0xa, 0xc, 0xe, 0x11, 0xffff, 0xffff, - 0x13, 0x16, 0x18, 0xffff, 0x1a, 0x1e, 0x22, 0xffff, - - 0x26, 0x29, 0x2c, 0x2f, 0x32, 0x35, 0xffff, 0x38, - 0x3b, 0x3e, 0x41, 0x44, 0x47, 0x4a, 0x4d, 0x50, - - 0xffff, 0x53, 0x56, 0x59, 0x5c, 0x5f, 0x62, 0xffff, - 0xffff, 0x65, 0x68, 0x6b, 0x6e, 0x71, 0xffff, 0xffff, - - 0x74, 0x77, 0x7a, 0x7d, 0x80, 0x83, 0xffff, 0x86, - 0x89, 0x8c, 0x8f, 0x92, 0x95, 0x98, 0x9b, 0x9e, - - 0xffff, 0xa1, 0xa4, 0xa7, 0xaa, 0xad, 0xb0, 0xffff, - 0xffff, 0xb3, 0xb6, 0xb9, 0xbc, 0xbf, 0xffff, 0xc2, - - 0xc5, 0xc8, 0xcb, 0xce, 0xd1, 0xd4, 0xd7, 0xda, - 0xdd, 0xe0, 0xe3, 0xe6, 0xe9, 0xec, 0xef, 0xf2, - - 0xffff, 0xffff, 0xf5, 0xf8, 0xfb, 0xfe, 0x101, 0x104, - 0x107, 0x10a, 0x10d, 0x110, 0x113, 0x116, 0x119, 0x11c, - - 0x11f, 0x122, 0x125, 0x128, 0x12b, 0x12e, 0xffff, 0xffff, - 0x131, 0x134, 0x137, 0x13a, 0x13d, 0x140, 0x143, 0x146, - - 0x149, 0xffff, 0x14c, 0x14f, 0x152, 0x155, 0x158, 0x15b, - 0xffff, 0x15e, 0x161, 0x164, 0x167, 0x16a, 0x16d, 0x170, - - 0x173, 0xffff, 0xffff, 0x176, 0x179, 0x17c, 0x17f, 0x182, - 0x185, 0x188, 0xffff, 0xffff, 0x18b, 0x18e, 0x191, 0x194, - - 0x197, 0x19a, 0xffff, 0xffff, 0x19d, 0x1a0, 0x1a3, 0x1a6, - 0x1a9, 0x1ac, 0x1af, 0x1b2, 0x1b5, 0x1b8, 0x1bb, 0x1be, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + + 5324, 5324, 5324, 5324, 5324, 5580, 5836, 6092, + 6348, 6604, 6860, 7116, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 7372, 5324, 5324, + 7628, 7884, 8140, 8396, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + 5324, 5324, 5324, 5324, 5324, 5324, 5324, 5324, + + 5324, 5324, 5324, 5324, 8652, 8908, 9164, 5324, + 5324, 5324, 5324, 5324, + + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0x0, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x2, 0xffff, 0x5, 0xffff, 0xffff, 0xffff, 0xffff, 0x7, + + 0xffff, 0xffff, 0xa, 0xc, 0xe, 0x11, 0xffff, 0xffff, + 0x13, 0x16, 0x18, 0xffff, 0x1a, 0x1e, 0x22, 0xffff, + + 0x26, 0x29, 0x2c, 0x2f, 0x32, 0x35, 0xffff, 0x38, + 0x3b, 0x3e, 0x41, 0x44, 0x47, 0x4a, 0x4d, 0x50, + + 0xffff, 0x53, 0x56, 0x59, 0x5c, 0x5f, 0x62, 0xffff, + 0xffff, 0x65, 0x68, 0x6b, 0x6e, 0x71, 0xffff, 0xffff, + + 0x74, 0x77, 0x7a, 0x7d, 0x80, 0x83, 0xffff, 0x86, + 0x89, 0x8c, 0x8f, 0x92, 0x95, 0x98, 0x9b, 0x9e, + + 0xffff, 0xa1, 0xa4, 0xa7, 0xaa, 0xad, 0xb0, 0xffff, + 0xffff, 0xb3, 0xb6, 0xb9, 0xbc, 0xbf, 0xffff, 0xc2, + + 0xc5, 0xc8, 0xcb, 0xce, 0xd1, 0xd4, 0xd7, 0xda, + 0xdd, 0xe0, 0xe3, 0xe6, 0xe9, 0xec, 0xef, 0xf2, + + 0xffff, 0xffff, 0xf5, 0xf8, 0xfb, 0xfe, 0x101, 0x104, + 0x107, 0x10a, 0x10d, 0x110, 0x113, 0x116, 0x119, 0x11c, + + 0x11f, 0x122, 0x125, 0x128, 0x12b, 0x12e, 0xffff, 0xffff, + 0x131, 0x134, 0x137, 0x13a, 0x13d, 0x140, 0x143, 0x146, + + 0x149, 0xffff, 0x14c, 0x14f, 0x152, 0x155, 0x158, 0x15b, + 0xffff, 0x15e, 0x161, 0x164, 0x167, 0x16a, 0x16d, 0x170, + + 0x173, 0xffff, 0xffff, 0x176, 0x179, 0x17c, 0x17f, 0x182, + 0x185, 0x188, 0xffff, 0xffff, 0x18b, 0x18e, 0x191, 0x194, + + 0x197, 0x19a, 0xffff, 0xffff, 0x19d, 0x1a0, 0x1a3, 0x1a6, + 0x1a9, 0x1ac, 0x1af, 0x1b2, 0x1b5, 0x1b8, 0x1bb, 0x1be, - 0x1c1, 0x1c4, 0x1c7, 0x1ca, 0x1cd, 0x1d0, 0xffff, 0xffff, - 0x1d3, 0x1d6, 0x1d9, 0x1dc, 0x1df, 0x1e2, 0x1e5, 0x1e8, + 0x1c1, 0x1c4, 0x1c7, 0x1ca, 0x1cd, 0x1d0, 0xffff, 0xffff, + 0x1d3, 0x1d6, 0x1d9, 0x1dc, 0x1df, 0x1e2, 0x1e5, 0x1e8, - 0x1eb, 0x1ee, 0x1f1, 0x1f4, 0x1f7, 0x1fa, 0x1fd, 0x200, - 0x203, 0x206, 0x209, 0x20c, 0x20f, 0x212, 0x215, 0x218, + 0x1eb, 0x1ee, 0x1f1, 0x1f4, 0x1f7, 0x1fa, 0x1fd, 0x200, + 0x203, 0x206, 0x209, 0x20c, 0x20f, 0x212, 0x215, 0x218, - 0x21a, 0x21d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x220, + 0x21a, 0x21d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x220, - 0x223, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x223, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x226, 0x229, 0x22c, 0x22f, - 0x232, 0x235, 0x238, 0x23b, 0x23e, 0x241, 0x244, 0x247, + 0xffff, 0xffff, 0xffff, 0xffff, 0x226, 0x229, 0x22c, 0x22f, + 0x232, 0x235, 0x238, 0x23b, 0x23e, 0x241, 0x244, 0x247, - 0x24a, 0x24d, 0x250, 0x253, 0x256, 0x259, 0x25c, 0x25f, - 0x262, 0x265, 0x268, 0x26b, 0x26e, 0xffff, 0x271, 0x274, + 0x24a, 0x24d, 0x250, 0x253, 0x256, 0x259, 0x25c, 0x25f, + 0x262, 0x265, 0x268, 0x26b, 0x26e, 0xffff, 0x271, 0x274, - 0x277, 0x27a, 0x27d, 0x280, 0xffff, 0xffff, 0x283, 0x286, - 0x289, 0x28c, 0x28f, 0x292, 0x295, 0x298, 0x29b, 0x29e, + 0x277, 0x27a, 0x27d, 0x280, 0xffff, 0xffff, 0x283, 0x286, + 0x289, 0x28c, 0x28f, 0x292, 0x295, 0x298, 0x29b, 0x29e, - 0x2a1, 0x2a4, 0x2a7, 0x2aa, 0x2ad, 0x2b0, 0xffff, 0xffff, - 0x2b3, 0x2b6, 0x2b9, 0x2bc, 0x2bf, 0x2c2, 0x2c5, 0x2c8, + 0x2a1, 0x2a4, 0x2a7, 0x2aa, 0x2ad, 0x2b0, 0xffff, 0xffff, + 0x2b3, 0x2b6, 0x2b9, 0x2bc, 0x2bf, 0x2c2, 0x2c5, 0x2c8, - 0x2cb, 0x2ce, 0x2d1, 0x2d4, 0x2d7, 0x2da, 0x2dd, 0x2e0, - 0x2e3, 0x2e6, 0x2e9, 0x2ec, 0x2ef, 0x2f2, 0x2f5, 0x2f8, + 0x2cb, 0x2ce, 0x2d1, 0x2d4, 0x2d7, 0x2da, 0x2dd, 0x2e0, + 0x2e3, 0x2e6, 0x2e9, 0x2ec, 0x2ef, 0x2f2, 0x2f5, 0x2f8, - 0x2fb, 0x2fe, 0x301, 0x304, 0x307, 0x30a, 0x30d, 0x310, - 0x313, 0x316, 0x319, 0x31c, 0xffff, 0xffff, 0x31f, 0x322, + 0x2fb, 0x2fe, 0x301, 0x304, 0x307, 0x30a, 0x30d, 0x310, + 0x313, 0x316, 0x319, 0x31c, 0xffff, 0xffff, 0x31f, 0x322, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x325, 0x328, - 0x32b, 0x32e, 0x331, 0x334, 0x337, 0x33a, 0x33d, 0x340, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x325, 0x328, + 0x32b, 0x32e, 0x331, 0x334, 0x337, 0x33a, 0x33d, 0x340, - 0x343, 0x346, 0x349, 0x34c, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x343, 0x346, 0x349, 0x34c, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x34f, 0x351, 0x353, 0x355, 0x357, 0x359, 0x35b, 0x35d, - 0x35f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x34f, 0x351, 0x353, 0x355, 0x357, 0x359, 0x35b, 0x35d, + 0x35f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x361, 0x364, 0x367, 0x36a, 0x36d, 0x370, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x361, 0x364, 0x367, 0x36a, 0x36d, 0x370, 0xffff, 0xffff, - 0x373, 0x375, 0x377, 0x379, 0x37b, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x373, 0x375, 0x377, 0x379, 0x37b, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x37d, 0x37f, 0xffff, 0x381, 0x383, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x37d, 0x37f, 0xffff, 0x381, 0x383, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x386, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x388, 0xffff, 0xffff, 0xffff, 0x38b, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x386, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x388, 0xffff, 0xffff, 0xffff, 0x38b, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x38d, 0x390, 0x393, 0x396, - 0x398, 0x39b, 0x39e, 0xffff, 0x3a1, 0xffff, 0x3a4, 0x3a7, + 0xffff, 0xffff, 0xffff, 0xffff, 0x38d, 0x390, 0x393, 0x396, + 0x398, 0x39b, 0x39e, 0xffff, 0x3a1, 0xffff, 0x3a4, 0x3a7, - 0x3aa, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x3aa, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x3ad, 0x3b0, 0x3b3, 0x3b6, 0x3b9, 0x3bc, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x3ad, 0x3b0, 0x3b3, 0x3b6, 0x3b9, 0x3bc, - 0x3bf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x3bf, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x3c2, 0x3c5, 0x3c8, 0x3cb, 0x3ce, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x3c2, 0x3c5, 0x3c8, 0x3cb, 0x3ce, 0xffff, - 0x3d1, 0x3d3, 0x3d5, 0x3d7, 0x3da, 0x3dd, 0x3df, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x3d1, 0x3d3, 0x3d5, 0x3d7, 0x3da, 0x3dd, 0x3df, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x3e1, 0x3e3, 0x3e5, 0xffff, 0x3e7, 0x3e9, 0xffff, 0xffff, - 0xffff, 0x3eb, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x3e1, 0x3e3, 0x3e5, 0xffff, 0x3e7, 0x3e9, 0xffff, 0xffff, + 0xffff, 0x3eb, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x3ed, 0x3f0, 0xffff, 0x3f3, 0xffff, 0xffff, 0xffff, 0x3f6, - 0xffff, 0xffff, 0xffff, 0xffff, 0x3f9, 0x3fc, 0x3ff, 0xffff, + 0x3ed, 0x3f0, 0xffff, 0x3f3, 0xffff, 0xffff, 0xffff, 0x3f6, + 0xffff, 0xffff, 0xffff, 0xffff, 0x3f9, 0x3fc, 0x3ff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x402, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x402, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x405, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x405, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x408, 0x40b, 0xffff, 0x40e, 0xffff, 0xffff, 0xffff, 0x411, - 0xffff, 0xffff, 0xffff, 0xffff, 0x414, 0x417, 0x41a, 0xffff, + 0x408, 0x40b, 0xffff, 0x40e, 0xffff, 0xffff, 0xffff, 0x411, + 0xffff, 0xffff, 0xffff, 0xffff, 0x414, 0x417, 0x41a, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x41d, 0x420, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x41d, 0x420, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x423, 0x426, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x423, 0x426, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x429, 0x42c, 0x42f, 0x432, 0xffff, 0xffff, 0x435, 0x438, - 0xffff, 0xffff, 0x43b, 0x43e, 0x441, 0x444, 0x447, 0x44a, + 0x429, 0x42c, 0x42f, 0x432, 0xffff, 0xffff, 0x435, 0x438, + 0xffff, 0xffff, 0x43b, 0x43e, 0x441, 0x444, 0x447, 0x44a, - 0xffff, 0xffff, 0x44d, 0x450, 0x453, 0x456, 0x459, 0x45c, - 0xffff, 0xffff, 0x45f, 0x462, 0x465, 0x468, 0x46b, 0x46e, + 0xffff, 0xffff, 0x44d, 0x450, 0x453, 0x456, 0x459, 0x45c, + 0xffff, 0xffff, 0x45f, 0x462, 0x465, 0x468, 0x46b, 0x46e, - 0x471, 0x474, 0x477, 0x47a, 0x47d, 0x480, 0xffff, 0xffff, - 0x483, 0x486, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x471, 0x474, 0x477, 0x47a, 0x47d, 0x480, 0xffff, 0xffff, + 0x483, 0x486, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x489, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x489, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x48c, 0x48f, 0x492, 0x495, 0x498, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x48c, 0x48f, 0x492, 0x495, 0x498, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x49b, 0x49e, 0x4a1, - 0x4a4, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x49b, 0x49e, 0x4a1, + 0x4a4, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x4a7, 0xffff, 0x4aa, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x4a7, 0xffff, 0x4aa, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x4ad, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x4ad, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x4b0, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x4b0, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x4b3, 0xffff, 0xffff, 0x4b6, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x4b3, 0xffff, 0xffff, 0x4b6, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x4b9, 0x4bc, 0x4bf, 0x4c2, 0x4c5, 0x4c8, 0x4cb, 0x4ce, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x4b9, 0x4bc, 0x4bf, 0x4c2, 0x4c5, 0x4c8, 0x4cb, 0x4ce, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x4d1, 0x4d4, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x4d1, 0x4d4, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x4d7, 0x4da, 0xffff, 0x4dd, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x4d7, 0x4da, 0xffff, 0x4dd, - 0xffff, 0xffff, 0xffff, 0x4e0, 0xffff, 0xffff, 0x4e3, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x4e0, 0xffff, 0xffff, 0x4e3, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x4e6, 0x4e9, 0x4ec, 0xffff, 0xffff, 0x4ef, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x4e6, 0x4e9, 0x4ec, 0xffff, 0xffff, 0x4ef, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x4f2, 0xffff, 0xffff, 0x4f5, 0x4f8, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x4f2, 0xffff, 0xffff, 0x4f5, 0x4f8, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x4fb, 0x4fe, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x4fb, 0x4fe, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x501, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x501, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x504, 0x507, 0x50a, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x504, 0x507, 0x50a, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x50d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x50d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x510, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x513, - 0x516, 0xffff, 0x519, 0x51c, 0xffff, 0xffff, 0xffff, 0xffff, + 0x510, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x513, + 0x516, 0xffff, 0x519, 0x51c, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x51f, 0x522, 0x525, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x51f, 0x522, 0x525, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x528, 0xffff, 0x52b, 0x52e, 0x531, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x528, 0xffff, 0x52b, 0x52e, 0x531, 0xffff, - 0xffff, 0xffff, 0xffff, 0x534, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x534, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x537, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x537, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x53a, 0x53d, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x53a, 0x53d, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x540, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x540, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x542, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x545, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x542, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x545, 0xffff, 0xffff, - 0xffff, 0xffff, 0x548, 0xffff, 0xffff, 0xffff, 0xffff, 0x54b, - 0xffff, 0xffff, 0xffff, 0xffff, 0x54e, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x548, 0xffff, 0xffff, 0xffff, 0xffff, 0x54b, + 0xffff, 0xffff, 0xffff, 0xffff, 0x54e, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x551, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x551, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x554, 0xffff, 0x557, 0x55a, 0x55d, - 0x560, 0x563, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x554, 0xffff, 0x557, 0x55a, 0x55d, + 0x560, 0x563, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x566, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x566, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x569, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x56c, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x569, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x56c, 0xffff, 0xffff, - 0xffff, 0xffff, 0x56f, 0xffff, 0xffff, 0xffff, 0xffff, 0x572, - 0xffff, 0xffff, 0xffff, 0xffff, 0x575, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x56f, 0xffff, 0xffff, 0xffff, 0xffff, 0x572, + 0xffff, 0xffff, 0xffff, 0xffff, 0x575, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x578, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x578, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x57b, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x57b, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x57e, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x57e, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x580, 0xffff, - 0x583, 0xffff, 0x586, 0xffff, 0x589, 0xffff, 0x58c, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x580, 0xffff, + 0x583, 0xffff, 0x586, 0xffff, 0x589, 0xffff, 0x58c, 0xffff, - 0xffff, 0xffff, 0x58f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x58f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x592, 0xffff, 0x595, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x592, 0xffff, 0x595, 0xffff, 0xffff, - 0x598, 0x59b, 0xffff, 0x59e, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x598, 0x59b, 0xffff, 0x59e, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x5a1, 0x5a3, 0x5a5, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x5a1, 0x5a3, 0x5a5, 0xffff, - 0x5a7, 0x5a9, 0x5ab, 0x5ad, 0x5af, 0x5b1, 0x5b3, 0x5b5, - 0x5b7, 0x5b9, 0x5bb, 0xffff, 0x5bd, 0x5bf, 0x5c1, 0x5c3, + 0x5a7, 0x5a9, 0x5ab, 0x5ad, 0x5af, 0x5b1, 0x5b3, 0x5b5, + 0x5b7, 0x5b9, 0x5bb, 0xffff, 0x5bd, 0x5bf, 0x5c1, 0x5c3, - 0x5c5, 0x5c7, 0x5c9, 0x5cb, 0x5cd, 0x5cf, 0x5d1, 0x5d3, - 0x5d5, 0x5d7, 0x5d9, 0x5db, 0x5dd, 0x5df, 0xffff, 0x5e1, + 0x5c5, 0x5c7, 0x5c9, 0x5cb, 0x5cd, 0x5cf, 0x5d1, 0x5d3, + 0x5d5, 0x5d7, 0x5d9, 0x5db, 0x5dd, 0x5df, 0xffff, 0x5e1, - 0x5e3, 0x5e5, 0x5e7, 0x5e9, 0x5eb, 0x5ed, 0x5ef, 0x5f1, - 0x5f3, 0x5f5, 0x5f7, 0x5f9, 0x5fb, 0x5fd, 0x5ff, 0x601, + 0x5e3, 0x5e5, 0x5e7, 0x5e9, 0x5eb, 0x5ed, 0x5ef, 0x5f1, + 0x5f3, 0x5f5, 0x5f7, 0x5f9, 0x5fb, 0x5fd, 0x5ff, 0x601, - 0x603, 0x605, 0x607, 0x609, 0x60b, 0x60d, 0x60f, 0x611, - 0x613, 0x615, 0x617, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x603, 0x605, 0x607, 0x609, 0x60b, 0x60d, 0x60f, 0x611, + 0x613, 0x615, 0x617, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x619, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x619, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x61b, 0x61d, 0x61f, 0x621, 0x623, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x61b, 0x61d, 0x61f, 0x621, 0x623, - 0x625, 0x627, 0x629, 0x62b, 0x62d, 0x62f, 0x631, 0x633, - 0x635, 0x637, 0x639, 0x63b, 0x63d, 0x63f, 0x641, 0x643, + 0x625, 0x627, 0x629, 0x62b, 0x62d, 0x62f, 0x631, 0x633, + 0x635, 0x637, 0x639, 0x63b, 0x63d, 0x63f, 0x641, 0x643, - 0x645, 0x647, 0x649, 0x64b, 0x64d, 0x64f, 0x651, 0x653, - 0x655, 0x657, 0x659, 0x65b, 0x65d, 0x65f, 0x661, 0x663, + 0x645, 0x647, 0x649, 0x64b, 0x64d, 0x64f, 0x651, 0x653, + 0x655, 0x657, 0x659, 0x65b, 0x65d, 0x65f, 0x661, 0x663, - 0x665, 0x668, 0x66b, 0x66e, 0x671, 0x674, 0x677, 0x67a, - 0x67d, 0x680, 0x683, 0x686, 0x689, 0x68c, 0x68f, 0x692, + 0x665, 0x668, 0x66b, 0x66e, 0x671, 0x674, 0x677, 0x67a, + 0x67d, 0x680, 0x683, 0x686, 0x689, 0x68c, 0x68f, 0x692, - 0x695, 0x698, 0x69b, 0x69e, 0x6a1, 0x6a4, 0x6a7, 0x6aa, - 0x6ad, 0x6b0, 0x6b3, 0x6b6, 0x6b9, 0x6bc, 0x6bf, 0x6c2, + 0x695, 0x698, 0x69b, 0x69e, 0x6a1, 0x6a4, 0x6a7, 0x6aa, + 0x6ad, 0x6b0, 0x6b3, 0x6b6, 0x6b9, 0x6bc, 0x6bf, 0x6c2, - 0x6c5, 0x6c8, 0x6cb, 0x6ce, 0x6d1, 0x6d4, 0x6d7, 0x6da, - 0x6dd, 0x6e0, 0x6e3, 0x6e6, 0x6e9, 0x6ec, 0x6ef, 0x6f2, + 0x6c5, 0x6c8, 0x6cb, 0x6ce, 0x6d1, 0x6d4, 0x6d7, 0x6da, + 0x6dd, 0x6e0, 0x6e3, 0x6e6, 0x6e9, 0x6ec, 0x6ef, 0x6f2, - 0x6f5, 0x6f8, 0x6fb, 0x6fe, 0x701, 0x704, 0x707, 0x70a, - 0x70d, 0x710, 0x713, 0x716, 0x719, 0x71c, 0x71f, 0x722, + 0x6f5, 0x6f8, 0x6fb, 0x6fe, 0x701, 0x704, 0x707, 0x70a, + 0x70d, 0x710, 0x713, 0x716, 0x719, 0x71c, 0x71f, 0x722, - 0x725, 0x728, 0x72b, 0x72e, 0x731, 0x734, 0x737, 0x73a, - 0x73d, 0x740, 0x743, 0x746, 0x749, 0x74c, 0x74f, 0x752, + 0x725, 0x728, 0x72b, 0x72e, 0x731, 0x734, 0x737, 0x73a, + 0x73d, 0x740, 0x743, 0x746, 0x749, 0x74c, 0x74f, 0x752, - 0x755, 0x758, 0x75b, 0x75e, 0x761, 0x764, 0x767, 0x76a, - 0x76d, 0x770, 0x773, 0x776, 0x779, 0x77c, 0x77f, 0x782, + 0x755, 0x758, 0x75b, 0x75e, 0x761, 0x764, 0x767, 0x76a, + 0x76d, 0x770, 0x773, 0x776, 0x779, 0x77c, 0x77f, 0x782, - 0x785, 0x788, 0x78b, 0x78e, 0x791, 0x794, 0x797, 0x79a, - 0x79d, 0x7a0, 0x7a3, 0x7a6, 0x7a9, 0x7ac, 0x7af, 0x7b2, + 0x785, 0x788, 0x78b, 0x78e, 0x791, 0x794, 0x797, 0x79a, + 0x79d, 0x7a0, 0x7a3, 0x7a6, 0x7a9, 0x7ac, 0x7af, 0x7b2, - 0x7b5, 0x7b8, 0x7bb, 0x7be, 0x7c1, 0x7c4, 0x7c7, 0x7ca, - 0x7cd, 0x7d0, 0x7d3, 0x7d6, 0x7d9, 0x7dc, 0x7df, 0x7e2, + 0x7b5, 0x7b8, 0x7bb, 0x7be, 0x7c1, 0x7c4, 0x7c7, 0x7ca, + 0x7cd, 0x7d0, 0x7d3, 0x7d6, 0x7d9, 0x7dc, 0x7df, 0x7e2, - 0x7e5, 0x7e8, 0x7eb, 0x7ee, 0x7f1, 0x7f4, 0x7f7, 0x7fa, - 0x7fd, 0x800, 0x803, 0x806, 0x809, 0x80c, 0x80f, 0x812, + 0x7e5, 0x7e8, 0x7eb, 0x7ee, 0x7f1, 0x7f4, 0x7f7, 0x7fa, + 0x7fd, 0x800, 0x803, 0x806, 0x809, 0x80c, 0x80f, 0x812, - 0x815, 0x818, 0x81b, 0x81e, 0x821, 0x824, 0x827, 0x82a, - 0x82d, 0x830, 0x833, 0x836, 0xffff, 0xffff, 0xffff, 0xffff, + 0x815, 0x818, 0x81b, 0x81e, 0x821, 0x824, 0x827, 0x82a, + 0x82d, 0x830, 0x833, 0x836, 0xffff, 0xffff, 0xffff, 0xffff, - 0x839, 0x83c, 0x83f, 0x842, 0x845, 0x848, 0x84b, 0x84e, - 0x851, 0x854, 0x857, 0x85a, 0x85d, 0x860, 0x863, 0x866, + 0x839, 0x83c, 0x83f, 0x842, 0x845, 0x848, 0x84b, 0x84e, + 0x851, 0x854, 0x857, 0x85a, 0x85d, 0x860, 0x863, 0x866, - 0x869, 0x86c, 0x86f, 0x872, 0x875, 0x878, 0x87b, 0x87e, - 0x881, 0x884, 0x887, 0x88a, 0x88d, 0x890, 0x893, 0x896, + 0x869, 0x86c, 0x86f, 0x872, 0x875, 0x878, 0x87b, 0x87e, + 0x881, 0x884, 0x887, 0x88a, 0x88d, 0x890, 0x893, 0x896, - 0x899, 0x89c, 0x89f, 0x8a2, 0x8a5, 0x8a8, 0x8ab, 0x8ae, - 0x8b1, 0x8b4, 0x8b7, 0x8ba, 0x8bd, 0x8c0, 0x8c3, 0x8c6, + 0x899, 0x89c, 0x89f, 0x8a2, 0x8a5, 0x8a8, 0x8ab, 0x8ae, + 0x8b1, 0x8b4, 0x8b7, 0x8ba, 0x8bd, 0x8c0, 0x8c3, 0x8c6, - 0x8c9, 0x8cc, 0x8cf, 0x8d2, 0x8d5, 0x8d8, 0x8db, 0x8de, - 0x8e1, 0x8e4, 0x8e7, 0x8ea, 0x8ed, 0x8f0, 0x8f3, 0x8f6, + 0x8c9, 0x8cc, 0x8cf, 0x8d2, 0x8d5, 0x8d8, 0x8db, 0x8de, + 0x8e1, 0x8e4, 0x8e7, 0x8ea, 0x8ed, 0x8f0, 0x8f3, 0x8f6, - 0x8f9, 0x8fc, 0x8ff, 0x902, 0x905, 0x908, 0x90b, 0x90e, - 0x911, 0x914, 0x917, 0x91a, 0x91d, 0x920, 0x923, 0x926, + 0x8f9, 0x8fc, 0x8ff, 0x902, 0x905, 0x908, 0x90b, 0x90e, + 0x911, 0x914, 0x917, 0x91a, 0x91d, 0x920, 0x923, 0x926, - 0x929, 0x92c, 0x92f, 0x932, 0x935, 0x938, 0x93b, 0x93e, - 0x941, 0x944, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x929, 0x92c, 0x92f, 0x932, 0x935, 0x938, 0x93b, 0x93e, + 0x941, 0x944, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x947, 0x94a, 0x94d, 0x950, 0x953, 0x956, 0x959, 0x95c, - 0x95f, 0x962, 0x965, 0x968, 0x96b, 0x96e, 0x971, 0x974, + 0x947, 0x94a, 0x94d, 0x950, 0x953, 0x956, 0x959, 0x95c, + 0x95f, 0x962, 0x965, 0x968, 0x96b, 0x96e, 0x971, 0x974, - 0x977, 0x97a, 0x97d, 0x980, 0x983, 0x986, 0xffff, 0xffff, - 0x989, 0x98c, 0x98f, 0x992, 0x995, 0x998, 0xffff, 0xffff, + 0x977, 0x97a, 0x97d, 0x980, 0x983, 0x986, 0xffff, 0xffff, + 0x989, 0x98c, 0x98f, 0x992, 0x995, 0x998, 0xffff, 0xffff, - 0x99b, 0x99e, 0x9a1, 0x9a4, 0x9a7, 0x9aa, 0x9ad, 0x9b0, - 0x9b3, 0x9b6, 0x9b9, 0x9bc, 0x9bf, 0x9c2, 0x9c5, 0x9c8, + 0x99b, 0x99e, 0x9a1, 0x9a4, 0x9a7, 0x9aa, 0x9ad, 0x9b0, + 0x9b3, 0x9b6, 0x9b9, 0x9bc, 0x9bf, 0x9c2, 0x9c5, 0x9c8, - 0x9cb, 0x9ce, 0x9d1, 0x9d4, 0x9d7, 0x9da, 0x9dd, 0x9e0, - 0x9e3, 0x9e6, 0x9e9, 0x9ec, 0x9ef, 0x9f2, 0x9f5, 0x9f8, + 0x9cb, 0x9ce, 0x9d1, 0x9d4, 0x9d7, 0x9da, 0x9dd, 0x9e0, + 0x9e3, 0x9e6, 0x9e9, 0x9ec, 0x9ef, 0x9f2, 0x9f5, 0x9f8, - 0x9fb, 0x9fe, 0xa01, 0xa04, 0xa07, 0xa0a, 0xffff, 0xffff, - 0xa0d, 0xa10, 0xa13, 0xa16, 0xa19, 0xa1c, 0xffff, 0xffff, + 0x9fb, 0x9fe, 0xa01, 0xa04, 0xa07, 0xa0a, 0xffff, 0xffff, + 0xa0d, 0xa10, 0xa13, 0xa16, 0xa19, 0xa1c, 0xffff, 0xffff, - 0xa1f, 0xa22, 0xa25, 0xa28, 0xa2b, 0xa2e, 0xa31, 0xa34, - 0xffff, 0xa37, 0xffff, 0xa3a, 0xffff, 0xa3d, 0xffff, 0xa40, + 0xa1f, 0xa22, 0xa25, 0xa28, 0xa2b, 0xa2e, 0xa31, 0xa34, + 0xffff, 0xa37, 0xffff, 0xa3a, 0xffff, 0xa3d, 0xffff, 0xa40, - 0xa43, 0xa46, 0xa49, 0xa4c, 0xa4f, 0xa52, 0xa55, 0xa58, - 0xa5b, 0xa5e, 0xa61, 0xa64, 0xa67, 0xa6a, 0xa6d, 0xa70, + 0xa43, 0xa46, 0xa49, 0xa4c, 0xa4f, 0xa52, 0xa55, 0xa58, + 0xa5b, 0xa5e, 0xa61, 0xa64, 0xa67, 0xa6a, 0xa6d, 0xa70, - 0xa73, 0xa76, 0xa78, 0xa7b, 0xa7d, 0xa80, 0xa82, 0xa85, - 0xa87, 0xa8a, 0xa8c, 0xa8f, 0xa91, 0xa94, 0xffff, 0xffff, + 0xa73, 0xa76, 0xa78, 0xa7b, 0xa7d, 0xa80, 0xa82, 0xa85, + 0xa87, 0xa8a, 0xa8c, 0xa8f, 0xa91, 0xa94, 0xffff, 0xffff, - 0xa96, 0xa99, 0xa9c, 0xa9f, 0xaa2, 0xaa5, 0xaa8, 0xaab, - 0xaae, 0xab1, 0xab4, 0xab7, 0xaba, 0xabd, 0xac0, 0xac3, + 0xa96, 0xa99, 0xa9c, 0xa9f, 0xaa2, 0xaa5, 0xaa8, 0xaab, + 0xaae, 0xab1, 0xab4, 0xab7, 0xaba, 0xabd, 0xac0, 0xac3, - 0xac6, 0xac9, 0xacc, 0xacf, 0xad2, 0xad5, 0xad8, 0xadb, - 0xade, 0xae1, 0xae4, 0xae7, 0xaea, 0xaed, 0xaf0, 0xaf3, + 0xac6, 0xac9, 0xacc, 0xacf, 0xad2, 0xad5, 0xad8, 0xadb, + 0xade, 0xae1, 0xae4, 0xae7, 0xaea, 0xaed, 0xaf0, 0xaf3, - 0xaf6, 0xaf9, 0xafc, 0xaff, 0xb02, 0xb05, 0xb08, 0xb0b, - 0xb0e, 0xb11, 0xb14, 0xb17, 0xb1a, 0xb1d, 0xb20, 0xb23, + 0xaf6, 0xaf9, 0xafc, 0xaff, 0xb02, 0xb05, 0xb08, 0xb0b, + 0xb0e, 0xb11, 0xb14, 0xb17, 0xb1a, 0xb1d, 0xb20, 0xb23, - 0xb26, 0xb29, 0xb2c, 0xb2f, 0xb32, 0xffff, 0xb35, 0xb38, - 0xb3b, 0xb3e, 0xb41, 0xb44, 0xb46, 0xb49, 0xb4c, 0xb4e, + 0xb26, 0xb29, 0xb2c, 0xb2f, 0xb32, 0xffff, 0xb35, 0xb38, + 0xb3b, 0xb3e, 0xb41, 0xb44, 0xb46, 0xb49, 0xb4c, 0xb4e, - 0xb51, 0xb54, 0xb57, 0xb5a, 0xb5d, 0xffff, 0xb60, 0xb63, - 0xb66, 0xb69, 0xb6b, 0xb6e, 0xb70, 0xb73, 0xb76, 0xb79, + 0xb51, 0xb54, 0xb57, 0xb5a, 0xb5d, 0xffff, 0xb60, 0xb63, + 0xb66, 0xb69, 0xb6b, 0xb6e, 0xb70, 0xb73, 0xb76, 0xb79, - 0xb7c, 0xb7f, 0xb82, 0xb85, 0xffff, 0xffff, 0xb87, 0xb8a, - 0xb8d, 0xb90, 0xb93, 0xb96, 0xffff, 0xb98, 0xb9b, 0xb9e, + 0xb7c, 0xb7f, 0xb82, 0xb85, 0xffff, 0xffff, 0xb87, 0xb8a, + 0xb8d, 0xb90, 0xb93, 0xb96, 0xffff, 0xb98, 0xb9b, 0xb9e, - 0xba1, 0xba4, 0xba7, 0xbaa, 0xbac, 0xbaf, 0xbb2, 0xbb5, - 0xbb8, 0xbbb, 0xbbe, 0xbc1, 0xbc3, 0xbc6, 0xbc9, 0xbcb, + 0xba1, 0xba4, 0xba7, 0xbaa, 0xbac, 0xbaf, 0xbb2, 0xbb5, + 0xbb8, 0xbbb, 0xbbe, 0xbc1, 0xbc3, 0xbc6, 0xbc9, 0xbcb, - 0xffff, 0xffff, 0xbcd, 0xbd0, 0xbd3, 0xffff, 0xbd6, 0xbd9, - 0xbdc, 0xbdf, 0xbe1, 0xbe4, 0xbe6, 0xbe9, 0xbeb, 0xffff, + 0xffff, 0xffff, 0xbcd, 0xbd0, 0xbd3, 0xffff, 0xbd6, 0xbd9, + 0xbdc, 0xbdf, 0xbe1, 0xbe4, 0xbe6, 0xbe9, 0xbeb, 0xffff, - 0xbee, 0xbf0, 0xbf2, 0xbf4, 0xbf6, 0xbf8, 0xbfa, 0xbfc, - 0xbfe, 0xc00, 0xc02, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xbee, 0xbf0, 0xbf2, 0xbf4, 0xbf6, 0xbf8, 0xbfa, 0xbfc, + 0xbfe, 0xc00, 0xc02, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xc04, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc06, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xc04, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc06, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xc09, 0xc0b, 0xc0e, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc12, + 0xffff, 0xffff, 0xffff, 0xffff, 0xc09, 0xc0b, 0xc0e, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc12, - 0xffff, 0xffff, 0xffff, 0xc14, 0xc17, 0xffff, 0xc1b, 0xc1e, - 0xffff, 0xffff, 0xffff, 0xffff, 0xc22, 0xffff, 0xc25, 0xffff, + 0xffff, 0xffff, 0xffff, 0xc14, 0xc17, 0xffff, 0xc1b, 0xc1e, + 0xffff, 0xffff, 0xffff, 0xffff, 0xc22, 0xffff, 0xc25, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc28, - 0xc2b, 0xc2e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc28, + 0xc2b, 0xc2e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc31, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc36, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc31, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xc36, - 0xc38, 0xc3a, 0xffff, 0xffff, 0xc3c, 0xc3e, 0xc40, 0xc42, - 0xc44, 0xc46, 0xc48, 0xc4a, 0xc4c, 0xc4e, 0xc50, 0xc52, + 0xc38, 0xc3a, 0xffff, 0xffff, 0xc3c, 0xc3e, 0xc40, 0xc42, + 0xc44, 0xc46, 0xc48, 0xc4a, 0xc4c, 0xc4e, 0xc50, 0xc52, - 0xc54, 0xc56, 0xc58, 0xc5a, 0xc5c, 0xc5e, 0xc60, 0xc62, - 0xc64, 0xc66, 0xc68, 0xc6a, 0xc6c, 0xc6e, 0xc70, 0xffff, + 0xc54, 0xc56, 0xc58, 0xc5a, 0xc5c, 0xc5e, 0xc60, 0xc62, + 0xc64, 0xc66, 0xc68, 0xc6a, 0xc6c, 0xc6e, 0xc70, 0xffff, - 0xc72, 0xc74, 0xc76, 0xc78, 0xc7a, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xc72, 0xc74, 0xc76, 0xc78, 0xc7a, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xc7c, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xc7c, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xc7f, 0xc83, 0xc87, 0xc89, 0xffff, 0xc8c, 0xc90, 0xc94, - 0xffff, 0xc96, 0xc99, 0xc9b, 0xc9d, 0xc9f, 0xca1, 0xca3, + 0xc7f, 0xc83, 0xc87, 0xc89, 0xffff, 0xc8c, 0xc90, 0xc94, + 0xffff, 0xc96, 0xc99, 0xc9b, 0xc9d, 0xc9f, 0xca1, 0xca3, - 0xca5, 0xca7, 0xca9, 0xcab, 0xffff, 0xcad, 0xcaf, 0xffff, - 0xffff, 0xcb2, 0xcb4, 0xcb6, 0xcb8, 0xcba, 0xffff, 0xffff, + 0xca5, 0xca7, 0xca9, 0xcab, 0xffff, 0xcad, 0xcaf, 0xffff, + 0xffff, 0xcb2, 0xcb4, 0xcb6, 0xcb8, 0xcba, 0xffff, 0xffff, - 0xcbc, 0xcbf, 0xcc3, 0xffff, 0xcc6, 0xffff, 0xcc8, 0xffff, - 0xcca, 0xffff, 0xccc, 0xcce, 0xcd0, 0xcd2, 0xffff, 0xcd4, + 0xcbc, 0xcbf, 0xcc3, 0xffff, 0xcc6, 0xffff, 0xcc8, 0xffff, + 0xcca, 0xffff, 0xccc, 0xcce, 0xcd0, 0xcd2, 0xffff, 0xcd4, - 0xcd6, 0xcd8, 0xffff, 0xcda, 0xcdc, 0xcde, 0xce0, 0xce2, - 0xce4, 0xce6, 0xffff, 0xce8, 0xcec, 0xcee, 0xcf0, 0xcf2, + 0xcd6, 0xcd8, 0xffff, 0xcda, 0xcdc, 0xcde, 0xce0, 0xce2, + 0xce4, 0xce6, 0xffff, 0xce8, 0xcec, 0xcee, 0xcf0, 0xcf2, - 0xcf4, 0xffff, 0xffff, 0xffff, 0xffff, 0xcf6, 0xcf8, 0xcfa, - 0xcfc, 0xcfe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xcf4, 0xffff, 0xffff, 0xffff, 0xffff, 0xcf6, 0xcf8, 0xcfa, + 0xcfc, 0xcfe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xd00, 0xd04, 0xd08, 0xd0c, 0xd10, - 0xd14, 0xd18, 0xd1c, 0xd20, 0xd24, 0xd28, 0xd2c, 0xd30, + 0xffff, 0xffff, 0xffff, 0xd00, 0xd04, 0xd08, 0xd0c, 0xd10, + 0xd14, 0xd18, 0xd1c, 0xd20, 0xd24, 0xd28, 0xd2c, 0xd30, - 0xd33, 0xd35, 0xd38, 0xd3c, 0xd3f, 0xd41, 0xd44, 0xd48, - 0xd4d, 0xd50, 0xd52, 0xd55, 0xd59, 0xd5b, 0xd5d, 0xd5f, + 0xd33, 0xd35, 0xd38, 0xd3c, 0xd3f, 0xd41, 0xd44, 0xd48, + 0xd4d, 0xd50, 0xd52, 0xd55, 0xd59, 0xd5b, 0xd5d, 0xd5f, - 0xd61, 0xd63, 0xd66, 0xd6a, 0xd6d, 0xd6f, 0xd72, 0xd76, - 0xd7b, 0xd7e, 0xd80, 0xd83, 0xd87, 0xd89, 0xd8b, 0xd8d, + 0xd61, 0xd63, 0xd66, 0xd6a, 0xd6d, 0xd6f, 0xd72, 0xd76, + 0xd7b, 0xd7e, 0xd80, 0xd83, 0xd87, 0xd89, 0xd8b, 0xd8d, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xd8f, 0xd92, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xd8f, 0xd92, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xd95, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xd95, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xd98, 0xd9b, 0xd9e, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xd98, 0xd9b, 0xd9e, - 0xffff, 0xffff, 0xffff, 0xffff, 0xda1, 0xffff, 0xffff, 0xffff, - 0xffff, 0xda4, 0xffff, 0xffff, 0xda7, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xda1, 0xffff, 0xffff, 0xffff, + 0xffff, 0xda4, 0xffff, 0xffff, 0xda7, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xdaa, 0xffff, 0xdad, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xdb0, 0xdb3, 0xffff, 0xdb7, + 0xffff, 0xffff, 0xffff, 0xffff, 0xdaa, 0xffff, 0xdad, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xdb0, 0xdb3, 0xffff, 0xdb7, - 0xdba, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xdba, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xdbe, 0xffff, 0xffff, 0xdc1, 0xffff, 0xffff, 0xdc4, - 0xffff, 0xdc7, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xdbe, 0xffff, 0xffff, 0xdc1, 0xffff, 0xffff, 0xdc4, + 0xffff, 0xdc7, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xdca, 0xffff, 0xdcd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xdd0, 0xdd3, 0xdd6, + 0xdca, 0xffff, 0xdcd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xdd0, 0xdd3, 0xdd6, - 0xdd9, 0xddc, 0xffff, 0xffff, 0xddf, 0xde2, 0xffff, 0xffff, - 0xde5, 0xde8, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xdd9, 0xddc, 0xffff, 0xffff, 0xddf, 0xde2, 0xffff, 0xffff, + 0xde5, 0xde8, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xdeb, 0xdee, 0xffff, 0xffff, 0xdf1, 0xdf4, 0xffff, 0xffff, - 0xdf7, 0xdfa, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xdeb, 0xdee, 0xffff, 0xffff, 0xdf1, 0xdf4, 0xffff, 0xffff, + 0xdf7, 0xdfa, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xdfd, 0xe00, 0xe03, 0xe06, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xdfd, 0xe00, 0xe03, 0xe06, - 0xe09, 0xe0c, 0xe0f, 0xe12, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xe15, 0xe18, 0xe1b, 0xe1e, 0xffff, 0xffff, + 0xe09, 0xe0c, 0xe0f, 0xe12, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xe15, 0xe18, 0xe1b, 0xe1e, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xe21, 0xe23, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xe21, 0xe23, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xe25, 0xe27, 0xe29, 0xe2b, 0xe2d, 0xe2f, 0xe31, 0xe33, - 0xe35, 0xe37, 0xe3a, 0xe3d, 0xe40, 0xe43, 0xe46, 0xe49, + 0xe25, 0xe27, 0xe29, 0xe2b, 0xe2d, 0xe2f, 0xe31, 0xe33, + 0xe35, 0xe37, 0xe3a, 0xe3d, 0xe40, 0xe43, 0xe46, 0xe49, - 0xe4c, 0xe4f, 0xe52, 0xe55, 0xe58, 0xe5c, 0xe60, 0xe64, - 0xe68, 0xe6c, 0xe70, 0xe74, 0xe78, 0xe7c, 0xe81, 0xe86, + 0xe4c, 0xe4f, 0xe52, 0xe55, 0xe58, 0xe5c, 0xe60, 0xe64, + 0xe68, 0xe6c, 0xe70, 0xe74, 0xe78, 0xe7c, 0xe81, 0xe86, - 0xe8b, 0xe90, 0xe95, 0xe9a, 0xe9f, 0xea4, 0xea9, 0xeae, - 0xeb3, 0xeb6, 0xeb9, 0xebc, 0xebf, 0xec2, 0xec5, 0xec8, + 0xe8b, 0xe90, 0xe95, 0xe9a, 0xe9f, 0xea4, 0xea9, 0xeae, + 0xeb3, 0xeb6, 0xeb9, 0xebc, 0xebf, 0xec2, 0xec5, 0xec8, - 0xecb, 0xece, 0xed2, 0xed6, 0xeda, 0xede, 0xee2, 0xee6, - 0xeea, 0xeee, 0xef2, 0xef6, 0xefa, 0xefe, 0xf02, 0xf06, + 0xecb, 0xece, 0xed2, 0xed6, 0xeda, 0xede, 0xee2, 0xee6, + 0xeea, 0xeee, 0xef2, 0xef6, 0xefa, 0xefe, 0xf02, 0xf06, - 0xf0a, 0xf0e, 0xf12, 0xf16, 0xf1a, 0xf1e, 0xf22, 0xf26, - 0xf2a, 0xf2e, 0xf32, 0xf36, 0xf3a, 0xf3e, 0xf42, 0xf46, + 0xf0a, 0xf0e, 0xf12, 0xf16, 0xf1a, 0xf1e, 0xf22, 0xf26, + 0xf2a, 0xf2e, 0xf32, 0xf36, 0xf3a, 0xf3e, 0xf42, 0xf46, - 0xf4a, 0xf4e, 0xf52, 0xf56, 0xf5a, 0xf5e, 0xf62, 0xf64, - 0xf66, 0xf68, 0xf6a, 0xf6c, 0xf6e, 0xf70, 0xf72, 0xf74, + 0xf4a, 0xf4e, 0xf52, 0xf56, 0xf5a, 0xf5e, 0xf62, 0xf64, + 0xf66, 0xf68, 0xf6a, 0xf6c, 0xf6e, 0xf70, 0xf72, 0xf74, - 0xf76, 0xf78, 0xf7a, 0xf7c, 0xf7e, 0xf80, 0xf82, 0xf84, - 0xf86, 0xf88, 0xf8a, 0xf8c, 0xf8e, 0xf90, 0xf92, 0xf94, + 0xf76, 0xf78, 0xf7a, 0xf7c, 0xf7e, 0xf80, 0xf82, 0xf84, + 0xf86, 0xf88, 0xf8a, 0xf8c, 0xf8e, 0xf90, 0xf92, 0xf94, - 0xf96, 0xf98, 0xf9a, 0xf9c, 0xf9e, 0xfa0, 0xfa2, 0xfa4, - 0xfa6, 0xfa8, 0xfaa, 0xfac, 0xfae, 0xfb0, 0xfb2, 0xfb4, + 0xf96, 0xf98, 0xf9a, 0xf9c, 0xf9e, 0xfa0, 0xfa2, 0xfa4, + 0xfa6, 0xfa8, 0xfaa, 0xfac, 0xfae, 0xfb0, 0xfb2, 0xfb4, - 0xfb6, 0xfb8, 0xfba, 0xfbc, 0xfbe, 0xfc0, 0xfc2, 0xfc4, - 0xfc6, 0xfc8, 0xfca, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xfb6, 0xfb8, 0xfba, 0xfbc, 0xfbe, 0xfc0, 0xfc2, 0xfc4, + 0xfc6, 0xfc8, 0xfca, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xfcc, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xfcc, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xfd1, 0xfd5, 0xfd8, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xfd1, 0xfd5, 0xfd8, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xfdc, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xfdc, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfdf, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfdf, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfe1, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfe1, - 0xffff, 0xffff, 0xffff, 0xfe3, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xfe3, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xfe5, 0xfe7, 0xfe9, 0xfeb, 0xfed, 0xfef, 0xff1, 0xff3, - 0xff5, 0xff7, 0xff9, 0xffb, 0xffd, 0xfff, 0x1001, 0x1003, + 0xfe5, 0xfe7, 0xfe9, 0xfeb, 0xfed, 0xfef, 0xff1, 0xff3, + 0xff5, 0xff7, 0xff9, 0xffb, 0xffd, 0xfff, 0x1001, 0x1003, - 0x1005, 0x1007, 0x1009, 0x100b, 0x100d, 0x100f, 0x1011, 0x1013, - 0x1015, 0x1017, 0x1019, 0x101b, 0x101d, 0x101f, 0x1021, 0x1023, + 0x1005, 0x1007, 0x1009, 0x100b, 0x100d, 0x100f, 0x1011, 0x1013, + 0x1015, 0x1017, 0x1019, 0x101b, 0x101d, 0x101f, 0x1021, 0x1023, - 0x1025, 0x1027, 0x1029, 0x102b, 0x102d, 0x102f, 0x1031, 0x1033, - 0x1035, 0x1037, 0x1039, 0x103b, 0x103d, 0x103f, 0x1041, 0x1043, + 0x1025, 0x1027, 0x1029, 0x102b, 0x102d, 0x102f, 0x1031, 0x1033, + 0x1035, 0x1037, 0x1039, 0x103b, 0x103d, 0x103f, 0x1041, 0x1043, - 0x1045, 0x1047, 0x1049, 0x104b, 0x104d, 0x104f, 0x1051, 0x1053, - 0x1055, 0x1057, 0x1059, 0x105b, 0x105d, 0x105f, 0x1061, 0x1063, + 0x1045, 0x1047, 0x1049, 0x104b, 0x104d, 0x104f, 0x1051, 0x1053, + 0x1055, 0x1057, 0x1059, 0x105b, 0x105d, 0x105f, 0x1061, 0x1063, - 0x1065, 0x1067, 0x1069, 0x106b, 0x106d, 0x106f, 0x1071, 0x1073, - 0x1075, 0x1077, 0x1079, 0x107b, 0x107d, 0x107f, 0x1081, 0x1083, + 0x1065, 0x1067, 0x1069, 0x106b, 0x106d, 0x106f, 0x1071, 0x1073, + 0x1075, 0x1077, 0x1079, 0x107b, 0x107d, 0x107f, 0x1081, 0x1083, - 0x1085, 0x1087, 0x1089, 0x108b, 0x108d, 0x108f, 0x1091, 0x1093, - 0x1095, 0x1097, 0x1099, 0x109b, 0x109d, 0x109f, 0x10a1, 0x10a3, + 0x1085, 0x1087, 0x1089, 0x108b, 0x108d, 0x108f, 0x1091, 0x1093, + 0x1095, 0x1097, 0x1099, 0x109b, 0x109d, 0x109f, 0x10a1, 0x10a3, - 0x10a5, 0x10a7, 0x10a9, 0x10ab, 0x10ad, 0x10af, 0x10b1, 0x10b3, - 0x10b5, 0x10b7, 0x10b9, 0x10bb, 0x10bd, 0x10bf, 0x10c1, 0x10c3, + 0x10a5, 0x10a7, 0x10a9, 0x10ab, 0x10ad, 0x10af, 0x10b1, 0x10b3, + 0x10b5, 0x10b7, 0x10b9, 0x10bb, 0x10bd, 0x10bf, 0x10c1, 0x10c3, - 0x10c5, 0x10c7, 0x10c9, 0x10cb, 0x10cd, 0x10cf, 0x10d1, 0x10d3, - 0x10d5, 0x10d7, 0x10d9, 0x10db, 0x10dd, 0x10df, 0x10e1, 0x10e3, + 0x10c5, 0x10c7, 0x10c9, 0x10cb, 0x10cd, 0x10cf, 0x10d1, 0x10d3, + 0x10d5, 0x10d7, 0x10d9, 0x10db, 0x10dd, 0x10df, 0x10e1, 0x10e3, - 0x10e5, 0x10e7, 0x10e9, 0x10eb, 0x10ed, 0x10ef, 0x10f1, 0x10f3, - 0x10f5, 0x10f7, 0x10f9, 0x10fb, 0x10fd, 0x10ff, 0x1101, 0x1103, + 0x10e5, 0x10e7, 0x10e9, 0x10eb, 0x10ed, 0x10ef, 0x10f1, 0x10f3, + 0x10f5, 0x10f7, 0x10f9, 0x10fb, 0x10fd, 0x10ff, 0x1101, 0x1103, - 0x1105, 0x1107, 0x1109, 0x110b, 0x110d, 0x110f, 0x1111, 0x1113, - 0x1115, 0x1117, 0x1119, 0x111b, 0x111d, 0x111f, 0x1121, 0x1123, + 0x1105, 0x1107, 0x1109, 0x110b, 0x110d, 0x110f, 0x1111, 0x1113, + 0x1115, 0x1117, 0x1119, 0x111b, 0x111d, 0x111f, 0x1121, 0x1123, - 0x1125, 0x1127, 0x1129, 0x112b, 0x112d, 0x112f, 0x1131, 0x1133, - 0x1135, 0x1137, 0x1139, 0x113b, 0x113d, 0x113f, 0x1141, 0x1143, + 0x1125, 0x1127, 0x1129, 0x112b, 0x112d, 0x112f, 0x1131, 0x1133, + 0x1135, 0x1137, 0x1139, 0x113b, 0x113d, 0x113f, 0x1141, 0x1143, - 0x1145, 0x1147, 0x1149, 0x114b, 0x114d, 0x114f, 0x1151, 0x1153, - 0x1155, 0x1157, 0x1159, 0x115b, 0x115d, 0x115f, 0x1161, 0x1163, + 0x1145, 0x1147, 0x1149, 0x114b, 0x114d, 0x114f, 0x1151, 0x1153, + 0x1155, 0x1157, 0x1159, 0x115b, 0x115d, 0x115f, 0x1161, 0x1163, - 0x1165, 0x1167, 0x1169, 0x116b, 0x116d, 0x116f, 0x1171, 0x1173, - 0x1175, 0x1177, 0x1179, 0x117b, 0x117d, 0x117f, 0x1181, 0x1183, + 0x1165, 0x1167, 0x1169, 0x116b, 0x116d, 0x116f, 0x1171, 0x1173, + 0x1175, 0x1177, 0x1179, 0x117b, 0x117d, 0x117f, 0x1181, 0x1183, - 0x1185, 0x1187, 0x1189, 0x118b, 0x118d, 0x118f, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x1185, 0x1187, 0x1189, 0x118b, 0x118d, 0x118f, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x1191, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x1191, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x1193, 0xffff, - 0x1195, 0x1197, 0x1199, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x1193, 0xffff, + 0x1195, 0x1197, 0x1199, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x119b, 0xffff, 0x119e, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x119b, 0xffff, 0x119e, 0xffff, - 0x11a1, 0xffff, 0x11a4, 0xffff, 0x11a7, 0xffff, 0x11aa, 0xffff, - 0x11ad, 0xffff, 0x11b0, 0xffff, 0x11b3, 0xffff, 0x11b6, 0xffff, + 0x11a1, 0xffff, 0x11a4, 0xffff, 0x11a7, 0xffff, 0x11aa, 0xffff, + 0x11ad, 0xffff, 0x11b0, 0xffff, 0x11b3, 0xffff, 0x11b6, 0xffff, - 0x11b9, 0xffff, 0x11bc, 0xffff, 0xffff, 0x11bf, 0xffff, 0x11c2, - 0xffff, 0x11c5, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x11b9, 0xffff, 0x11bc, 0xffff, 0xffff, 0x11bf, 0xffff, 0x11c2, + 0xffff, 0x11c5, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x11c8, 0x11cb, 0xffff, 0x11ce, 0x11d1, 0xffff, 0x11d4, 0x11d7, - 0xffff, 0x11da, 0x11dd, 0xffff, 0x11e0, 0x11e3, 0xffff, 0xffff, + 0x11c8, 0x11cb, 0xffff, 0x11ce, 0x11d1, 0xffff, 0x11d4, 0x11d7, + 0xffff, 0x11da, 0x11dd, 0xffff, 0x11e0, 0x11e3, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x11e6, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x11e9, 0x11ec, 0xffff, 0x11ef, 0x11f2, + 0xffff, 0xffff, 0xffff, 0xffff, 0x11e6, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x11e9, 0x11ec, 0xffff, 0x11ef, 0x11f2, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x11f5, 0xffff, 0x11f8, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x11f5, 0xffff, 0x11f8, 0xffff, - 0x11fb, 0xffff, 0x11fe, 0xffff, 0x1201, 0xffff, 0x1204, 0xffff, - 0x1207, 0xffff, 0x120a, 0xffff, 0x120d, 0xffff, 0x1210, 0xffff, + 0x11fb, 0xffff, 0x11fe, 0xffff, 0x1201, 0xffff, 0x1204, 0xffff, + 0x1207, 0xffff, 0x120a, 0xffff, 0x120d, 0xffff, 0x1210, 0xffff, - 0x1213, 0xffff, 0x1216, 0xffff, 0xffff, 0x1219, 0xffff, 0x121c, - 0xffff, 0x121f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x1213, 0xffff, 0x1216, 0xffff, 0xffff, 0x1219, 0xffff, 0x121c, + 0xffff, 0x121f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x1222, 0x1225, 0xffff, 0x1228, 0x122b, 0xffff, 0x122e, 0x1231, - 0xffff, 0x1234, 0x1237, 0xffff, 0x123a, 0x123d, 0xffff, 0xffff, + 0x1222, 0x1225, 0xffff, 0x1228, 0x122b, 0xffff, 0x122e, 0x1231, + 0xffff, 0x1234, 0x1237, 0xffff, 0x123a, 0x123d, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x1240, 0xffff, 0xffff, 0x1243, - 0x1246, 0x1249, 0x124c, 0xffff, 0xffff, 0xffff, 0x124f, 0x1252, + 0xffff, 0xffff, 0xffff, 0xffff, 0x1240, 0xffff, 0xffff, 0x1243, + 0x1246, 0x1249, 0x124c, 0xffff, 0xffff, 0xffff, 0x124f, 0x1252, - 0xffff, 0x1255, 0x1257, 0x1259, 0x125b, 0x125d, 0x125f, 0x1261, - 0x1263, 0x1265, 0x1267, 0x1269, 0x126b, 0x126d, 0x126f, 0x1271, + 0xffff, 0x1255, 0x1257, 0x1259, 0x125b, 0x125d, 0x125f, 0x1261, + 0x1263, 0x1265, 0x1267, 0x1269, 0x126b, 0x126d, 0x126f, 0x1271, - 0x1273, 0x1275, 0x1277, 0x1279, 0x127b, 0x127d, 0x127f, 0x1281, - 0x1283, 0x1285, 0x1287, 0x1289, 0x128b, 0x128d, 0x128f, 0x1291, + 0x1273, 0x1275, 0x1277, 0x1279, 0x127b, 0x127d, 0x127f, 0x1281, + 0x1283, 0x1285, 0x1287, 0x1289, 0x128b, 0x128d, 0x128f, 0x1291, - 0x1293, 0x1295, 0x1297, 0x1299, 0x129b, 0x129d, 0x129f, 0x12a1, - 0x12a3, 0x12a5, 0x12a7, 0x12a9, 0x12ab, 0x12ad, 0x12af, 0x12b1, + 0x1293, 0x1295, 0x1297, 0x1299, 0x129b, 0x129d, 0x129f, 0x12a1, + 0x12a3, 0x12a5, 0x12a7, 0x12a9, 0x12ab, 0x12ad, 0x12af, 0x12b1, - 0x12b3, 0x12b5, 0x12b7, 0x12b9, 0x12bb, 0x12bd, 0x12bf, 0x12c1, - 0x12c3, 0x12c5, 0x12c7, 0x12c9, 0x12cb, 0x12cd, 0x12cf, 0x12d1, + 0x12b3, 0x12b5, 0x12b7, 0x12b9, 0x12bb, 0x12bd, 0x12bf, 0x12c1, + 0x12c3, 0x12c5, 0x12c7, 0x12c9, 0x12cb, 0x12cd, 0x12cf, 0x12d1, - 0x12d3, 0x12d5, 0x12d7, 0x12d9, 0x12db, 0x12dd, 0x12df, 0x12e1, - 0x12e3, 0x12e5, 0x12e7, 0x12e9, 0x12eb, 0x12ed, 0x12ef, 0x12f1, + 0x12d3, 0x12d5, 0x12d7, 0x12d9, 0x12db, 0x12dd, 0x12df, 0x12e1, + 0x12e3, 0x12e5, 0x12e7, 0x12e9, 0x12eb, 0x12ed, 0x12ef, 0x12f1, - 0x12f3, 0x12f5, 0x12f7, 0x12f9, 0x12fb, 0x12fd, 0x12ff, 0x1301, - 0x1303, 0x1305, 0x1307, 0x1309, 0x130b, 0x130d, 0x130f, 0xffff, + 0x12f3, 0x12f5, 0x12f7, 0x12f9, 0x12fb, 0x12fd, 0x12ff, 0x1301, + 0x1303, 0x1305, 0x1307, 0x1309, 0x130b, 0x130d, 0x130f, 0xffff, - 0xffff, 0xffff, 0x1311, 0x1313, 0x1315, 0x1317, 0x1319, 0x131b, - 0x131d, 0x131f, 0x1321, 0x1323, 0x1325, 0x1327, 0x1329, 0x132b, + 0xffff, 0xffff, 0x1311, 0x1313, 0x1315, 0x1317, 0x1319, 0x131b, + 0x131d, 0x131f, 0x1321, 0x1323, 0x1325, 0x1327, 0x1329, 0x132b, - 0x132d, 0x1331, 0x1335, 0x1339, 0x133d, 0x1341, 0x1345, 0x1349, - 0x134d, 0x1351, 0x1355, 0x1359, 0x135d, 0x1361, 0x1365, 0x136a, + 0x132d, 0x1331, 0x1335, 0x1339, 0x133d, 0x1341, 0x1345, 0x1349, + 0x134d, 0x1351, 0x1355, 0x1359, 0x135d, 0x1361, 0x1365, 0x136a, - 0x136f, 0x1374, 0x1379, 0x137e, 0x1383, 0x1388, 0x138d, 0x1392, - 0x1397, 0x139c, 0x13a1, 0x13a6, 0x13ab, 0x13b0, 0x13b8, 0xffff, + 0x136f, 0x1374, 0x1379, 0x137e, 0x1383, 0x1388, 0x138d, 0x1392, + 0x1397, 0x139c, 0x13a1, 0x13a6, 0x13ab, 0x13b0, 0x13b8, 0xffff, - 0x13bf, 0x13c3, 0x13c7, 0x13cb, 0x13cf, 0x13d3, 0x13d7, 0x13db, - 0x13df, 0x13e3, 0x13e7, 0x13eb, 0x13ef, 0x13f3, 0x13f7, 0x13fb, + 0x13bf, 0x13c3, 0x13c7, 0x13cb, 0x13cf, 0x13d3, 0x13d7, 0x13db, + 0x13df, 0x13e3, 0x13e7, 0x13eb, 0x13ef, 0x13f3, 0x13f7, 0x13fb, - 0x13ff, 0x1403, 0x1407, 0x140b, 0x140f, 0x1413, 0x1417, 0x141b, - 0x141f, 0x1423, 0x1427, 0x142b, 0x142f, 0x1433, 0x1437, 0x143b, + 0x13ff, 0x1403, 0x1407, 0x140b, 0x140f, 0x1413, 0x1417, 0x141b, + 0x141f, 0x1423, 0x1427, 0x142b, 0x142f, 0x1433, 0x1437, 0x143b, - 0x143f, 0x1443, 0x1447, 0x144b, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x143f, 0x1443, 0x1447, 0x144b, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x144f, 0x1453, 0x1456, 0x1459, 0x145c, 0x145f, 0x1462, 0x1465, - 0x1468, 0x146b, 0x146e, 0x1471, 0x1474, 0x1477, 0x147a, 0x147d, + 0x144f, 0x1453, 0x1456, 0x1459, 0x145c, 0x145f, 0x1462, 0x1465, + 0x1468, 0x146b, 0x146e, 0x1471, 0x1474, 0x1477, 0x147a, 0x147d, - 0x1480, 0x1482, 0x1484, 0x1486, 0x1488, 0x148a, 0x148c, 0x148e, - 0x1490, 0x1492, 0x1494, 0x1496, 0x1498, 0x149a, 0x149c, 0x149f, + 0x1480, 0x1482, 0x1484, 0x1486, 0x1488, 0x148a, 0x148c, 0x148e, + 0x1490, 0x1492, 0x1494, 0x1496, 0x1498, 0x149a, 0x149c, 0x149f, - 0x14a2, 0x14a5, 0x14a8, 0x14ab, 0x14ae, 0x14b1, 0x14b4, 0x14b7, - 0x14ba, 0x14bd, 0x14c0, 0x14c3, 0x14c6, 0x14cc, 0x14d1, 0xffff, + 0x14a2, 0x14a5, 0x14a8, 0x14ab, 0x14ae, 0x14b1, 0x14b4, 0x14b7, + 0x14ba, 0x14bd, 0x14c0, 0x14c3, 0x14c6, 0x14cc, 0x14d1, 0xffff, - 0x14d4, 0x14d6, 0x14d8, 0x14da, 0x14dc, 0x14de, 0x14e0, 0x14e2, - 0x14e4, 0x14e6, 0x14e8, 0x14ea, 0x14ec, 0x14ee, 0x14f0, 0x14f2, + 0x14d4, 0x14d6, 0x14d8, 0x14da, 0x14dc, 0x14de, 0x14e0, 0x14e2, + 0x14e4, 0x14e6, 0x14e8, 0x14ea, 0x14ec, 0x14ee, 0x14f0, 0x14f2, - 0x14f4, 0x14f6, 0x14f8, 0x14fa, 0x14fc, 0x14fe, 0x1500, 0x1502, - 0x1504, 0x1506, 0x1508, 0x150a, 0x150c, 0x150e, 0x1510, 0x1512, + 0x14f4, 0x14f6, 0x14f8, 0x14fa, 0x14fc, 0x14fe, 0x1500, 0x1502, + 0x1504, 0x1506, 0x1508, 0x150a, 0x150c, 0x150e, 0x1510, 0x1512, - 0x1514, 0x1516, 0x1518, 0x151a, 0x151c, 0x151e, 0x1520, 0x1522, - 0x1524, 0x1526, 0x1528, 0x152a, 0x152c, 0x152e, 0x1530, 0x1532, + 0x1514, 0x1516, 0x1518, 0x151a, 0x151c, 0x151e, 0x1520, 0x1522, + 0x1524, 0x1526, 0x1528, 0x152a, 0x152c, 0x152e, 0x1530, 0x1532, - 0x1534, 0x1536, 0x1539, 0x153c, 0x153f, 0x1542, 0x1545, 0x1548, - 0x154b, 0x154e, 0x1551, 0x1554, 0x1557, 0x155a, 0x155d, 0x1560, + 0x1534, 0x1536, 0x1539, 0x153c, 0x153f, 0x1542, 0x1545, 0x1548, + 0x154b, 0x154e, 0x1551, 0x1554, 0x1557, 0x155a, 0x155d, 0x1560, - 0x1563, 0x1566, 0x1569, 0x156c, 0x156f, 0x1572, 0x1575, 0x1578, - 0x157b, 0x157e, 0x1582, 0x1586, 0x158a, 0x158d, 0x1591, 0x1594, + 0x1563, 0x1566, 0x1569, 0x156c, 0x156f, 0x1572, 0x1575, 0x1578, + 0x157b, 0x157e, 0x1582, 0x1586, 0x158a, 0x158d, 0x1591, 0x1594, - 0x1598, 0x159a, 0x159c, 0x159e, 0x15a0, 0x15a2, 0x15a4, 0x15a6, - 0x15a8, 0x15aa, 0x15ac, 0x15ae, 0x15b0, 0x15b2, 0x15b4, 0x15b6, + 0x1598, 0x159a, 0x159c, 0x159e, 0x15a0, 0x15a2, 0x15a4, 0x15a6, + 0x15a8, 0x15aa, 0x15ac, 0x15ae, 0x15b0, 0x15b2, 0x15b4, 0x15b6, - 0x15b8, 0x15ba, 0x15bc, 0x15be, 0x15c0, 0x15c2, 0x15c4, 0x15c6, - 0x15c8, 0x15ca, 0x15cc, 0x15ce, 0x15d0, 0x15d2, 0x15d4, 0x15d6, + 0x15b8, 0x15ba, 0x15bc, 0x15be, 0x15c0, 0x15c2, 0x15c4, 0x15c6, + 0x15c8, 0x15ca, 0x15cc, 0x15ce, 0x15d0, 0x15d2, 0x15d4, 0x15d6, - 0x15d8, 0x15da, 0x15dc, 0x15de, 0x15e0, 0x15e2, 0x15e4, 0x15e6, - 0x15e8, 0x15ea, 0x15ec, 0x15ee, 0x15f0, 0x15f2, 0x15f4, 0xffff, + 0x15d8, 0x15da, 0x15dc, 0x15de, 0x15e0, 0x15e2, 0x15e4, 0x15e6, + 0x15e8, 0x15ea, 0x15ec, 0x15ee, 0x15f0, 0x15f2, 0x15f4, 0xffff, - 0x15f6, 0x15fb, 0x1600, 0x1605, 0x1609, 0x160e, 0x1612, 0x1616, - 0x161c, 0x1621, 0x1625, 0x1629, 0x162d, 0x1632, 0x1637, 0x163b, + 0x15f6, 0x15fb, 0x1600, 0x1605, 0x1609, 0x160e, 0x1612, 0x1616, + 0x161c, 0x1621, 0x1625, 0x1629, 0x162d, 0x1632, 0x1637, 0x163b, - 0x163f, 0x1642, 0x1646, 0x164b, 0x1650, 0x1653, 0x1659, 0x1660, - 0x1666, 0x166a, 0x1670, 0x1676, 0x167b, 0x167f, 0x1683, 0x1687, - - 0x168c, 0x1692, 0x1697, 0x169b, 0x169f, 0x16a3, 0x16a6, 0x16a9, - 0x16ac, 0x16af, 0x16b3, 0x16b7, 0x16bd, 0x16c1, 0x16c6, 0x16cc, - - 0x16d0, 0x16d3, 0x16d6, 0x16dc, 0x16e1, 0x16e7, 0x16eb, 0x16f1, - 0x16f4, 0x16f8, 0x16fc, 0x1700, 0x1704, 0x1708, 0x170d, 0x1711, - - 0x1714, 0x1718, 0x171c, 0x1720, 0x1725, 0x1729, 0x172d, 0x1731, - 0x1737, 0x173c, 0x173f, 0x1745, 0x1748, 0x174d, 0x1752, 0x1756, - - 0x175a, 0x175e, 0x1763, 0x1766, 0x176a, 0x176f, 0x1772, 0x1778, - 0x177c, 0x177f, 0x1782, 0x1785, 0x1788, 0x178b, 0x178e, 0x1791, - - 0x1794, 0x1797, 0x179a, 0x179e, 0x17a2, 0x17a6, 0x17aa, 0x17ae, - 0x17b2, 0x17b6, 0x17ba, 0x17be, 0x17c2, 0x17c6, 0x17ca, 0x17ce, - - 0x17d2, 0x17d6, 0x17da, 0x17dd, 0x17e0, 0x17e4, 0x17e7, 0x17ea, - 0x17ed, 0x17f1, 0x17f5, 0x17f8, 0x17fb, 0x17fe, 0x1801, 0x1804, - - 0x1809, 0x180c, 0x180f, 0x1812, 0x1815, 0x1818, 0x181b, 0x181e, - 0x1821, 0x1825, 0x182a, 0x182d, 0x1830, 0x1833, 0x1836, 0x1839, - - 0x183c, 0x183f, 0x1843, 0x1847, 0x184b, 0x184f, 0x1852, 0x1855, - 0x1858, 0x185b, 0x185e, 0x1861, 0x1864, 0x1867, 0x186a, 0x186d, - - 0x1871, 0x1875, 0x1878, 0x187c, 0x1880, 0x1884, 0x1887, 0x188b, - 0x188f, 0x1894, 0x1897, 0x189b, 0x189f, 0x18a3, 0x18a7, 0x18ad, - - 0x18b4, 0x18b7, 0x18ba, 0x18bd, 0x18c0, 0x18c3, 0x18c6, 0x18c9, - 0x18cc, 0x18cf, 0x18d2, 0x18d5, 0x18d8, 0x18db, 0x18de, 0x18e1, - - 0x18e4, 0x18e7, 0x18ea, 0x18ef, 0x18f2, 0x18f5, 0x18f8, 0x18fd, - 0x1901, 0x1904, 0x1907, 0x190a, 0x190d, 0x1910, 0x1913, 0x1916, - - 0x1919, 0x191c, 0x191f, 0x1923, 0x1926, 0x1929, 0x192d, 0x1931, - 0x1934, 0x1939, 0x193d, 0x1940, 0x1943, 0x1946, 0x1949, 0x194d, - - 0x1951, 0x1954, 0x1957, 0x195a, 0x195d, 0x1960, 0x1963, 0x1966, - 0x1969, 0x196c, 0x1970, 0x1974, 0x1978, 0x197c, 0x1980, 0x1984, - - 0x1988, 0x198c, 0x1990, 0x1994, 0x1998, 0x199c, 0x19a0, 0x19a4, - 0x19a8, 0x19ac, 0x19b0, 0x19b4, 0x19b8, 0x19bc, 0x19c0, 0x19c4, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0x19c8, 0x19ca, 0x19cc, 0x19ce, 0x19d0, 0x19d2, 0x19d4, 0x19d6, - 0x19d8, 0x19da, 0x19dc, 0x19de, 0x19e0, 0x19e2, 0x19e4, 0x19e6, - 0x19e8, 0x19ea, 0x19ec, 0x19ee, 0x19f0, 0x19f2, 0x19f4, 0x19f6, - 0x19f8, 0x19fa, 0x19fc, 0x19fe, 0x1a00, 0x1a02, 0x1a04, 0x1a06, - 0x1a08, 0x1a0a, 0x1a0c, 0x1a0e, 0x1a10, 0x1a12, 0x1a14, 0x1a16, - 0x1a18, 0x1a1a, 0x1a1c, 0x1a1e, 0x1a20, 0x1a22, 0x1a24, 0x1a26, - 0x1a28, 0x1a2a, 0x1a2c, 0x1a2e, 0x1a30, 0x1a32, 0x1a34, 0x1a36, - 0x1a38, 0x1a3a, 0x1a3c, 0x1a3e, 0x1a40, 0x1a42, 0x1a44, 0x1a46, - 0x1a48, 0x1a4a, 0x1a4c, 0x1a4e, 0x1a50, 0x1a52, 0x1a54, 0x1a56, - 0x1a58, 0x1a5a, 0x1a5c, 0x1a5e, 0x1a60, 0x1a62, 0x1a64, 0x1a66, - 0x1a68, 0x1a6a, 0x1a6c, 0x1a6e, 0x1a70, 0x1a72, 0x1a74, 0x1a76, - 0x1a78, 0x1a7a, 0x1a7c, 0x1a7e, 0x1a80, 0x1a82, 0x1a84, 0x1a86, - 0x1a88, 0x1a8a, 0x1a8c, 0x1a8e, 0x1a90, 0x1a92, 0x1a94, 0x1a96, - 0x1a98, 0x1a9a, 0x1a9c, 0x1a9e, 0x1aa0, 0x1aa2, 0x1aa4, 0x1aa6, - 0x1aa8, 0x1aaa, 0x1aac, 0x1aae, 0x1ab0, 0x1ab2, 0x1ab4, 0x1ab6, - 0x1ab8, 0x1aba, 0x1abc, 0x1abe, 0x1ac0, 0x1ac2, 0x1ac4, 0x1ac6, - 0x1ac8, 0x1aca, 0x1acc, 0x1ace, 0x1ad0, 0x1ad2, 0x1ad4, 0x1ad6, - 0x1ad8, 0x1ada, 0x1adc, 0x1ade, 0x1ae0, 0x1ae2, 0x1ae4, 0x1ae6, - 0x1ae8, 0x1aea, 0x1aec, 0x1aee, 0x1af0, 0x1af2, 0x1af4, 0x1af6, - 0x1af8, 0x1afa, 0x1afc, 0x1afe, 0x1b00, 0x1b02, 0x1b04, 0x1b06, - 0x1b08, 0x1b0a, 0x1b0c, 0x1b0e, 0x1b10, 0x1b12, 0x1b14, 0x1b16, - 0x1b18, 0x1b1a, 0x1b1c, 0x1b1e, 0x1b20, 0x1b22, 0x1b24, 0x1b26, - 0x1b28, 0x1b2a, 0x1b2c, 0x1b2e, 0x1b30, 0x1b32, 0x1b34, 0x1b36, - 0x1b38, 0x1b3a, 0x1b3c, 0x1b3e, 0x1b40, 0x1b42, 0x1b44, 0x1b46, - 0x1b48, 0x1b4a, 0x1b4c, 0x1b4e, 0x1b50, 0x1b52, 0x1b54, 0x1b56, - 0x1b58, 0x1b5a, 0x1b5c, 0x1b5e, 0x1b60, 0x1b62, 0x1b64, 0x1b66, - 0x1b68, 0x1b6a, 0x1b6c, 0x1b6e, 0x1b70, 0x1b72, 0x1b74, 0x1b76, - 0x1b78, 0x1b7a, 0x1b7c, 0x1b7e, 0x1b80, 0x1b82, 0x1b84, 0x1b86, - 0x1b88, 0x1b8a, 0x1b8c, 0x1b8e, 0x1b90, 0x1b92, 0x1b94, 0x1b96, - 0x1b98, 0x1b9a, 0x1b9c, 0x1b9e, 0x1ba0, 0x1ba2, 0x1ba4, 0x1ba6, - 0x1ba8, 0x1baa, 0x1bac, 0x1bae, 0x1bb0, 0x1bb2, 0x1bb4, 0x1bb6, - 0x1bb8, 0x1bba, 0x1bbc, 0x1bbe, 0x1bc0, 0x1bc2, 0x1bc4, 0x1bc6, - - 0x1bc8, 0x1bca, 0x1bcc, 0x1bce, 0x1bd0, 0x1bd2, 0x1bd4, 0x1bd6, - 0x1bd8, 0x1bda, 0x1bdc, 0x1bde, 0x1be0, 0x1be2, 0xffff, 0xffff, - 0x1be4, 0xffff, 0x1be6, 0xffff, 0xffff, 0x1be8, 0x1bea, 0x1bec, - 0x1bee, 0x1bf0, 0x1bf2, 0x1bf4, 0x1bf6, 0x1bf8, 0x1bfa, 0xffff, - 0x1bfc, 0xffff, 0x1bfe, 0xffff, 0xffff, 0x1c00, 0x1c02, 0xffff, - 0xffff, 0xffff, 0x1c04, 0x1c06, 0x1c08, 0x1c0a, 0xffff, 0xffff, - 0x1c0c, 0x1c0e, 0x1c10, 0x1c12, 0x1c14, 0x1c16, 0x1c18, 0x1c1a, - 0x1c1c, 0x1c1e, 0x1c20, 0x1c22, 0x1c24, 0x1c26, 0x1c28, 0x1c2a, - 0x1c2c, 0x1c2e, 0x1c30, 0x1c32, 0x1c34, 0x1c36, 0x1c38, 0x1c3a, - 0x1c3c, 0x1c3e, 0x1c40, 0x1c42, 0x1c44, 0x1c46, 0x1c48, 0x1c4a, - 0x1c4c, 0x1c4e, 0x1c50, 0x1c52, 0x1c54, 0x1c56, 0x1c58, 0x1c5a, - 0x1c5c, 0x1c5e, 0x1c60, 0x1c62, 0x1c64, 0x1c66, 0x1c68, 0x1c6a, - 0x1c6c, 0x1c6e, 0x1c70, 0x1c72, 0x1c74, 0x1c76, 0x1c78, 0x1c7a, - 0x1c7c, 0x1c7e, 0x1c80, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x1c82, 0x1c84, 0x1c86, 0x1c88, 0x1c8a, 0x1c8c, 0x1c8e, 0x1c90, - 0x1c92, 0x1c94, 0x1c96, 0x1c98, 0x1c9a, 0x1c9c, 0x1c9e, 0x1ca0, - 0x1ca2, 0x1ca4, 0x1ca6, 0x1ca8, 0x1caa, 0x1cac, 0x1cae, 0x1cb0, - 0x1cb2, 0x1cb4, 0x1cb6, 0x1cb8, 0x1cba, 0x1cbc, 0x1cbe, 0x1cc0, - 0x1cc2, 0x1cc4, 0x1cc6, 0x1cc8, 0x1cca, 0x1ccc, 0x1cce, 0x1cd0, - 0x1cd2, 0x1cd4, 0x1cd6, 0x1cd8, 0x1cda, 0x1cdc, 0x1cde, 0x1ce0, - 0x1ce2, 0x1ce4, 0x1ce6, 0x1ce8, 0x1cea, 0x1cec, 0x1cee, 0x1cf0, - 0x1cf2, 0x1cf4, 0x1cf6, 0x1cf8, 0x1cfa, 0x1cfc, 0x1cfe, 0x1d00, - 0x1d02, 0x1d04, 0x1d06, 0x1d08, 0x1d0a, 0x1d0c, 0x1d0e, 0x1d10, - 0x1d12, 0x1d14, 0x1d16, 0x1d18, 0x1d1a, 0x1d1c, 0x1d1e, 0x1d20, - 0x1d22, 0x1d24, 0x1d26, 0x1d28, 0x1d2a, 0x1d2c, 0x1d2e, 0x1d30, - 0x1d32, 0x1d34, 0x1d36, 0x1d38, 0x1d3a, 0x1d3c, 0x1d3e, 0x1d40, - 0x1d43, 0x1d46, 0x1d49, 0x1d4b, 0x1d4d, 0x1d4f, 0x1d52, 0x1d55, - 0x1d58, 0x1d5a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0x1d5c, 0x1d5f, 0x1d62, 0x1d65, 0x1d69, 0x1d6d, 0x1d70, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x1d73, 0x1d76, 0x1d79, 0x1d7c, 0x1d7f, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x1d82, 0xffff, 0x1d85, - 0x1d88, 0x1d8a, 0x1d8c, 0x1d8e, 0x1d90, 0x1d92, 0x1d94, 0x1d96, - 0x1d98, 0x1d9a, 0x1d9c, 0x1d9f, 0x1da2, 0x1da5, 0x1da8, 0x1dab, - 0x1dae, 0x1db1, 0x1db4, 0x1db7, 0x1dba, 0x1dbd, 0x1dc0, 0xffff, - 0x1dc3, 0x1dc6, 0x1dc9, 0x1dcc, 0x1dcf, 0xffff, 0x1dd2, 0xffff, - 0x1dd5, 0x1dd8, 0xffff, 0x1ddb, 0x1dde, 0xffff, 0x1de1, 0x1de4, - 0x1de7, 0x1dea, 0x1ded, 0x1df0, 0x1df3, 0x1df6, 0x1df9, 0x1dfc, - 0x1dff, 0x1e01, 0x1e03, 0x1e05, 0x1e07, 0x1e09, 0x1e0b, 0x1e0d, - 0x1e0f, 0x1e11, 0x1e13, 0x1e15, 0x1e17, 0x1e19, 0x1e1b, 0x1e1d, - 0x1e1f, 0x1e21, 0x1e23, 0x1e25, 0x1e27, 0x1e29, 0x1e2b, 0x1e2d, - 0x1e2f, 0x1e31, 0x1e33, 0x1e35, 0x1e37, 0x1e39, 0x1e3b, 0x1e3d, - 0x1e3f, 0x1e41, 0x1e43, 0x1e45, 0x1e47, 0x1e49, 0x1e4b, 0x1e4d, - 0x1e4f, 0x1e51, 0x1e53, 0x1e55, 0x1e57, 0x1e59, 0x1e5b, 0x1e5d, - 0x1e5f, 0x1e61, 0x1e63, 0x1e65, 0x1e67, 0x1e69, 0x1e6b, 0x1e6d, - 0x1e6f, 0x1e71, 0x1e73, 0x1e75, 0x1e77, 0x1e79, 0x1e7b, 0x1e7d, - 0x1e7f, 0x1e81, 0x1e83, 0x1e85, 0x1e87, 0x1e89, 0x1e8b, 0x1e8d, - 0x1e8f, 0x1e91, 0x1e93, 0x1e95, 0x1e97, 0x1e99, 0x1e9b, 0x1e9d, - 0x1e9f, 0x1ea1, 0x1ea3, 0x1ea5, 0x1ea7, 0x1ea9, 0x1eab, 0x1ead, - 0x1eaf, 0x1eb1, 0x1eb3, 0x1eb5, 0x1eb7, 0x1eb9, 0x1ebb, 0x1ebd, - 0x1ebf, 0x1ec1, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x1ec3, 0x1ec5, 0x1ec7, 0x1ec9, 0x1ecb, - 0x1ecd, 0x1ecf, 0x1ed1, 0x1ed3, 0x1ed5, 0x1ed7, 0x1ed9, 0x1edb, - 0x1edd, 0x1edf, 0x1ee1, 0x1ee3, 0x1ee5, 0x1ee7, 0x1ee9, 0x1eeb, - 0x1eed, 0x1eef, 0x1ef1, 0x1ef4, 0x1ef7, 0x1efa, 0x1efd, 0x1f00, - 0x1f03, 0x1f06, 0x1f09, 0x1f0c, 0x1f0f, 0x1f12, 0x1f15, 0x1f18, - 0x1f1b, 0x1f1e, 0x1f21, 0x1f24, 0x1f27, 0x1f29, 0x1f2b, 0x1f2d, - - 0x1f2f, 0x1f32, 0x1f35, 0x1f38, 0x1f3b, 0x1f3e, 0x1f41, 0x1f44, - 0x1f47, 0x1f4a, 0x1f4d, 0x1f50, 0x1f53, 0x1f56, 0x1f59, 0x1f5c, - 0x1f5f, 0x1f62, 0x1f65, 0x1f68, 0x1f6b, 0x1f6e, 0x1f71, 0x1f74, - 0x1f77, 0x1f7a, 0x1f7d, 0x1f80, 0x1f83, 0x1f86, 0x1f89, 0x1f8c, - 0x1f8f, 0x1f92, 0x1f95, 0x1f98, 0x1f9b, 0x1f9e, 0x1fa1, 0x1fa4, - 0x1fa7, 0x1faa, 0x1fad, 0x1fb0, 0x1fb3, 0x1fb6, 0x1fb9, 0x1fbc, - 0x1fbf, 0x1fc2, 0x1fc5, 0x1fc8, 0x1fcb, 0x1fce, 0x1fd1, 0x1fd4, - 0x1fd7, 0x1fda, 0x1fdd, 0x1fe0, 0x1fe3, 0x1fe6, 0x1fe9, 0x1fec, - 0x1fef, 0x1ff2, 0x1ff5, 0x1ff8, 0x1ffb, 0x1ffe, 0x2001, 0x2004, - 0x2007, 0x200a, 0x200d, 0x2010, 0x2013, 0x2016, 0x2019, 0x201c, - 0x201f, 0x2022, 0x2025, 0x2028, 0x202b, 0x202e, 0x2031, 0x2034, - 0x2037, 0x203a, 0x203d, 0x2040, 0x2043, 0x2046, 0x2049, 0x204d, - 0x2051, 0x2055, 0x2059, 0x205d, 0x2061, 0x2064, 0x2067, 0x206a, - 0x206d, 0x2070, 0x2073, 0x2076, 0x2079, 0x207c, 0x207f, 0x2082, - 0x2085, 0x2088, 0x208b, 0x208e, 0x2091, 0x2094, 0x2097, 0x209a, - 0x209d, 0x20a0, 0x20a3, 0x20a6, 0x20a9, 0x20ac, 0x20af, 0x20b2, - 0x20b5, 0x20b8, 0x20bb, 0x20be, 0x20c1, 0x20c4, 0x20c7, 0x20ca, - 0x20cd, 0x20d0, 0x20d3, 0x20d6, 0x20d9, 0x20dc, 0x20df, 0x20e2, - 0x20e5, 0x20e8, 0x20eb, 0x20ee, 0x20f1, 0x20f4, 0x20f7, 0x20fa, - 0x20fd, 0x2100, 0x2103, 0x2106, 0x2109, 0x210c, 0x210f, 0x2112, - 0x2115, 0x2118, 0x211b, 0x211e, 0x2121, 0x2124, 0x2127, 0x212a, - 0x212d, 0x2130, 0x2133, 0x2136, 0x2139, 0x213c, 0x213f, 0x2142, - 0x2145, 0x2148, 0x214b, 0x214e, 0x2151, 0x2154, 0x2157, 0x215a, - 0x215d, 0x2160, 0x2163, 0x2166, 0x2169, 0x216c, 0x216f, 0x2172, - 0x2175, 0x2178, 0x217b, 0x217e, 0x2181, 0x2184, 0x2187, 0x218a, - 0x218d, 0x2190, 0x2193, 0x2196, 0x2199, 0x219c, 0x219f, 0x21a2, - 0x21a5, 0x21a8, 0x21ab, 0x21ae, 0x21b1, 0x21b4, 0x21b7, 0x21ba, - 0x21bd, 0x21c0, 0x21c3, 0x21c6, 0x21c9, 0x21cc, 0x21cf, 0x21d2, - 0x21d5, 0x21d8, 0x21db, 0x21de, 0x21e1, 0x21e4, 0x21e7, 0x21ea, - 0x21ed, 0x21f0, 0x21f3, 0x21f6, 0x21f9, 0x21fc, 0x21ff, 0x2202, - 0x2205, 0x2208, 0x220b, 0x220f, 0x2213, 0x2217, 0x221a, 0x221d, - 0x2220, 0x2223, 0x2226, 0x2229, 0x222c, 0x222f, 0x2232, 0x2235, - - 0x2238, 0x223b, 0x223e, 0x2241, 0x2244, 0x2247, 0x224a, 0x224d, - 0x2250, 0x2253, 0x2256, 0x2259, 0x225c, 0x225f, 0x2262, 0x2265, - 0x2268, 0x226b, 0x226e, 0x2271, 0x2274, 0x2277, 0x227a, 0x227d, - 0x2280, 0x2283, 0x2286, 0x2289, 0x228c, 0x228f, 0x2292, 0x2295, - 0x2298, 0x229b, 0x229e, 0x22a1, 0x22a4, 0x22a7, 0x22aa, 0x22ad, - 0x22b0, 0x22b3, 0x22b6, 0x22b9, 0x22bc, 0x22bf, 0x22c2, 0x22c5, - 0x22c8, 0x22cb, 0x22ce, 0x22d1, 0x22d4, 0x22d7, 0x22da, 0x22dd, - 0x22e0, 0x22e3, 0x22e6, 0x22e9, 0x22ec, 0x22ef, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x22f2, 0x22f6, 0x22fa, 0x22fe, 0x2302, 0x2306, 0x230a, 0x230e, - 0x2312, 0x2316, 0x231a, 0x231e, 0x2322, 0x2326, 0x232a, 0x232e, - 0x2332, 0x2336, 0x233a, 0x233e, 0x2342, 0x2346, 0x234a, 0x234e, - 0x2352, 0x2356, 0x235a, 0x235e, 0x2362, 0x2366, 0x236a, 0x236e, - 0x2372, 0x2376, 0x237a, 0x237e, 0x2382, 0x2386, 0x238a, 0x238e, - 0x2392, 0x2396, 0x239a, 0x239e, 0x23a2, 0x23a6, 0x23aa, 0x23ae, - 0x23b2, 0x23b6, 0x23ba, 0x23be, 0x23c2, 0x23c6, 0x23ca, 0x23ce, - 0x23d2, 0x23d6, 0x23da, 0x23de, 0x23e2, 0x23e6, 0x23ea, 0x23ee, - 0xffff, 0xffff, 0x23f2, 0x23f6, 0x23fa, 0x23fe, 0x2402, 0x2406, - 0x240a, 0x240e, 0x2412, 0x2416, 0x241a, 0x241e, 0x2422, 0x2426, - 0x242a, 0x242e, 0x2432, 0x2436, 0x243a, 0x243e, 0x2442, 0x2446, - 0x244a, 0x244e, 0x2452, 0x2456, 0x245a, 0x245e, 0x2462, 0x2466, - 0x246a, 0x246e, 0x2472, 0x2476, 0x247a, 0x247e, 0x2482, 0x2486, - 0x248a, 0x248e, 0x2492, 0x2496, 0x249a, 0x249e, 0x24a2, 0x24a6, - 0x24aa, 0x24ae, 0x24b2, 0x24b6, 0x24ba, 0x24be, 0x24c2, 0x24c6, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x24ca, 0x24ce, 0x24d2, 0x24d7, 0x24dc, 0x24e1, 0x24e6, 0x24eb, - 0x24f0, 0x24f5, 0x24f9, 0x250c, 0x2515, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x251a, 0x251c, 0x251e, 0x2520, 0x2522, 0x2524, 0x2526, 0x2528, - 0x252a, 0x252c, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x252e, 0x2530, 0x2532, 0x2534, 0x2536, 0x2538, 0x253a, 0x253c, - 0x253e, 0x2540, 0x2542, 0x2544, 0x2546, 0x2548, 0x254a, 0x254c, - 0x254e, 0x2550, 0x2552, 0x2554, 0x2556, 0xffff, 0xffff, 0x2558, - 0x255a, 0x255c, 0x255e, 0x2560, 0x2562, 0x2564, 0x2566, 0x2568, - 0x256a, 0x256c, 0x256e, 0xffff, 0x2570, 0x2572, 0x2574, 0x2576, - 0x2578, 0x257a, 0x257c, 0x257e, 0x2580, 0x2582, 0x2584, 0x2586, - 0x2588, 0x258a, 0x258c, 0x258e, 0x2590, 0x2592, 0x2594, 0xffff, - 0x2596, 0x2598, 0x259a, 0x259c, 0xffff, 0xffff, 0xffff, 0xffff, - 0x259e, 0x25a1, 0x25a4, 0xffff, 0x25a7, 0xffff, 0x25aa, 0x25ad, - 0x25b0, 0x25b3, 0x25b6, 0x25b9, 0x25bc, 0x25bf, 0x25c2, 0x25c5, - 0x25c8, 0x25ca, 0x25cc, 0x25ce, 0x25d0, 0x25d2, 0x25d4, 0x25d6, - 0x25d8, 0x25da, 0x25dc, 0x25de, 0x25e0, 0x25e2, 0x25e4, 0x25e6, - 0x25e8, 0x25ea, 0x25ec, 0x25ee, 0x25f0, 0x25f2, 0x25f4, 0x25f6, - 0x25f8, 0x25fa, 0x25fc, 0x25fe, 0x2600, 0x2602, 0x2604, 0x2606, - 0x2608, 0x260a, 0x260c, 0x260e, 0x2610, 0x2612, 0x2614, 0x2616, - 0x2618, 0x261a, 0x261c, 0x261e, 0x2620, 0x2622, 0x2624, 0x2626, - 0x2628, 0x262a, 0x262c, 0x262e, 0x2630, 0x2632, 0x2634, 0x2636, - 0x2638, 0x263a, 0x263c, 0x263e, 0x2640, 0x2642, 0x2644, 0x2646, - 0x2648, 0x264a, 0x264c, 0x264e, 0x2650, 0x2652, 0x2654, 0x2656, - 0x2658, 0x265a, 0x265c, 0x265e, 0x2660, 0x2662, 0x2664, 0x2666, - 0x2668, 0x266a, 0x266c, 0x266e, 0x2670, 0x2672, 0x2674, 0x2676, - 0x2678, 0x267a, 0x267c, 0x267e, 0x2680, 0x2682, 0x2684, 0x2686, - 0x2688, 0x268a, 0x268c, 0x268e, 0x2690, 0x2692, 0x2694, 0x2696, - 0x2698, 0x269a, 0x269c, 0x269e, 0x26a0, 0x26a2, 0x26a4, 0x26a6, - 0x26a8, 0x26aa, 0x26ac, 0x26ae, 0x26b0, 0x26b2, 0x26b5, 0x26b8, - 0x26bb, 0x26be, 0x26c1, 0x26c4, 0x26c7, 0xffff, 0xffff, 0xffff, - - 0xffff, 0x26ca, 0x26cc, 0x26ce, 0x26d0, 0x26d2, 0x26d4, 0x26d6, - 0x26d8, 0x26da, 0x26dc, 0x26de, 0x26e0, 0x26e2, 0x26e4, 0x26e6, - 0x26e8, 0x26ea, 0x26ec, 0x26ee, 0x26f0, 0x26f2, 0x26f4, 0x26f6, - 0x26f8, 0x26fa, 0x26fc, 0x26fe, 0x2700, 0x2702, 0x2704, 0x2706, - 0x2708, 0x270a, 0x270c, 0x270e, 0x2710, 0x2712, 0x2714, 0x2716, - 0x2718, 0x271a, 0x271c, 0x271e, 0x2720, 0x2722, 0x2724, 0x2726, - 0x2728, 0x272a, 0x272c, 0x272e, 0x2730, 0x2732, 0x2734, 0x2736, - 0x2738, 0x273a, 0x273c, 0x273e, 0x2740, 0x2742, 0x2744, 0x2746, - 0x2748, 0x274a, 0x274c, 0x274e, 0x2750, 0x2752, 0x2754, 0x2756, - 0x2758, 0x275a, 0x275c, 0x275e, 0x2760, 0x2762, 0x2764, 0x2766, - 0x2768, 0x276a, 0x276c, 0x276e, 0x2770, 0x2772, 0x2774, 0x2776, - 0x2778, 0x277a, 0x277c, 0x277e, 0x2780, 0x2782, 0x2784, 0x2786, - 0x2788, 0x278a, 0x278c, 0x278e, 0x2790, 0x2792, 0x2794, 0x2796, - 0x2798, 0x279a, 0x279c, 0x279e, 0x27a0, 0x27a2, 0x27a4, 0x27a6, - 0x27a8, 0x27aa, 0x27ac, 0x27ae, 0x27b0, 0x27b2, 0x27b4, 0x27b6, - 0x27b8, 0x27ba, 0x27bc, 0x27be, 0x27c0, 0x27c2, 0x27c4, 0x27c6, - 0x27c8, 0x27ca, 0x27cc, 0x27ce, 0x27d0, 0x27d2, 0x27d4, 0x27d6, - 0x27d8, 0x27da, 0x27dc, 0x27de, 0x27e0, 0x27e2, 0x27e4, 0x27e6, - 0x27e8, 0x27ea, 0x27ec, 0x27ee, 0x27f0, 0x27f2, 0x27f4, 0x27f6, - 0x27f8, 0x27fa, 0x27fc, 0x27fe, 0x2800, 0x2802, 0x2804, 0x2806, - 0x2808, 0x280a, 0x280c, 0x280e, 0x2810, 0x2812, 0x2814, 0x2816, - 0x2818, 0x281a, 0x281c, 0x281e, 0x2820, 0x2822, 0x2824, 0x2826, - 0x2828, 0x282a, 0x282c, 0x282e, 0x2830, 0x2832, 0x2834, 0x2836, - 0x2838, 0x283a, 0x283c, 0x283e, 0x2840, 0x2842, 0x2844, 0xffff, - 0xffff, 0xffff, 0x2846, 0x2848, 0x284a, 0x284c, 0x284e, 0x2850, - 0xffff, 0xffff, 0x2852, 0x2854, 0x2856, 0x2858, 0x285a, 0x285c, - 0xffff, 0xffff, 0x285e, 0x2860, 0x2862, 0x2864, 0x2866, 0x2868, - 0xffff, 0xffff, 0x286a, 0x286c, 0x286e, 0xffff, 0xffff, 0xffff, - 0x2870, 0x2872, 0x2874, 0x2876, 0x2878, 0x287a, 0x287c, 0xffff, - 0x287e, 0x2880, 0x2882, 0x2884, 0x2886, 0x2888, 0x288a, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x288c, 0x2891, - 0x2896, 0x289b, 0x28a0, 0x28a5, 0x28aa, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x28af, 0x28b4, 0x28b9, 0x28be, 0x28c3, - 0x28c8, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0x28cd, 0x28cf, 0x28d1, 0x28d3, 0x28d5, 0x28d7, 0x28d9, 0x28db, - 0x28dd, 0x28df, 0x28e1, 0x28e3, 0x28e5, 0x28e7, 0x28e9, 0x28eb, - 0x28ed, 0x28ef, 0x28f1, 0x28f3, 0x28f5, 0x28f7, 0x28f9, 0x28fb, - 0x28fd, 0x28ff, 0x2901, 0x2903, 0x2905, 0x2907, 0x2909, 0x290b, - 0x290d, 0x290f, 0x2911, 0x2913, 0x2915, 0x2917, 0x2919, 0x291b, - 0x291d, 0x291f, 0x2921, 0x2923, 0x2925, 0x2927, 0x2929, 0x292b, - 0x292d, 0x292f, 0x2931, 0x2933, 0x2935, 0x2937, 0x2939, 0x293b, - 0x293d, 0x293f, 0x2941, 0x2943, 0x2945, 0x2947, 0x2949, 0x294b, - 0x294d, 0x294f, 0x2951, 0x2953, 0x2955, 0x2957, 0x2959, 0x295b, - 0x295d, 0x295f, 0x2961, 0x2963, 0x2965, 0x2967, 0x2969, 0x296b, - 0x296d, 0x296f, 0x2971, 0x2973, 0x2975, 0xffff, 0x2977, 0x2979, - 0x297b, 0x297d, 0x297f, 0x2981, 0x2983, 0x2985, 0x2987, 0x2989, - 0x298b, 0x298d, 0x298f, 0x2991, 0x2993, 0x2995, 0x2997, 0x2999, - 0x299b, 0x299d, 0x299f, 0x29a1, 0x29a3, 0x29a5, 0x29a7, 0x29a9, - 0x29ab, 0x29ad, 0x29af, 0x29b1, 0x29b3, 0x29b5, 0x29b7, 0x29b9, - 0x29bb, 0x29bd, 0x29bf, 0x29c1, 0x29c3, 0x29c5, 0x29c7, 0x29c9, - 0x29cb, 0x29cd, 0x29cf, 0x29d1, 0x29d3, 0x29d5, 0x29d7, 0x29d9, - 0x29db, 0x29dd, 0x29df, 0x29e1, 0x29e3, 0x29e5, 0x29e7, 0x29e9, - 0x29eb, 0x29ed, 0x29ef, 0x29f1, 0x29f3, 0x29f5, 0x29f7, 0x29f9, - 0x29fb, 0x29fd, 0x29ff, 0x2a01, 0x2a03, 0xffff, 0x2a05, 0x2a07, - 0xffff, 0xffff, 0x2a09, 0xffff, 0xffff, 0x2a0b, 0x2a0d, 0xffff, - 0xffff, 0x2a0f, 0x2a11, 0x2a13, 0x2a15, 0xffff, 0x2a17, 0x2a19, - 0x2a1b, 0x2a1d, 0x2a1f, 0x2a21, 0x2a23, 0x2a25, 0x2a27, 0x2a29, - 0x2a2b, 0x2a2d, 0xffff, 0x2a2f, 0xffff, 0x2a31, 0x2a33, 0x2a35, - 0x2a37, 0x2a39, 0x2a3b, 0x2a3d, 0xffff, 0x2a3f, 0x2a41, 0x2a43, - 0x2a45, 0x2a47, 0x2a49, 0x2a4b, 0x2a4d, 0x2a4f, 0x2a51, 0x2a53, - 0x2a55, 0x2a57, 0x2a59, 0x2a5b, 0x2a5d, 0x2a5f, 0x2a61, 0x2a63, - 0x2a65, 0x2a67, 0x2a69, 0x2a6b, 0x2a6d, 0x2a6f, 0x2a71, 0x2a73, - 0x2a75, 0x2a77, 0x2a79, 0x2a7b, 0x2a7d, 0x2a7f, 0x2a81, 0x2a83, - 0x2a85, 0x2a87, 0x2a89, 0x2a8b, 0x2a8d, 0x2a8f, 0x2a91, 0x2a93, - 0x2a95, 0x2a97, 0x2a99, 0x2a9b, 0x2a9d, 0x2a9f, 0x2aa1, 0x2aa3, - 0x2aa5, 0x2aa7, 0x2aa9, 0x2aab, 0x2aad, 0x2aaf, 0x2ab1, 0x2ab3, - - 0x2ab5, 0x2ab7, 0x2ab9, 0x2abb, 0x2abd, 0x2abf, 0xffff, 0x2ac1, - 0x2ac3, 0x2ac5, 0x2ac7, 0xffff, 0xffff, 0x2ac9, 0x2acb, 0x2acd, - 0x2acf, 0x2ad1, 0x2ad3, 0x2ad5, 0x2ad7, 0xffff, 0x2ad9, 0x2adb, - 0x2add, 0x2adf, 0x2ae1, 0x2ae3, 0x2ae5, 0xffff, 0x2ae7, 0x2ae9, - 0x2aeb, 0x2aed, 0x2aef, 0x2af1, 0x2af3, 0x2af5, 0x2af7, 0x2af9, - 0x2afb, 0x2afd, 0x2aff, 0x2b01, 0x2b03, 0x2b05, 0x2b07, 0x2b09, - 0x2b0b, 0x2b0d, 0x2b0f, 0x2b11, 0x2b13, 0x2b15, 0x2b17, 0x2b19, - 0x2b1b, 0x2b1d, 0xffff, 0x2b1f, 0x2b21, 0x2b23, 0x2b25, 0xffff, - 0x2b27, 0x2b29, 0x2b2b, 0x2b2d, 0x2b2f, 0xffff, 0x2b31, 0xffff, - 0xffff, 0xffff, 0x2b33, 0x2b35, 0x2b37, 0x2b39, 0x2b3b, 0x2b3d, - 0x2b3f, 0xffff, 0x2b41, 0x2b43, 0x2b45, 0x2b47, 0x2b49, 0x2b4b, - 0x2b4d, 0x2b4f, 0x2b51, 0x2b53, 0x2b55, 0x2b57, 0x2b59, 0x2b5b, - 0x2b5d, 0x2b5f, 0x2b61, 0x2b63, 0x2b65, 0x2b67, 0x2b69, 0x2b6b, - 0x2b6d, 0x2b6f, 0x2b71, 0x2b73, 0x2b75, 0x2b77, 0x2b79, 0x2b7b, - 0x2b7d, 0x2b7f, 0x2b81, 0x2b83, 0x2b85, 0x2b87, 0x2b89, 0x2b8b, - 0x2b8d, 0x2b8f, 0x2b91, 0x2b93, 0x2b95, 0x2b97, 0x2b99, 0x2b9b, - 0x2b9d, 0x2b9f, 0x2ba1, 0x2ba3, 0x2ba5, 0x2ba7, 0x2ba9, 0x2bab, - 0x2bad, 0x2baf, 0x2bb1, 0x2bb3, 0x2bb5, 0x2bb7, 0x2bb9, 0x2bbb, - 0x2bbd, 0x2bbf, 0x2bc1, 0x2bc3, 0x2bc5, 0x2bc7, 0x2bc9, 0x2bcb, - 0x2bcd, 0x2bcf, 0x2bd1, 0x2bd3, 0x2bd5, 0x2bd7, 0x2bd9, 0x2bdb, - 0x2bdd, 0x2bdf, 0x2be1, 0x2be3, 0x2be5, 0x2be7, 0x2be9, 0x2beb, - 0x2bed, 0x2bef, 0x2bf1, 0x2bf3, 0x2bf5, 0x2bf7, 0x2bf9, 0x2bfb, - 0x2bfd, 0x2bff, 0x2c01, 0x2c03, 0x2c05, 0x2c07, 0x2c09, 0x2c0b, - 0x2c0d, 0x2c0f, 0x2c11, 0x2c13, 0x2c15, 0x2c17, 0x2c19, 0x2c1b, - 0x2c1d, 0x2c1f, 0x2c21, 0x2c23, 0x2c25, 0x2c27, 0x2c29, 0x2c2b, - 0x2c2d, 0x2c2f, 0x2c31, 0x2c33, 0x2c35, 0x2c37, 0x2c39, 0x2c3b, - 0x2c3d, 0x2c3f, 0x2c41, 0x2c43, 0x2c45, 0x2c47, 0x2c49, 0x2c4b, - 0x2c4d, 0x2c4f, 0x2c51, 0x2c53, 0x2c55, 0x2c57, 0x2c59, 0x2c5b, - 0x2c5d, 0x2c5f, 0x2c61, 0x2c63, 0x2c65, 0x2c67, 0x2c69, 0x2c6b, - 0x2c6d, 0x2c6f, 0x2c71, 0x2c73, 0x2c75, 0x2c77, 0x2c79, 0x2c7b, - 0x2c7d, 0x2c7f, 0x2c81, 0x2c83, 0x2c85, 0x2c87, 0x2c89, 0x2c8b, - 0x2c8d, 0x2c8f, 0x2c91, 0x2c93, 0x2c95, 0x2c97, 0x2c99, 0x2c9b, - - 0x2c9d, 0x2c9f, 0x2ca1, 0x2ca3, 0x2ca5, 0x2ca7, 0x2ca9, 0x2cab, - 0x2cad, 0x2caf, 0x2cb1, 0x2cb3, 0x2cb5, 0x2cb7, 0x2cb9, 0x2cbb, - 0x2cbd, 0x2cbf, 0x2cc1, 0x2cc3, 0x2cc5, 0x2cc7, 0x2cc9, 0x2ccb, - 0x2ccd, 0x2ccf, 0x2cd1, 0x2cd3, 0x2cd5, 0x2cd7, 0x2cd9, 0x2cdb, - 0x2cdd, 0x2cdf, 0x2ce1, 0x2ce3, 0x2ce5, 0x2ce7, 0x2ce9, 0x2ceb, - 0x2ced, 0x2cef, 0x2cf1, 0x2cf3, 0x2cf5, 0x2cf7, 0x2cf9, 0x2cfb, - 0x2cfd, 0x2cff, 0x2d01, 0x2d03, 0x2d05, 0x2d07, 0x2d09, 0x2d0b, - 0x2d0d, 0x2d0f, 0x2d11, 0x2d13, 0x2d15, 0x2d17, 0x2d19, 0x2d1b, - 0x2d1d, 0x2d1f, 0x2d21, 0x2d23, 0x2d25, 0x2d27, 0x2d29, 0x2d2b, - 0x2d2d, 0x2d2f, 0x2d31, 0x2d33, 0x2d35, 0x2d37, 0x2d39, 0x2d3b, - 0x2d3d, 0x2d3f, 0x2d41, 0x2d43, 0x2d45, 0x2d47, 0x2d49, 0x2d4b, - 0x2d4d, 0x2d4f, 0x2d51, 0x2d53, 0x2d55, 0x2d57, 0x2d59, 0x2d5b, - 0x2d5d, 0x2d5f, 0x2d61, 0x2d63, 0x2d65, 0x2d67, 0x2d69, 0x2d6b, - 0x2d6d, 0x2d6f, 0x2d71, 0x2d73, 0x2d75, 0x2d77, 0x2d79, 0x2d7b, - 0x2d7d, 0x2d7f, 0x2d81, 0x2d83, 0x2d85, 0x2d87, 0x2d89, 0x2d8b, - 0x2d8d, 0x2d8f, 0x2d91, 0x2d93, 0x2d95, 0x2d97, 0x2d99, 0x2d9b, - 0x2d9d, 0x2d9f, 0x2da1, 0x2da3, 0x2da5, 0x2da7, 0x2da9, 0x2dab, - 0x2dad, 0x2daf, 0x2db1, 0x2db3, 0x2db5, 0x2db7, 0x2db9, 0x2dbb, - 0x2dbd, 0x2dbf, 0x2dc1, 0x2dc3, 0x2dc5, 0x2dc7, 0x2dc9, 0x2dcb, - 0x2dcd, 0x2dcf, 0x2dd1, 0x2dd3, 0x2dd5, 0x2dd7, 0x2dd9, 0x2ddb, - 0x2ddd, 0x2ddf, 0x2de1, 0x2de3, 0x2de5, 0x2de7, 0xffff, 0xffff, - 0x2de9, 0x2deb, 0x2ded, 0x2def, 0x2df1, 0x2df3, 0x2df5, 0x2df7, - 0x2df9, 0x2dfb, 0x2dfd, 0x2dff, 0x2e01, 0x2e03, 0x2e05, 0x2e07, - 0x2e09, 0x2e0b, 0x2e0d, 0x2e0f, 0x2e11, 0x2e13, 0x2e15, 0x2e17, - 0x2e19, 0x2e1b, 0x2e1d, 0x2e1f, 0x2e21, 0x2e23, 0x2e25, 0x2e27, - 0x2e29, 0x2e2b, 0x2e2d, 0x2e2f, 0x2e31, 0x2e33, 0x2e35, 0x2e37, - 0x2e39, 0x2e3b, 0x2e3d, 0x2e3f, 0x2e41, 0x2e43, 0x2e45, 0x2e47, - 0x2e49, 0x2e4b, 0x2e4d, 0x2e4f, 0x2e51, 0x2e53, 0x2e55, 0x2e57, - 0x2e59, 0x2e5b, 0x2e5d, 0x2e5f, 0x2e61, 0x2e63, 0x2e65, 0x2e67, - 0x2e69, 0x2e6b, 0x2e6d, 0x2e6f, 0x2e71, 0x2e73, 0x2e75, 0x2e77, - 0x2e79, 0x2e7b, 0x2e7d, 0x2e7f, 0x2e81, 0x2e83, 0x2e85, 0x2e87, - 0x2e89, 0x2e8b, 0x2e8d, 0x2e8f, 0x2e91, 0x2e93, 0x2e95, 0x2e97, - - 0x2e99, 0x2e9b, 0x2e9d, 0x2e9f, 0x2ea1, 0x2ea3, 0x2ea5, 0x2ea7, - 0x2ea9, 0x2eab, 0x2ead, 0x2eaf, 0x2eb1, 0x2eb3, 0x2eb5, 0x2eb7, - 0x2eb9, 0x2ebb, 0x2ebd, 0x2ebf, 0x2ec1, 0x2ec3, 0x2ec5, 0x2ec7, - 0x2ec9, 0x2ecb, 0x2ecd, 0x2ecf, 0x2ed1, 0x2ed3, 0x2ed5, 0x2ed7, - 0x2ed9, 0x2edb, 0x2edd, 0x2edf, 0x2ee1, 0x2ee3, 0x2ee5, 0x2ee7, - 0x2ee9, 0x2eeb, 0x2eed, 0x2eef, 0x2ef1, 0x2ef3, 0x2ef5, 0x2ef7, - 0x2ef9, 0x2efb, 0x2efd, 0x2eff, 0x2f01, 0x2f03, 0x2f05, 0x2f07, - 0x2f09, 0x2f0b, 0x2f0d, 0x2f0f, 0x2f11, 0x2f13, 0x2f15, 0x2f17, - 0x2f19, 0x2f1b, 0x2f1d, 0x2f1f, 0x2f21, 0x2f23, 0x2f25, 0x2f27, - 0x2f29, 0x2f2b, 0x2f2d, 0x2f2f, 0x2f31, 0x2f33, 0x2f35, 0x2f37, - 0x2f39, 0x2f3b, 0x2f3d, 0x2f3f, 0x2f41, 0x2f43, 0x2f45, 0x2f47, - 0x2f49, 0x2f4b, 0x2f4d, 0x2f4f, 0x2f51, 0x2f53, 0x2f55, 0x2f57, - 0x2f59, 0x2f5b, 0x2f5d, 0x2f5f, 0x2f61, 0x2f63, 0x2f65, 0x2f67, - 0x2f69, 0x2f6b, 0x2f6d, 0x2f6f, 0x2f71, 0x2f73, 0x2f75, 0x2f77, - 0x2f79, 0x2f7b, 0x2f7d, 0x2f7f, 0x2f81, 0x2f83, 0x2f85, 0x2f87, - 0x2f89, 0x2f8b, 0x2f8d, 0x2f8f, 0x2f91, 0x2f93, 0x2f95, 0x2f97, - 0x2f99, 0x2f9b, 0x2f9d, 0x2f9f, 0x2fa1, 0x2fa3, 0x2fa5, 0x2fa7, - 0x2fa9, 0x2fab, 0x2fad, 0x2faf, 0x2fb1, 0x2fb3, 0x2fb5, 0x2fb7, - 0x2fb9, 0x2fbb, 0x2fbd, 0x2fbf, 0x2fc1, 0x2fc3, 0x2fc5, 0x2fc7, - 0x2fc9, 0x2fcb, 0x2fcd, 0x2fcf, 0x2fd1, 0x2fd3, 0x2fd5, 0x2fd7, - 0x2fd9, 0x2fdb, 0x2fdd, 0x2fdf, 0x2fe1, 0x2fe3, 0x2fe5, 0x2fe7, - 0x2fe9, 0x2feb, 0x2fed, 0x2fef, 0x2ff1, 0x2ff3, 0x2ff5, 0x2ff7, - 0x2ff9, 0x2ffb, 0x2ffd, 0x2fff, 0x3001, 0x3003, 0x3005, 0x3007, - 0x3009, 0x300b, 0x300d, 0x300f, 0x3011, 0x3013, 0x3015, 0x3017, - 0x3019, 0x301b, 0x301d, 0x301f, 0x3021, 0x3023, 0x3025, 0x3027, - 0x3029, 0x302b, 0x302d, 0x302f, 0xffff, 0xffff, 0x3031, 0x3033, - 0x3035, 0x3037, 0x3039, 0x303b, 0x303d, 0x303f, 0x3041, 0x3043, - 0x3045, 0x3047, 0x3049, 0x304b, 0x304d, 0x304f, 0x3051, 0x3053, - 0x3055, 0x3057, 0x3059, 0x305b, 0x305d, 0x305f, 0x3061, 0x3063, - 0x3065, 0x3067, 0x3069, 0x306b, 0x306d, 0x306f, 0x3071, 0x3073, - 0x3075, 0x3077, 0x3079, 0x307b, 0x307d, 0x307f, 0x3081, 0x3083, - 0x3085, 0x3087, 0x3089, 0x308b, 0x308d, 0x308f, 0x3091, 0x3093, - - 0x3095, 0x3097, 0x3099, 0x309b, 0x309e, 0x30a0, 0x30a2, 0x30a4, - 0x30a6, 0x30a8, 0x30aa, 0x30ac, 0x30ae, 0x30b0, 0x30b3, 0x30b5, - 0x30b7, 0x30b9, 0x30bb, 0x30be, 0x30c0, 0x30c2, 0x30c4, 0x30c7, - 0x30c9, 0x30cb, 0x30cd, 0x30cf, 0x30d1, 0x30d4, 0x30d6, 0x30d8, - 0x30da, 0x30dc, 0x30de, 0x30e0, 0x30e2, 0x30e4, 0x30e6, 0x30e8, - 0x30ea, 0x30ec, 0x30ee, 0x30f0, 0x30f2, 0x30f4, 0x30f6, 0x30f8, - 0x30fa, 0x30fc, 0x30fe, 0x3100, 0x3102, 0x3105, 0x3107, 0x3109, - 0x310b, 0x310e, 0x3110, 0x3112, 0x3114, 0x3116, 0x3118, 0x311a, - 0x311c, 0x311e, 0x3120, 0x3122, 0x3124, 0x3126, 0x3128, 0x312a, - 0x312c, 0x312e, 0x3130, 0x3132, 0x3134, 0x3136, 0x3138, 0x313a, - 0x313c, 0x313e, 0x3140, 0x3142, 0x3144, 0x3146, 0x3148, 0x314a, - 0x314c, 0x314e, 0x3151, 0x3153, 0x3155, 0x3157, 0x3159, 0x315b, - 0x315d, 0x3160, 0x3163, 0x3165, 0x3167, 0x3169, 0x316b, 0x316d, - 0x316f, 0x3171, 0x3173, 0x3175, 0x3177, 0x317a, 0x317c, 0x317e, - 0x3180, 0x3182, 0x3185, 0x3187, 0x3189, 0x318b, 0x318d, 0x318f, - 0x3191, 0x3193, 0x3195, 0x3197, 0x319a, 0x319c, 0x319f, 0x31a1, - 0x31a3, 0x31a5, 0x31a7, 0x31a9, 0x31ab, 0x31ad, 0x31af, 0x31b1, - 0x31b3, 0x31b5, 0x31b8, 0x31ba, 0x31bc, 0x31be, 0x31c0, 0x31c2, - 0x31c5, 0x31c7, 0x31ca, 0x31cd, 0x31cf, 0x31d1, 0x31d3, 0x31d5, - 0x31d8, 0x31db, 0x31dd, 0x31df, 0x31e1, 0x31e3, 0x31e5, 0x31e7, - 0x31e9, 0x31eb, 0x31ed, 0x31ef, 0x31f1, 0x31f4, 0x31f6, 0x31f8, - 0x31fa, 0x31fc, 0x31fe, 0x3200, 0x3202, 0x3204, 0x3206, 0x3208, - 0x320a, 0x320c, 0x320e, 0x3210, 0x3212, 0x3214, 0x3216, 0x3218, - 0x321a, 0x321d, 0x321f, 0x3221, 0x3223, 0x3225, 0x3227, 0x322a, - 0x322c, 0x322e, 0x3230, 0x3232, 0x3234, 0x3236, 0x3238, 0x323a, - 0x323c, 0x323e, 0x3240, 0x3243, 0x3245, 0x3247, 0x3249, 0x324b, - 0x324d, 0x324f, 0x3251, 0x3253, 0x3255, 0x3257, 0x3259, 0x325b, - 0x325d, 0x325f, 0x3261, 0x3263, 0x3265, 0x3267, 0x326a, 0x326c, - 0x326e, 0x3270, 0x3272, 0x3274, 0x3277, 0x3279, 0x327b, 0x327d, - 0x327f, 0x3281, 0x3283, 0x3285, 0x3287, 0x328a, 0x328c, 0x328e, - 0x3290, 0x3293, 0x3295, 0x3297, 0x3299, 0x329b, 0x329d, 0x329f, - 0x32a2, 0x32a5, 0x32a8, 0x32aa, 0x32ad, 0x32af, 0x32b1, 0x32b3, - - 0x32b5, 0x32b7, 0x32b9, 0x32bb, 0x32bd, 0x32bf, 0x32c1, 0x32c4, - 0x32c6, 0x32c8, 0x32ca, 0x32cc, 0x32ce, 0x32d0, 0x32d3, 0x32d5, - 0x32d7, 0x32da, 0x32dd, 0x32df, 0x32e1, 0x32e3, 0x32e5, 0x32e7, - 0x32e9, 0x32eb, 0x32ed, 0x32ef, 0x32f2, 0x32f4, 0x32f7, 0x32f9, - 0x32fc, 0x32fe, 0x3300, 0x3302, 0x3305, 0x3307, 0x3309, 0x330c, - 0x330f, 0x3311, 0x3313, 0x3315, 0x3317, 0x3319, 0x331b, 0x331d, - 0x331f, 0x3321, 0x3323, 0x3325, 0x3327, 0x3329, 0x332c, 0x332e, - 0x3331, 0x3333, 0x3336, 0x3338, 0x333b, 0x333e, 0x3341, 0x3343, - 0x3345, 0x3347, 0x334a, 0x334d, 0x3350, 0x3353, 0x3355, 0x3357, - 0x3359, 0x335b, 0x335d, 0x335f, 0x3361, 0x3363, 0x3366, 0x3368, - 0x336a, 0x336c, 0x336e, 0x3371, 0x3373, 0x3376, 0x3379, 0x337b, - 0x337d, 0x337f, 0x3381, 0x3383, 0x3385, 0x3388, 0x338b, 0x338e, - 0x3390, 0x3392, 0x3395, 0x3397, 0x3399, 0x339b, 0x339e, 0x33a0, - 0x33a2, 0x33a4, 0x33a6, 0x33a8, 0x33ab, 0x33ad, 0x33af, 0x33b1, - 0x33b3, 0x33b5, 0x33b7, 0x33ba, 0x33bd, 0x33bf, 0x33c2, 0x33c4, - 0x33c7, 0x33c9, 0x33cb, 0x33cd, 0x33d0, 0x33d3, 0x33d5, 0x33d8, - 0x33da, 0x33dd, 0x33df, 0x33e1, 0x33e3, 0x33e5, 0x33e7, 0x33e9, - 0x33ec, 0x33ef, 0x33f2, 0x33f5, 0x33f7, 0x33f9, 0x33fb, 0x33fd, - 0x33ff, 0x3401, 0x3403, 0x3405, 0x3407, 0x3409, 0x340b, 0x340d, - 0x3410, 0x3412, 0x3414, 0x3416, 0x3418, 0x341a, 0x341c, 0x341e, - 0x3420, 0x3422, 0x3424, 0x3426, 0x3428, 0x342b, 0x342e, 0x3431, - 0x3433, 0x3435, 0x3437, 0x3439, 0x343c, 0x343e, 0x3441, 0x3443, - 0x3445, 0x3448, 0x344b, 0x344d, 0x344f, 0x3451, 0x3453, 0x3455, - 0x3457, 0x3459, 0x345b, 0x345d, 0x345f, 0x3461, 0x3463, 0x3465, - 0x3467, 0x3469, 0x346b, 0x346d, 0x346f, 0x3471, 0x3474, 0x3476, - 0x3478, 0x347a, 0x347c, 0x347e, 0x3481, 0x3484, 0x3486, 0x3488, - 0x348a, 0x348c, 0x348e, 0x3490, 0x3493, 0x3495, 0x3497, 0x3499, - 0x349b, 0x349e, 0x34a1, 0x34a3, 0x34a5, 0x34a7, 0x34aa, 0x34ac, - 0x34ae, 0x34b1, 0x34b4, 0x34b6, 0x34b8, 0x34ba, 0x34bd, 0x34bf, - 0x34c1, 0x34c3, 0x34c5, 0x34c7, 0x34c9, 0x34cb, 0x34ce, 0x34d0, - 0x34d2, 0x34d4, 0x34d7, 0x34d9, 0x34db, 0x34dd, 0x34df, 0x34e2, - 0x34e5, 0x34e7, 0x34e9, 0x34eb, 0x34ee, 0x34f0, 0x34f3, 0x34f5, - - 0x34f7, 0x34f9, 0x34fc, 0x34fe, 0x3500, 0x3502, 0x3504, 0x3506, - 0x3508, 0x350a, 0x350d, 0x350f, 0x3511, 0x3513, 0x3515, 0x3517, - 0x3519, 0x351c, 0x351e, 0x3521, 0x3524, 0x3527, 0x3529, 0x352b, - 0x352d, 0x352f, 0x3531, 0x3533, 0x3535, 0x3537, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x163f, 0x1642, 0x1646, 0x164b, 0x1650, 0x1653, 0x1659, 0x1660, + 0x1666, 0x166a, 0x1670, 0x1676, 0x167b, 0x167f, 0x1683, 0x1687, + + 0x168c, 0x1692, 0x1697, 0x169b, 0x169f, 0x16a3, 0x16a6, 0x16a9, + 0x16ac, 0x16af, 0x16b3, 0x16b7, 0x16bd, 0x16c1, 0x16c6, 0x16cc, + + 0x16d0, 0x16d3, 0x16d6, 0x16dc, 0x16e1, 0x16e7, 0x16eb, 0x16f1, + 0x16f4, 0x16f8, 0x16fc, 0x1700, 0x1704, 0x1708, 0x170d, 0x1711, + + 0x1714, 0x1718, 0x171c, 0x1720, 0x1725, 0x1729, 0x172d, 0x1731, + 0x1737, 0x173c, 0x173f, 0x1745, 0x1748, 0x174d, 0x1752, 0x1756, + + 0x175a, 0x175e, 0x1763, 0x1766, 0x176a, 0x176f, 0x1772, 0x1778, + 0x177c, 0x177f, 0x1782, 0x1785, 0x1788, 0x178b, 0x178e, 0x1791, + + 0x1794, 0x1797, 0x179a, 0x179e, 0x17a2, 0x17a6, 0x17aa, 0x17ae, + 0x17b2, 0x17b6, 0x17ba, 0x17be, 0x17c2, 0x17c6, 0x17ca, 0x17ce, + + 0x17d2, 0x17d6, 0x17da, 0x17dd, 0x17e0, 0x17e4, 0x17e7, 0x17ea, + 0x17ed, 0x17f1, 0x17f5, 0x17f8, 0x17fb, 0x17fe, 0x1801, 0x1804, + + 0x1809, 0x180c, 0x180f, 0x1812, 0x1815, 0x1818, 0x181b, 0x181e, + 0x1821, 0x1825, 0x182a, 0x182d, 0x1830, 0x1833, 0x1836, 0x1839, + + 0x183c, 0x183f, 0x1843, 0x1847, 0x184b, 0x184f, 0x1852, 0x1855, + 0x1858, 0x185b, 0x185e, 0x1861, 0x1864, 0x1867, 0x186a, 0x186d, + + 0x1871, 0x1875, 0x1878, 0x187c, 0x1880, 0x1884, 0x1887, 0x188b, + 0x188f, 0x1894, 0x1897, 0x189b, 0x189f, 0x18a3, 0x18a7, 0x18ad, + + 0x18b4, 0x18b7, 0x18ba, 0x18bd, 0x18c0, 0x18c3, 0x18c6, 0x18c9, + 0x18cc, 0x18cf, 0x18d2, 0x18d5, 0x18d8, 0x18db, 0x18de, 0x18e1, + + 0x18e4, 0x18e7, 0x18ea, 0x18ef, 0x18f2, 0x18f5, 0x18f8, 0x18fd, + 0x1901, 0x1904, 0x1907, 0x190a, 0x190d, 0x1910, 0x1913, 0x1916, + + 0x1919, 0x191c, 0x191f, 0x1923, 0x1926, 0x1929, 0x192d, 0x1931, + 0x1934, 0x1939, 0x193d, 0x1940, 0x1943, 0x1946, 0x1949, 0x194d, + + 0x1951, 0x1954, 0x1957, 0x195a, 0x195d, 0x1960, 0x1963, 0x1966, + 0x1969, 0x196c, 0x1970, 0x1974, 0x1978, 0x197c, 0x1980, 0x1984, + + 0x1988, 0x198c, 0x1990, 0x1994, 0x1998, 0x199c, 0x19a0, 0x19a4, + 0x19a8, 0x19ac, 0x19b0, 0x19b4, 0x19b8, 0x19bc, 0x19c0, 0x19c4, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0x19c8, 0x19ca, 0x19cc, 0x19ce, 0x19d0, 0x19d2, 0x19d4, 0x19d6, + 0x19d8, 0x19da, 0x19dc, 0x19de, 0x19e0, 0x19e2, 0x19e4, 0x19e6, + 0x19e8, 0x19ea, 0x19ec, 0x19ee, 0x19f0, 0x19f2, 0x19f4, 0x19f6, + 0x19f8, 0x19fa, 0x19fc, 0x19fe, 0x1a00, 0x1a02, 0x1a04, 0x1a06, + 0x1a08, 0x1a0a, 0x1a0c, 0x1a0e, 0x1a10, 0x1a12, 0x1a14, 0x1a16, + 0x1a18, 0x1a1a, 0x1a1c, 0x1a1e, 0x1a20, 0x1a22, 0x1a24, 0x1a26, + 0x1a28, 0x1a2a, 0x1a2c, 0x1a2e, 0x1a30, 0x1a32, 0x1a34, 0x1a36, + 0x1a38, 0x1a3a, 0x1a3c, 0x1a3e, 0x1a40, 0x1a42, 0x1a44, 0x1a46, + 0x1a48, 0x1a4a, 0x1a4c, 0x1a4e, 0x1a50, 0x1a52, 0x1a54, 0x1a56, + 0x1a58, 0x1a5a, 0x1a5c, 0x1a5e, 0x1a60, 0x1a62, 0x1a64, 0x1a66, + 0x1a68, 0x1a6a, 0x1a6c, 0x1a6e, 0x1a70, 0x1a72, 0x1a74, 0x1a76, + 0x1a78, 0x1a7a, 0x1a7c, 0x1a7e, 0x1a80, 0x1a82, 0x1a84, 0x1a86, + 0x1a88, 0x1a8a, 0x1a8c, 0x1a8e, 0x1a90, 0x1a92, 0x1a94, 0x1a96, + 0x1a98, 0x1a9a, 0x1a9c, 0x1a9e, 0x1aa0, 0x1aa2, 0x1aa4, 0x1aa6, + 0x1aa8, 0x1aaa, 0x1aac, 0x1aae, 0x1ab0, 0x1ab2, 0x1ab4, 0x1ab6, + 0x1ab8, 0x1aba, 0x1abc, 0x1abe, 0x1ac0, 0x1ac2, 0x1ac4, 0x1ac6, + 0x1ac8, 0x1aca, 0x1acc, 0x1ace, 0x1ad0, 0x1ad2, 0x1ad4, 0x1ad6, + 0x1ad8, 0x1ada, 0x1adc, 0x1ade, 0x1ae0, 0x1ae2, 0x1ae4, 0x1ae6, + 0x1ae8, 0x1aea, 0x1aec, 0x1aee, 0x1af0, 0x1af2, 0x1af4, 0x1af6, + 0x1af8, 0x1afa, 0x1afc, 0x1afe, 0x1b00, 0x1b02, 0x1b04, 0x1b06, + 0x1b08, 0x1b0a, 0x1b0c, 0x1b0e, 0x1b10, 0x1b12, 0x1b14, 0x1b16, + 0x1b18, 0x1b1a, 0x1b1c, 0x1b1e, 0x1b20, 0x1b22, 0x1b24, 0x1b26, + 0x1b28, 0x1b2a, 0x1b2c, 0x1b2e, 0x1b30, 0x1b32, 0x1b34, 0x1b36, + 0x1b38, 0x1b3a, 0x1b3c, 0x1b3e, 0x1b40, 0x1b42, 0x1b44, 0x1b46, + 0x1b48, 0x1b4a, 0x1b4c, 0x1b4e, 0x1b50, 0x1b52, 0x1b54, 0x1b56, + 0x1b58, 0x1b5a, 0x1b5c, 0x1b5e, 0x1b60, 0x1b62, 0x1b64, 0x1b66, + 0x1b68, 0x1b6a, 0x1b6c, 0x1b6e, 0x1b70, 0x1b72, 0x1b74, 0x1b76, + 0x1b78, 0x1b7a, 0x1b7c, 0x1b7e, 0x1b80, 0x1b82, 0x1b84, 0x1b86, + 0x1b88, 0x1b8a, 0x1b8c, 0x1b8e, 0x1b90, 0x1b92, 0x1b94, 0x1b96, + 0x1b98, 0x1b9a, 0x1b9c, 0x1b9e, 0x1ba0, 0x1ba2, 0x1ba4, 0x1ba6, + 0x1ba8, 0x1baa, 0x1bac, 0x1bae, 0x1bb0, 0x1bb2, 0x1bb4, 0x1bb6, + 0x1bb8, 0x1bba, 0x1bbc, 0x1bbe, 0x1bc0, 0x1bc2, 0x1bc4, 0x1bc6, + + 0x1bc8, 0x1bca, 0x1bcc, 0x1bce, 0x1bd0, 0x1bd2, 0x1bd4, 0x1bd6, + 0x1bd8, 0x1bda, 0x1bdc, 0x1bde, 0x1be0, 0x1be2, 0xffff, 0xffff, + 0x1be4, 0xffff, 0x1be6, 0xffff, 0xffff, 0x1be8, 0x1bea, 0x1bec, + 0x1bee, 0x1bf0, 0x1bf2, 0x1bf4, 0x1bf6, 0x1bf8, 0x1bfa, 0xffff, + 0x1bfc, 0xffff, 0x1bfe, 0xffff, 0xffff, 0x1c00, 0x1c02, 0xffff, + 0xffff, 0xffff, 0x1c04, 0x1c06, 0x1c08, 0x1c0a, 0xffff, 0xffff, + 0x1c0c, 0x1c0e, 0x1c10, 0x1c12, 0x1c14, 0x1c16, 0x1c18, 0x1c1a, + 0x1c1c, 0x1c1e, 0x1c20, 0x1c22, 0x1c24, 0x1c26, 0x1c28, 0x1c2a, + 0x1c2c, 0x1c2e, 0x1c30, 0x1c32, 0x1c34, 0x1c36, 0x1c38, 0x1c3a, + 0x1c3c, 0x1c3e, 0x1c40, 0x1c42, 0x1c44, 0x1c46, 0x1c48, 0x1c4a, + 0x1c4c, 0x1c4e, 0x1c50, 0x1c52, 0x1c54, 0x1c56, 0x1c58, 0x1c5a, + 0x1c5c, 0x1c5e, 0x1c60, 0x1c62, 0x1c64, 0x1c66, 0x1c68, 0x1c6a, + 0x1c6c, 0x1c6e, 0x1c70, 0x1c72, 0x1c74, 0x1c76, 0x1c78, 0x1c7a, + 0x1c7c, 0x1c7e, 0x1c80, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x1c82, 0x1c84, 0x1c86, 0x1c88, 0x1c8a, 0x1c8c, 0x1c8e, 0x1c90, + 0x1c92, 0x1c94, 0x1c96, 0x1c98, 0x1c9a, 0x1c9c, 0x1c9e, 0x1ca0, + 0x1ca2, 0x1ca4, 0x1ca6, 0x1ca8, 0x1caa, 0x1cac, 0x1cae, 0x1cb0, + 0x1cb2, 0x1cb4, 0x1cb6, 0x1cb8, 0x1cba, 0x1cbc, 0x1cbe, 0x1cc0, + 0x1cc2, 0x1cc4, 0x1cc6, 0x1cc8, 0x1cca, 0x1ccc, 0x1cce, 0x1cd0, + 0x1cd2, 0x1cd4, 0x1cd6, 0x1cd8, 0x1cda, 0x1cdc, 0x1cde, 0x1ce0, + 0x1ce2, 0x1ce4, 0x1ce6, 0x1ce8, 0x1cea, 0x1cec, 0x1cee, 0x1cf0, + 0x1cf2, 0x1cf4, 0x1cf6, 0x1cf8, 0x1cfa, 0x1cfc, 0x1cfe, 0x1d00, + 0x1d02, 0x1d04, 0x1d06, 0x1d08, 0x1d0a, 0x1d0c, 0x1d0e, 0x1d10, + 0x1d12, 0x1d14, 0x1d16, 0x1d18, 0x1d1a, 0x1d1c, 0x1d1e, 0x1d20, + 0x1d22, 0x1d24, 0x1d26, 0x1d28, 0x1d2a, 0x1d2c, 0x1d2e, 0x1d30, + 0x1d32, 0x1d34, 0x1d36, 0x1d38, 0x1d3a, 0x1d3c, 0x1d3e, 0x1d40, + 0x1d43, 0x1d46, 0x1d49, 0x1d4b, 0x1d4d, 0x1d4f, 0x1d52, 0x1d55, + 0x1d58, 0x1d5a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0x1d5c, 0x1d5f, 0x1d62, 0x1d65, 0x1d69, 0x1d6d, 0x1d70, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x1d73, 0x1d76, 0x1d79, 0x1d7c, 0x1d7f, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x1d82, 0xffff, 0x1d85, + 0x1d88, 0x1d8a, 0x1d8c, 0x1d8e, 0x1d90, 0x1d92, 0x1d94, 0x1d96, + 0x1d98, 0x1d9a, 0x1d9c, 0x1d9f, 0x1da2, 0x1da5, 0x1da8, 0x1dab, + 0x1dae, 0x1db1, 0x1db4, 0x1db7, 0x1dba, 0x1dbd, 0x1dc0, 0xffff, + 0x1dc3, 0x1dc6, 0x1dc9, 0x1dcc, 0x1dcf, 0xffff, 0x1dd2, 0xffff, + 0x1dd5, 0x1dd8, 0xffff, 0x1ddb, 0x1dde, 0xffff, 0x1de1, 0x1de4, + 0x1de7, 0x1dea, 0x1ded, 0x1df0, 0x1df3, 0x1df6, 0x1df9, 0x1dfc, + 0x1dff, 0x1e01, 0x1e03, 0x1e05, 0x1e07, 0x1e09, 0x1e0b, 0x1e0d, + 0x1e0f, 0x1e11, 0x1e13, 0x1e15, 0x1e17, 0x1e19, 0x1e1b, 0x1e1d, + 0x1e1f, 0x1e21, 0x1e23, 0x1e25, 0x1e27, 0x1e29, 0x1e2b, 0x1e2d, + 0x1e2f, 0x1e31, 0x1e33, 0x1e35, 0x1e37, 0x1e39, 0x1e3b, 0x1e3d, + 0x1e3f, 0x1e41, 0x1e43, 0x1e45, 0x1e47, 0x1e49, 0x1e4b, 0x1e4d, + 0x1e4f, 0x1e51, 0x1e53, 0x1e55, 0x1e57, 0x1e59, 0x1e5b, 0x1e5d, + 0x1e5f, 0x1e61, 0x1e63, 0x1e65, 0x1e67, 0x1e69, 0x1e6b, 0x1e6d, + 0x1e6f, 0x1e71, 0x1e73, 0x1e75, 0x1e77, 0x1e79, 0x1e7b, 0x1e7d, + 0x1e7f, 0x1e81, 0x1e83, 0x1e85, 0x1e87, 0x1e89, 0x1e8b, 0x1e8d, + 0x1e8f, 0x1e91, 0x1e93, 0x1e95, 0x1e97, 0x1e99, 0x1e9b, 0x1e9d, + 0x1e9f, 0x1ea1, 0x1ea3, 0x1ea5, 0x1ea7, 0x1ea9, 0x1eab, 0x1ead, + 0x1eaf, 0x1eb1, 0x1eb3, 0x1eb5, 0x1eb7, 0x1eb9, 0x1ebb, 0x1ebd, + 0x1ebf, 0x1ec1, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x1ec3, 0x1ec5, 0x1ec7, 0x1ec9, 0x1ecb, + 0x1ecd, 0x1ecf, 0x1ed1, 0x1ed3, 0x1ed5, 0x1ed7, 0x1ed9, 0x1edb, + 0x1edd, 0x1edf, 0x1ee1, 0x1ee3, 0x1ee5, 0x1ee7, 0x1ee9, 0x1eeb, + 0x1eed, 0x1eef, 0x1ef1, 0x1ef4, 0x1ef7, 0x1efa, 0x1efd, 0x1f00, + 0x1f03, 0x1f06, 0x1f09, 0x1f0c, 0x1f0f, 0x1f12, 0x1f15, 0x1f18, + 0x1f1b, 0x1f1e, 0x1f21, 0x1f24, 0x1f27, 0x1f29, 0x1f2b, 0x1f2d, + + 0x1f2f, 0x1f32, 0x1f35, 0x1f38, 0x1f3b, 0x1f3e, 0x1f41, 0x1f44, + 0x1f47, 0x1f4a, 0x1f4d, 0x1f50, 0x1f53, 0x1f56, 0x1f59, 0x1f5c, + 0x1f5f, 0x1f62, 0x1f65, 0x1f68, 0x1f6b, 0x1f6e, 0x1f71, 0x1f74, + 0x1f77, 0x1f7a, 0x1f7d, 0x1f80, 0x1f83, 0x1f86, 0x1f89, 0x1f8c, + 0x1f8f, 0x1f92, 0x1f95, 0x1f98, 0x1f9b, 0x1f9e, 0x1fa1, 0x1fa4, + 0x1fa7, 0x1faa, 0x1fad, 0x1fb0, 0x1fb3, 0x1fb6, 0x1fb9, 0x1fbc, + 0x1fbf, 0x1fc2, 0x1fc5, 0x1fc8, 0x1fcb, 0x1fce, 0x1fd1, 0x1fd4, + 0x1fd7, 0x1fda, 0x1fdd, 0x1fe0, 0x1fe3, 0x1fe6, 0x1fe9, 0x1fec, + 0x1fef, 0x1ff2, 0x1ff5, 0x1ff8, 0x1ffb, 0x1ffe, 0x2001, 0x2004, + 0x2007, 0x200a, 0x200d, 0x2010, 0x2013, 0x2016, 0x2019, 0x201c, + 0x201f, 0x2022, 0x2025, 0x2028, 0x202b, 0x202e, 0x2031, 0x2034, + 0x2037, 0x203a, 0x203d, 0x2040, 0x2043, 0x2046, 0x2049, 0x204d, + 0x2051, 0x2055, 0x2059, 0x205d, 0x2061, 0x2064, 0x2067, 0x206a, + 0x206d, 0x2070, 0x2073, 0x2076, 0x2079, 0x207c, 0x207f, 0x2082, + 0x2085, 0x2088, 0x208b, 0x208e, 0x2091, 0x2094, 0x2097, 0x209a, + 0x209d, 0x20a0, 0x20a3, 0x20a6, 0x20a9, 0x20ac, 0x20af, 0x20b2, + 0x20b5, 0x20b8, 0x20bb, 0x20be, 0x20c1, 0x20c4, 0x20c7, 0x20ca, + 0x20cd, 0x20d0, 0x20d3, 0x20d6, 0x20d9, 0x20dc, 0x20df, 0x20e2, + 0x20e5, 0x20e8, 0x20eb, 0x20ee, 0x20f1, 0x20f4, 0x20f7, 0x20fa, + 0x20fd, 0x2100, 0x2103, 0x2106, 0x2109, 0x210c, 0x210f, 0x2112, + 0x2115, 0x2118, 0x211b, 0x211e, 0x2121, 0x2124, 0x2127, 0x212a, + 0x212d, 0x2130, 0x2133, 0x2136, 0x2139, 0x213c, 0x213f, 0x2142, + 0x2145, 0x2148, 0x214b, 0x214e, 0x2151, 0x2154, 0x2157, 0x215a, + 0x215d, 0x2160, 0x2163, 0x2166, 0x2169, 0x216c, 0x216f, 0x2172, + 0x2175, 0x2178, 0x217b, 0x217e, 0x2181, 0x2184, 0x2187, 0x218a, + 0x218d, 0x2190, 0x2193, 0x2196, 0x2199, 0x219c, 0x219f, 0x21a2, + 0x21a5, 0x21a8, 0x21ab, 0x21ae, 0x21b1, 0x21b4, 0x21b7, 0x21ba, + 0x21bd, 0x21c0, 0x21c3, 0x21c6, 0x21c9, 0x21cc, 0x21cf, 0x21d2, + 0x21d5, 0x21d8, 0x21db, 0x21de, 0x21e1, 0x21e4, 0x21e7, 0x21ea, + 0x21ed, 0x21f0, 0x21f3, 0x21f6, 0x21f9, 0x21fc, 0x21ff, 0x2202, + 0x2205, 0x2208, 0x220b, 0x220f, 0x2213, 0x2217, 0x221a, 0x221d, + 0x2220, 0x2223, 0x2226, 0x2229, 0x222c, 0x222f, 0x2232, 0x2235, + + 0x2238, 0x223b, 0x223e, 0x2241, 0x2244, 0x2247, 0x224a, 0x224d, + 0x2250, 0x2253, 0x2256, 0x2259, 0x225c, 0x225f, 0x2262, 0x2265, + 0x2268, 0x226b, 0x226e, 0x2271, 0x2274, 0x2277, 0x227a, 0x227d, + 0x2280, 0x2283, 0x2286, 0x2289, 0x228c, 0x228f, 0x2292, 0x2295, + 0x2298, 0x229b, 0x229e, 0x22a1, 0x22a4, 0x22a7, 0x22aa, 0x22ad, + 0x22b0, 0x22b3, 0x22b6, 0x22b9, 0x22bc, 0x22bf, 0x22c2, 0x22c5, + 0x22c8, 0x22cb, 0x22ce, 0x22d1, 0x22d4, 0x22d7, 0x22da, 0x22dd, + 0x22e0, 0x22e3, 0x22e6, 0x22e9, 0x22ec, 0x22ef, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x22f2, 0x22f6, 0x22fa, 0x22fe, 0x2302, 0x2306, 0x230a, 0x230e, + 0x2312, 0x2316, 0x231a, 0x231e, 0x2322, 0x2326, 0x232a, 0x232e, + 0x2332, 0x2336, 0x233a, 0x233e, 0x2342, 0x2346, 0x234a, 0x234e, + 0x2352, 0x2356, 0x235a, 0x235e, 0x2362, 0x2366, 0x236a, 0x236e, + 0x2372, 0x2376, 0x237a, 0x237e, 0x2382, 0x2386, 0x238a, 0x238e, + 0x2392, 0x2396, 0x239a, 0x239e, 0x23a2, 0x23a6, 0x23aa, 0x23ae, + 0x23b2, 0x23b6, 0x23ba, 0x23be, 0x23c2, 0x23c6, 0x23ca, 0x23ce, + 0x23d2, 0x23d6, 0x23da, 0x23de, 0x23e2, 0x23e6, 0x23ea, 0x23ee, + 0xffff, 0xffff, 0x23f2, 0x23f6, 0x23fa, 0x23fe, 0x2402, 0x2406, + 0x240a, 0x240e, 0x2412, 0x2416, 0x241a, 0x241e, 0x2422, 0x2426, + 0x242a, 0x242e, 0x2432, 0x2436, 0x243a, 0x243e, 0x2442, 0x2446, + 0x244a, 0x244e, 0x2452, 0x2456, 0x245a, 0x245e, 0x2462, 0x2466, + 0x246a, 0x246e, 0x2472, 0x2476, 0x247a, 0x247e, 0x2482, 0x2486, + 0x248a, 0x248e, 0x2492, 0x2496, 0x249a, 0x249e, 0x24a2, 0x24a6, + 0x24aa, 0x24ae, 0x24b2, 0x24b6, 0x24ba, 0x24be, 0x24c2, 0x24c6, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x24ca, 0x24ce, 0x24d2, 0x24d7, 0x24dc, 0x24e1, 0x24e6, 0x24eb, + 0x24f0, 0x24f5, 0x24f9, 0x250c, 0x2515, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x251a, 0x251c, 0x251e, 0x2520, 0x2522, 0x2524, 0x2526, 0x2528, + 0x252a, 0x252c, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x252e, 0x2530, 0x2532, 0x2534, 0x2536, 0x2538, 0x253a, 0x253c, + 0x253e, 0x2540, 0x2542, 0x2544, 0x2546, 0x2548, 0x254a, 0x254c, + 0x254e, 0x2550, 0x2552, 0x2554, 0x2556, 0xffff, 0xffff, 0x2558, + 0x255a, 0x255c, 0x255e, 0x2560, 0x2562, 0x2564, 0x2566, 0x2568, + 0x256a, 0x256c, 0x256e, 0xffff, 0x2570, 0x2572, 0x2574, 0x2576, + 0x2578, 0x257a, 0x257c, 0x257e, 0x2580, 0x2582, 0x2584, 0x2586, + 0x2588, 0x258a, 0x258c, 0x258e, 0x2590, 0x2592, 0x2594, 0xffff, + 0x2596, 0x2598, 0x259a, 0x259c, 0xffff, 0xffff, 0xffff, 0xffff, + 0x259e, 0x25a1, 0x25a4, 0xffff, 0x25a7, 0xffff, 0x25aa, 0x25ad, + 0x25b0, 0x25b3, 0x25b6, 0x25b9, 0x25bc, 0x25bf, 0x25c2, 0x25c5, + 0x25c8, 0x25ca, 0x25cc, 0x25ce, 0x25d0, 0x25d2, 0x25d4, 0x25d6, + 0x25d8, 0x25da, 0x25dc, 0x25de, 0x25e0, 0x25e2, 0x25e4, 0x25e6, + 0x25e8, 0x25ea, 0x25ec, 0x25ee, 0x25f0, 0x25f2, 0x25f4, 0x25f6, + 0x25f8, 0x25fa, 0x25fc, 0x25fe, 0x2600, 0x2602, 0x2604, 0x2606, + 0x2608, 0x260a, 0x260c, 0x260e, 0x2610, 0x2612, 0x2614, 0x2616, + 0x2618, 0x261a, 0x261c, 0x261e, 0x2620, 0x2622, 0x2624, 0x2626, + 0x2628, 0x262a, 0x262c, 0x262e, 0x2630, 0x2632, 0x2634, 0x2636, + 0x2638, 0x263a, 0x263c, 0x263e, 0x2640, 0x2642, 0x2644, 0x2646, + 0x2648, 0x264a, 0x264c, 0x264e, 0x2650, 0x2652, 0x2654, 0x2656, + 0x2658, 0x265a, 0x265c, 0x265e, 0x2660, 0x2662, 0x2664, 0x2666, + 0x2668, 0x266a, 0x266c, 0x266e, 0x2670, 0x2672, 0x2674, 0x2676, + 0x2678, 0x267a, 0x267c, 0x267e, 0x2680, 0x2682, 0x2684, 0x2686, + 0x2688, 0x268a, 0x268c, 0x268e, 0x2690, 0x2692, 0x2694, 0x2696, + 0x2698, 0x269a, 0x269c, 0x269e, 0x26a0, 0x26a2, 0x26a4, 0x26a6, + 0x26a8, 0x26aa, 0x26ac, 0x26ae, 0x26b0, 0x26b2, 0x26b5, 0x26b8, + 0x26bb, 0x26be, 0x26c1, 0x26c4, 0x26c7, 0xffff, 0xffff, 0xffff, + + 0xffff, 0x26ca, 0x26cc, 0x26ce, 0x26d0, 0x26d2, 0x26d4, 0x26d6, + 0x26d8, 0x26da, 0x26dc, 0x26de, 0x26e0, 0x26e2, 0x26e4, 0x26e6, + 0x26e8, 0x26ea, 0x26ec, 0x26ee, 0x26f0, 0x26f2, 0x26f4, 0x26f6, + 0x26f8, 0x26fa, 0x26fc, 0x26fe, 0x2700, 0x2702, 0x2704, 0x2706, + 0x2708, 0x270a, 0x270c, 0x270e, 0x2710, 0x2712, 0x2714, 0x2716, + 0x2718, 0x271a, 0x271c, 0x271e, 0x2720, 0x2722, 0x2724, 0x2726, + 0x2728, 0x272a, 0x272c, 0x272e, 0x2730, 0x2732, 0x2734, 0x2736, + 0x2738, 0x273a, 0x273c, 0x273e, 0x2740, 0x2742, 0x2744, 0x2746, + 0x2748, 0x274a, 0x274c, 0x274e, 0x2750, 0x2752, 0x2754, 0x2756, + 0x2758, 0x275a, 0x275c, 0x275e, 0x2760, 0x2762, 0x2764, 0x2766, + 0x2768, 0x276a, 0x276c, 0x276e, 0x2770, 0x2772, 0x2774, 0x2776, + 0x2778, 0x277a, 0x277c, 0x277e, 0x2780, 0x2782, 0x2784, 0x2786, + 0x2788, 0x278a, 0x278c, 0x278e, 0x2790, 0x2792, 0x2794, 0x2796, + 0x2798, 0x279a, 0x279c, 0x279e, 0x27a0, 0x27a2, 0x27a4, 0x27a6, + 0x27a8, 0x27aa, 0x27ac, 0x27ae, 0x27b0, 0x27b2, 0x27b4, 0x27b6, + 0x27b8, 0x27ba, 0x27bc, 0x27be, 0x27c0, 0x27c2, 0x27c4, 0x27c6, + 0x27c8, 0x27ca, 0x27cc, 0x27ce, 0x27d0, 0x27d2, 0x27d4, 0x27d6, + 0x27d8, 0x27da, 0x27dc, 0x27de, 0x27e0, 0x27e2, 0x27e4, 0x27e6, + 0x27e8, 0x27ea, 0x27ec, 0x27ee, 0x27f0, 0x27f2, 0x27f4, 0x27f6, + 0x27f8, 0x27fa, 0x27fc, 0x27fe, 0x2800, 0x2802, 0x2804, 0x2806, + 0x2808, 0x280a, 0x280c, 0x280e, 0x2810, 0x2812, 0x2814, 0x2816, + 0x2818, 0x281a, 0x281c, 0x281e, 0x2820, 0x2822, 0x2824, 0x2826, + 0x2828, 0x282a, 0x282c, 0x282e, 0x2830, 0x2832, 0x2834, 0x2836, + 0x2838, 0x283a, 0x283c, 0x283e, 0x2840, 0x2842, 0x2844, 0xffff, + 0xffff, 0xffff, 0x2846, 0x2848, 0x284a, 0x284c, 0x284e, 0x2850, + 0xffff, 0xffff, 0x2852, 0x2854, 0x2856, 0x2858, 0x285a, 0x285c, + 0xffff, 0xffff, 0x285e, 0x2860, 0x2862, 0x2864, 0x2866, 0x2868, + 0xffff, 0xffff, 0x286a, 0x286c, 0x286e, 0xffff, 0xffff, 0xffff, + 0x2870, 0x2872, 0x2874, 0x2876, 0x2878, 0x287a, 0x287c, 0xffff, + 0x287e, 0x2880, 0x2882, 0x2884, 0x2886, 0x2888, 0x288a, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x288c, 0x2891, + 0x2896, 0x289b, 0x28a0, 0x28a5, 0x28aa, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x28af, 0x28b4, 0x28b9, 0x28be, 0x28c3, + 0x28c8, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0x28cd, 0x28cf, 0x28d1, 0x28d3, 0x28d5, 0x28d7, 0x28d9, 0x28db, + 0x28dd, 0x28df, 0x28e1, 0x28e3, 0x28e5, 0x28e7, 0x28e9, 0x28eb, + 0x28ed, 0x28ef, 0x28f1, 0x28f3, 0x28f5, 0x28f7, 0x28f9, 0x28fb, + 0x28fd, 0x28ff, 0x2901, 0x2903, 0x2905, 0x2907, 0x2909, 0x290b, + 0x290d, 0x290f, 0x2911, 0x2913, 0x2915, 0x2917, 0x2919, 0x291b, + 0x291d, 0x291f, 0x2921, 0x2923, 0x2925, 0x2927, 0x2929, 0x292b, + 0x292d, 0x292f, 0x2931, 0x2933, 0x2935, 0x2937, 0x2939, 0x293b, + 0x293d, 0x293f, 0x2941, 0x2943, 0x2945, 0x2947, 0x2949, 0x294b, + 0x294d, 0x294f, 0x2951, 0x2953, 0x2955, 0x2957, 0x2959, 0x295b, + 0x295d, 0x295f, 0x2961, 0x2963, 0x2965, 0x2967, 0x2969, 0x296b, + 0x296d, 0x296f, 0x2971, 0x2973, 0x2975, 0xffff, 0x2977, 0x2979, + 0x297b, 0x297d, 0x297f, 0x2981, 0x2983, 0x2985, 0x2987, 0x2989, + 0x298b, 0x298d, 0x298f, 0x2991, 0x2993, 0x2995, 0x2997, 0x2999, + 0x299b, 0x299d, 0x299f, 0x29a1, 0x29a3, 0x29a5, 0x29a7, 0x29a9, + 0x29ab, 0x29ad, 0x29af, 0x29b1, 0x29b3, 0x29b5, 0x29b7, 0x29b9, + 0x29bb, 0x29bd, 0x29bf, 0x29c1, 0x29c3, 0x29c5, 0x29c7, 0x29c9, + 0x29cb, 0x29cd, 0x29cf, 0x29d1, 0x29d3, 0x29d5, 0x29d7, 0x29d9, + 0x29db, 0x29dd, 0x29df, 0x29e1, 0x29e3, 0x29e5, 0x29e7, 0x29e9, + 0x29eb, 0x29ed, 0x29ef, 0x29f1, 0x29f3, 0x29f5, 0x29f7, 0x29f9, + 0x29fb, 0x29fd, 0x29ff, 0x2a01, 0x2a03, 0xffff, 0x2a05, 0x2a07, + 0xffff, 0xffff, 0x2a09, 0xffff, 0xffff, 0x2a0b, 0x2a0d, 0xffff, + 0xffff, 0x2a0f, 0x2a11, 0x2a13, 0x2a15, 0xffff, 0x2a17, 0x2a19, + 0x2a1b, 0x2a1d, 0x2a1f, 0x2a21, 0x2a23, 0x2a25, 0x2a27, 0x2a29, + 0x2a2b, 0x2a2d, 0xffff, 0x2a2f, 0xffff, 0x2a31, 0x2a33, 0x2a35, + 0x2a37, 0x2a39, 0x2a3b, 0x2a3d, 0xffff, 0x2a3f, 0x2a41, 0x2a43, + 0x2a45, 0x2a47, 0x2a49, 0x2a4b, 0x2a4d, 0x2a4f, 0x2a51, 0x2a53, + 0x2a55, 0x2a57, 0x2a59, 0x2a5b, 0x2a5d, 0x2a5f, 0x2a61, 0x2a63, + 0x2a65, 0x2a67, 0x2a69, 0x2a6b, 0x2a6d, 0x2a6f, 0x2a71, 0x2a73, + 0x2a75, 0x2a77, 0x2a79, 0x2a7b, 0x2a7d, 0x2a7f, 0x2a81, 0x2a83, + 0x2a85, 0x2a87, 0x2a89, 0x2a8b, 0x2a8d, 0x2a8f, 0x2a91, 0x2a93, + 0x2a95, 0x2a97, 0x2a99, 0x2a9b, 0x2a9d, 0x2a9f, 0x2aa1, 0x2aa3, + 0x2aa5, 0x2aa7, 0x2aa9, 0x2aab, 0x2aad, 0x2aaf, 0x2ab1, 0x2ab3, + + 0x2ab5, 0x2ab7, 0x2ab9, 0x2abb, 0x2abd, 0x2abf, 0xffff, 0x2ac1, + 0x2ac3, 0x2ac5, 0x2ac7, 0xffff, 0xffff, 0x2ac9, 0x2acb, 0x2acd, + 0x2acf, 0x2ad1, 0x2ad3, 0x2ad5, 0x2ad7, 0xffff, 0x2ad9, 0x2adb, + 0x2add, 0x2adf, 0x2ae1, 0x2ae3, 0x2ae5, 0xffff, 0x2ae7, 0x2ae9, + 0x2aeb, 0x2aed, 0x2aef, 0x2af1, 0x2af3, 0x2af5, 0x2af7, 0x2af9, + 0x2afb, 0x2afd, 0x2aff, 0x2b01, 0x2b03, 0x2b05, 0x2b07, 0x2b09, + 0x2b0b, 0x2b0d, 0x2b0f, 0x2b11, 0x2b13, 0x2b15, 0x2b17, 0x2b19, + 0x2b1b, 0x2b1d, 0xffff, 0x2b1f, 0x2b21, 0x2b23, 0x2b25, 0xffff, + 0x2b27, 0x2b29, 0x2b2b, 0x2b2d, 0x2b2f, 0xffff, 0x2b31, 0xffff, + 0xffff, 0xffff, 0x2b33, 0x2b35, 0x2b37, 0x2b39, 0x2b3b, 0x2b3d, + 0x2b3f, 0xffff, 0x2b41, 0x2b43, 0x2b45, 0x2b47, 0x2b49, 0x2b4b, + 0x2b4d, 0x2b4f, 0x2b51, 0x2b53, 0x2b55, 0x2b57, 0x2b59, 0x2b5b, + 0x2b5d, 0x2b5f, 0x2b61, 0x2b63, 0x2b65, 0x2b67, 0x2b69, 0x2b6b, + 0x2b6d, 0x2b6f, 0x2b71, 0x2b73, 0x2b75, 0x2b77, 0x2b79, 0x2b7b, + 0x2b7d, 0x2b7f, 0x2b81, 0x2b83, 0x2b85, 0x2b87, 0x2b89, 0x2b8b, + 0x2b8d, 0x2b8f, 0x2b91, 0x2b93, 0x2b95, 0x2b97, 0x2b99, 0x2b9b, + 0x2b9d, 0x2b9f, 0x2ba1, 0x2ba3, 0x2ba5, 0x2ba7, 0x2ba9, 0x2bab, + 0x2bad, 0x2baf, 0x2bb1, 0x2bb3, 0x2bb5, 0x2bb7, 0x2bb9, 0x2bbb, + 0x2bbd, 0x2bbf, 0x2bc1, 0x2bc3, 0x2bc5, 0x2bc7, 0x2bc9, 0x2bcb, + 0x2bcd, 0x2bcf, 0x2bd1, 0x2bd3, 0x2bd5, 0x2bd7, 0x2bd9, 0x2bdb, + 0x2bdd, 0x2bdf, 0x2be1, 0x2be3, 0x2be5, 0x2be7, 0x2be9, 0x2beb, + 0x2bed, 0x2bef, 0x2bf1, 0x2bf3, 0x2bf5, 0x2bf7, 0x2bf9, 0x2bfb, + 0x2bfd, 0x2bff, 0x2c01, 0x2c03, 0x2c05, 0x2c07, 0x2c09, 0x2c0b, + 0x2c0d, 0x2c0f, 0x2c11, 0x2c13, 0x2c15, 0x2c17, 0x2c19, 0x2c1b, + 0x2c1d, 0x2c1f, 0x2c21, 0x2c23, 0x2c25, 0x2c27, 0x2c29, 0x2c2b, + 0x2c2d, 0x2c2f, 0x2c31, 0x2c33, 0x2c35, 0x2c37, 0x2c39, 0x2c3b, + 0x2c3d, 0x2c3f, 0x2c41, 0x2c43, 0x2c45, 0x2c47, 0x2c49, 0x2c4b, + 0x2c4d, 0x2c4f, 0x2c51, 0x2c53, 0x2c55, 0x2c57, 0x2c59, 0x2c5b, + 0x2c5d, 0x2c5f, 0x2c61, 0x2c63, 0x2c65, 0x2c67, 0x2c69, 0x2c6b, + 0x2c6d, 0x2c6f, 0x2c71, 0x2c73, 0x2c75, 0x2c77, 0x2c79, 0x2c7b, + 0x2c7d, 0x2c7f, 0x2c81, 0x2c83, 0x2c85, 0x2c87, 0x2c89, 0x2c8b, + 0x2c8d, 0x2c8f, 0x2c91, 0x2c93, 0x2c95, 0x2c97, 0x2c99, 0x2c9b, + + 0x2c9d, 0x2c9f, 0x2ca1, 0x2ca3, 0x2ca5, 0x2ca7, 0x2ca9, 0x2cab, + 0x2cad, 0x2caf, 0x2cb1, 0x2cb3, 0x2cb5, 0x2cb7, 0x2cb9, 0x2cbb, + 0x2cbd, 0x2cbf, 0x2cc1, 0x2cc3, 0x2cc5, 0x2cc7, 0x2cc9, 0x2ccb, + 0x2ccd, 0x2ccf, 0x2cd1, 0x2cd3, 0x2cd5, 0x2cd7, 0x2cd9, 0x2cdb, + 0x2cdd, 0x2cdf, 0x2ce1, 0x2ce3, 0x2ce5, 0x2ce7, 0x2ce9, 0x2ceb, + 0x2ced, 0x2cef, 0x2cf1, 0x2cf3, 0x2cf5, 0x2cf7, 0x2cf9, 0x2cfb, + 0x2cfd, 0x2cff, 0x2d01, 0x2d03, 0x2d05, 0x2d07, 0x2d09, 0x2d0b, + 0x2d0d, 0x2d0f, 0x2d11, 0x2d13, 0x2d15, 0x2d17, 0x2d19, 0x2d1b, + 0x2d1d, 0x2d1f, 0x2d21, 0x2d23, 0x2d25, 0x2d27, 0x2d29, 0x2d2b, + 0x2d2d, 0x2d2f, 0x2d31, 0x2d33, 0x2d35, 0x2d37, 0x2d39, 0x2d3b, + 0x2d3d, 0x2d3f, 0x2d41, 0x2d43, 0x2d45, 0x2d47, 0x2d49, 0x2d4b, + 0x2d4d, 0x2d4f, 0x2d51, 0x2d53, 0x2d55, 0x2d57, 0x2d59, 0x2d5b, + 0x2d5d, 0x2d5f, 0x2d61, 0x2d63, 0x2d65, 0x2d67, 0x2d69, 0x2d6b, + 0x2d6d, 0x2d6f, 0x2d71, 0x2d73, 0x2d75, 0x2d77, 0x2d79, 0x2d7b, + 0x2d7d, 0x2d7f, 0x2d81, 0x2d83, 0x2d85, 0x2d87, 0x2d89, 0x2d8b, + 0x2d8d, 0x2d8f, 0x2d91, 0x2d93, 0x2d95, 0x2d97, 0x2d99, 0x2d9b, + 0x2d9d, 0x2d9f, 0x2da1, 0x2da3, 0x2da5, 0x2da7, 0x2da9, 0x2dab, + 0x2dad, 0x2daf, 0x2db1, 0x2db3, 0x2db5, 0x2db7, 0x2db9, 0x2dbb, + 0x2dbd, 0x2dbf, 0x2dc1, 0x2dc3, 0x2dc5, 0x2dc7, 0x2dc9, 0x2dcb, + 0x2dcd, 0x2dcf, 0x2dd1, 0x2dd3, 0x2dd5, 0x2dd7, 0x2dd9, 0x2ddb, + 0x2ddd, 0x2ddf, 0x2de1, 0x2de3, 0x2de5, 0x2de7, 0xffff, 0xffff, + 0x2de9, 0x2deb, 0x2ded, 0x2def, 0x2df1, 0x2df3, 0x2df5, 0x2df7, + 0x2df9, 0x2dfb, 0x2dfd, 0x2dff, 0x2e01, 0x2e03, 0x2e05, 0x2e07, + 0x2e09, 0x2e0b, 0x2e0d, 0x2e0f, 0x2e11, 0x2e13, 0x2e15, 0x2e17, + 0x2e19, 0x2e1b, 0x2e1d, 0x2e1f, 0x2e21, 0x2e23, 0x2e25, 0x2e27, + 0x2e29, 0x2e2b, 0x2e2d, 0x2e2f, 0x2e31, 0x2e33, 0x2e35, 0x2e37, + 0x2e39, 0x2e3b, 0x2e3d, 0x2e3f, 0x2e41, 0x2e43, 0x2e45, 0x2e47, + 0x2e49, 0x2e4b, 0x2e4d, 0x2e4f, 0x2e51, 0x2e53, 0x2e55, 0x2e57, + 0x2e59, 0x2e5b, 0x2e5d, 0x2e5f, 0x2e61, 0x2e63, 0x2e65, 0x2e67, + 0x2e69, 0x2e6b, 0x2e6d, 0x2e6f, 0x2e71, 0x2e73, 0x2e75, 0x2e77, + 0x2e79, 0x2e7b, 0x2e7d, 0x2e7f, 0x2e81, 0x2e83, 0x2e85, 0x2e87, + 0x2e89, 0x2e8b, 0x2e8d, 0x2e8f, 0x2e91, 0x2e93, 0x2e95, 0x2e97, + + 0x2e99, 0x2e9b, 0x2e9d, 0x2e9f, 0x2ea1, 0x2ea3, 0x2ea5, 0x2ea7, + 0x2ea9, 0x2eab, 0x2ead, 0x2eaf, 0x2eb1, 0x2eb3, 0x2eb5, 0x2eb7, + 0x2eb9, 0x2ebb, 0x2ebd, 0x2ebf, 0x2ec1, 0x2ec3, 0x2ec5, 0x2ec7, + 0x2ec9, 0x2ecb, 0x2ecd, 0x2ecf, 0x2ed1, 0x2ed3, 0x2ed5, 0x2ed7, + 0x2ed9, 0x2edb, 0x2edd, 0x2edf, 0x2ee1, 0x2ee3, 0x2ee5, 0x2ee7, + 0x2ee9, 0x2eeb, 0x2eed, 0x2eef, 0x2ef1, 0x2ef3, 0x2ef5, 0x2ef7, + 0x2ef9, 0x2efb, 0x2efd, 0x2eff, 0x2f01, 0x2f03, 0x2f05, 0x2f07, + 0x2f09, 0x2f0b, 0x2f0d, 0x2f0f, 0x2f11, 0x2f13, 0x2f15, 0x2f17, + 0x2f19, 0x2f1b, 0x2f1d, 0x2f1f, 0x2f21, 0x2f23, 0x2f25, 0x2f27, + 0x2f29, 0x2f2b, 0x2f2d, 0x2f2f, 0x2f31, 0x2f33, 0x2f35, 0x2f37, + 0x2f39, 0x2f3b, 0x2f3d, 0x2f3f, 0x2f41, 0x2f43, 0x2f45, 0x2f47, + 0x2f49, 0x2f4b, 0x2f4d, 0x2f4f, 0x2f51, 0x2f53, 0x2f55, 0x2f57, + 0x2f59, 0x2f5b, 0x2f5d, 0x2f5f, 0x2f61, 0x2f63, 0x2f65, 0x2f67, + 0x2f69, 0x2f6b, 0x2f6d, 0x2f6f, 0x2f71, 0x2f73, 0x2f75, 0x2f77, + 0x2f79, 0x2f7b, 0x2f7d, 0x2f7f, 0x2f81, 0x2f83, 0x2f85, 0x2f87, + 0x2f89, 0x2f8b, 0x2f8d, 0x2f8f, 0x2f91, 0x2f93, 0x2f95, 0x2f97, + 0x2f99, 0x2f9b, 0x2f9d, 0x2f9f, 0x2fa1, 0x2fa3, 0x2fa5, 0x2fa7, + 0x2fa9, 0x2fab, 0x2fad, 0x2faf, 0x2fb1, 0x2fb3, 0x2fb5, 0x2fb7, + 0x2fb9, 0x2fbb, 0x2fbd, 0x2fbf, 0x2fc1, 0x2fc3, 0x2fc5, 0x2fc7, + 0x2fc9, 0x2fcb, 0x2fcd, 0x2fcf, 0x2fd1, 0x2fd3, 0x2fd5, 0x2fd7, + 0x2fd9, 0x2fdb, 0x2fdd, 0x2fdf, 0x2fe1, 0x2fe3, 0x2fe5, 0x2fe7, + 0x2fe9, 0x2feb, 0x2fed, 0x2fef, 0x2ff1, 0x2ff3, 0x2ff5, 0x2ff7, + 0x2ff9, 0x2ffb, 0x2ffd, 0x2fff, 0x3001, 0x3003, 0x3005, 0x3007, + 0x3009, 0x300b, 0x300d, 0x300f, 0x3011, 0x3013, 0x3015, 0x3017, + 0x3019, 0x301b, 0x301d, 0x301f, 0x3021, 0x3023, 0x3025, 0x3027, + 0x3029, 0x302b, 0x302d, 0x302f, 0xffff, 0xffff, 0x3031, 0x3033, + 0x3035, 0x3037, 0x3039, 0x303b, 0x303d, 0x303f, 0x3041, 0x3043, + 0x3045, 0x3047, 0x3049, 0x304b, 0x304d, 0x304f, 0x3051, 0x3053, + 0x3055, 0x3057, 0x3059, 0x305b, 0x305d, 0x305f, 0x3061, 0x3063, + 0x3065, 0x3067, 0x3069, 0x306b, 0x306d, 0x306f, 0x3071, 0x3073, + 0x3075, 0x3077, 0x3079, 0x307b, 0x307d, 0x307f, 0x3081, 0x3083, + 0x3085, 0x3087, 0x3089, 0x308b, 0x308d, 0x308f, 0x3091, 0x3093, + + 0x3095, 0x3097, 0x3099, 0x309b, 0x309e, 0x30a0, 0x30a2, 0x30a4, + 0x30a6, 0x30a8, 0x30aa, 0x30ac, 0x30ae, 0x30b0, 0x30b3, 0x30b5, + 0x30b7, 0x30b9, 0x30bb, 0x30be, 0x30c0, 0x30c2, 0x30c4, 0x30c7, + 0x30c9, 0x30cb, 0x30cd, 0x30cf, 0x30d1, 0x30d4, 0x30d6, 0x30d8, + 0x30da, 0x30dc, 0x30de, 0x30e0, 0x30e2, 0x30e4, 0x30e6, 0x30e8, + 0x30ea, 0x30ec, 0x30ee, 0x30f0, 0x30f2, 0x30f4, 0x30f6, 0x30f8, + 0x30fa, 0x30fc, 0x30fe, 0x3100, 0x3102, 0x3105, 0x3107, 0x3109, + 0x310b, 0x310e, 0x3110, 0x3112, 0x3114, 0x3116, 0x3118, 0x311a, + 0x311c, 0x311e, 0x3120, 0x3122, 0x3124, 0x3126, 0x3128, 0x312a, + 0x312c, 0x312e, 0x3130, 0x3132, 0x3134, 0x3136, 0x3138, 0x313a, + 0x313c, 0x313e, 0x3140, 0x3142, 0x3144, 0x3146, 0x3148, 0x314a, + 0x314c, 0x314e, 0x3151, 0x3153, 0x3155, 0x3157, 0x3159, 0x315b, + 0x315d, 0x3160, 0x3163, 0x3165, 0x3167, 0x3169, 0x316b, 0x316d, + 0x316f, 0x3171, 0x3173, 0x3175, 0x3177, 0x317a, 0x317c, 0x317e, + 0x3180, 0x3182, 0x3185, 0x3187, 0x3189, 0x318b, 0x318d, 0x318f, + 0x3191, 0x3193, 0x3195, 0x3197, 0x319a, 0x319c, 0x319f, 0x31a1, + 0x31a3, 0x31a5, 0x31a7, 0x31a9, 0x31ab, 0x31ad, 0x31af, 0x31b1, + 0x31b3, 0x31b5, 0x31b8, 0x31ba, 0x31bc, 0x31be, 0x31c0, 0x31c2, + 0x31c5, 0x31c7, 0x31ca, 0x31cd, 0x31cf, 0x31d1, 0x31d3, 0x31d5, + 0x31d8, 0x31db, 0x31dd, 0x31df, 0x31e1, 0x31e3, 0x31e5, 0x31e7, + 0x31e9, 0x31eb, 0x31ed, 0x31ef, 0x31f1, 0x31f4, 0x31f6, 0x31f8, + 0x31fa, 0x31fc, 0x31fe, 0x3200, 0x3202, 0x3204, 0x3206, 0x3208, + 0x320a, 0x320c, 0x320e, 0x3210, 0x3212, 0x3214, 0x3216, 0x3218, + 0x321a, 0x321d, 0x321f, 0x3221, 0x3223, 0x3225, 0x3227, 0x322a, + 0x322c, 0x322e, 0x3230, 0x3232, 0x3234, 0x3236, 0x3238, 0x323a, + 0x323c, 0x323e, 0x3240, 0x3243, 0x3245, 0x3247, 0x3249, 0x324b, + 0x324d, 0x324f, 0x3251, 0x3253, 0x3255, 0x3257, 0x3259, 0x325b, + 0x325d, 0x325f, 0x3261, 0x3263, 0x3265, 0x3267, 0x326a, 0x326c, + 0x326e, 0x3270, 0x3272, 0x3274, 0x3277, 0x3279, 0x327b, 0x327d, + 0x327f, 0x3281, 0x3283, 0x3285, 0x3287, 0x328a, 0x328c, 0x328e, + 0x3290, 0x3293, 0x3295, 0x3297, 0x3299, 0x329b, 0x329d, 0x329f, + 0x32a2, 0x32a5, 0x32a8, 0x32aa, 0x32ad, 0x32af, 0x32b1, 0x32b3, + + 0x32b5, 0x32b7, 0x32b9, 0x32bb, 0x32bd, 0x32bf, 0x32c1, 0x32c4, + 0x32c6, 0x32c8, 0x32ca, 0x32cc, 0x32ce, 0x32d0, 0x32d3, 0x32d5, + 0x32d7, 0x32da, 0x32dd, 0x32df, 0x32e1, 0x32e3, 0x32e5, 0x32e7, + 0x32e9, 0x32eb, 0x32ed, 0x32ef, 0x32f2, 0x32f4, 0x32f7, 0x32f9, + 0x32fc, 0x32fe, 0x3300, 0x3302, 0x3305, 0x3307, 0x3309, 0x330c, + 0x330f, 0x3311, 0x3313, 0x3315, 0x3317, 0x3319, 0x331b, 0x331d, + 0x331f, 0x3321, 0x3323, 0x3325, 0x3327, 0x3329, 0x332c, 0x332e, + 0x3331, 0x3333, 0x3336, 0x3338, 0x333b, 0x333e, 0x3341, 0x3343, + 0x3345, 0x3347, 0x334a, 0x334d, 0x3350, 0x3353, 0x3355, 0x3357, + 0x3359, 0x335b, 0x335d, 0x335f, 0x3361, 0x3363, 0x3366, 0x3368, + 0x336a, 0x336c, 0x336e, 0x3371, 0x3373, 0x3376, 0x3379, 0x337b, + 0x337d, 0x337f, 0x3381, 0x3383, 0x3385, 0x3388, 0x338b, 0x338e, + 0x3390, 0x3392, 0x3395, 0x3397, 0x3399, 0x339b, 0x339e, 0x33a0, + 0x33a2, 0x33a4, 0x33a6, 0x33a8, 0x33ab, 0x33ad, 0x33af, 0x33b1, + 0x33b3, 0x33b5, 0x33b7, 0x33ba, 0x33bd, 0x33bf, 0x33c2, 0x33c4, + 0x33c7, 0x33c9, 0x33cb, 0x33cd, 0x33d0, 0x33d3, 0x33d5, 0x33d8, + 0x33da, 0x33dd, 0x33df, 0x33e1, 0x33e3, 0x33e5, 0x33e7, 0x33e9, + 0x33ec, 0x33ef, 0x33f2, 0x33f5, 0x33f7, 0x33f9, 0x33fb, 0x33fd, + 0x33ff, 0x3401, 0x3403, 0x3405, 0x3407, 0x3409, 0x340b, 0x340d, + 0x3410, 0x3412, 0x3414, 0x3416, 0x3418, 0x341a, 0x341c, 0x341e, + 0x3420, 0x3422, 0x3424, 0x3426, 0x3428, 0x342b, 0x342e, 0x3431, + 0x3433, 0x3435, 0x3437, 0x3439, 0x343c, 0x343e, 0x3441, 0x3443, + 0x3445, 0x3448, 0x344b, 0x344d, 0x344f, 0x3451, 0x3453, 0x3455, + 0x3457, 0x3459, 0x345b, 0x345d, 0x345f, 0x3461, 0x3463, 0x3465, + 0x3467, 0x3469, 0x346b, 0x346d, 0x346f, 0x3471, 0x3474, 0x3476, + 0x3478, 0x347a, 0x347c, 0x347e, 0x3481, 0x3484, 0x3486, 0x3488, + 0x348a, 0x348c, 0x348e, 0x3490, 0x3493, 0x3495, 0x3497, 0x3499, + 0x349b, 0x349e, 0x34a1, 0x34a3, 0x34a5, 0x34a7, 0x34aa, 0x34ac, + 0x34ae, 0x34b1, 0x34b4, 0x34b6, 0x34b8, 0x34ba, 0x34bd, 0x34bf, + 0x34c1, 0x34c3, 0x34c5, 0x34c7, 0x34c9, 0x34cb, 0x34ce, 0x34d0, + 0x34d2, 0x34d4, 0x34d7, 0x34d9, 0x34db, 0x34dd, 0x34df, 0x34e2, + 0x34e5, 0x34e7, 0x34e9, 0x34eb, 0x34ee, 0x34f0, 0x34f3, 0x34f5, + + 0x34f7, 0x34f9, 0x34fc, 0x34fe, 0x3500, 0x3502, 0x3504, 0x3506, + 0x3508, 0x350a, 0x350d, 0x350f, 0x3511, 0x3513, 0x3515, 0x3517, + 0x3519, 0x351c, 0x351e, 0x3521, 0x3524, 0x3527, 0x3529, 0x352b, + 0x352d, 0x352f, 0x3531, 0x3533, 0x3535, 0x3537, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, }; #define GET_DECOMPOSITION_INDEX(ucs4) \ @@ -5833,2113 +5834,2113 @@ static const unsigned short uc_decomposition_trie[] = { static const unsigned short uc_decomposition_map[] = { - 0x103, 0x20, 0x210, 0x20, 0x308, 0x109, 0x61, 0x210, - 0x20, 0x304, 0x109, 0x32, 0x109, 0x33, 0x210, 0x20, - 0x301, 0x110, 0x3bc, 0x210, 0x20, 0x327, 0x109, 0x31, - 0x109, 0x6f, 0x311, 0x31, 0x2044, 0x34, 0x311, 0x31, - 0x2044, 0x32, 0x311, 0x33, 0x2044, 0x34, 0x201, 0x41, - 0x300, 0x201, 0x41, 0x301, 0x201, 0x41, 0x302, 0x201, - 0x41, 0x303, 0x201, 0x41, 0x308, 0x201, 0x41, 0x30a, - 0x201, 0x43, 0x327, 0x201, 0x45, 0x300, 0x201, 0x45, - 0x301, 0x201, 0x45, 0x302, 0x201, 0x45, 0x308, 0x201, - 0x49, 0x300, 0x201, 0x49, 0x301, 0x201, 0x49, 0x302, - 0x201, 0x49, 0x308, 0x201, 0x4e, 0x303, 0x201, 0x4f, - 0x300, 0x201, 0x4f, 0x301, 0x201, 0x4f, 0x302, 0x201, - 0x4f, 0x303, 0x201, 0x4f, 0x308, 0x201, 0x55, 0x300, - 0x201, 0x55, 0x301, 0x201, 0x55, 0x302, 0x201, 0x55, - 0x308, 0x201, 0x59, 0x301, 0x201, 0x61, 0x300, 0x201, - 0x61, 0x301, 0x201, 0x61, 0x302, 0x201, 0x61, 0x303, - 0x201, 0x61, 0x308, 0x201, 0x61, 0x30a, 0x201, 0x63, - 0x327, 0x201, 0x65, 0x300, 0x201, 0x65, 0x301, 0x201, - 0x65, 0x302, 0x201, 0x65, 0x308, 0x201, 0x69, 0x300, - 0x201, 0x69, 0x301, 0x201, 0x69, 0x302, 0x201, 0x69, - 0x308, 0x201, 0x6e, 0x303, 0x201, 0x6f, 0x300, 0x201, - 0x6f, 0x301, 0x201, 0x6f, 0x302, 0x201, 0x6f, 0x303, - 0x201, 0x6f, 0x308, 0x201, 0x75, 0x300, 0x201, 0x75, - 0x301, 0x201, 0x75, 0x302, 0x201, 0x75, 0x308, 0x201, - 0x79, 0x301, 0x201, 0x79, 0x308, 0x201, 0x41, 0x304, - 0x201, 0x61, 0x304, 0x201, 0x41, 0x306, 0x201, 0x61, - 0x306, 0x201, 0x41, 0x328, 0x201, 0x61, 0x328, 0x201, - 0x43, 0x301, 0x201, 0x63, 0x301, 0x201, 0x43, 0x302, - 0x201, 0x63, 0x302, 0x201, 0x43, 0x307, 0x201, 0x63, - 0x307, 0x201, 0x43, 0x30c, 0x201, 0x63, 0x30c, 0x201, - 0x44, 0x30c, 0x201, 0x64, 0x30c, 0x201, 0x45, 0x304, - 0x201, 0x65, 0x304, 0x201, 0x45, 0x306, 0x201, 0x65, - 0x306, 0x201, 0x45, 0x307, 0x201, 0x65, 0x307, 0x201, - 0x45, 0x328, 0x201, 0x65, 0x328, 0x201, 0x45, 0x30c, - 0x201, 0x65, 0x30c, 0x201, 0x47, 0x302, 0x201, 0x67, - 0x302, 0x201, 0x47, 0x306, 0x201, 0x67, 0x306, 0x201, - 0x47, 0x307, 0x201, 0x67, 0x307, 0x201, 0x47, 0x327, - 0x201, 0x67, 0x327, 0x201, 0x48, 0x302, 0x201, 0x68, - 0x302, 0x201, 0x49, 0x303, 0x201, 0x69, 0x303, 0x201, - 0x49, 0x304, 0x201, 0x69, 0x304, 0x201, 0x49, 0x306, - 0x201, 0x69, 0x306, 0x201, 0x49, 0x328, 0x201, 0x69, - 0x328, 0x201, 0x49, 0x307, 0x210, 0x49, 0x4a, 0x210, - 0x69, 0x6a, 0x201, 0x4a, 0x302, 0x201, 0x6a, 0x302, - 0x201, 0x4b, 0x327, 0x201, 0x6b, 0x327, 0x201, 0x4c, - 0x301, 0x201, 0x6c, 0x301, 0x201, 0x4c, 0x327, 0x201, - 0x6c, 0x327, 0x201, 0x4c, 0x30c, 0x201, 0x6c, 0x30c, - 0x210, 0x4c, 0xb7, 0x210, 0x6c, 0xb7, 0x201, 0x4e, - 0x301, 0x201, 0x6e, 0x301, 0x201, 0x4e, 0x327, 0x201, - 0x6e, 0x327, 0x201, 0x4e, 0x30c, 0x201, 0x6e, 0x30c, - 0x210, 0x2bc, 0x6e, 0x201, 0x4f, 0x304, 0x201, 0x6f, - 0x304, 0x201, 0x4f, 0x306, 0x201, 0x6f, 0x306, 0x201, - 0x4f, 0x30b, 0x201, 0x6f, 0x30b, 0x201, 0x52, 0x301, - 0x201, 0x72, 0x301, 0x201, 0x52, 0x327, 0x201, 0x72, - 0x327, 0x201, 0x52, 0x30c, 0x201, 0x72, 0x30c, 0x201, - 0x53, 0x301, 0x201, 0x73, 0x301, 0x201, 0x53, 0x302, - 0x201, 0x73, 0x302, 0x201, 0x53, 0x327, 0x201, 0x73, - 0x327, 0x201, 0x53, 0x30c, 0x201, 0x73, 0x30c, 0x201, - 0x54, 0x327, 0x201, 0x74, 0x327, 0x201, 0x54, 0x30c, - 0x201, 0x74, 0x30c, 0x201, 0x55, 0x303, 0x201, 0x75, - 0x303, 0x201, 0x55, 0x304, 0x201, 0x75, 0x304, 0x201, - 0x55, 0x306, 0x201, 0x75, 0x306, 0x201, 0x55, 0x30a, - 0x201, 0x75, 0x30a, 0x201, 0x55, 0x30b, 0x201, 0x75, - 0x30b, 0x201, 0x55, 0x328, 0x201, 0x75, 0x328, 0x201, - 0x57, 0x302, 0x201, 0x77, 0x302, 0x201, 0x59, 0x302, - 0x201, 0x79, 0x302, 0x201, 0x59, 0x308, 0x201, 0x5a, - 0x301, 0x201, 0x7a, 0x301, 0x201, 0x5a, 0x307, 0x201, - 0x7a, 0x307, 0x201, 0x5a, 0x30c, 0x201, 0x7a, 0x30c, - 0x110, 0x73, 0x201, 0x4f, 0x31b, 0x201, 0x6f, 0x31b, - 0x201, 0x55, 0x31b, 0x201, 0x75, 0x31b, 0x210, 0x44, - 0x17d, 0x210, 0x44, 0x17e, 0x210, 0x64, 0x17e, 0x210, - 0x4c, 0x4a, 0x210, 0x4c, 0x6a, 0x210, 0x6c, 0x6a, - 0x210, 0x4e, 0x4a, 0x210, 0x4e, 0x6a, 0x210, 0x6e, - 0x6a, 0x201, 0x41, 0x30c, 0x201, 0x61, 0x30c, 0x201, - 0x49, 0x30c, 0x201, 0x69, 0x30c, 0x201, 0x4f, 0x30c, - 0x201, 0x6f, 0x30c, 0x201, 0x55, 0x30c, 0x201, 0x75, - 0x30c, 0x201, 0xdc, 0x304, 0x201, 0xfc, 0x304, 0x201, - 0xdc, 0x301, 0x201, 0xfc, 0x301, 0x201, 0xdc, 0x30c, - 0x201, 0xfc, 0x30c, 0x201, 0xdc, 0x300, 0x201, 0xfc, - 0x300, 0x201, 0xc4, 0x304, 0x201, 0xe4, 0x304, 0x201, - 0x226, 0x304, 0x201, 0x227, 0x304, 0x201, 0xc6, 0x304, - 0x201, 0xe6, 0x304, 0x201, 0x47, 0x30c, 0x201, 0x67, - 0x30c, 0x201, 0x4b, 0x30c, 0x201, 0x6b, 0x30c, 0x201, - 0x4f, 0x328, 0x201, 0x6f, 0x328, 0x201, 0x1ea, 0x304, - 0x201, 0x1eb, 0x304, 0x201, 0x1b7, 0x30c, 0x201, 0x292, - 0x30c, 0x201, 0x6a, 0x30c, 0x210, 0x44, 0x5a, 0x210, - 0x44, 0x7a, 0x210, 0x64, 0x7a, 0x201, 0x47, 0x301, - 0x201, 0x67, 0x301, 0x201, 0x4e, 0x300, 0x201, 0x6e, - 0x300, 0x201, 0xc5, 0x301, 0x201, 0xe5, 0x301, 0x201, - 0xc6, 0x301, 0x201, 0xe6, 0x301, 0x201, 0xd8, 0x301, - 0x201, 0xf8, 0x301, 0x201, 0x41, 0x30f, 0x201, 0x61, - 0x30f, 0x201, 0x41, 0x311, 0x201, 0x61, 0x311, 0x201, - 0x45, 0x30f, 0x201, 0x65, 0x30f, 0x201, 0x45, 0x311, - 0x201, 0x65, 0x311, 0x201, 0x49, 0x30f, 0x201, 0x69, - 0x30f, 0x201, 0x49, 0x311, 0x201, 0x69, 0x311, 0x201, - 0x4f, 0x30f, 0x201, 0x6f, 0x30f, 0x201, 0x4f, 0x311, - 0x201, 0x6f, 0x311, 0x201, 0x52, 0x30f, 0x201, 0x72, - 0x30f, 0x201, 0x52, 0x311, 0x201, 0x72, 0x311, 0x201, - 0x55, 0x30f, 0x201, 0x75, 0x30f, 0x201, 0x55, 0x311, - 0x201, 0x75, 0x311, 0x201, 0x53, 0x326, 0x201, 0x73, - 0x326, 0x201, 0x54, 0x326, 0x201, 0x74, 0x326, 0x201, - 0x48, 0x30c, 0x201, 0x68, 0x30c, 0x201, 0x41, 0x307, - 0x201, 0x61, 0x307, 0x201, 0x45, 0x327, 0x201, 0x65, - 0x327, 0x201, 0xd6, 0x304, 0x201, 0xf6, 0x304, 0x201, - 0xd5, 0x304, 0x201, 0xf5, 0x304, 0x201, 0x4f, 0x307, - 0x201, 0x6f, 0x307, 0x201, 0x22e, 0x304, 0x201, 0x22f, - 0x304, 0x201, 0x59, 0x304, 0x201, 0x79, 0x304, 0x109, - 0x68, 0x109, 0x266, 0x109, 0x6a, 0x109, 0x72, 0x109, - 0x279, 0x109, 0x27b, 0x109, 0x281, 0x109, 0x77, 0x109, - 0x79, 0x210, 0x20, 0x306, 0x210, 0x20, 0x307, 0x210, - 0x20, 0x30a, 0x210, 0x20, 0x328, 0x210, 0x20, 0x303, - 0x210, 0x20, 0x30b, 0x109, 0x263, 0x109, 0x6c, 0x109, - 0x73, 0x109, 0x78, 0x109, 0x295, 0x101, 0x300, 0x101, - 0x301, 0x101, 0x313, 0x201, 0x308, 0x301, 0x101, 0x2b9, - 0x210, 0x20, 0x345, 0x101, 0x3b, 0x210, 0x20, 0x301, - 0x201, 0xa8, 0x301, 0x201, 0x391, 0x301, 0x101, 0xb7, - 0x201, 0x395, 0x301, 0x201, 0x397, 0x301, 0x201, 0x399, - 0x301, 0x201, 0x39f, 0x301, 0x201, 0x3a5, 0x301, 0x201, - 0x3a9, 0x301, 0x201, 0x3ca, 0x301, 0x201, 0x399, 0x308, - 0x201, 0x3a5, 0x308, 0x201, 0x3b1, 0x301, 0x201, 0x3b5, - 0x301, 0x201, 0x3b7, 0x301, 0x201, 0x3b9, 0x301, 0x201, - 0x3cb, 0x301, 0x201, 0x3b9, 0x308, 0x201, 0x3c5, 0x308, - 0x201, 0x3bf, 0x301, 0x201, 0x3c5, 0x301, 0x201, 0x3c9, - 0x301, 0x110, 0x3b2, 0x110, 0x3b8, 0x110, 0x3a5, 0x201, - 0x3d2, 0x301, 0x201, 0x3d2, 0x308, 0x110, 0x3c6, 0x110, - 0x3c0, 0x110, 0x3ba, 0x110, 0x3c1, 0x110, 0x3c2, 0x110, - 0x398, 0x110, 0x3b5, 0x110, 0x3a3, 0x201, 0x415, 0x300, - 0x201, 0x415, 0x308, 0x201, 0x413, 0x301, 0x201, 0x406, - 0x308, 0x201, 0x41a, 0x301, 0x201, 0x418, 0x300, 0x201, - 0x423, 0x306, 0x201, 0x418, 0x306, 0x201, 0x438, 0x306, - 0x201, 0x435, 0x300, 0x201, 0x435, 0x308, 0x201, 0x433, - 0x301, 0x201, 0x456, 0x308, 0x201, 0x43a, 0x301, 0x201, - 0x438, 0x300, 0x201, 0x443, 0x306, 0x201, 0x474, 0x30f, - 0x201, 0x475, 0x30f, 0x201, 0x416, 0x306, 0x201, 0x436, - 0x306, 0x201, 0x410, 0x306, 0x201, 0x430, 0x306, 0x201, - 0x410, 0x308, 0x201, 0x430, 0x308, 0x201, 0x415, 0x306, - 0x201, 0x435, 0x306, 0x201, 0x4d8, 0x308, 0x201, 0x4d9, - 0x308, 0x201, 0x416, 0x308, 0x201, 0x436, 0x308, 0x201, - 0x417, 0x308, 0x201, 0x437, 0x308, 0x201, 0x418, 0x304, - 0x201, 0x438, 0x304, 0x201, 0x418, 0x308, 0x201, 0x438, - 0x308, 0x201, 0x41e, 0x308, 0x201, 0x43e, 0x308, 0x201, - 0x4e8, 0x308, 0x201, 0x4e9, 0x308, 0x201, 0x42d, 0x308, - 0x201, 0x44d, 0x308, 0x201, 0x423, 0x304, 0x201, 0x443, - 0x304, 0x201, 0x423, 0x308, 0x201, 0x443, 0x308, 0x201, - 0x423, 0x30b, 0x201, 0x443, 0x30b, 0x201, 0x427, 0x308, - 0x201, 0x447, 0x308, 0x201, 0x42b, 0x308, 0x201, 0x44b, - 0x308, 0x210, 0x565, 0x582, 0x201, 0x627, 0x653, 0x201, - 0x627, 0x654, 0x201, 0x648, 0x654, 0x201, 0x627, 0x655, - 0x201, 0x64a, 0x654, 0x210, 0x627, 0x674, 0x210, 0x648, - 0x674, 0x210, 0x6c7, 0x674, 0x210, 0x64a, 0x674, 0x201, - 0x6d5, 0x654, 0x201, 0x6c1, 0x654, 0x201, 0x6d2, 0x654, - 0x201, 0x928, 0x93c, 0x201, 0x930, 0x93c, 0x201, 0x933, - 0x93c, 0x201, 0x915, 0x93c, 0x201, 0x916, 0x93c, 0x201, - 0x917, 0x93c, 0x201, 0x91c, 0x93c, 0x201, 0x921, 0x93c, - 0x201, 0x922, 0x93c, 0x201, 0x92b, 0x93c, 0x201, 0x92f, - 0x93c, 0x201, 0x9c7, 0x9be, 0x201, 0x9c7, 0x9d7, 0x201, - 0x9a1, 0x9bc, 0x201, 0x9a2, 0x9bc, 0x201, 0x9af, 0x9bc, - 0x201, 0xa32, 0xa3c, 0x201, 0xa38, 0xa3c, 0x201, 0xa16, - 0xa3c, 0x201, 0xa17, 0xa3c, 0x201, 0xa1c, 0xa3c, 0x201, - 0xa2b, 0xa3c, 0x201, 0xb47, 0xb56, 0x201, 0xb47, 0xb3e, - 0x201, 0xb47, 0xb57, 0x201, 0xb21, 0xb3c, 0x201, 0xb22, - 0xb3c, 0x201, 0xb92, 0xbd7, 0x201, 0xbc6, 0xbbe, 0x201, - 0xbc7, 0xbbe, 0x201, 0xbc6, 0xbd7, 0x201, 0xc46, 0xc56, - 0x201, 0xcbf, 0xcd5, 0x201, 0xcc6, 0xcd5, 0x201, 0xcc6, - 0xcd6, 0x201, 0xcc6, 0xcc2, 0x201, 0xcca, 0xcd5, 0x201, - 0xd46, 0xd3e, 0x201, 0xd47, 0xd3e, 0x201, 0xd46, 0xd57, - 0x201, 0xdd9, 0xdca, 0x201, 0xdd9, 0xdcf, 0x201, 0xddc, - 0xdca, 0x201, 0xdd9, 0xddf, 0x210, 0xe4d, 0xe32, 0x210, - 0xecd, 0xeb2, 0x210, 0xeab, 0xe99, 0x210, 0xeab, 0xea1, - 0x103, 0xf0b, 0x201, 0xf42, 0xfb7, 0x201, 0xf4c, 0xfb7, - 0x201, 0xf51, 0xfb7, 0x201, 0xf56, 0xfb7, 0x201, 0xf5b, - 0xfb7, 0x201, 0xf40, 0xfb5, 0x201, 0xf71, 0xf72, 0x201, - 0xf71, 0xf74, 0x201, 0xfb2, 0xf80, 0x210, 0xfb2, 0xf81, - 0x201, 0xfb3, 0xf80, 0x210, 0xfb3, 0xf81, 0x201, 0xf71, - 0xf80, 0x201, 0xf92, 0xfb7, 0x201, 0xf9c, 0xfb7, 0x201, - 0xfa1, 0xfb7, 0x201, 0xfa6, 0xfb7, 0x201, 0xfab, 0xfb7, - 0x201, 0xf90, 0xfb5, 0x201, 0x1025, 0x102e, 0x109, 0x10dc, - 0x201, 0x1b05, 0x1b35, 0x201, 0x1b07, 0x1b35, 0x201, 0x1b09, - 0x1b35, 0x201, 0x1b0b, 0x1b35, 0x201, 0x1b0d, 0x1b35, 0x201, - 0x1b11, 0x1b35, 0x201, 0x1b3a, 0x1b35, 0x201, 0x1b3c, 0x1b35, - 0x201, 0x1b3e, 0x1b35, 0x201, 0x1b3f, 0x1b35, 0x201, 0x1b42, - 0x1b35, 0x109, 0x41, 0x109, 0xc6, 0x109, 0x42, 0x109, - 0x44, 0x109, 0x45, 0x109, 0x18e, 0x109, 0x47, 0x109, - 0x48, 0x109, 0x49, 0x109, 0x4a, 0x109, 0x4b, 0x109, - 0x4c, 0x109, 0x4d, 0x109, 0x4e, 0x109, 0x4f, 0x109, - 0x222, 0x109, 0x50, 0x109, 0x52, 0x109, 0x54, 0x109, - 0x55, 0x109, 0x57, 0x109, 0x61, 0x109, 0x250, 0x109, - 0x251, 0x109, 0x1d02, 0x109, 0x62, 0x109, 0x64, 0x109, - 0x65, 0x109, 0x259, 0x109, 0x25b, 0x109, 0x25c, 0x109, - 0x67, 0x109, 0x6b, 0x109, 0x6d, 0x109, 0x14b, 0x109, - 0x6f, 0x109, 0x254, 0x109, 0x1d16, 0x109, 0x1d17, 0x109, - 0x70, 0x109, 0x74, 0x109, 0x75, 0x109, 0x1d1d, 0x109, - 0x26f, 0x109, 0x76, 0x109, 0x1d25, 0x109, 0x3b2, 0x109, - 0x3b3, 0x109, 0x3b4, 0x109, 0x3c6, 0x109, 0x3c7, 0x10a, - 0x69, 0x10a, 0x72, 0x10a, 0x75, 0x10a, 0x76, 0x10a, - 0x3b2, 0x10a, 0x3b3, 0x10a, 0x3c1, 0x10a, 0x3c6, 0x10a, - 0x3c7, 0x109, 0x43d, 0x109, 0x252, 0x109, 0x63, 0x109, - 0x255, 0x109, 0xf0, 0x109, 0x25c, 0x109, 0x66, 0x109, - 0x25f, 0x109, 0x261, 0x109, 0x265, 0x109, 0x268, 0x109, - 0x269, 0x109, 0x26a, 0x109, 0x1d7b, 0x109, 0x29d, 0x109, - 0x26d, 0x109, 0x1d85, 0x109, 0x29f, 0x109, 0x271, 0x109, - 0x270, 0x109, 0x272, 0x109, 0x273, 0x109, 0x274, 0x109, - 0x275, 0x109, 0x278, 0x109, 0x282, 0x109, 0x283, 0x109, - 0x1ab, 0x109, 0x289, 0x109, 0x28a, 0x109, 0x1d1c, 0x109, - 0x28b, 0x109, 0x28c, 0x109, 0x7a, 0x109, 0x290, 0x109, - 0x291, 0x109, 0x292, 0x109, 0x3b8, 0x201, 0x41, 0x325, - 0x201, 0x61, 0x325, 0x201, 0x42, 0x307, 0x201, 0x62, - 0x307, 0x201, 0x42, 0x323, 0x201, 0x62, 0x323, 0x201, - 0x42, 0x331, 0x201, 0x62, 0x331, 0x201, 0xc7, 0x301, - 0x201, 0xe7, 0x301, 0x201, 0x44, 0x307, 0x201, 0x64, - 0x307, 0x201, 0x44, 0x323, 0x201, 0x64, 0x323, 0x201, - 0x44, 0x331, 0x201, 0x64, 0x331, 0x201, 0x44, 0x327, - 0x201, 0x64, 0x327, 0x201, 0x44, 0x32d, 0x201, 0x64, - 0x32d, 0x201, 0x112, 0x300, 0x201, 0x113, 0x300, 0x201, - 0x112, 0x301, 0x201, 0x113, 0x301, 0x201, 0x45, 0x32d, - 0x201, 0x65, 0x32d, 0x201, 0x45, 0x330, 0x201, 0x65, - 0x330, 0x201, 0x228, 0x306, 0x201, 0x229, 0x306, 0x201, - 0x46, 0x307, 0x201, 0x66, 0x307, 0x201, 0x47, 0x304, - 0x201, 0x67, 0x304, 0x201, 0x48, 0x307, 0x201, 0x68, - 0x307, 0x201, 0x48, 0x323, 0x201, 0x68, 0x323, 0x201, - 0x48, 0x308, 0x201, 0x68, 0x308, 0x201, 0x48, 0x327, - 0x201, 0x68, 0x327, 0x201, 0x48, 0x32e, 0x201, 0x68, - 0x32e, 0x201, 0x49, 0x330, 0x201, 0x69, 0x330, 0x201, - 0xcf, 0x301, 0x201, 0xef, 0x301, 0x201, 0x4b, 0x301, - 0x201, 0x6b, 0x301, 0x201, 0x4b, 0x323, 0x201, 0x6b, - 0x323, 0x201, 0x4b, 0x331, 0x201, 0x6b, 0x331, 0x201, - 0x4c, 0x323, 0x201, 0x6c, 0x323, 0x201, 0x1e36, 0x304, - 0x201, 0x1e37, 0x304, 0x201, 0x4c, 0x331, 0x201, 0x6c, - 0x331, 0x201, 0x4c, 0x32d, 0x201, 0x6c, 0x32d, 0x201, - 0x4d, 0x301, 0x201, 0x6d, 0x301, 0x201, 0x4d, 0x307, - 0x201, 0x6d, 0x307, 0x201, 0x4d, 0x323, 0x201, 0x6d, - 0x323, 0x201, 0x4e, 0x307, 0x201, 0x6e, 0x307, 0x201, - 0x4e, 0x323, 0x201, 0x6e, 0x323, 0x201, 0x4e, 0x331, - 0x201, 0x6e, 0x331, 0x201, 0x4e, 0x32d, 0x201, 0x6e, - 0x32d, 0x201, 0xd5, 0x301, 0x201, 0xf5, 0x301, 0x201, - 0xd5, 0x308, 0x201, 0xf5, 0x308, 0x201, 0x14c, 0x300, - 0x201, 0x14d, 0x300, 0x201, 0x14c, 0x301, 0x201, 0x14d, - 0x301, 0x201, 0x50, 0x301, 0x201, 0x70, 0x301, 0x201, - 0x50, 0x307, 0x201, 0x70, 0x307, 0x201, 0x52, 0x307, - 0x201, 0x72, 0x307, 0x201, 0x52, 0x323, 0x201, 0x72, - 0x323, 0x201, 0x1e5a, 0x304, 0x201, 0x1e5b, 0x304, 0x201, - 0x52, 0x331, 0x201, 0x72, 0x331, 0x201, 0x53, 0x307, - 0x201, 0x73, 0x307, 0x201, 0x53, 0x323, 0x201, 0x73, - 0x323, 0x201, 0x15a, 0x307, 0x201, 0x15b, 0x307, 0x201, - 0x160, 0x307, 0x201, 0x161, 0x307, 0x201, 0x1e62, 0x307, - 0x201, 0x1e63, 0x307, 0x201, 0x54, 0x307, 0x201, 0x74, - 0x307, 0x201, 0x54, 0x323, 0x201, 0x74, 0x323, 0x201, - 0x54, 0x331, 0x201, 0x74, 0x331, 0x201, 0x54, 0x32d, - 0x201, 0x74, 0x32d, 0x201, 0x55, 0x324, 0x201, 0x75, - 0x324, 0x201, 0x55, 0x330, 0x201, 0x75, 0x330, 0x201, - 0x55, 0x32d, 0x201, 0x75, 0x32d, 0x201, 0x168, 0x301, - 0x201, 0x169, 0x301, 0x201, 0x16a, 0x308, 0x201, 0x16b, - 0x308, 0x201, 0x56, 0x303, 0x201, 0x76, 0x303, 0x201, - 0x56, 0x323, 0x201, 0x76, 0x323, 0x201, 0x57, 0x300, - 0x201, 0x77, 0x300, 0x201, 0x57, 0x301, 0x201, 0x77, - 0x301, 0x201, 0x57, 0x308, 0x201, 0x77, 0x308, 0x201, - 0x57, 0x307, 0x201, 0x77, 0x307, 0x201, 0x57, 0x323, - 0x201, 0x77, 0x323, 0x201, 0x58, 0x307, 0x201, 0x78, - 0x307, 0x201, 0x58, 0x308, 0x201, 0x78, 0x308, 0x201, - 0x59, 0x307, 0x201, 0x79, 0x307, 0x201, 0x5a, 0x302, - 0x201, 0x7a, 0x302, 0x201, 0x5a, 0x323, 0x201, 0x7a, - 0x323, 0x201, 0x5a, 0x331, 0x201, 0x7a, 0x331, 0x201, - 0x68, 0x331, 0x201, 0x74, 0x308, 0x201, 0x77, 0x30a, - 0x201, 0x79, 0x30a, 0x210, 0x61, 0x2be, 0x201, 0x17f, - 0x307, 0x201, 0x41, 0x323, 0x201, 0x61, 0x323, 0x201, - 0x41, 0x309, 0x201, 0x61, 0x309, 0x201, 0xc2, 0x301, - 0x201, 0xe2, 0x301, 0x201, 0xc2, 0x300, 0x201, 0xe2, - 0x300, 0x201, 0xc2, 0x309, 0x201, 0xe2, 0x309, 0x201, - 0xc2, 0x303, 0x201, 0xe2, 0x303, 0x201, 0x1ea0, 0x302, - 0x201, 0x1ea1, 0x302, 0x201, 0x102, 0x301, 0x201, 0x103, - 0x301, 0x201, 0x102, 0x300, 0x201, 0x103, 0x300, 0x201, - 0x102, 0x309, 0x201, 0x103, 0x309, 0x201, 0x102, 0x303, - 0x201, 0x103, 0x303, 0x201, 0x1ea0, 0x306, 0x201, 0x1ea1, - 0x306, 0x201, 0x45, 0x323, 0x201, 0x65, 0x323, 0x201, - 0x45, 0x309, 0x201, 0x65, 0x309, 0x201, 0x45, 0x303, - 0x201, 0x65, 0x303, 0x201, 0xca, 0x301, 0x201, 0xea, - 0x301, 0x201, 0xca, 0x300, 0x201, 0xea, 0x300, 0x201, - 0xca, 0x309, 0x201, 0xea, 0x309, 0x201, 0xca, 0x303, - 0x201, 0xea, 0x303, 0x201, 0x1eb8, 0x302, 0x201, 0x1eb9, - 0x302, 0x201, 0x49, 0x309, 0x201, 0x69, 0x309, 0x201, - 0x49, 0x323, 0x201, 0x69, 0x323, 0x201, 0x4f, 0x323, - 0x201, 0x6f, 0x323, 0x201, 0x4f, 0x309, 0x201, 0x6f, - 0x309, 0x201, 0xd4, 0x301, 0x201, 0xf4, 0x301, 0x201, - 0xd4, 0x300, 0x201, 0xf4, 0x300, 0x201, 0xd4, 0x309, - 0x201, 0xf4, 0x309, 0x201, 0xd4, 0x303, 0x201, 0xf4, - 0x303, 0x201, 0x1ecc, 0x302, 0x201, 0x1ecd, 0x302, 0x201, - 0x1a0, 0x301, 0x201, 0x1a1, 0x301, 0x201, 0x1a0, 0x300, - 0x201, 0x1a1, 0x300, 0x201, 0x1a0, 0x309, 0x201, 0x1a1, - 0x309, 0x201, 0x1a0, 0x303, 0x201, 0x1a1, 0x303, 0x201, - 0x1a0, 0x323, 0x201, 0x1a1, 0x323, 0x201, 0x55, 0x323, - 0x201, 0x75, 0x323, 0x201, 0x55, 0x309, 0x201, 0x75, - 0x309, 0x201, 0x1af, 0x301, 0x201, 0x1b0, 0x301, 0x201, - 0x1af, 0x300, 0x201, 0x1b0, 0x300, 0x201, 0x1af, 0x309, - 0x201, 0x1b0, 0x309, 0x201, 0x1af, 0x303, 0x201, 0x1b0, - 0x303, 0x201, 0x1af, 0x323, 0x201, 0x1b0, 0x323, 0x201, - 0x59, 0x300, 0x201, 0x79, 0x300, 0x201, 0x59, 0x323, - 0x201, 0x79, 0x323, 0x201, 0x59, 0x309, 0x201, 0x79, - 0x309, 0x201, 0x59, 0x303, 0x201, 0x79, 0x303, 0x201, - 0x3b1, 0x313, 0x201, 0x3b1, 0x314, 0x201, 0x1f00, 0x300, - 0x201, 0x1f01, 0x300, 0x201, 0x1f00, 0x301, 0x201, 0x1f01, - 0x301, 0x201, 0x1f00, 0x342, 0x201, 0x1f01, 0x342, 0x201, - 0x391, 0x313, 0x201, 0x391, 0x314, 0x201, 0x1f08, 0x300, - 0x201, 0x1f09, 0x300, 0x201, 0x1f08, 0x301, 0x201, 0x1f09, - 0x301, 0x201, 0x1f08, 0x342, 0x201, 0x1f09, 0x342, 0x201, - 0x3b5, 0x313, 0x201, 0x3b5, 0x314, 0x201, 0x1f10, 0x300, - 0x201, 0x1f11, 0x300, 0x201, 0x1f10, 0x301, 0x201, 0x1f11, - 0x301, 0x201, 0x395, 0x313, 0x201, 0x395, 0x314, 0x201, - 0x1f18, 0x300, 0x201, 0x1f19, 0x300, 0x201, 0x1f18, 0x301, - 0x201, 0x1f19, 0x301, 0x201, 0x3b7, 0x313, 0x201, 0x3b7, - 0x314, 0x201, 0x1f20, 0x300, 0x201, 0x1f21, 0x300, 0x201, - 0x1f20, 0x301, 0x201, 0x1f21, 0x301, 0x201, 0x1f20, 0x342, - 0x201, 0x1f21, 0x342, 0x201, 0x397, 0x313, 0x201, 0x397, - 0x314, 0x201, 0x1f28, 0x300, 0x201, 0x1f29, 0x300, 0x201, - 0x1f28, 0x301, 0x201, 0x1f29, 0x301, 0x201, 0x1f28, 0x342, - 0x201, 0x1f29, 0x342, 0x201, 0x3b9, 0x313, 0x201, 0x3b9, - 0x314, 0x201, 0x1f30, 0x300, 0x201, 0x1f31, 0x300, 0x201, - 0x1f30, 0x301, 0x201, 0x1f31, 0x301, 0x201, 0x1f30, 0x342, - 0x201, 0x1f31, 0x342, 0x201, 0x399, 0x313, 0x201, 0x399, - 0x314, 0x201, 0x1f38, 0x300, 0x201, 0x1f39, 0x300, 0x201, - 0x1f38, 0x301, 0x201, 0x1f39, 0x301, 0x201, 0x1f38, 0x342, - 0x201, 0x1f39, 0x342, 0x201, 0x3bf, 0x313, 0x201, 0x3bf, - 0x314, 0x201, 0x1f40, 0x300, 0x201, 0x1f41, 0x300, 0x201, - 0x1f40, 0x301, 0x201, 0x1f41, 0x301, 0x201, 0x39f, 0x313, - 0x201, 0x39f, 0x314, 0x201, 0x1f48, 0x300, 0x201, 0x1f49, - 0x300, 0x201, 0x1f48, 0x301, 0x201, 0x1f49, 0x301, 0x201, - 0x3c5, 0x313, 0x201, 0x3c5, 0x314, 0x201, 0x1f50, 0x300, - 0x201, 0x1f51, 0x300, 0x201, 0x1f50, 0x301, 0x201, 0x1f51, - 0x301, 0x201, 0x1f50, 0x342, 0x201, 0x1f51, 0x342, 0x201, - 0x3a5, 0x314, 0x201, 0x1f59, 0x300, 0x201, 0x1f59, 0x301, - 0x201, 0x1f59, 0x342, 0x201, 0x3c9, 0x313, 0x201, 0x3c9, - 0x314, 0x201, 0x1f60, 0x300, 0x201, 0x1f61, 0x300, 0x201, - 0x1f60, 0x301, 0x201, 0x1f61, 0x301, 0x201, 0x1f60, 0x342, - 0x201, 0x1f61, 0x342, 0x201, 0x3a9, 0x313, 0x201, 0x3a9, - 0x314, 0x201, 0x1f68, 0x300, 0x201, 0x1f69, 0x300, 0x201, - 0x1f68, 0x301, 0x201, 0x1f69, 0x301, 0x201, 0x1f68, 0x342, - 0x201, 0x1f69, 0x342, 0x201, 0x3b1, 0x300, 0x101, 0x3ac, - 0x201, 0x3b5, 0x300, 0x101, 0x3ad, 0x201, 0x3b7, 0x300, - 0x101, 0x3ae, 0x201, 0x3b9, 0x300, 0x101, 0x3af, 0x201, - 0x3bf, 0x300, 0x101, 0x3cc, 0x201, 0x3c5, 0x300, 0x101, - 0x3cd, 0x201, 0x3c9, 0x300, 0x101, 0x3ce, 0x201, 0x1f00, - 0x345, 0x201, 0x1f01, 0x345, 0x201, 0x1f02, 0x345, 0x201, - 0x1f03, 0x345, 0x201, 0x1f04, 0x345, 0x201, 0x1f05, 0x345, - 0x201, 0x1f06, 0x345, 0x201, 0x1f07, 0x345, 0x201, 0x1f08, - 0x345, 0x201, 0x1f09, 0x345, 0x201, 0x1f0a, 0x345, 0x201, - 0x1f0b, 0x345, 0x201, 0x1f0c, 0x345, 0x201, 0x1f0d, 0x345, - 0x201, 0x1f0e, 0x345, 0x201, 0x1f0f, 0x345, 0x201, 0x1f20, - 0x345, 0x201, 0x1f21, 0x345, 0x201, 0x1f22, 0x345, 0x201, - 0x1f23, 0x345, 0x201, 0x1f24, 0x345, 0x201, 0x1f25, 0x345, - 0x201, 0x1f26, 0x345, 0x201, 0x1f27, 0x345, 0x201, 0x1f28, - 0x345, 0x201, 0x1f29, 0x345, 0x201, 0x1f2a, 0x345, 0x201, - 0x1f2b, 0x345, 0x201, 0x1f2c, 0x345, 0x201, 0x1f2d, 0x345, - 0x201, 0x1f2e, 0x345, 0x201, 0x1f2f, 0x345, 0x201, 0x1f60, - 0x345, 0x201, 0x1f61, 0x345, 0x201, 0x1f62, 0x345, 0x201, - 0x1f63, 0x345, 0x201, 0x1f64, 0x345, 0x201, 0x1f65, 0x345, - 0x201, 0x1f66, 0x345, 0x201, 0x1f67, 0x345, 0x201, 0x1f68, - 0x345, 0x201, 0x1f69, 0x345, 0x201, 0x1f6a, 0x345, 0x201, - 0x1f6b, 0x345, 0x201, 0x1f6c, 0x345, 0x201, 0x1f6d, 0x345, - 0x201, 0x1f6e, 0x345, 0x201, 0x1f6f, 0x345, 0x201, 0x3b1, - 0x306, 0x201, 0x3b1, 0x304, 0x201, 0x1f70, 0x345, 0x201, - 0x3b1, 0x345, 0x201, 0x3ac, 0x345, 0x201, 0x3b1, 0x342, - 0x201, 0x1fb6, 0x345, 0x201, 0x391, 0x306, 0x201, 0x391, - 0x304, 0x201, 0x391, 0x300, 0x101, 0x386, 0x201, 0x391, - 0x345, 0x210, 0x20, 0x313, 0x101, 0x3b9, 0x210, 0x20, - 0x313, 0x210, 0x20, 0x342, 0x201, 0xa8, 0x342, 0x201, - 0x1f74, 0x345, 0x201, 0x3b7, 0x345, 0x201, 0x3ae, 0x345, - 0x201, 0x3b7, 0x342, 0x201, 0x1fc6, 0x345, 0x201, 0x395, - 0x300, 0x101, 0x388, 0x201, 0x397, 0x300, 0x101, 0x389, - 0x201, 0x397, 0x345, 0x201, 0x1fbf, 0x300, 0x201, 0x1fbf, - 0x301, 0x201, 0x1fbf, 0x342, 0x201, 0x3b9, 0x306, 0x201, - 0x3b9, 0x304, 0x201, 0x3ca, 0x300, 0x101, 0x390, 0x201, - 0x3b9, 0x342, 0x201, 0x3ca, 0x342, 0x201, 0x399, 0x306, - 0x201, 0x399, 0x304, 0x201, 0x399, 0x300, 0x101, 0x38a, - 0x201, 0x1ffe, 0x300, 0x201, 0x1ffe, 0x301, 0x201, 0x1ffe, - 0x342, 0x201, 0x3c5, 0x306, 0x201, 0x3c5, 0x304, 0x201, - 0x3cb, 0x300, 0x101, 0x3b0, 0x201, 0x3c1, 0x313, 0x201, - 0x3c1, 0x314, 0x201, 0x3c5, 0x342, 0x201, 0x3cb, 0x342, - 0x201, 0x3a5, 0x306, 0x201, 0x3a5, 0x304, 0x201, 0x3a5, - 0x300, 0x101, 0x38e, 0x201, 0x3a1, 0x314, 0x201, 0xa8, - 0x300, 0x101, 0x385, 0x101, 0x60, 0x201, 0x1f7c, 0x345, - 0x201, 0x3c9, 0x345, 0x201, 0x3ce, 0x345, 0x201, 0x3c9, - 0x342, 0x201, 0x1ff6, 0x345, 0x201, 0x39f, 0x300, 0x101, - 0x38c, 0x201, 0x3a9, 0x300, 0x101, 0x38f, 0x201, 0x3a9, - 0x345, 0x101, 0xb4, 0x210, 0x20, 0x314, 0x101, 0x2002, - 0x101, 0x2003, 0x110, 0x20, 0x110, 0x20, 0x110, 0x20, - 0x110, 0x20, 0x110, 0x20, 0x103, 0x20, 0x110, 0x20, - 0x110, 0x20, 0x110, 0x20, 0x103, 0x2010, 0x210, 0x20, - 0x333, 0x110, 0x2e, 0x210, 0x2e, 0x2e, 0x310, 0x2e, - 0x2e, 0x2e, 0x103, 0x20, 0x210, 0x2032, 0x2032, 0x310, - 0x2032, 0x2032, 0x2032, 0x210, 0x2035, 0x2035, 0x310, 0x2035, - 0x2035, 0x2035, 0x210, 0x21, 0x21, 0x210, 0x20, 0x305, - 0x210, 0x3f, 0x3f, 0x210, 0x3f, 0x21, 0x210, 0x21, - 0x3f, 0x410, 0x2032, 0x2032, 0x2032, 0x2032, 0x110, 0x20, - 0x109, 0x30, 0x109, 0x69, 0x109, 0x34, 0x109, 0x35, - 0x109, 0x36, 0x109, 0x37, 0x109, 0x38, 0x109, 0x39, - 0x109, 0x2b, 0x109, 0x2212, 0x109, 0x3d, 0x109, 0x28, - 0x109, 0x29, 0x109, 0x6e, 0x10a, 0x30, 0x10a, 0x31, - 0x10a, 0x32, 0x10a, 0x33, 0x10a, 0x34, 0x10a, 0x35, - 0x10a, 0x36, 0x10a, 0x37, 0x10a, 0x38, 0x10a, 0x39, - 0x10a, 0x2b, 0x10a, 0x2212, 0x10a, 0x3d, 0x10a, 0x28, - 0x10a, 0x29, 0x10a, 0x61, 0x10a, 0x65, 0x10a, 0x6f, - 0x10a, 0x78, 0x10a, 0x259, 0x210, 0x52, 0x73, 0x310, - 0x61, 0x2f, 0x63, 0x310, 0x61, 0x2f, 0x73, 0x102, - 0x43, 0x210, 0xb0, 0x43, 0x310, 0x63, 0x2f, 0x6f, - 0x310, 0x63, 0x2f, 0x75, 0x110, 0x190, 0x210, 0xb0, - 0x46, 0x102, 0x67, 0x102, 0x48, 0x102, 0x48, 0x102, - 0x48, 0x102, 0x68, 0x102, 0x127, 0x102, 0x49, 0x102, - 0x49, 0x102, 0x4c, 0x102, 0x6c, 0x102, 0x4e, 0x210, - 0x4e, 0x6f, 0x102, 0x50, 0x102, 0x51, 0x102, 0x52, - 0x102, 0x52, 0x102, 0x52, 0x209, 0x53, 0x4d, 0x310, - 0x54, 0x45, 0x4c, 0x209, 0x54, 0x4d, 0x102, 0x5a, - 0x101, 0x3a9, 0x102, 0x5a, 0x101, 0x4b, 0x101, 0xc5, - 0x102, 0x42, 0x102, 0x43, 0x102, 0x65, 0x102, 0x45, - 0x102, 0x46, 0x102, 0x4d, 0x102, 0x6f, 0x110, 0x5d0, - 0x110, 0x5d1, 0x110, 0x5d2, 0x110, 0x5d3, 0x102, 0x69, - 0x310, 0x46, 0x41, 0x58, 0x102, 0x3c0, 0x102, 0x3b3, - 0x102, 0x393, 0x102, 0x3a0, 0x102, 0x2211, 0x102, 0x44, - 0x102, 0x64, 0x102, 0x65, 0x102, 0x69, 0x102, 0x6a, - 0x311, 0x31, 0x2044, 0x33, 0x311, 0x32, 0x2044, 0x33, - 0x311, 0x31, 0x2044, 0x35, 0x311, 0x32, 0x2044, 0x35, - 0x311, 0x33, 0x2044, 0x35, 0x311, 0x34, 0x2044, 0x35, - 0x311, 0x31, 0x2044, 0x36, 0x311, 0x35, 0x2044, 0x36, - 0x311, 0x31, 0x2044, 0x38, 0x311, 0x33, 0x2044, 0x38, - 0x311, 0x35, 0x2044, 0x38, 0x311, 0x37, 0x2044, 0x38, - 0x211, 0x31, 0x2044, 0x110, 0x49, 0x210, 0x49, 0x49, - 0x310, 0x49, 0x49, 0x49, 0x210, 0x49, 0x56, 0x110, - 0x56, 0x210, 0x56, 0x49, 0x310, 0x56, 0x49, 0x49, - 0x410, 0x56, 0x49, 0x49, 0x49, 0x210, 0x49, 0x58, - 0x110, 0x58, 0x210, 0x58, 0x49, 0x310, 0x58, 0x49, - 0x49, 0x110, 0x4c, 0x110, 0x43, 0x110, 0x44, 0x110, - 0x4d, 0x110, 0x69, 0x210, 0x69, 0x69, 0x310, 0x69, - 0x69, 0x69, 0x210, 0x69, 0x76, 0x110, 0x76, 0x210, - 0x76, 0x69, 0x310, 0x76, 0x69, 0x69, 0x410, 0x76, - 0x69, 0x69, 0x69, 0x210, 0x69, 0x78, 0x110, 0x78, - 0x210, 0x78, 0x69, 0x310, 0x78, 0x69, 0x69, 0x110, - 0x6c, 0x110, 0x63, 0x110, 0x64, 0x110, 0x6d, 0x201, - 0x2190, 0x338, 0x201, 0x2192, 0x338, 0x201, 0x2194, 0x338, - 0x201, 0x21d0, 0x338, 0x201, 0x21d4, 0x338, 0x201, 0x21d2, - 0x338, 0x201, 0x2203, 0x338, 0x201, 0x2208, 0x338, 0x201, - 0x220b, 0x338, 0x201, 0x2223, 0x338, 0x201, 0x2225, 0x338, - 0x210, 0x222b, 0x222b, 0x310, 0x222b, 0x222b, 0x222b, 0x210, - 0x222e, 0x222e, 0x310, 0x222e, 0x222e, 0x222e, 0x201, 0x223c, - 0x338, 0x201, 0x2243, 0x338, 0x201, 0x2245, 0x338, 0x201, - 0x2248, 0x338, 0x201, 0x3d, 0x338, 0x201, 0x2261, 0x338, - 0x201, 0x224d, 0x338, 0x201, 0x3c, 0x338, 0x201, 0x3e, - 0x338, 0x201, 0x2264, 0x338, 0x201, 0x2265, 0x338, 0x201, - 0x2272, 0x338, 0x201, 0x2273, 0x338, 0x201, 0x2276, 0x338, - 0x201, 0x2277, 0x338, 0x201, 0x227a, 0x338, 0x201, 0x227b, - 0x338, 0x201, 0x2282, 0x338, 0x201, 0x2283, 0x338, 0x201, - 0x2286, 0x338, 0x201, 0x2287, 0x338, 0x201, 0x22a2, 0x338, - 0x201, 0x22a8, 0x338, 0x201, 0x22a9, 0x338, 0x201, 0x22ab, - 0x338, 0x201, 0x227c, 0x338, 0x201, 0x227d, 0x338, 0x201, - 0x2291, 0x338, 0x201, 0x2292, 0x338, 0x201, 0x22b2, 0x338, - 0x201, 0x22b3, 0x338, 0x201, 0x22b4, 0x338, 0x201, 0x22b5, - 0x338, 0x101, 0x3008, 0x101, 0x3009, 0x108, 0x31, 0x108, - 0x32, 0x108, 0x33, 0x108, 0x34, 0x108, 0x35, 0x108, - 0x36, 0x108, 0x37, 0x108, 0x38, 0x108, 0x39, 0x208, - 0x31, 0x30, 0x208, 0x31, 0x31, 0x208, 0x31, 0x32, - 0x208, 0x31, 0x33, 0x208, 0x31, 0x34, 0x208, 0x31, - 0x35, 0x208, 0x31, 0x36, 0x208, 0x31, 0x37, 0x208, - 0x31, 0x38, 0x208, 0x31, 0x39, 0x208, 0x32, 0x30, - 0x310, 0x28, 0x31, 0x29, 0x310, 0x28, 0x32, 0x29, - 0x310, 0x28, 0x33, 0x29, 0x310, 0x28, 0x34, 0x29, - 0x310, 0x28, 0x35, 0x29, 0x310, 0x28, 0x36, 0x29, - 0x310, 0x28, 0x37, 0x29, 0x310, 0x28, 0x38, 0x29, - 0x310, 0x28, 0x39, 0x29, 0x410, 0x28, 0x31, 0x30, - 0x29, 0x410, 0x28, 0x31, 0x31, 0x29, 0x410, 0x28, - 0x31, 0x32, 0x29, 0x410, 0x28, 0x31, 0x33, 0x29, - 0x410, 0x28, 0x31, 0x34, 0x29, 0x410, 0x28, 0x31, - 0x35, 0x29, 0x410, 0x28, 0x31, 0x36, 0x29, 0x410, - 0x28, 0x31, 0x37, 0x29, 0x410, 0x28, 0x31, 0x38, - 0x29, 0x410, 0x28, 0x31, 0x39, 0x29, 0x410, 0x28, - 0x32, 0x30, 0x29, 0x210, 0x31, 0x2e, 0x210, 0x32, - 0x2e, 0x210, 0x33, 0x2e, 0x210, 0x34, 0x2e, 0x210, - 0x35, 0x2e, 0x210, 0x36, 0x2e, 0x210, 0x37, 0x2e, - 0x210, 0x38, 0x2e, 0x210, 0x39, 0x2e, 0x310, 0x31, - 0x30, 0x2e, 0x310, 0x31, 0x31, 0x2e, 0x310, 0x31, - 0x32, 0x2e, 0x310, 0x31, 0x33, 0x2e, 0x310, 0x31, - 0x34, 0x2e, 0x310, 0x31, 0x35, 0x2e, 0x310, 0x31, - 0x36, 0x2e, 0x310, 0x31, 0x37, 0x2e, 0x310, 0x31, - 0x38, 0x2e, 0x310, 0x31, 0x39, 0x2e, 0x310, 0x32, - 0x30, 0x2e, 0x310, 0x28, 0x61, 0x29, 0x310, 0x28, - 0x62, 0x29, 0x310, 0x28, 0x63, 0x29, 0x310, 0x28, - 0x64, 0x29, 0x310, 0x28, 0x65, 0x29, 0x310, 0x28, - 0x66, 0x29, 0x310, 0x28, 0x67, 0x29, 0x310, 0x28, - 0x68, 0x29, 0x310, 0x28, 0x69, 0x29, 0x310, 0x28, - 0x6a, 0x29, 0x310, 0x28, 0x6b, 0x29, 0x310, 0x28, - 0x6c, 0x29, 0x310, 0x28, 0x6d, 0x29, 0x310, 0x28, - 0x6e, 0x29, 0x310, 0x28, 0x6f, 0x29, 0x310, 0x28, - 0x70, 0x29, 0x310, 0x28, 0x71, 0x29, 0x310, 0x28, - 0x72, 0x29, 0x310, 0x28, 0x73, 0x29, 0x310, 0x28, - 0x74, 0x29, 0x310, 0x28, 0x75, 0x29, 0x310, 0x28, - 0x76, 0x29, 0x310, 0x28, 0x77, 0x29, 0x310, 0x28, - 0x78, 0x29, 0x310, 0x28, 0x79, 0x29, 0x310, 0x28, - 0x7a, 0x29, 0x108, 0x41, 0x108, 0x42, 0x108, 0x43, - 0x108, 0x44, 0x108, 0x45, 0x108, 0x46, 0x108, 0x47, - 0x108, 0x48, 0x108, 0x49, 0x108, 0x4a, 0x108, 0x4b, - 0x108, 0x4c, 0x108, 0x4d, 0x108, 0x4e, 0x108, 0x4f, - 0x108, 0x50, 0x108, 0x51, 0x108, 0x52, 0x108, 0x53, - 0x108, 0x54, 0x108, 0x55, 0x108, 0x56, 0x108, 0x57, - 0x108, 0x58, 0x108, 0x59, 0x108, 0x5a, 0x108, 0x61, - 0x108, 0x62, 0x108, 0x63, 0x108, 0x64, 0x108, 0x65, - 0x108, 0x66, 0x108, 0x67, 0x108, 0x68, 0x108, 0x69, - 0x108, 0x6a, 0x108, 0x6b, 0x108, 0x6c, 0x108, 0x6d, - 0x108, 0x6e, 0x108, 0x6f, 0x108, 0x70, 0x108, 0x71, - 0x108, 0x72, 0x108, 0x73, 0x108, 0x74, 0x108, 0x75, - 0x108, 0x76, 0x108, 0x77, 0x108, 0x78, 0x108, 0x79, - 0x108, 0x7a, 0x108, 0x30, 0x410, 0x222b, 0x222b, 0x222b, - 0x222b, 0x310, 0x3a, 0x3a, 0x3d, 0x210, 0x3d, 0x3d, - 0x310, 0x3d, 0x3d, 0x3d, 0x201, 0x2add, 0x338, 0x109, - 0x2d61, 0x110, 0x6bcd, 0x110, 0x9f9f, 0x110, 0x4e00, 0x110, - 0x4e28, 0x110, 0x4e36, 0x110, 0x4e3f, 0x110, 0x4e59, 0x110, - 0x4e85, 0x110, 0x4e8c, 0x110, 0x4ea0, 0x110, 0x4eba, 0x110, - 0x513f, 0x110, 0x5165, 0x110, 0x516b, 0x110, 0x5182, 0x110, - 0x5196, 0x110, 0x51ab, 0x110, 0x51e0, 0x110, 0x51f5, 0x110, - 0x5200, 0x110, 0x529b, 0x110, 0x52f9, 0x110, 0x5315, 0x110, - 0x531a, 0x110, 0x5338, 0x110, 0x5341, 0x110, 0x535c, 0x110, - 0x5369, 0x110, 0x5382, 0x110, 0x53b6, 0x110, 0x53c8, 0x110, - 0x53e3, 0x110, 0x56d7, 0x110, 0x571f, 0x110, 0x58eb, 0x110, - 0x5902, 0x110, 0x590a, 0x110, 0x5915, 0x110, 0x5927, 0x110, - 0x5973, 0x110, 0x5b50, 0x110, 0x5b80, 0x110, 0x5bf8, 0x110, - 0x5c0f, 0x110, 0x5c22, 0x110, 0x5c38, 0x110, 0x5c6e, 0x110, - 0x5c71, 0x110, 0x5ddb, 0x110, 0x5de5, 0x110, 0x5df1, 0x110, - 0x5dfe, 0x110, 0x5e72, 0x110, 0x5e7a, 0x110, 0x5e7f, 0x110, - 0x5ef4, 0x110, 0x5efe, 0x110, 0x5f0b, 0x110, 0x5f13, 0x110, - 0x5f50, 0x110, 0x5f61, 0x110, 0x5f73, 0x110, 0x5fc3, 0x110, - 0x6208, 0x110, 0x6236, 0x110, 0x624b, 0x110, 0x652f, 0x110, - 0x6534, 0x110, 0x6587, 0x110, 0x6597, 0x110, 0x65a4, 0x110, - 0x65b9, 0x110, 0x65e0, 0x110, 0x65e5, 0x110, 0x66f0, 0x110, - 0x6708, 0x110, 0x6728, 0x110, 0x6b20, 0x110, 0x6b62, 0x110, - 0x6b79, 0x110, 0x6bb3, 0x110, 0x6bcb, 0x110, 0x6bd4, 0x110, - 0x6bdb, 0x110, 0x6c0f, 0x110, 0x6c14, 0x110, 0x6c34, 0x110, - 0x706b, 0x110, 0x722a, 0x110, 0x7236, 0x110, 0x723b, 0x110, - 0x723f, 0x110, 0x7247, 0x110, 0x7259, 0x110, 0x725b, 0x110, - 0x72ac, 0x110, 0x7384, 0x110, 0x7389, 0x110, 0x74dc, 0x110, - 0x74e6, 0x110, 0x7518, 0x110, 0x751f, 0x110, 0x7528, 0x110, - 0x7530, 0x110, 0x758b, 0x110, 0x7592, 0x110, 0x7676, 0x110, - 0x767d, 0x110, 0x76ae, 0x110, 0x76bf, 0x110, 0x76ee, 0x110, - 0x77db, 0x110, 0x77e2, 0x110, 0x77f3, 0x110, 0x793a, 0x110, - 0x79b8, 0x110, 0x79be, 0x110, 0x7a74, 0x110, 0x7acb, 0x110, - 0x7af9, 0x110, 0x7c73, 0x110, 0x7cf8, 0x110, 0x7f36, 0x110, - 0x7f51, 0x110, 0x7f8a, 0x110, 0x7fbd, 0x110, 0x8001, 0x110, - 0x800c, 0x110, 0x8012, 0x110, 0x8033, 0x110, 0x807f, 0x110, - 0x8089, 0x110, 0x81e3, 0x110, 0x81ea, 0x110, 0x81f3, 0x110, - 0x81fc, 0x110, 0x820c, 0x110, 0x821b, 0x110, 0x821f, 0x110, - 0x826e, 0x110, 0x8272, 0x110, 0x8278, 0x110, 0x864d, 0x110, - 0x866b, 0x110, 0x8840, 0x110, 0x884c, 0x110, 0x8863, 0x110, - 0x897e, 0x110, 0x898b, 0x110, 0x89d2, 0x110, 0x8a00, 0x110, - 0x8c37, 0x110, 0x8c46, 0x110, 0x8c55, 0x110, 0x8c78, 0x110, - 0x8c9d, 0x110, 0x8d64, 0x110, 0x8d70, 0x110, 0x8db3, 0x110, - 0x8eab, 0x110, 0x8eca, 0x110, 0x8f9b, 0x110, 0x8fb0, 0x110, - 0x8fb5, 0x110, 0x9091, 0x110, 0x9149, 0x110, 0x91c6, 0x110, - 0x91cc, 0x110, 0x91d1, 0x110, 0x9577, 0x110, 0x9580, 0x110, - 0x961c, 0x110, 0x96b6, 0x110, 0x96b9, 0x110, 0x96e8, 0x110, - 0x9751, 0x110, 0x975e, 0x110, 0x9762, 0x110, 0x9769, 0x110, - 0x97cb, 0x110, 0x97ed, 0x110, 0x97f3, 0x110, 0x9801, 0x110, - 0x98a8, 0x110, 0x98db, 0x110, 0x98df, 0x110, 0x9996, 0x110, - 0x9999, 0x110, 0x99ac, 0x110, 0x9aa8, 0x110, 0x9ad8, 0x110, - 0x9adf, 0x110, 0x9b25, 0x110, 0x9b2f, 0x110, 0x9b32, 0x110, - 0x9b3c, 0x110, 0x9b5a, 0x110, 0x9ce5, 0x110, 0x9e75, 0x110, - 0x9e7f, 0x110, 0x9ea5, 0x110, 0x9ebb, 0x110, 0x9ec3, 0x110, - 0x9ecd, 0x110, 0x9ed1, 0x110, 0x9ef9, 0x110, 0x9efd, 0x110, - 0x9f0e, 0x110, 0x9f13, 0x110, 0x9f20, 0x110, 0x9f3b, 0x110, - 0x9f4a, 0x110, 0x9f52, 0x110, 0x9f8d, 0x110, 0x9f9c, 0x110, - 0x9fa0, 0x10c, 0x20, 0x110, 0x3012, 0x110, 0x5341, 0x110, - 0x5344, 0x110, 0x5345, 0x201, 0x304b, 0x3099, 0x201, 0x304d, - 0x3099, 0x201, 0x304f, 0x3099, 0x201, 0x3051, 0x3099, 0x201, - 0x3053, 0x3099, 0x201, 0x3055, 0x3099, 0x201, 0x3057, 0x3099, - 0x201, 0x3059, 0x3099, 0x201, 0x305b, 0x3099, 0x201, 0x305d, - 0x3099, 0x201, 0x305f, 0x3099, 0x201, 0x3061, 0x3099, 0x201, - 0x3064, 0x3099, 0x201, 0x3066, 0x3099, 0x201, 0x3068, 0x3099, - 0x201, 0x306f, 0x3099, 0x201, 0x306f, 0x309a, 0x201, 0x3072, - 0x3099, 0x201, 0x3072, 0x309a, 0x201, 0x3075, 0x3099, 0x201, - 0x3075, 0x309a, 0x201, 0x3078, 0x3099, 0x201, 0x3078, 0x309a, - 0x201, 0x307b, 0x3099, 0x201, 0x307b, 0x309a, 0x201, 0x3046, - 0x3099, 0x210, 0x20, 0x3099, 0x210, 0x20, 0x309a, 0x201, - 0x309d, 0x3099, 0x20b, 0x3088, 0x308a, 0x201, 0x30ab, 0x3099, - 0x201, 0x30ad, 0x3099, 0x201, 0x30af, 0x3099, 0x201, 0x30b1, - 0x3099, 0x201, 0x30b3, 0x3099, 0x201, 0x30b5, 0x3099, 0x201, - 0x30b7, 0x3099, 0x201, 0x30b9, 0x3099, 0x201, 0x30bb, 0x3099, - 0x201, 0x30bd, 0x3099, 0x201, 0x30bf, 0x3099, 0x201, 0x30c1, - 0x3099, 0x201, 0x30c4, 0x3099, 0x201, 0x30c6, 0x3099, 0x201, - 0x30c8, 0x3099, 0x201, 0x30cf, 0x3099, 0x201, 0x30cf, 0x309a, - 0x201, 0x30d2, 0x3099, 0x201, 0x30d2, 0x309a, 0x201, 0x30d5, - 0x3099, 0x201, 0x30d5, 0x309a, 0x201, 0x30d8, 0x3099, 0x201, - 0x30d8, 0x309a, 0x201, 0x30db, 0x3099, 0x201, 0x30db, 0x309a, - 0x201, 0x30a6, 0x3099, 0x201, 0x30ef, 0x3099, 0x201, 0x30f0, - 0x3099, 0x201, 0x30f1, 0x3099, 0x201, 0x30f2, 0x3099, 0x201, - 0x30fd, 0x3099, 0x20b, 0x30b3, 0x30c8, 0x110, 0x1100, 0x110, - 0x1101, 0x110, 0x11aa, 0x110, 0x1102, 0x110, 0x11ac, 0x110, - 0x11ad, 0x110, 0x1103, 0x110, 0x1104, 0x110, 0x1105, 0x110, - 0x11b0, 0x110, 0x11b1, 0x110, 0x11b2, 0x110, 0x11b3, 0x110, - 0x11b4, 0x110, 0x11b5, 0x110, 0x111a, 0x110, 0x1106, 0x110, - 0x1107, 0x110, 0x1108, 0x110, 0x1121, 0x110, 0x1109, 0x110, - 0x110a, 0x110, 0x110b, 0x110, 0x110c, 0x110, 0x110d, 0x110, - 0x110e, 0x110, 0x110f, 0x110, 0x1110, 0x110, 0x1111, 0x110, - 0x1112, 0x110, 0x1161, 0x110, 0x1162, 0x110, 0x1163, 0x110, - 0x1164, 0x110, 0x1165, 0x110, 0x1166, 0x110, 0x1167, 0x110, - 0x1168, 0x110, 0x1169, 0x110, 0x116a, 0x110, 0x116b, 0x110, - 0x116c, 0x110, 0x116d, 0x110, 0x116e, 0x110, 0x116f, 0x110, - 0x1170, 0x110, 0x1171, 0x110, 0x1172, 0x110, 0x1173, 0x110, - 0x1174, 0x110, 0x1175, 0x110, 0x1160, 0x110, 0x1114, 0x110, - 0x1115, 0x110, 0x11c7, 0x110, 0x11c8, 0x110, 0x11cc, 0x110, - 0x11ce, 0x110, 0x11d3, 0x110, 0x11d7, 0x110, 0x11d9, 0x110, - 0x111c, 0x110, 0x11dd, 0x110, 0x11df, 0x110, 0x111d, 0x110, - 0x111e, 0x110, 0x1120, 0x110, 0x1122, 0x110, 0x1123, 0x110, - 0x1127, 0x110, 0x1129, 0x110, 0x112b, 0x110, 0x112c, 0x110, - 0x112d, 0x110, 0x112e, 0x110, 0x112f, 0x110, 0x1132, 0x110, - 0x1136, 0x110, 0x1140, 0x110, 0x1147, 0x110, 0x114c, 0x110, - 0x11f1, 0x110, 0x11f2, 0x110, 0x1157, 0x110, 0x1158, 0x110, - 0x1159, 0x110, 0x1184, 0x110, 0x1185, 0x110, 0x1188, 0x110, - 0x1191, 0x110, 0x1192, 0x110, 0x1194, 0x110, 0x119e, 0x110, - 0x11a1, 0x109, 0x4e00, 0x109, 0x4e8c, 0x109, 0x4e09, 0x109, - 0x56db, 0x109, 0x4e0a, 0x109, 0x4e2d, 0x109, 0x4e0b, 0x109, - 0x7532, 0x109, 0x4e59, 0x109, 0x4e19, 0x109, 0x4e01, 0x109, - 0x5929, 0x109, 0x5730, 0x109, 0x4eba, 0x310, 0x28, 0x1100, - 0x29, 0x310, 0x28, 0x1102, 0x29, 0x310, 0x28, 0x1103, - 0x29, 0x310, 0x28, 0x1105, 0x29, 0x310, 0x28, 0x1106, - 0x29, 0x310, 0x28, 0x1107, 0x29, 0x310, 0x28, 0x1109, - 0x29, 0x310, 0x28, 0x110b, 0x29, 0x310, 0x28, 0x110c, - 0x29, 0x310, 0x28, 0x110e, 0x29, 0x310, 0x28, 0x110f, - 0x29, 0x310, 0x28, 0x1110, 0x29, 0x310, 0x28, 0x1111, - 0x29, 0x310, 0x28, 0x1112, 0x29, 0x410, 0x28, 0x1100, - 0x1161, 0x29, 0x410, 0x28, 0x1102, 0x1161, 0x29, 0x410, - 0x28, 0x1103, 0x1161, 0x29, 0x410, 0x28, 0x1105, 0x1161, - 0x29, 0x410, 0x28, 0x1106, 0x1161, 0x29, 0x410, 0x28, - 0x1107, 0x1161, 0x29, 0x410, 0x28, 0x1109, 0x1161, 0x29, - 0x410, 0x28, 0x110b, 0x1161, 0x29, 0x410, 0x28, 0x110c, - 0x1161, 0x29, 0x410, 0x28, 0x110e, 0x1161, 0x29, 0x410, - 0x28, 0x110f, 0x1161, 0x29, 0x410, 0x28, 0x1110, 0x1161, - 0x29, 0x410, 0x28, 0x1111, 0x1161, 0x29, 0x410, 0x28, - 0x1112, 0x1161, 0x29, 0x410, 0x28, 0x110c, 0x116e, 0x29, - 0x710, 0x28, 0x110b, 0x1169, 0x110c, 0x1165, 0x11ab, 0x29, - 0x610, 0x28, 0x110b, 0x1169, 0x1112, 0x116e, 0x29, 0x310, - 0x28, 0x4e00, 0x29, 0x310, 0x28, 0x4e8c, 0x29, 0x310, - 0x28, 0x4e09, 0x29, 0x310, 0x28, 0x56db, 0x29, 0x310, - 0x28, 0x4e94, 0x29, 0x310, 0x28, 0x516d, 0x29, 0x310, - 0x28, 0x4e03, 0x29, 0x310, 0x28, 0x516b, 0x29, 0x310, - 0x28, 0x4e5d, 0x29, 0x310, 0x28, 0x5341, 0x29, 0x310, - 0x28, 0x6708, 0x29, 0x310, 0x28, 0x706b, 0x29, 0x310, - 0x28, 0x6c34, 0x29, 0x310, 0x28, 0x6728, 0x29, 0x310, - 0x28, 0x91d1, 0x29, 0x310, 0x28, 0x571f, 0x29, 0x310, - 0x28, 0x65e5, 0x29, 0x310, 0x28, 0x682a, 0x29, 0x310, - 0x28, 0x6709, 0x29, 0x310, 0x28, 0x793e, 0x29, 0x310, - 0x28, 0x540d, 0x29, 0x310, 0x28, 0x7279, 0x29, 0x310, - 0x28, 0x8ca1, 0x29, 0x310, 0x28, 0x795d, 0x29, 0x310, - 0x28, 0x52b4, 0x29, 0x310, 0x28, 0x4ee3, 0x29, 0x310, - 0x28, 0x547c, 0x29, 0x310, 0x28, 0x5b66, 0x29, 0x310, - 0x28, 0x76e3, 0x29, 0x310, 0x28, 0x4f01, 0x29, 0x310, - 0x28, 0x8cc7, 0x29, 0x310, 0x28, 0x5354, 0x29, 0x310, - 0x28, 0x796d, 0x29, 0x310, 0x28, 0x4f11, 0x29, 0x310, - 0x28, 0x81ea, 0x29, 0x310, 0x28, 0x81f3, 0x29, 0x30f, - 0x50, 0x54, 0x45, 0x208, 0x32, 0x31, 0x208, 0x32, - 0x32, 0x208, 0x32, 0x33, 0x208, 0x32, 0x34, 0x208, - 0x32, 0x35, 0x208, 0x32, 0x36, 0x208, 0x32, 0x37, - 0x208, 0x32, 0x38, 0x208, 0x32, 0x39, 0x208, 0x33, - 0x30, 0x208, 0x33, 0x31, 0x208, 0x33, 0x32, 0x208, - 0x33, 0x33, 0x208, 0x33, 0x34, 0x208, 0x33, 0x35, - 0x108, 0x1100, 0x108, 0x1102, 0x108, 0x1103, 0x108, 0x1105, - 0x108, 0x1106, 0x108, 0x1107, 0x108, 0x1109, 0x108, 0x110b, - 0x108, 0x110c, 0x108, 0x110e, 0x108, 0x110f, 0x108, 0x1110, - 0x108, 0x1111, 0x108, 0x1112, 0x208, 0x1100, 0x1161, 0x208, - 0x1102, 0x1161, 0x208, 0x1103, 0x1161, 0x208, 0x1105, 0x1161, - 0x208, 0x1106, 0x1161, 0x208, 0x1107, 0x1161, 0x208, 0x1109, - 0x1161, 0x208, 0x110b, 0x1161, 0x208, 0x110c, 0x1161, 0x208, - 0x110e, 0x1161, 0x208, 0x110f, 0x1161, 0x208, 0x1110, 0x1161, - 0x208, 0x1111, 0x1161, 0x208, 0x1112, 0x1161, 0x508, 0x110e, - 0x1161, 0x11b7, 0x1100, 0x1169, 0x408, 0x110c, 0x116e, 0x110b, - 0x1174, 0x208, 0x110b, 0x116e, 0x108, 0x4e00, 0x108, 0x4e8c, - 0x108, 0x4e09, 0x108, 0x56db, 0x108, 0x4e94, 0x108, 0x516d, - 0x108, 0x4e03, 0x108, 0x516b, 0x108, 0x4e5d, 0x108, 0x5341, - 0x108, 0x6708, 0x108, 0x706b, 0x108, 0x6c34, 0x108, 0x6728, - 0x108, 0x91d1, 0x108, 0x571f, 0x108, 0x65e5, 0x108, 0x682a, - 0x108, 0x6709, 0x108, 0x793e, 0x108, 0x540d, 0x108, 0x7279, - 0x108, 0x8ca1, 0x108, 0x795d, 0x108, 0x52b4, 0x108, 0x79d8, - 0x108, 0x7537, 0x108, 0x5973, 0x108, 0x9069, 0x108, 0x512a, - 0x108, 0x5370, 0x108, 0x6ce8, 0x108, 0x9805, 0x108, 0x4f11, - 0x108, 0x5199, 0x108, 0x6b63, 0x108, 0x4e0a, 0x108, 0x4e2d, - 0x108, 0x4e0b, 0x108, 0x5de6, 0x108, 0x53f3, 0x108, 0x533b, - 0x108, 0x5b97, 0x108, 0x5b66, 0x108, 0x76e3, 0x108, 0x4f01, - 0x108, 0x8cc7, 0x108, 0x5354, 0x108, 0x591c, 0x208, 0x33, - 0x36, 0x208, 0x33, 0x37, 0x208, 0x33, 0x38, 0x208, - 0x33, 0x39, 0x208, 0x34, 0x30, 0x208, 0x34, 0x31, - 0x208, 0x34, 0x32, 0x208, 0x34, 0x33, 0x208, 0x34, - 0x34, 0x208, 0x34, 0x35, 0x208, 0x34, 0x36, 0x208, - 0x34, 0x37, 0x208, 0x34, 0x38, 0x208, 0x34, 0x39, - 0x208, 0x35, 0x30, 0x210, 0x31, 0x6708, 0x210, 0x32, - 0x6708, 0x210, 0x33, 0x6708, 0x210, 0x34, 0x6708, 0x210, - 0x35, 0x6708, 0x210, 0x36, 0x6708, 0x210, 0x37, 0x6708, - 0x210, 0x38, 0x6708, 0x210, 0x39, 0x6708, 0x310, 0x31, - 0x30, 0x6708, 0x310, 0x31, 0x31, 0x6708, 0x310, 0x31, - 0x32, 0x6708, 0x20f, 0x48, 0x67, 0x30f, 0x65, 0x72, - 0x67, 0x20f, 0x65, 0x56, 0x30f, 0x4c, 0x54, 0x44, - 0x108, 0x30a2, 0x108, 0x30a4, 0x108, 0x30a6, 0x108, 0x30a8, - 0x108, 0x30aa, 0x108, 0x30ab, 0x108, 0x30ad, 0x108, 0x30af, - 0x108, 0x30b1, 0x108, 0x30b3, 0x108, 0x30b5, 0x108, 0x30b7, - 0x108, 0x30b9, 0x108, 0x30bb, 0x108, 0x30bd, 0x108, 0x30bf, - 0x108, 0x30c1, 0x108, 0x30c4, 0x108, 0x30c6, 0x108, 0x30c8, - 0x108, 0x30ca, 0x108, 0x30cb, 0x108, 0x30cc, 0x108, 0x30cd, - 0x108, 0x30ce, 0x108, 0x30cf, 0x108, 0x30d2, 0x108, 0x30d5, - 0x108, 0x30d8, 0x108, 0x30db, 0x108, 0x30de, 0x108, 0x30df, - 0x108, 0x30e0, 0x108, 0x30e1, 0x108, 0x30e2, 0x108, 0x30e4, - 0x108, 0x30e6, 0x108, 0x30e8, 0x108, 0x30e9, 0x108, 0x30ea, - 0x108, 0x30eb, 0x108, 0x30ec, 0x108, 0x30ed, 0x108, 0x30ef, - 0x108, 0x30f0, 0x108, 0x30f1, 0x108, 0x30f2, 0x40f, 0x30a2, - 0x30d1, 0x30fc, 0x30c8, 0x40f, 0x30a2, 0x30eb, 0x30d5, 0x30a1, - 0x40f, 0x30a2, 0x30f3, 0x30da, 0x30a2, 0x30f, 0x30a2, 0x30fc, - 0x30eb, 0x40f, 0x30a4, 0x30cb, 0x30f3, 0x30b0, 0x30f, 0x30a4, - 0x30f3, 0x30c1, 0x30f, 0x30a6, 0x30a9, 0x30f3, 0x50f, 0x30a8, - 0x30b9, 0x30af, 0x30fc, 0x30c9, 0x40f, 0x30a8, 0x30fc, 0x30ab, - 0x30fc, 0x30f, 0x30aa, 0x30f3, 0x30b9, 0x30f, 0x30aa, 0x30fc, - 0x30e0, 0x30f, 0x30ab, 0x30a4, 0x30ea, 0x40f, 0x30ab, 0x30e9, - 0x30c3, 0x30c8, 0x40f, 0x30ab, 0x30ed, 0x30ea, 0x30fc, 0x30f, - 0x30ac, 0x30ed, 0x30f3, 0x30f, 0x30ac, 0x30f3, 0x30de, 0x20f, - 0x30ae, 0x30ac, 0x30f, 0x30ae, 0x30cb, 0x30fc, 0x40f, 0x30ad, - 0x30e5, 0x30ea, 0x30fc, 0x40f, 0x30ae, 0x30eb, 0x30c0, 0x30fc, - 0x20f, 0x30ad, 0x30ed, 0x50f, 0x30ad, 0x30ed, 0x30b0, 0x30e9, - 0x30e0, 0x60f, 0x30ad, 0x30ed, 0x30e1, 0x30fc, 0x30c8, 0x30eb, - 0x50f, 0x30ad, 0x30ed, 0x30ef, 0x30c3, 0x30c8, 0x30f, 0x30b0, - 0x30e9, 0x30e0, 0x50f, 0x30b0, 0x30e9, 0x30e0, 0x30c8, 0x30f3, - 0x50f, 0x30af, 0x30eb, 0x30bc, 0x30a4, 0x30ed, 0x40f, 0x30af, - 0x30ed, 0x30fc, 0x30cd, 0x30f, 0x30b1, 0x30fc, 0x30b9, 0x30f, - 0x30b3, 0x30eb, 0x30ca, 0x30f, 0x30b3, 0x30fc, 0x30dd, 0x40f, - 0x30b5, 0x30a4, 0x30af, 0x30eb, 0x50f, 0x30b5, 0x30f3, 0x30c1, - 0x30fc, 0x30e0, 0x40f, 0x30b7, 0x30ea, 0x30f3, 0x30b0, 0x30f, - 0x30bb, 0x30f3, 0x30c1, 0x30f, 0x30bb, 0x30f3, 0x30c8, 0x30f, - 0x30c0, 0x30fc, 0x30b9, 0x20f, 0x30c7, 0x30b7, 0x20f, 0x30c9, - 0x30eb, 0x20f, 0x30c8, 0x30f3, 0x20f, 0x30ca, 0x30ce, 0x30f, - 0x30ce, 0x30c3, 0x30c8, 0x30f, 0x30cf, 0x30a4, 0x30c4, 0x50f, - 0x30d1, 0x30fc, 0x30bb, 0x30f3, 0x30c8, 0x30f, 0x30d1, 0x30fc, - 0x30c4, 0x40f, 0x30d0, 0x30fc, 0x30ec, 0x30eb, 0x50f, 0x30d4, - 0x30a2, 0x30b9, 0x30c8, 0x30eb, 0x30f, 0x30d4, 0x30af, 0x30eb, - 0x20f, 0x30d4, 0x30b3, 0x20f, 0x30d3, 0x30eb, 0x50f, 0x30d5, - 0x30a1, 0x30e9, 0x30c3, 0x30c9, 0x40f, 0x30d5, 0x30a3, 0x30fc, - 0x30c8, 0x50f, 0x30d6, 0x30c3, 0x30b7, 0x30a7, 0x30eb, 0x30f, - 0x30d5, 0x30e9, 0x30f3, 0x50f, 0x30d8, 0x30af, 0x30bf, 0x30fc, - 0x30eb, 0x20f, 0x30da, 0x30bd, 0x30f, 0x30da, 0x30cb, 0x30d2, - 0x30f, 0x30d8, 0x30eb, 0x30c4, 0x30f, 0x30da, 0x30f3, 0x30b9, - 0x30f, 0x30da, 0x30fc, 0x30b8, 0x30f, 0x30d9, 0x30fc, 0x30bf, - 0x40f, 0x30dd, 0x30a4, 0x30f3, 0x30c8, 0x30f, 0x30dc, 0x30eb, - 0x30c8, 0x20f, 0x30db, 0x30f3, 0x30f, 0x30dd, 0x30f3, 0x30c9, - 0x30f, 0x30db, 0x30fc, 0x30eb, 0x30f, 0x30db, 0x30fc, 0x30f3, - 0x40f, 0x30de, 0x30a4, 0x30af, 0x30ed, 0x30f, 0x30de, 0x30a4, - 0x30eb, 0x30f, 0x30de, 0x30c3, 0x30cf, 0x30f, 0x30de, 0x30eb, - 0x30af, 0x50f, 0x30de, 0x30f3, 0x30b7, 0x30e7, 0x30f3, 0x40f, - 0x30df, 0x30af, 0x30ed, 0x30f3, 0x20f, 0x30df, 0x30ea, 0x50f, - 0x30df, 0x30ea, 0x30d0, 0x30fc, 0x30eb, 0x20f, 0x30e1, 0x30ac, - 0x40f, 0x30e1, 0x30ac, 0x30c8, 0x30f3, 0x40f, 0x30e1, 0x30fc, - 0x30c8, 0x30eb, 0x30f, 0x30e4, 0x30fc, 0x30c9, 0x30f, 0x30e4, - 0x30fc, 0x30eb, 0x30f, 0x30e6, 0x30a2, 0x30f3, 0x40f, 0x30ea, - 0x30c3, 0x30c8, 0x30eb, 0x20f, 0x30ea, 0x30e9, 0x30f, 0x30eb, - 0x30d4, 0x30fc, 0x40f, 0x30eb, 0x30fc, 0x30d6, 0x30eb, 0x20f, - 0x30ec, 0x30e0, 0x50f, 0x30ec, 0x30f3, 0x30c8, 0x30b2, 0x30f3, - 0x30f, 0x30ef, 0x30c3, 0x30c8, 0x210, 0x30, 0x70b9, 0x210, - 0x31, 0x70b9, 0x210, 0x32, 0x70b9, 0x210, 0x33, 0x70b9, - 0x210, 0x34, 0x70b9, 0x210, 0x35, 0x70b9, 0x210, 0x36, - 0x70b9, 0x210, 0x37, 0x70b9, 0x210, 0x38, 0x70b9, 0x210, - 0x39, 0x70b9, 0x310, 0x31, 0x30, 0x70b9, 0x310, 0x31, - 0x31, 0x70b9, 0x310, 0x31, 0x32, 0x70b9, 0x310, 0x31, - 0x33, 0x70b9, 0x310, 0x31, 0x34, 0x70b9, 0x310, 0x31, - 0x35, 0x70b9, 0x310, 0x31, 0x36, 0x70b9, 0x310, 0x31, - 0x37, 0x70b9, 0x310, 0x31, 0x38, 0x70b9, 0x310, 0x31, - 0x39, 0x70b9, 0x310, 0x32, 0x30, 0x70b9, 0x310, 0x32, - 0x31, 0x70b9, 0x310, 0x32, 0x32, 0x70b9, 0x310, 0x32, - 0x33, 0x70b9, 0x310, 0x32, 0x34, 0x70b9, 0x30f, 0x68, - 0x50, 0x61, 0x20f, 0x64, 0x61, 0x20f, 0x41, 0x55, - 0x30f, 0x62, 0x61, 0x72, 0x20f, 0x6f, 0x56, 0x20f, - 0x70, 0x63, 0x20f, 0x64, 0x6d, 0x30f, 0x64, 0x6d, - 0xb2, 0x30f, 0x64, 0x6d, 0xb3, 0x20f, 0x49, 0x55, - 0x20f, 0x5e73, 0x6210, 0x20f, 0x662d, 0x548c, 0x20f, 0x5927, - 0x6b63, 0x20f, 0x660e, 0x6cbb, 0x40f, 0x682a, 0x5f0f, 0x4f1a, - 0x793e, 0x20f, 0x70, 0x41, 0x20f, 0x6e, 0x41, 0x20f, - 0x3bc, 0x41, 0x20f, 0x6d, 0x41, 0x20f, 0x6b, 0x41, - 0x20f, 0x4b, 0x42, 0x20f, 0x4d, 0x42, 0x20f, 0x47, - 0x42, 0x30f, 0x63, 0x61, 0x6c, 0x40f, 0x6b, 0x63, - 0x61, 0x6c, 0x20f, 0x70, 0x46, 0x20f, 0x6e, 0x46, - 0x20f, 0x3bc, 0x46, 0x20f, 0x3bc, 0x67, 0x20f, 0x6d, - 0x67, 0x20f, 0x6b, 0x67, 0x20f, 0x48, 0x7a, 0x30f, - 0x6b, 0x48, 0x7a, 0x30f, 0x4d, 0x48, 0x7a, 0x30f, - 0x47, 0x48, 0x7a, 0x30f, 0x54, 0x48, 0x7a, 0x20f, - 0x3bc, 0x2113, 0x20f, 0x6d, 0x2113, 0x20f, 0x64, 0x2113, - 0x20f, 0x6b, 0x2113, 0x20f, 0x66, 0x6d, 0x20f, 0x6e, - 0x6d, 0x20f, 0x3bc, 0x6d, 0x20f, 0x6d, 0x6d, 0x20f, - 0x63, 0x6d, 0x20f, 0x6b, 0x6d, 0x30f, 0x6d, 0x6d, - 0xb2, 0x30f, 0x63, 0x6d, 0xb2, 0x20f, 0x6d, 0xb2, - 0x30f, 0x6b, 0x6d, 0xb2, 0x30f, 0x6d, 0x6d, 0xb3, - 0x30f, 0x63, 0x6d, 0xb3, 0x20f, 0x6d, 0xb3, 0x30f, - 0x6b, 0x6d, 0xb3, 0x30f, 0x6d, 0x2215, 0x73, 0x40f, - 0x6d, 0x2215, 0x73, 0xb2, 0x20f, 0x50, 0x61, 0x30f, - 0x6b, 0x50, 0x61, 0x30f, 0x4d, 0x50, 0x61, 0x30f, - 0x47, 0x50, 0x61, 0x30f, 0x72, 0x61, 0x64, 0x50f, - 0x72, 0x61, 0x64, 0x2215, 0x73, 0x60f, 0x72, 0x61, - 0x64, 0x2215, 0x73, 0xb2, 0x20f, 0x70, 0x73, 0x20f, - 0x6e, 0x73, 0x20f, 0x3bc, 0x73, 0x20f, 0x6d, 0x73, - 0x20f, 0x70, 0x56, 0x20f, 0x6e, 0x56, 0x20f, 0x3bc, - 0x56, 0x20f, 0x6d, 0x56, 0x20f, 0x6b, 0x56, 0x20f, - 0x4d, 0x56, 0x20f, 0x70, 0x57, 0x20f, 0x6e, 0x57, - 0x20f, 0x3bc, 0x57, 0x20f, 0x6d, 0x57, 0x20f, 0x6b, - 0x57, 0x20f, 0x4d, 0x57, 0x20f, 0x6b, 0x3a9, 0x20f, - 0x4d, 0x3a9, 0x40f, 0x61, 0x2e, 0x6d, 0x2e, 0x20f, - 0x42, 0x71, 0x20f, 0x63, 0x63, 0x20f, 0x63, 0x64, - 0x40f, 0x43, 0x2215, 0x6b, 0x67, 0x30f, 0x43, 0x6f, - 0x2e, 0x20f, 0x64, 0x42, 0x20f, 0x47, 0x79, 0x20f, - 0x68, 0x61, 0x20f, 0x48, 0x50, 0x20f, 0x69, 0x6e, - 0x20f, 0x4b, 0x4b, 0x20f, 0x4b, 0x4d, 0x20f, 0x6b, - 0x74, 0x20f, 0x6c, 0x6d, 0x20f, 0x6c, 0x6e, 0x30f, - 0x6c, 0x6f, 0x67, 0x20f, 0x6c, 0x78, 0x20f, 0x6d, - 0x62, 0x30f, 0x6d, 0x69, 0x6c, 0x30f, 0x6d, 0x6f, - 0x6c, 0x20f, 0x50, 0x48, 0x40f, 0x70, 0x2e, 0x6d, - 0x2e, 0x30f, 0x50, 0x50, 0x4d, 0x20f, 0x50, 0x52, - 0x20f, 0x73, 0x72, 0x20f, 0x53, 0x76, 0x20f, 0x57, - 0x62, 0x30f, 0x56, 0x2215, 0x6d, 0x30f, 0x41, 0x2215, - 0x6d, 0x210, 0x31, 0x65e5, 0x210, 0x32, 0x65e5, 0x210, - 0x33, 0x65e5, 0x210, 0x34, 0x65e5, 0x210, 0x35, 0x65e5, - 0x210, 0x36, 0x65e5, 0x210, 0x37, 0x65e5, 0x210, 0x38, - 0x65e5, 0x210, 0x39, 0x65e5, 0x310, 0x31, 0x30, 0x65e5, - 0x310, 0x31, 0x31, 0x65e5, 0x310, 0x31, 0x32, 0x65e5, - 0x310, 0x31, 0x33, 0x65e5, 0x310, 0x31, 0x34, 0x65e5, - 0x310, 0x31, 0x35, 0x65e5, 0x310, 0x31, 0x36, 0x65e5, - 0x310, 0x31, 0x37, 0x65e5, 0x310, 0x31, 0x38, 0x65e5, - 0x310, 0x31, 0x39, 0x65e5, 0x310, 0x32, 0x30, 0x65e5, - 0x310, 0x32, 0x31, 0x65e5, 0x310, 0x32, 0x32, 0x65e5, - 0x310, 0x32, 0x33, 0x65e5, 0x310, 0x32, 0x34, 0x65e5, - 0x310, 0x32, 0x35, 0x65e5, 0x310, 0x32, 0x36, 0x65e5, - 0x310, 0x32, 0x37, 0x65e5, 0x310, 0x32, 0x38, 0x65e5, - 0x310, 0x32, 0x39, 0x65e5, 0x310, 0x33, 0x30, 0x65e5, - 0x310, 0x33, 0x31, 0x65e5, 0x30f, 0x67, 0x61, 0x6c, - 0x101, 0x8c48, 0x101, 0x66f4, 0x101, 0x8eca, 0x101, 0x8cc8, - 0x101, 0x6ed1, 0x101, 0x4e32, 0x101, 0x53e5, 0x101, 0x9f9c, - 0x101, 0x9f9c, 0x101, 0x5951, 0x101, 0x91d1, 0x101, 0x5587, - 0x101, 0x5948, 0x101, 0x61f6, 0x101, 0x7669, 0x101, 0x7f85, - 0x101, 0x863f, 0x101, 0x87ba, 0x101, 0x88f8, 0x101, 0x908f, - 0x101, 0x6a02, 0x101, 0x6d1b, 0x101, 0x70d9, 0x101, 0x73de, - 0x101, 0x843d, 0x101, 0x916a, 0x101, 0x99f1, 0x101, 0x4e82, - 0x101, 0x5375, 0x101, 0x6b04, 0x101, 0x721b, 0x101, 0x862d, - 0x101, 0x9e1e, 0x101, 0x5d50, 0x101, 0x6feb, 0x101, 0x85cd, - 0x101, 0x8964, 0x101, 0x62c9, 0x101, 0x81d8, 0x101, 0x881f, - 0x101, 0x5eca, 0x101, 0x6717, 0x101, 0x6d6a, 0x101, 0x72fc, - 0x101, 0x90ce, 0x101, 0x4f86, 0x101, 0x51b7, 0x101, 0x52de, - 0x101, 0x64c4, 0x101, 0x6ad3, 0x101, 0x7210, 0x101, 0x76e7, - 0x101, 0x8001, 0x101, 0x8606, 0x101, 0x865c, 0x101, 0x8def, - 0x101, 0x9732, 0x101, 0x9b6f, 0x101, 0x9dfa, 0x101, 0x788c, - 0x101, 0x797f, 0x101, 0x7da0, 0x101, 0x83c9, 0x101, 0x9304, - 0x101, 0x9e7f, 0x101, 0x8ad6, 0x101, 0x58df, 0x101, 0x5f04, - 0x101, 0x7c60, 0x101, 0x807e, 0x101, 0x7262, 0x101, 0x78ca, - 0x101, 0x8cc2, 0x101, 0x96f7, 0x101, 0x58d8, 0x101, 0x5c62, - 0x101, 0x6a13, 0x101, 0x6dda, 0x101, 0x6f0f, 0x101, 0x7d2f, - 0x101, 0x7e37, 0x101, 0x964b, 0x101, 0x52d2, 0x101, 0x808b, - 0x101, 0x51dc, 0x101, 0x51cc, 0x101, 0x7a1c, 0x101, 0x7dbe, - 0x101, 0x83f1, 0x101, 0x9675, 0x101, 0x8b80, 0x101, 0x62cf, - 0x101, 0x6a02, 0x101, 0x8afe, 0x101, 0x4e39, 0x101, 0x5be7, - 0x101, 0x6012, 0x101, 0x7387, 0x101, 0x7570, 0x101, 0x5317, - 0x101, 0x78fb, 0x101, 0x4fbf, 0x101, 0x5fa9, 0x101, 0x4e0d, - 0x101, 0x6ccc, 0x101, 0x6578, 0x101, 0x7d22, 0x101, 0x53c3, - 0x101, 0x585e, 0x101, 0x7701, 0x101, 0x8449, 0x101, 0x8aaa, - 0x101, 0x6bba, 0x101, 0x8fb0, 0x101, 0x6c88, 0x101, 0x62fe, - 0x101, 0x82e5, 0x101, 0x63a0, 0x101, 0x7565, 0x101, 0x4eae, - 0x101, 0x5169, 0x101, 0x51c9, 0x101, 0x6881, 0x101, 0x7ce7, - 0x101, 0x826f, 0x101, 0x8ad2, 0x101, 0x91cf, 0x101, 0x52f5, - 0x101, 0x5442, 0x101, 0x5973, 0x101, 0x5eec, 0x101, 0x65c5, - 0x101, 0x6ffe, 0x101, 0x792a, 0x101, 0x95ad, 0x101, 0x9a6a, - 0x101, 0x9e97, 0x101, 0x9ece, 0x101, 0x529b, 0x101, 0x66c6, - 0x101, 0x6b77, 0x101, 0x8f62, 0x101, 0x5e74, 0x101, 0x6190, - 0x101, 0x6200, 0x101, 0x649a, 0x101, 0x6f23, 0x101, 0x7149, - 0x101, 0x7489, 0x101, 0x79ca, 0x101, 0x7df4, 0x101, 0x806f, - 0x101, 0x8f26, 0x101, 0x84ee, 0x101, 0x9023, 0x101, 0x934a, - 0x101, 0x5217, 0x101, 0x52a3, 0x101, 0x54bd, 0x101, 0x70c8, - 0x101, 0x88c2, 0x101, 0x8aaa, 0x101, 0x5ec9, 0x101, 0x5ff5, - 0x101, 0x637b, 0x101, 0x6bae, 0x101, 0x7c3e, 0x101, 0x7375, - 0x101, 0x4ee4, 0x101, 0x56f9, 0x101, 0x5be7, 0x101, 0x5dba, - 0x101, 0x601c, 0x101, 0x73b2, 0x101, 0x7469, 0x101, 0x7f9a, - 0x101, 0x8046, 0x101, 0x9234, 0x101, 0x96f6, 0x101, 0x9748, - 0x101, 0x9818, 0x101, 0x4f8b, 0x101, 0x79ae, 0x101, 0x91b4, - 0x101, 0x96b8, 0x101, 0x60e1, 0x101, 0x4e86, 0x101, 0x50da, - 0x101, 0x5bee, 0x101, 0x5c3f, 0x101, 0x6599, 0x101, 0x6a02, - 0x101, 0x71ce, 0x101, 0x7642, 0x101, 0x84fc, 0x101, 0x907c, - 0x101, 0x9f8d, 0x101, 0x6688, 0x101, 0x962e, 0x101, 0x5289, - 0x101, 0x677b, 0x101, 0x67f3, 0x101, 0x6d41, 0x101, 0x6e9c, - 0x101, 0x7409, 0x101, 0x7559, 0x101, 0x786b, 0x101, 0x7d10, - 0x101, 0x985e, 0x101, 0x516d, 0x101, 0x622e, 0x101, 0x9678, - 0x101, 0x502b, 0x101, 0x5d19, 0x101, 0x6dea, 0x101, 0x8f2a, - 0x101, 0x5f8b, 0x101, 0x6144, 0x101, 0x6817, 0x101, 0x7387, - 0x101, 0x9686, 0x101, 0x5229, 0x101, 0x540f, 0x101, 0x5c65, - 0x101, 0x6613, 0x101, 0x674e, 0x101, 0x68a8, 0x101, 0x6ce5, - 0x101, 0x7406, 0x101, 0x75e2, 0x101, 0x7f79, 0x101, 0x88cf, - 0x101, 0x88e1, 0x101, 0x91cc, 0x101, 0x96e2, 0x101, 0x533f, - 0x101, 0x6eba, 0x101, 0x541d, 0x101, 0x71d0, 0x101, 0x7498, - 0x101, 0x85fa, 0x101, 0x96a3, 0x101, 0x9c57, 0x101, 0x9e9f, - 0x101, 0x6797, 0x101, 0x6dcb, 0x101, 0x81e8, 0x101, 0x7acb, - 0x101, 0x7b20, 0x101, 0x7c92, 0x101, 0x72c0, 0x101, 0x7099, - 0x101, 0x8b58, 0x101, 0x4ec0, 0x101, 0x8336, 0x101, 0x523a, - 0x101, 0x5207, 0x101, 0x5ea6, 0x101, 0x62d3, 0x101, 0x7cd6, - 0x101, 0x5b85, 0x101, 0x6d1e, 0x101, 0x66b4, 0x101, 0x8f3b, - 0x101, 0x884c, 0x101, 0x964d, 0x101, 0x898b, 0x101, 0x5ed3, - 0x101, 0x5140, 0x101, 0x55c0, 0x101, 0x585a, 0x101, 0x6674, - 0x101, 0x51de, 0x101, 0x732a, 0x101, 0x76ca, 0x101, 0x793c, - 0x101, 0x795e, 0x101, 0x7965, 0x101, 0x798f, 0x101, 0x9756, - 0x101, 0x7cbe, 0x101, 0x7fbd, 0x101, 0x8612, 0x101, 0x8af8, - 0x101, 0x9038, 0x101, 0x90fd, 0x101, 0x98ef, 0x101, 0x98fc, - 0x101, 0x9928, 0x101, 0x9db4, 0x101, 0x4fae, 0x101, 0x50e7, - 0x101, 0x514d, 0x101, 0x52c9, 0x101, 0x52e4, 0x101, 0x5351, - 0x101, 0x559d, 0x101, 0x5606, 0x101, 0x5668, 0x101, 0x5840, - 0x101, 0x58a8, 0x101, 0x5c64, 0x101, 0x5c6e, 0x101, 0x6094, - 0x101, 0x6168, 0x101, 0x618e, 0x101, 0x61f2, 0x101, 0x654f, - 0x101, 0x65e2, 0x101, 0x6691, 0x101, 0x6885, 0x101, 0x6d77, - 0x101, 0x6e1a, 0x101, 0x6f22, 0x101, 0x716e, 0x101, 0x722b, - 0x101, 0x7422, 0x101, 0x7891, 0x101, 0x793e, 0x101, 0x7949, - 0x101, 0x7948, 0x101, 0x7950, 0x101, 0x7956, 0x101, 0x795d, - 0x101, 0x798d, 0x101, 0x798e, 0x101, 0x7a40, 0x101, 0x7a81, - 0x101, 0x7bc0, 0x101, 0x7df4, 0x101, 0x7e09, 0x101, 0x7e41, - 0x101, 0x7f72, 0x101, 0x8005, 0x101, 0x81ed, 0x101, 0x8279, - 0x101, 0x8279, 0x101, 0x8457, 0x101, 0x8910, 0x101, 0x8996, - 0x101, 0x8b01, 0x101, 0x8b39, 0x101, 0x8cd3, 0x101, 0x8d08, - 0x101, 0x8fb6, 0x101, 0x9038, 0x101, 0x96e3, 0x101, 0x97ff, - 0x101, 0x983b, 0x101, 0x4e26, 0x101, 0x51b5, 0x101, 0x5168, - 0x101, 0x4f80, 0x101, 0x5145, 0x101, 0x5180, 0x101, 0x52c7, - 0x101, 0x52fa, 0x101, 0x559d, 0x101, 0x5555, 0x101, 0x5599, - 0x101, 0x55e2, 0x101, 0x585a, 0x101, 0x58b3, 0x101, 0x5944, - 0x101, 0x5954, 0x101, 0x5a62, 0x101, 0x5b28, 0x101, 0x5ed2, - 0x101, 0x5ed9, 0x101, 0x5f69, 0x101, 0x5fad, 0x101, 0x60d8, - 0x101, 0x614e, 0x101, 0x6108, 0x101, 0x618e, 0x101, 0x6160, - 0x101, 0x61f2, 0x101, 0x6234, 0x101, 0x63c4, 0x101, 0x641c, - 0x101, 0x6452, 0x101, 0x6556, 0x101, 0x6674, 0x101, 0x6717, - 0x101, 0x671b, 0x101, 0x6756, 0x101, 0x6b79, 0x101, 0x6bba, - 0x101, 0x6d41, 0x101, 0x6edb, 0x101, 0x6ecb, 0x101, 0x6f22, - 0x101, 0x701e, 0x101, 0x716e, 0x101, 0x77a7, 0x101, 0x7235, - 0x101, 0x72af, 0x101, 0x732a, 0x101, 0x7471, 0x101, 0x7506, - 0x101, 0x753b, 0x101, 0x761d, 0x101, 0x761f, 0x101, 0x76ca, - 0x101, 0x76db, 0x101, 0x76f4, 0x101, 0x774a, 0x101, 0x7740, - 0x101, 0x78cc, 0x101, 0x7ab1, 0x101, 0x7bc0, 0x101, 0x7c7b, - 0x101, 0x7d5b, 0x101, 0x7df4, 0x101, 0x7f3e, 0x101, 0x8005, - 0x101, 0x8352, 0x101, 0x83ef, 0x101, 0x8779, 0x101, 0x8941, - 0x101, 0x8986, 0x101, 0x8996, 0x101, 0x8abf, 0x101, 0x8af8, - 0x101, 0x8acb, 0x101, 0x8b01, 0x101, 0x8afe, 0x101, 0x8aed, - 0x101, 0x8b39, 0x101, 0x8b8a, 0x101, 0x8d08, 0x101, 0x8f38, - 0x101, 0x9072, 0x101, 0x9199, 0x101, 0x9276, 0x101, 0x967c, - 0x101, 0x96e3, 0x101, 0x9756, 0x101, 0x97db, 0x101, 0x97ff, - 0x101, 0x980b, 0x101, 0x983b, 0x101, 0x9b12, 0x101, 0x9f9c, - 0x201, 0xd84a, 0xdc4a, 0x201, 0xd84a, 0xdc44, 0x201, 0xd84c, - 0xdfd5, 0x101, 0x3b9d, 0x101, 0x4018, 0x101, 0x4039, 0x201, - 0xd854, 0xde49, 0x201, 0xd857, 0xdcd0, 0x201, 0xd85f, 0xded3, - 0x101, 0x9f43, 0x101, 0x9f8e, 0x210, 0x66, 0x66, 0x210, - 0x66, 0x69, 0x210, 0x66, 0x6c, 0x310, 0x66, 0x66, - 0x69, 0x310, 0x66, 0x66, 0x6c, 0x210, 0x17f, 0x74, - 0x210, 0x73, 0x74, 0x210, 0x574, 0x576, 0x210, 0x574, - 0x565, 0x210, 0x574, 0x56b, 0x210, 0x57e, 0x576, 0x210, - 0x574, 0x56d, 0x201, 0x5d9, 0x5b4, 0x201, 0x5f2, 0x5b7, - 0x102, 0x5e2, 0x102, 0x5d0, 0x102, 0x5d3, 0x102, 0x5d4, - 0x102, 0x5db, 0x102, 0x5dc, 0x102, 0x5dd, 0x102, 0x5e8, - 0x102, 0x5ea, 0x102, 0x2b, 0x201, 0x5e9, 0x5c1, 0x201, - 0x5e9, 0x5c2, 0x201, 0xfb49, 0x5c1, 0x201, 0xfb49, 0x5c2, - 0x201, 0x5d0, 0x5b7, 0x201, 0x5d0, 0x5b8, 0x201, 0x5d0, - 0x5bc, 0x201, 0x5d1, 0x5bc, 0x201, 0x5d2, 0x5bc, 0x201, - 0x5d3, 0x5bc, 0x201, 0x5d4, 0x5bc, 0x201, 0x5d5, 0x5bc, - 0x201, 0x5d6, 0x5bc, 0x201, 0x5d8, 0x5bc, 0x201, 0x5d9, - 0x5bc, 0x201, 0x5da, 0x5bc, 0x201, 0x5db, 0x5bc, 0x201, - 0x5dc, 0x5bc, 0x201, 0x5de, 0x5bc, 0x201, 0x5e0, 0x5bc, - 0x201, 0x5e1, 0x5bc, 0x201, 0x5e3, 0x5bc, 0x201, 0x5e4, - 0x5bc, 0x201, 0x5e6, 0x5bc, 0x201, 0x5e7, 0x5bc, 0x201, - 0x5e8, 0x5bc, 0x201, 0x5e9, 0x5bc, 0x201, 0x5ea, 0x5bc, - 0x201, 0x5d5, 0x5b9, 0x201, 0x5d1, 0x5bf, 0x201, 0x5db, - 0x5bf, 0x201, 0x5e4, 0x5bf, 0x210, 0x5d0, 0x5dc, 0x107, - 0x671, 0x106, 0x671, 0x107, 0x67b, 0x106, 0x67b, 0x104, - 0x67b, 0x105, 0x67b, 0x107, 0x67e, 0x106, 0x67e, 0x104, - 0x67e, 0x105, 0x67e, 0x107, 0x680, 0x106, 0x680, 0x104, - 0x680, 0x105, 0x680, 0x107, 0x67a, 0x106, 0x67a, 0x104, - 0x67a, 0x105, 0x67a, 0x107, 0x67f, 0x106, 0x67f, 0x104, - 0x67f, 0x105, 0x67f, 0x107, 0x679, 0x106, 0x679, 0x104, - 0x679, 0x105, 0x679, 0x107, 0x6a4, 0x106, 0x6a4, 0x104, - 0x6a4, 0x105, 0x6a4, 0x107, 0x6a6, 0x106, 0x6a6, 0x104, - 0x6a6, 0x105, 0x6a6, 0x107, 0x684, 0x106, 0x684, 0x104, - 0x684, 0x105, 0x684, 0x107, 0x683, 0x106, 0x683, 0x104, - 0x683, 0x105, 0x683, 0x107, 0x686, 0x106, 0x686, 0x104, - 0x686, 0x105, 0x686, 0x107, 0x687, 0x106, 0x687, 0x104, - 0x687, 0x105, 0x687, 0x107, 0x68d, 0x106, 0x68d, 0x107, - 0x68c, 0x106, 0x68c, 0x107, 0x68e, 0x106, 0x68e, 0x107, - 0x688, 0x106, 0x688, 0x107, 0x698, 0x106, 0x698, 0x107, - 0x691, 0x106, 0x691, 0x107, 0x6a9, 0x106, 0x6a9, 0x104, - 0x6a9, 0x105, 0x6a9, 0x107, 0x6af, 0x106, 0x6af, 0x104, - 0x6af, 0x105, 0x6af, 0x107, 0x6b3, 0x106, 0x6b3, 0x104, - 0x6b3, 0x105, 0x6b3, 0x107, 0x6b1, 0x106, 0x6b1, 0x104, - 0x6b1, 0x105, 0x6b1, 0x107, 0x6ba, 0x106, 0x6ba, 0x107, - 0x6bb, 0x106, 0x6bb, 0x104, 0x6bb, 0x105, 0x6bb, 0x107, - 0x6c0, 0x106, 0x6c0, 0x107, 0x6c1, 0x106, 0x6c1, 0x104, - 0x6c1, 0x105, 0x6c1, 0x107, 0x6be, 0x106, 0x6be, 0x104, - 0x6be, 0x105, 0x6be, 0x107, 0x6d2, 0x106, 0x6d2, 0x107, - 0x6d3, 0x106, 0x6d3, 0x107, 0x6ad, 0x106, 0x6ad, 0x104, - 0x6ad, 0x105, 0x6ad, 0x107, 0x6c7, 0x106, 0x6c7, 0x107, - 0x6c6, 0x106, 0x6c6, 0x107, 0x6c8, 0x106, 0x6c8, 0x107, - 0x677, 0x107, 0x6cb, 0x106, 0x6cb, 0x107, 0x6c5, 0x106, - 0x6c5, 0x107, 0x6c9, 0x106, 0x6c9, 0x107, 0x6d0, 0x106, - 0x6d0, 0x104, 0x6d0, 0x105, 0x6d0, 0x104, 0x649, 0x105, - 0x649, 0x207, 0x626, 0x627, 0x206, 0x626, 0x627, 0x207, - 0x626, 0x6d5, 0x206, 0x626, 0x6d5, 0x207, 0x626, 0x648, - 0x206, 0x626, 0x648, 0x207, 0x626, 0x6c7, 0x206, 0x626, - 0x6c7, 0x207, 0x626, 0x6c6, 0x206, 0x626, 0x6c6, 0x207, - 0x626, 0x6c8, 0x206, 0x626, 0x6c8, 0x207, 0x626, 0x6d0, - 0x206, 0x626, 0x6d0, 0x204, 0x626, 0x6d0, 0x207, 0x626, - 0x649, 0x206, 0x626, 0x649, 0x204, 0x626, 0x649, 0x107, - 0x6cc, 0x106, 0x6cc, 0x104, 0x6cc, 0x105, 0x6cc, 0x207, - 0x626, 0x62c, 0x207, 0x626, 0x62d, 0x207, 0x626, 0x645, - 0x207, 0x626, 0x649, 0x207, 0x626, 0x64a, 0x207, 0x628, - 0x62c, 0x207, 0x628, 0x62d, 0x207, 0x628, 0x62e, 0x207, - 0x628, 0x645, 0x207, 0x628, 0x649, 0x207, 0x628, 0x64a, - 0x207, 0x62a, 0x62c, 0x207, 0x62a, 0x62d, 0x207, 0x62a, - 0x62e, 0x207, 0x62a, 0x645, 0x207, 0x62a, 0x649, 0x207, - 0x62a, 0x64a, 0x207, 0x62b, 0x62c, 0x207, 0x62b, 0x645, - 0x207, 0x62b, 0x649, 0x207, 0x62b, 0x64a, 0x207, 0x62c, - 0x62d, 0x207, 0x62c, 0x645, 0x207, 0x62d, 0x62c, 0x207, - 0x62d, 0x645, 0x207, 0x62e, 0x62c, 0x207, 0x62e, 0x62d, - 0x207, 0x62e, 0x645, 0x207, 0x633, 0x62c, 0x207, 0x633, - 0x62d, 0x207, 0x633, 0x62e, 0x207, 0x633, 0x645, 0x207, - 0x635, 0x62d, 0x207, 0x635, 0x645, 0x207, 0x636, 0x62c, - 0x207, 0x636, 0x62d, 0x207, 0x636, 0x62e, 0x207, 0x636, - 0x645, 0x207, 0x637, 0x62d, 0x207, 0x637, 0x645, 0x207, - 0x638, 0x645, 0x207, 0x639, 0x62c, 0x207, 0x639, 0x645, - 0x207, 0x63a, 0x62c, 0x207, 0x63a, 0x645, 0x207, 0x641, - 0x62c, 0x207, 0x641, 0x62d, 0x207, 0x641, 0x62e, 0x207, - 0x641, 0x645, 0x207, 0x641, 0x649, 0x207, 0x641, 0x64a, - 0x207, 0x642, 0x62d, 0x207, 0x642, 0x645, 0x207, 0x642, - 0x649, 0x207, 0x642, 0x64a, 0x207, 0x643, 0x627, 0x207, - 0x643, 0x62c, 0x207, 0x643, 0x62d, 0x207, 0x643, 0x62e, - 0x207, 0x643, 0x644, 0x207, 0x643, 0x645, 0x207, 0x643, - 0x649, 0x207, 0x643, 0x64a, 0x207, 0x644, 0x62c, 0x207, - 0x644, 0x62d, 0x207, 0x644, 0x62e, 0x207, 0x644, 0x645, - 0x207, 0x644, 0x649, 0x207, 0x644, 0x64a, 0x207, 0x645, - 0x62c, 0x207, 0x645, 0x62d, 0x207, 0x645, 0x62e, 0x207, - 0x645, 0x645, 0x207, 0x645, 0x649, 0x207, 0x645, 0x64a, - 0x207, 0x646, 0x62c, 0x207, 0x646, 0x62d, 0x207, 0x646, - 0x62e, 0x207, 0x646, 0x645, 0x207, 0x646, 0x649, 0x207, - 0x646, 0x64a, 0x207, 0x647, 0x62c, 0x207, 0x647, 0x645, - 0x207, 0x647, 0x649, 0x207, 0x647, 0x64a, 0x207, 0x64a, - 0x62c, 0x207, 0x64a, 0x62d, 0x207, 0x64a, 0x62e, 0x207, - 0x64a, 0x645, 0x207, 0x64a, 0x649, 0x207, 0x64a, 0x64a, - 0x207, 0x630, 0x670, 0x207, 0x631, 0x670, 0x207, 0x649, - 0x670, 0x307, 0x20, 0x64c, 0x651, 0x307, 0x20, 0x64d, - 0x651, 0x307, 0x20, 0x64e, 0x651, 0x307, 0x20, 0x64f, - 0x651, 0x307, 0x20, 0x650, 0x651, 0x307, 0x20, 0x651, - 0x670, 0x206, 0x626, 0x631, 0x206, 0x626, 0x632, 0x206, - 0x626, 0x645, 0x206, 0x626, 0x646, 0x206, 0x626, 0x649, - 0x206, 0x626, 0x64a, 0x206, 0x628, 0x631, 0x206, 0x628, - 0x632, 0x206, 0x628, 0x645, 0x206, 0x628, 0x646, 0x206, - 0x628, 0x649, 0x206, 0x628, 0x64a, 0x206, 0x62a, 0x631, - 0x206, 0x62a, 0x632, 0x206, 0x62a, 0x645, 0x206, 0x62a, - 0x646, 0x206, 0x62a, 0x649, 0x206, 0x62a, 0x64a, 0x206, - 0x62b, 0x631, 0x206, 0x62b, 0x632, 0x206, 0x62b, 0x645, - 0x206, 0x62b, 0x646, 0x206, 0x62b, 0x649, 0x206, 0x62b, - 0x64a, 0x206, 0x641, 0x649, 0x206, 0x641, 0x64a, 0x206, - 0x642, 0x649, 0x206, 0x642, 0x64a, 0x206, 0x643, 0x627, - 0x206, 0x643, 0x644, 0x206, 0x643, 0x645, 0x206, 0x643, - 0x649, 0x206, 0x643, 0x64a, 0x206, 0x644, 0x645, 0x206, - 0x644, 0x649, 0x206, 0x644, 0x64a, 0x206, 0x645, 0x627, - 0x206, 0x645, 0x645, 0x206, 0x646, 0x631, 0x206, 0x646, - 0x632, 0x206, 0x646, 0x645, 0x206, 0x646, 0x646, 0x206, - 0x646, 0x649, 0x206, 0x646, 0x64a, 0x206, 0x649, 0x670, - 0x206, 0x64a, 0x631, 0x206, 0x64a, 0x632, 0x206, 0x64a, - 0x645, 0x206, 0x64a, 0x646, 0x206, 0x64a, 0x649, 0x206, - 0x64a, 0x64a, 0x204, 0x626, 0x62c, 0x204, 0x626, 0x62d, - 0x204, 0x626, 0x62e, 0x204, 0x626, 0x645, 0x204, 0x626, - 0x647, 0x204, 0x628, 0x62c, 0x204, 0x628, 0x62d, 0x204, - 0x628, 0x62e, 0x204, 0x628, 0x645, 0x204, 0x628, 0x647, - 0x204, 0x62a, 0x62c, 0x204, 0x62a, 0x62d, 0x204, 0x62a, - 0x62e, 0x204, 0x62a, 0x645, 0x204, 0x62a, 0x647, 0x204, - 0x62b, 0x645, 0x204, 0x62c, 0x62d, 0x204, 0x62c, 0x645, - 0x204, 0x62d, 0x62c, 0x204, 0x62d, 0x645, 0x204, 0x62e, - 0x62c, 0x204, 0x62e, 0x645, 0x204, 0x633, 0x62c, 0x204, - 0x633, 0x62d, 0x204, 0x633, 0x62e, 0x204, 0x633, 0x645, - 0x204, 0x635, 0x62d, 0x204, 0x635, 0x62e, 0x204, 0x635, - 0x645, 0x204, 0x636, 0x62c, 0x204, 0x636, 0x62d, 0x204, - 0x636, 0x62e, 0x204, 0x636, 0x645, 0x204, 0x637, 0x62d, - 0x204, 0x638, 0x645, 0x204, 0x639, 0x62c, 0x204, 0x639, - 0x645, 0x204, 0x63a, 0x62c, 0x204, 0x63a, 0x645, 0x204, - 0x641, 0x62c, 0x204, 0x641, 0x62d, 0x204, 0x641, 0x62e, - 0x204, 0x641, 0x645, 0x204, 0x642, 0x62d, 0x204, 0x642, - 0x645, 0x204, 0x643, 0x62c, 0x204, 0x643, 0x62d, 0x204, - 0x643, 0x62e, 0x204, 0x643, 0x644, 0x204, 0x643, 0x645, - 0x204, 0x644, 0x62c, 0x204, 0x644, 0x62d, 0x204, 0x644, - 0x62e, 0x204, 0x644, 0x645, 0x204, 0x644, 0x647, 0x204, - 0x645, 0x62c, 0x204, 0x645, 0x62d, 0x204, 0x645, 0x62e, - 0x204, 0x645, 0x645, 0x204, 0x646, 0x62c, 0x204, 0x646, - 0x62d, 0x204, 0x646, 0x62e, 0x204, 0x646, 0x645, 0x204, - 0x646, 0x647, 0x204, 0x647, 0x62c, 0x204, 0x647, 0x645, - 0x204, 0x647, 0x670, 0x204, 0x64a, 0x62c, 0x204, 0x64a, - 0x62d, 0x204, 0x64a, 0x62e, 0x204, 0x64a, 0x645, 0x204, - 0x64a, 0x647, 0x205, 0x626, 0x645, 0x205, 0x626, 0x647, - 0x205, 0x628, 0x645, 0x205, 0x628, 0x647, 0x205, 0x62a, - 0x645, 0x205, 0x62a, 0x647, 0x205, 0x62b, 0x645, 0x205, - 0x62b, 0x647, 0x205, 0x633, 0x645, 0x205, 0x633, 0x647, - 0x205, 0x634, 0x645, 0x205, 0x634, 0x647, 0x205, 0x643, - 0x644, 0x205, 0x643, 0x645, 0x205, 0x644, 0x645, 0x205, - 0x646, 0x645, 0x205, 0x646, 0x647, 0x205, 0x64a, 0x645, - 0x205, 0x64a, 0x647, 0x305, 0x640, 0x64e, 0x651, 0x305, - 0x640, 0x64f, 0x651, 0x305, 0x640, 0x650, 0x651, 0x207, - 0x637, 0x649, 0x207, 0x637, 0x64a, 0x207, 0x639, 0x649, - 0x207, 0x639, 0x64a, 0x207, 0x63a, 0x649, 0x207, 0x63a, - 0x64a, 0x207, 0x633, 0x649, 0x207, 0x633, 0x64a, 0x207, - 0x634, 0x649, 0x207, 0x634, 0x64a, 0x207, 0x62d, 0x649, - 0x207, 0x62d, 0x64a, 0x207, 0x62c, 0x649, 0x207, 0x62c, - 0x64a, 0x207, 0x62e, 0x649, 0x207, 0x62e, 0x64a, 0x207, - 0x635, 0x649, 0x207, 0x635, 0x64a, 0x207, 0x636, 0x649, - 0x207, 0x636, 0x64a, 0x207, 0x634, 0x62c, 0x207, 0x634, - 0x62d, 0x207, 0x634, 0x62e, 0x207, 0x634, 0x645, 0x207, - 0x634, 0x631, 0x207, 0x633, 0x631, 0x207, 0x635, 0x631, - 0x207, 0x636, 0x631, 0x206, 0x637, 0x649, 0x206, 0x637, - 0x64a, 0x206, 0x639, 0x649, 0x206, 0x639, 0x64a, 0x206, - 0x63a, 0x649, 0x206, 0x63a, 0x64a, 0x206, 0x633, 0x649, - 0x206, 0x633, 0x64a, 0x206, 0x634, 0x649, 0x206, 0x634, - 0x64a, 0x206, 0x62d, 0x649, 0x206, 0x62d, 0x64a, 0x206, - 0x62c, 0x649, 0x206, 0x62c, 0x64a, 0x206, 0x62e, 0x649, - 0x206, 0x62e, 0x64a, 0x206, 0x635, 0x649, 0x206, 0x635, - 0x64a, 0x206, 0x636, 0x649, 0x206, 0x636, 0x64a, 0x206, - 0x634, 0x62c, 0x206, 0x634, 0x62d, 0x206, 0x634, 0x62e, - 0x206, 0x634, 0x645, 0x206, 0x634, 0x631, 0x206, 0x633, - 0x631, 0x206, 0x635, 0x631, 0x206, 0x636, 0x631, 0x204, - 0x634, 0x62c, 0x204, 0x634, 0x62d, 0x204, 0x634, 0x62e, - 0x204, 0x634, 0x645, 0x204, 0x633, 0x647, 0x204, 0x634, - 0x647, 0x204, 0x637, 0x645, 0x205, 0x633, 0x62c, 0x205, - 0x633, 0x62d, 0x205, 0x633, 0x62e, 0x205, 0x634, 0x62c, - 0x205, 0x634, 0x62d, 0x205, 0x634, 0x62e, 0x205, 0x637, - 0x645, 0x205, 0x638, 0x645, 0x206, 0x627, 0x64b, 0x207, - 0x627, 0x64b, 0x304, 0x62a, 0x62c, 0x645, 0x306, 0x62a, - 0x62d, 0x62c, 0x304, 0x62a, 0x62d, 0x62c, 0x304, 0x62a, - 0x62d, 0x645, 0x304, 0x62a, 0x62e, 0x645, 0x304, 0x62a, - 0x645, 0x62c, 0x304, 0x62a, 0x645, 0x62d, 0x304, 0x62a, - 0x645, 0x62e, 0x306, 0x62c, 0x645, 0x62d, 0x304, 0x62c, - 0x645, 0x62d, 0x306, 0x62d, 0x645, 0x64a, 0x306, 0x62d, - 0x645, 0x649, 0x304, 0x633, 0x62d, 0x62c, 0x304, 0x633, - 0x62c, 0x62d, 0x306, 0x633, 0x62c, 0x649, 0x306, 0x633, - 0x645, 0x62d, 0x304, 0x633, 0x645, 0x62d, 0x304, 0x633, - 0x645, 0x62c, 0x306, 0x633, 0x645, 0x645, 0x304, 0x633, - 0x645, 0x645, 0x306, 0x635, 0x62d, 0x62d, 0x304, 0x635, - 0x62d, 0x62d, 0x306, 0x635, 0x645, 0x645, 0x306, 0x634, - 0x62d, 0x645, 0x304, 0x634, 0x62d, 0x645, 0x306, 0x634, - 0x62c, 0x64a, 0x306, 0x634, 0x645, 0x62e, 0x304, 0x634, - 0x645, 0x62e, 0x306, 0x634, 0x645, 0x645, 0x304, 0x634, - 0x645, 0x645, 0x306, 0x636, 0x62d, 0x649, 0x306, 0x636, - 0x62e, 0x645, 0x304, 0x636, 0x62e, 0x645, 0x306, 0x637, - 0x645, 0x62d, 0x304, 0x637, 0x645, 0x62d, 0x304, 0x637, - 0x645, 0x645, 0x306, 0x637, 0x645, 0x64a, 0x306, 0x639, - 0x62c, 0x645, 0x306, 0x639, 0x645, 0x645, 0x304, 0x639, - 0x645, 0x645, 0x306, 0x639, 0x645, 0x649, 0x306, 0x63a, - 0x645, 0x645, 0x306, 0x63a, 0x645, 0x64a, 0x306, 0x63a, - 0x645, 0x649, 0x306, 0x641, 0x62e, 0x645, 0x304, 0x641, - 0x62e, 0x645, 0x306, 0x642, 0x645, 0x62d, 0x306, 0x642, - 0x645, 0x645, 0x306, 0x644, 0x62d, 0x645, 0x306, 0x644, - 0x62d, 0x64a, 0x306, 0x644, 0x62d, 0x649, 0x304, 0x644, - 0x62c, 0x62c, 0x306, 0x644, 0x62c, 0x62c, 0x306, 0x644, - 0x62e, 0x645, 0x304, 0x644, 0x62e, 0x645, 0x306, 0x644, - 0x645, 0x62d, 0x304, 0x644, 0x645, 0x62d, 0x304, 0x645, - 0x62d, 0x62c, 0x304, 0x645, 0x62d, 0x645, 0x306, 0x645, - 0x62d, 0x64a, 0x304, 0x645, 0x62c, 0x62d, 0x304, 0x645, - 0x62c, 0x645, 0x304, 0x645, 0x62e, 0x62c, 0x304, 0x645, - 0x62e, 0x645, 0x304, 0x645, 0x62c, 0x62e, 0x304, 0x647, - 0x645, 0x62c, 0x304, 0x647, 0x645, 0x645, 0x304, 0x646, - 0x62d, 0x645, 0x306, 0x646, 0x62d, 0x649, 0x306, 0x646, - 0x62c, 0x645, 0x304, 0x646, 0x62c, 0x645, 0x306, 0x646, - 0x62c, 0x649, 0x306, 0x646, 0x645, 0x64a, 0x306, 0x646, - 0x645, 0x649, 0x306, 0x64a, 0x645, 0x645, 0x304, 0x64a, - 0x645, 0x645, 0x306, 0x628, 0x62e, 0x64a, 0x306, 0x62a, - 0x62c, 0x64a, 0x306, 0x62a, 0x62c, 0x649, 0x306, 0x62a, - 0x62e, 0x64a, 0x306, 0x62a, 0x62e, 0x649, 0x306, 0x62a, - 0x645, 0x64a, 0x306, 0x62a, 0x645, 0x649, 0x306, 0x62c, - 0x645, 0x64a, 0x306, 0x62c, 0x62d, 0x649, 0x306, 0x62c, - 0x645, 0x649, 0x306, 0x633, 0x62e, 0x649, 0x306, 0x635, - 0x62d, 0x64a, 0x306, 0x634, 0x62d, 0x64a, 0x306, 0x636, - 0x62d, 0x64a, 0x306, 0x644, 0x62c, 0x64a, 0x306, 0x644, - 0x645, 0x64a, 0x306, 0x64a, 0x62d, 0x64a, 0x306, 0x64a, - 0x62c, 0x64a, 0x306, 0x64a, 0x645, 0x64a, 0x306, 0x645, - 0x645, 0x64a, 0x306, 0x642, 0x645, 0x64a, 0x306, 0x646, - 0x62d, 0x64a, 0x304, 0x642, 0x645, 0x62d, 0x304, 0x644, - 0x62d, 0x645, 0x306, 0x639, 0x645, 0x64a, 0x306, 0x643, - 0x645, 0x64a, 0x304, 0x646, 0x62c, 0x62d, 0x306, 0x645, - 0x62e, 0x64a, 0x304, 0x644, 0x62c, 0x645, 0x306, 0x643, - 0x645, 0x645, 0x306, 0x644, 0x62c, 0x645, 0x306, 0x646, - 0x62c, 0x62d, 0x306, 0x62c, 0x62d, 0x64a, 0x306, 0x62d, - 0x62c, 0x64a, 0x306, 0x645, 0x62c, 0x64a, 0x306, 0x641, - 0x645, 0x64a, 0x306, 0x628, 0x62d, 0x64a, 0x304, 0x643, - 0x645, 0x645, 0x304, 0x639, 0x62c, 0x645, 0x304, 0x635, - 0x645, 0x645, 0x306, 0x633, 0x62e, 0x64a, 0x306, 0x646, - 0x62c, 0x64a, 0x307, 0x635, 0x644, 0x6d2, 0x307, 0x642, - 0x644, 0x6d2, 0x407, 0x627, 0x644, 0x644, 0x647, 0x407, - 0x627, 0x643, 0x628, 0x631, 0x407, 0x645, 0x62d, 0x645, - 0x62f, 0x407, 0x635, 0x644, 0x639, 0x645, 0x407, 0x631, - 0x633, 0x648, 0x644, 0x407, 0x639, 0x644, 0x64a, 0x647, - 0x407, 0x648, 0x633, 0x644, 0x645, 0x307, 0x635, 0x644, - 0x649, 0x1207, 0x635, 0x644, 0x649, 0x20, 0x627, 0x644, - 0x644, 0x647, 0x20, 0x639, 0x644, 0x64a, 0x647, 0x20, - 0x648, 0x633, 0x644, 0x645, 0x807, 0x62c, 0x644, 0x20, - 0x62c, 0x644, 0x627, 0x644, 0x647, 0x407, 0x631, 0x6cc, - 0x627, 0x644, 0x10b, 0x2c, 0x10b, 0x3001, 0x10b, 0x3002, - 0x10b, 0x3a, 0x10b, 0x3b, 0x10b, 0x21, 0x10b, 0x3f, - 0x10b, 0x3016, 0x10b, 0x3017, 0x10b, 0x2026, 0x10b, 0x2025, - 0x10b, 0x2014, 0x10b, 0x2013, 0x10b, 0x5f, 0x10b, 0x5f, - 0x10b, 0x28, 0x10b, 0x29, 0x10b, 0x7b, 0x10b, 0x7d, - 0x10b, 0x3014, 0x10b, 0x3015, 0x10b, 0x3010, 0x10b, 0x3011, - 0x10b, 0x300a, 0x10b, 0x300b, 0x10b, 0x3008, 0x10b, 0x3009, - 0x10b, 0x300c, 0x10b, 0x300d, 0x10b, 0x300e, 0x10b, 0x300f, - 0x10b, 0x5b, 0x10b, 0x5d, 0x110, 0x203e, 0x110, 0x203e, - 0x110, 0x203e, 0x110, 0x203e, 0x110, 0x5f, 0x110, 0x5f, - 0x110, 0x5f, 0x10e, 0x2c, 0x10e, 0x3001, 0x10e, 0x2e, - 0x10e, 0x3b, 0x10e, 0x3a, 0x10e, 0x3f, 0x10e, 0x21, - 0x10e, 0x2014, 0x10e, 0x28, 0x10e, 0x29, 0x10e, 0x7b, - 0x10e, 0x7d, 0x10e, 0x3014, 0x10e, 0x3015, 0x10e, 0x23, - 0x10e, 0x26, 0x10e, 0x2a, 0x10e, 0x2b, 0x10e, 0x2d, - 0x10e, 0x3c, 0x10e, 0x3e, 0x10e, 0x3d, 0x10e, 0x5c, - 0x10e, 0x24, 0x10e, 0x25, 0x10e, 0x40, 0x207, 0x20, - 0x64b, 0x205, 0x640, 0x64b, 0x207, 0x20, 0x64c, 0x207, - 0x20, 0x64d, 0x207, 0x20, 0x64e, 0x205, 0x640, 0x64e, - 0x207, 0x20, 0x64f, 0x205, 0x640, 0x64f, 0x207, 0x20, - 0x650, 0x205, 0x640, 0x650, 0x207, 0x20, 0x651, 0x205, - 0x640, 0x651, 0x207, 0x20, 0x652, 0x205, 0x640, 0x652, - 0x107, 0x621, 0x107, 0x622, 0x106, 0x622, 0x107, 0x623, - 0x106, 0x623, 0x107, 0x624, 0x106, 0x624, 0x107, 0x625, - 0x106, 0x625, 0x107, 0x626, 0x106, 0x626, 0x104, 0x626, - 0x105, 0x626, 0x107, 0x627, 0x106, 0x627, 0x107, 0x628, - 0x106, 0x628, 0x104, 0x628, 0x105, 0x628, 0x107, 0x629, - 0x106, 0x629, 0x107, 0x62a, 0x106, 0x62a, 0x104, 0x62a, - 0x105, 0x62a, 0x107, 0x62b, 0x106, 0x62b, 0x104, 0x62b, - 0x105, 0x62b, 0x107, 0x62c, 0x106, 0x62c, 0x104, 0x62c, - 0x105, 0x62c, 0x107, 0x62d, 0x106, 0x62d, 0x104, 0x62d, - 0x105, 0x62d, 0x107, 0x62e, 0x106, 0x62e, 0x104, 0x62e, - 0x105, 0x62e, 0x107, 0x62f, 0x106, 0x62f, 0x107, 0x630, - 0x106, 0x630, 0x107, 0x631, 0x106, 0x631, 0x107, 0x632, - 0x106, 0x632, 0x107, 0x633, 0x106, 0x633, 0x104, 0x633, - 0x105, 0x633, 0x107, 0x634, 0x106, 0x634, 0x104, 0x634, - 0x105, 0x634, 0x107, 0x635, 0x106, 0x635, 0x104, 0x635, - 0x105, 0x635, 0x107, 0x636, 0x106, 0x636, 0x104, 0x636, - 0x105, 0x636, 0x107, 0x637, 0x106, 0x637, 0x104, 0x637, - 0x105, 0x637, 0x107, 0x638, 0x106, 0x638, 0x104, 0x638, - 0x105, 0x638, 0x107, 0x639, 0x106, 0x639, 0x104, 0x639, - 0x105, 0x639, 0x107, 0x63a, 0x106, 0x63a, 0x104, 0x63a, - 0x105, 0x63a, 0x107, 0x641, 0x106, 0x641, 0x104, 0x641, - 0x105, 0x641, 0x107, 0x642, 0x106, 0x642, 0x104, 0x642, - 0x105, 0x642, 0x107, 0x643, 0x106, 0x643, 0x104, 0x643, - 0x105, 0x643, 0x107, 0x644, 0x106, 0x644, 0x104, 0x644, - 0x105, 0x644, 0x107, 0x645, 0x106, 0x645, 0x104, 0x645, - 0x105, 0x645, 0x107, 0x646, 0x106, 0x646, 0x104, 0x646, - 0x105, 0x646, 0x107, 0x647, 0x106, 0x647, 0x104, 0x647, - 0x105, 0x647, 0x107, 0x648, 0x106, 0x648, 0x107, 0x649, - 0x106, 0x649, 0x107, 0x64a, 0x106, 0x64a, 0x104, 0x64a, - 0x105, 0x64a, 0x207, 0x644, 0x622, 0x206, 0x644, 0x622, - 0x207, 0x644, 0x623, 0x206, 0x644, 0x623, 0x207, 0x644, - 0x625, 0x206, 0x644, 0x625, 0x207, 0x644, 0x627, 0x206, - 0x644, 0x627, 0x10c, 0x21, 0x10c, 0x22, 0x10c, 0x23, - 0x10c, 0x24, 0x10c, 0x25, 0x10c, 0x26, 0x10c, 0x27, - 0x10c, 0x28, 0x10c, 0x29, 0x10c, 0x2a, 0x10c, 0x2b, - 0x10c, 0x2c, 0x10c, 0x2d, 0x10c, 0x2e, 0x10c, 0x2f, - 0x10c, 0x30, 0x10c, 0x31, 0x10c, 0x32, 0x10c, 0x33, - 0x10c, 0x34, 0x10c, 0x35, 0x10c, 0x36, 0x10c, 0x37, - 0x10c, 0x38, 0x10c, 0x39, 0x10c, 0x3a, 0x10c, 0x3b, - 0x10c, 0x3c, 0x10c, 0x3d, 0x10c, 0x3e, 0x10c, 0x3f, - 0x10c, 0x40, 0x10c, 0x41, 0x10c, 0x42, 0x10c, 0x43, - 0x10c, 0x44, 0x10c, 0x45, 0x10c, 0x46, 0x10c, 0x47, - 0x10c, 0x48, 0x10c, 0x49, 0x10c, 0x4a, 0x10c, 0x4b, - 0x10c, 0x4c, 0x10c, 0x4d, 0x10c, 0x4e, 0x10c, 0x4f, - 0x10c, 0x50, 0x10c, 0x51, 0x10c, 0x52, 0x10c, 0x53, - 0x10c, 0x54, 0x10c, 0x55, 0x10c, 0x56, 0x10c, 0x57, - 0x10c, 0x58, 0x10c, 0x59, 0x10c, 0x5a, 0x10c, 0x5b, - 0x10c, 0x5c, 0x10c, 0x5d, 0x10c, 0x5e, 0x10c, 0x5f, - 0x10c, 0x60, 0x10c, 0x61, 0x10c, 0x62, 0x10c, 0x63, - 0x10c, 0x64, 0x10c, 0x65, 0x10c, 0x66, 0x10c, 0x67, - 0x10c, 0x68, 0x10c, 0x69, 0x10c, 0x6a, 0x10c, 0x6b, - 0x10c, 0x6c, 0x10c, 0x6d, 0x10c, 0x6e, 0x10c, 0x6f, - 0x10c, 0x70, 0x10c, 0x71, 0x10c, 0x72, 0x10c, 0x73, - 0x10c, 0x74, 0x10c, 0x75, 0x10c, 0x76, 0x10c, 0x77, - 0x10c, 0x78, 0x10c, 0x79, 0x10c, 0x7a, 0x10c, 0x7b, - 0x10c, 0x7c, 0x10c, 0x7d, 0x10c, 0x7e, 0x10c, 0x2985, - 0x10c, 0x2986, 0x10d, 0x3002, 0x10d, 0x300c, 0x10d, 0x300d, - 0x10d, 0x3001, 0x10d, 0x30fb, 0x10d, 0x30f2, 0x10d, 0x30a1, - 0x10d, 0x30a3, 0x10d, 0x30a5, 0x10d, 0x30a7, 0x10d, 0x30a9, - 0x10d, 0x30e3, 0x10d, 0x30e5, 0x10d, 0x30e7, 0x10d, 0x30c3, - 0x10d, 0x30fc, 0x10d, 0x30a2, 0x10d, 0x30a4, 0x10d, 0x30a6, - 0x10d, 0x30a8, 0x10d, 0x30aa, 0x10d, 0x30ab, 0x10d, 0x30ad, - 0x10d, 0x30af, 0x10d, 0x30b1, 0x10d, 0x30b3, 0x10d, 0x30b5, - 0x10d, 0x30b7, 0x10d, 0x30b9, 0x10d, 0x30bb, 0x10d, 0x30bd, - 0x10d, 0x30bf, 0x10d, 0x30c1, 0x10d, 0x30c4, 0x10d, 0x30c6, - 0x10d, 0x30c8, 0x10d, 0x30ca, 0x10d, 0x30cb, 0x10d, 0x30cc, - 0x10d, 0x30cd, 0x10d, 0x30ce, 0x10d, 0x30cf, 0x10d, 0x30d2, - 0x10d, 0x30d5, 0x10d, 0x30d8, 0x10d, 0x30db, 0x10d, 0x30de, - 0x10d, 0x30df, 0x10d, 0x30e0, 0x10d, 0x30e1, 0x10d, 0x30e2, - 0x10d, 0x30e4, 0x10d, 0x30e6, 0x10d, 0x30e8, 0x10d, 0x30e9, - 0x10d, 0x30ea, 0x10d, 0x30eb, 0x10d, 0x30ec, 0x10d, 0x30ed, - 0x10d, 0x30ef, 0x10d, 0x30f3, 0x10d, 0x3099, 0x10d, 0x309a, - 0x10d, 0x3164, 0x10d, 0x3131, 0x10d, 0x3132, 0x10d, 0x3133, - 0x10d, 0x3134, 0x10d, 0x3135, 0x10d, 0x3136, 0x10d, 0x3137, - 0x10d, 0x3138, 0x10d, 0x3139, 0x10d, 0x313a, 0x10d, 0x313b, - 0x10d, 0x313c, 0x10d, 0x313d, 0x10d, 0x313e, 0x10d, 0x313f, - 0x10d, 0x3140, 0x10d, 0x3141, 0x10d, 0x3142, 0x10d, 0x3143, - 0x10d, 0x3144, 0x10d, 0x3145, 0x10d, 0x3146, 0x10d, 0x3147, - 0x10d, 0x3148, 0x10d, 0x3149, 0x10d, 0x314a, 0x10d, 0x314b, - 0x10d, 0x314c, 0x10d, 0x314d, 0x10d, 0x314e, 0x10d, 0x314f, - 0x10d, 0x3150, 0x10d, 0x3151, 0x10d, 0x3152, 0x10d, 0x3153, - 0x10d, 0x3154, 0x10d, 0x3155, 0x10d, 0x3156, 0x10d, 0x3157, - 0x10d, 0x3158, 0x10d, 0x3159, 0x10d, 0x315a, 0x10d, 0x315b, - 0x10d, 0x315c, 0x10d, 0x315d, 0x10d, 0x315e, 0x10d, 0x315f, - 0x10d, 0x3160, 0x10d, 0x3161, 0x10d, 0x3162, 0x10d, 0x3163, - 0x10c, 0xa2, 0x10c, 0xa3, 0x10c, 0xac, 0x10c, 0xaf, - 0x10c, 0xa6, 0x10c, 0xa5, 0x10c, 0x20a9, 0x10d, 0x2502, - 0x10d, 0x2190, 0x10d, 0x2191, 0x10d, 0x2192, 0x10d, 0x2193, - 0x10d, 0x25a0, 0x10d, 0x25cb, 0x401, 0xd834, 0xdd57, 0xd834, - 0xdd65, 0x401, 0xd834, 0xdd58, 0xd834, 0xdd65, 0x401, 0xd834, - 0xdd5f, 0xd834, 0xdd6e, 0x401, 0xd834, 0xdd5f, 0xd834, 0xdd6f, - 0x401, 0xd834, 0xdd5f, 0xd834, 0xdd70, 0x401, 0xd834, 0xdd5f, - 0xd834, 0xdd71, 0x401, 0xd834, 0xdd5f, 0xd834, 0xdd72, 0x401, - 0xd834, 0xddb9, 0xd834, 0xdd65, 0x401, 0xd834, 0xddba, 0xd834, - 0xdd65, 0x401, 0xd834, 0xddbb, 0xd834, 0xdd6e, 0x401, 0xd834, - 0xddbc, 0xd834, 0xdd6e, 0x401, 0xd834, 0xddbb, 0xd834, 0xdd6f, - 0x401, 0xd834, 0xddbc, 0xd834, 0xdd6f, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, 0x6c, 0x102, - 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, 0x70, 0x102, - 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, 0x74, 0x102, - 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, 0x78, 0x102, - 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, 0x42, 0x102, - 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, 0x46, 0x102, - 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, 0x4a, 0x102, - 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, 0x4e, 0x102, - 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, 0x52, 0x102, - 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, 0x56, 0x102, - 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, 0x5a, 0x102, - 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, 0x64, 0x102, - 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, 0x68, 0x102, - 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, 0x6c, 0x102, - 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, 0x70, 0x102, - 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, 0x74, 0x102, - 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, 0x78, 0x102, - 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, 0x43, 0x102, - 0x44, 0x102, 0x47, 0x102, 0x4a, 0x102, 0x4b, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, 0x56, 0x102, - 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, 0x5a, 0x102, - 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, 0x64, 0x102, - 0x66, 0x102, 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, - 0x6b, 0x102, 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x44, 0x102, 0x45, 0x102, 0x46, 0x102, - 0x47, 0x102, 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, - 0x4d, 0x102, 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, - 0x51, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, 0x64, 0x102, - 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, 0x68, 0x102, - 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, 0x6c, 0x102, - 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, 0x70, 0x102, - 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, 0x74, 0x102, - 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, 0x78, 0x102, - 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, 0x42, 0x102, - 0x44, 0x102, 0x45, 0x102, 0x46, 0x102, 0x47, 0x102, - 0x49, 0x102, 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, - 0x4d, 0x102, 0x4f, 0x102, 0x53, 0x102, 0x54, 0x102, - 0x55, 0x102, 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, - 0x59, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, - 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, - 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, - 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, - 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, - 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, - 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, - 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, - 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, - 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, - 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, - 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, - 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, - 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x131, 0x102, - 0x237, 0x102, 0x391, 0x102, 0x392, 0x102, 0x393, 0x102, - 0x394, 0x102, 0x395, 0x102, 0x396, 0x102, 0x397, 0x102, - 0x398, 0x102, 0x399, 0x102, 0x39a, 0x102, 0x39b, 0x102, - 0x39c, 0x102, 0x39d, 0x102, 0x39e, 0x102, 0x39f, 0x102, - 0x3a0, 0x102, 0x3a1, 0x102, 0x3f4, 0x102, 0x3a3, 0x102, - 0x3a4, 0x102, 0x3a5, 0x102, 0x3a6, 0x102, 0x3a7, 0x102, - 0x3a8, 0x102, 0x3a9, 0x102, 0x2207, 0x102, 0x3b1, 0x102, - 0x3b2, 0x102, 0x3b3, 0x102, 0x3b4, 0x102, 0x3b5, 0x102, - 0x3b6, 0x102, 0x3b7, 0x102, 0x3b8, 0x102, 0x3b9, 0x102, - 0x3ba, 0x102, 0x3bb, 0x102, 0x3bc, 0x102, 0x3bd, 0x102, - 0x3be, 0x102, 0x3bf, 0x102, 0x3c0, 0x102, 0x3c1, 0x102, - 0x3c2, 0x102, 0x3c3, 0x102, 0x3c4, 0x102, 0x3c5, 0x102, - 0x3c6, 0x102, 0x3c7, 0x102, 0x3c8, 0x102, 0x3c9, 0x102, - 0x2202, 0x102, 0x3f5, 0x102, 0x3d1, 0x102, 0x3f0, 0x102, - 0x3d5, 0x102, 0x3f1, 0x102, 0x3d6, 0x102, 0x391, 0x102, - 0x392, 0x102, 0x393, 0x102, 0x394, 0x102, 0x395, 0x102, - 0x396, 0x102, 0x397, 0x102, 0x398, 0x102, 0x399, 0x102, - 0x39a, 0x102, 0x39b, 0x102, 0x39c, 0x102, 0x39d, 0x102, - 0x39e, 0x102, 0x39f, 0x102, 0x3a0, 0x102, 0x3a1, 0x102, - 0x3f4, 0x102, 0x3a3, 0x102, 0x3a4, 0x102, 0x3a5, 0x102, - 0x3a6, 0x102, 0x3a7, 0x102, 0x3a8, 0x102, 0x3a9, 0x102, - 0x2207, 0x102, 0x3b1, 0x102, 0x3b2, 0x102, 0x3b3, 0x102, - 0x3b4, 0x102, 0x3b5, 0x102, 0x3b6, 0x102, 0x3b7, 0x102, - 0x3b8, 0x102, 0x3b9, 0x102, 0x3ba, 0x102, 0x3bb, 0x102, - 0x3bc, 0x102, 0x3bd, 0x102, 0x3be, 0x102, 0x3bf, 0x102, - 0x3c0, 0x102, 0x3c1, 0x102, 0x3c2, 0x102, 0x3c3, 0x102, - 0x3c4, 0x102, 0x3c5, 0x102, 0x3c6, 0x102, 0x3c7, 0x102, - 0x3c8, 0x102, 0x3c9, 0x102, 0x2202, 0x102, 0x3f5, 0x102, - 0x3d1, 0x102, 0x3f0, 0x102, 0x3d5, 0x102, 0x3f1, 0x102, - 0x3d6, 0x102, 0x391, 0x102, 0x392, 0x102, 0x393, 0x102, - 0x394, 0x102, 0x395, 0x102, 0x396, 0x102, 0x397, 0x102, - 0x398, 0x102, 0x399, 0x102, 0x39a, 0x102, 0x39b, 0x102, - 0x39c, 0x102, 0x39d, 0x102, 0x39e, 0x102, 0x39f, 0x102, - 0x3a0, 0x102, 0x3a1, 0x102, 0x3f4, 0x102, 0x3a3, 0x102, - 0x3a4, 0x102, 0x3a5, 0x102, 0x3a6, 0x102, 0x3a7, 0x102, - 0x3a8, 0x102, 0x3a9, 0x102, 0x2207, 0x102, 0x3b1, 0x102, - 0x3b2, 0x102, 0x3b3, 0x102, 0x3b4, 0x102, 0x3b5, 0x102, - 0x3b6, 0x102, 0x3b7, 0x102, 0x3b8, 0x102, 0x3b9, 0x102, - 0x3ba, 0x102, 0x3bb, 0x102, 0x3bc, 0x102, 0x3bd, 0x102, - 0x3be, 0x102, 0x3bf, 0x102, 0x3c0, 0x102, 0x3c1, 0x102, - 0x3c2, 0x102, 0x3c3, 0x102, 0x3c4, 0x102, 0x3c5, 0x102, - 0x3c6, 0x102, 0x3c7, 0x102, 0x3c8, 0x102, 0x3c9, 0x102, - 0x2202, 0x102, 0x3f5, 0x102, 0x3d1, 0x102, 0x3f0, 0x102, - 0x3d5, 0x102, 0x3f1, 0x102, 0x3d6, 0x102, 0x391, 0x102, - 0x392, 0x102, 0x393, 0x102, 0x394, 0x102, 0x395, 0x102, - 0x396, 0x102, 0x397, 0x102, 0x398, 0x102, 0x399, 0x102, - 0x39a, 0x102, 0x39b, 0x102, 0x39c, 0x102, 0x39d, 0x102, - 0x39e, 0x102, 0x39f, 0x102, 0x3a0, 0x102, 0x3a1, 0x102, - 0x3f4, 0x102, 0x3a3, 0x102, 0x3a4, 0x102, 0x3a5, 0x102, - 0x3a6, 0x102, 0x3a7, 0x102, 0x3a8, 0x102, 0x3a9, 0x102, - 0x2207, 0x102, 0x3b1, 0x102, 0x3b2, 0x102, 0x3b3, 0x102, - 0x3b4, 0x102, 0x3b5, 0x102, 0x3b6, 0x102, 0x3b7, 0x102, - 0x3b8, 0x102, 0x3b9, 0x102, 0x3ba, 0x102, 0x3bb, 0x102, - 0x3bc, 0x102, 0x3bd, 0x102, 0x3be, 0x102, 0x3bf, 0x102, - 0x3c0, 0x102, 0x3c1, 0x102, 0x3c2, 0x102, 0x3c3, 0x102, - 0x3c4, 0x102, 0x3c5, 0x102, 0x3c6, 0x102, 0x3c7, 0x102, - 0x3c8, 0x102, 0x3c9, 0x102, 0x2202, 0x102, 0x3f5, 0x102, - 0x3d1, 0x102, 0x3f0, 0x102, 0x3d5, 0x102, 0x3f1, 0x102, - 0x3d6, 0x102, 0x391, 0x102, 0x392, 0x102, 0x393, 0x102, - 0x394, 0x102, 0x395, 0x102, 0x396, 0x102, 0x397, 0x102, - 0x398, 0x102, 0x399, 0x102, 0x39a, 0x102, 0x39b, 0x102, - 0x39c, 0x102, 0x39d, 0x102, 0x39e, 0x102, 0x39f, 0x102, - 0x3a0, 0x102, 0x3a1, 0x102, 0x3f4, 0x102, 0x3a3, 0x102, - 0x3a4, 0x102, 0x3a5, 0x102, 0x3a6, 0x102, 0x3a7, 0x102, - 0x3a8, 0x102, 0x3a9, 0x102, 0x2207, 0x102, 0x3b1, 0x102, - 0x3b2, 0x102, 0x3b3, 0x102, 0x3b4, 0x102, 0x3b5, 0x102, - 0x3b6, 0x102, 0x3b7, 0x102, 0x3b8, 0x102, 0x3b9, 0x102, - 0x3ba, 0x102, 0x3bb, 0x102, 0x3bc, 0x102, 0x3bd, 0x102, - 0x3be, 0x102, 0x3bf, 0x102, 0x3c0, 0x102, 0x3c1, 0x102, - 0x3c2, 0x102, 0x3c3, 0x102, 0x3c4, 0x102, 0x3c5, 0x102, - 0x3c6, 0x102, 0x3c7, 0x102, 0x3c8, 0x102, 0x3c9, 0x102, - 0x2202, 0x102, 0x3f5, 0x102, 0x3d1, 0x102, 0x3f0, 0x102, - 0x3d5, 0x102, 0x3f1, 0x102, 0x3d6, 0x102, 0x3dc, 0x102, - 0x3dd, 0x102, 0x30, 0x102, 0x31, 0x102, 0x32, 0x102, - 0x33, 0x102, 0x34, 0x102, 0x35, 0x102, 0x36, 0x102, - 0x37, 0x102, 0x38, 0x102, 0x39, 0x102, 0x30, 0x102, - 0x31, 0x102, 0x32, 0x102, 0x33, 0x102, 0x34, 0x102, - 0x35, 0x102, 0x36, 0x102, 0x37, 0x102, 0x38, 0x102, - 0x39, 0x102, 0x30, 0x102, 0x31, 0x102, 0x32, 0x102, - 0x33, 0x102, 0x34, 0x102, 0x35, 0x102, 0x36, 0x102, - 0x37, 0x102, 0x38, 0x102, 0x39, 0x102, 0x30, 0x102, - 0x31, 0x102, 0x32, 0x102, 0x33, 0x102, 0x34, 0x102, - 0x35, 0x102, 0x36, 0x102, 0x37, 0x102, 0x38, 0x102, - 0x39, 0x102, 0x30, 0x102, 0x31, 0x102, 0x32, 0x102, - 0x33, 0x102, 0x34, 0x102, 0x35, 0x102, 0x36, 0x102, - 0x37, 0x102, 0x38, 0x102, 0x39, 0x101, 0x4e3d, 0x101, - 0x4e38, 0x101, 0x4e41, 0x201, 0xd840, 0xdd22, 0x101, 0x4f60, - 0x101, 0x4fae, 0x101, 0x4fbb, 0x101, 0x5002, 0x101, 0x507a, - 0x101, 0x5099, 0x101, 0x50e7, 0x101, 0x50cf, 0x101, 0x349e, - 0x201, 0xd841, 0xde3a, 0x101, 0x514d, 0x101, 0x5154, 0x101, - 0x5164, 0x101, 0x5177, 0x201, 0xd841, 0xdd1c, 0x101, 0x34b9, - 0x101, 0x5167, 0x101, 0x518d, 0x201, 0xd841, 0xdd4b, 0x101, - 0x5197, 0x101, 0x51a4, 0x101, 0x4ecc, 0x101, 0x51ac, 0x101, - 0x51b5, 0x201, 0xd864, 0xdddf, 0x101, 0x51f5, 0x101, 0x5203, - 0x101, 0x34df, 0x101, 0x523b, 0x101, 0x5246, 0x101, 0x5272, - 0x101, 0x5277, 0x101, 0x3515, 0x101, 0x52c7, 0x101, 0x52c9, - 0x101, 0x52e4, 0x101, 0x52fa, 0x101, 0x5305, 0x101, 0x5306, - 0x101, 0x5317, 0x101, 0x5349, 0x101, 0x5351, 0x101, 0x535a, - 0x101, 0x5373, 0x101, 0x537d, 0x101, 0x537f, 0x101, 0x537f, - 0x101, 0x537f, 0x201, 0xd842, 0xde2c, 0x101, 0x7070, 0x101, - 0x53ca, 0x101, 0x53df, 0x201, 0xd842, 0xdf63, 0x101, 0x53eb, - 0x101, 0x53f1, 0x101, 0x5406, 0x101, 0x549e, 0x101, 0x5438, - 0x101, 0x5448, 0x101, 0x5468, 0x101, 0x54a2, 0x101, 0x54f6, - 0x101, 0x5510, 0x101, 0x5553, 0x101, 0x5563, 0x101, 0x5584, - 0x101, 0x5584, 0x101, 0x5599, 0x101, 0x55ab, 0x101, 0x55b3, - 0x101, 0x55c2, 0x101, 0x5716, 0x101, 0x5606, 0x101, 0x5717, - 0x101, 0x5651, 0x101, 0x5674, 0x101, 0x5207, 0x101, 0x58ee, - 0x101, 0x57ce, 0x101, 0x57f4, 0x101, 0x580d, 0x101, 0x578b, - 0x101, 0x5832, 0x101, 0x5831, 0x101, 0x58ac, 0x201, 0xd845, - 0xdce4, 0x101, 0x58f2, 0x101, 0x58f7, 0x101, 0x5906, 0x101, - 0x591a, 0x101, 0x5922, 0x101, 0x5962, 0x201, 0xd845, 0xdea8, - 0x201, 0xd845, 0xdeea, 0x101, 0x59ec, 0x101, 0x5a1b, 0x101, - 0x5a27, 0x101, 0x59d8, 0x101, 0x5a66, 0x101, 0x36ee, 0x101, - 0x36fc, 0x101, 0x5b08, 0x101, 0x5b3e, 0x101, 0x5b3e, 0x201, - 0xd846, 0xddc8, 0x101, 0x5bc3, 0x101, 0x5bd8, 0x101, 0x5be7, - 0x101, 0x5bf3, 0x201, 0xd846, 0xdf18, 0x101, 0x5bff, 0x101, - 0x5c06, 0x101, 0x5f53, 0x101, 0x5c22, 0x101, 0x3781, 0x101, - 0x5c60, 0x101, 0x5c6e, 0x101, 0x5cc0, 0x101, 0x5c8d, 0x201, - 0xd847, 0xdde4, 0x101, 0x5d43, 0x201, 0xd847, 0xdde6, 0x101, - 0x5d6e, 0x101, 0x5d6b, 0x101, 0x5d7c, 0x101, 0x5de1, 0x101, - 0x5de2, 0x101, 0x382f, 0x101, 0x5dfd, 0x101, 0x5e28, 0x101, - 0x5e3d, 0x101, 0x5e69, 0x101, 0x3862, 0x201, 0xd848, 0xdd83, - 0x101, 0x387c, 0x101, 0x5eb0, 0x101, 0x5eb3, 0x101, 0x5eb6, - 0x101, 0x5eca, 0x201, 0xd868, 0xdf92, 0x101, 0x5efe, 0x201, - 0xd848, 0xdf31, 0x201, 0xd848, 0xdf31, 0x101, 0x8201, 0x101, - 0x5f22, 0x101, 0x5f22, 0x101, 0x38c7, 0x201, 0xd84c, 0xdeb8, - 0x201, 0xd858, 0xddda, 0x101, 0x5f62, 0x101, 0x5f6b, 0x101, - 0x38e3, 0x101, 0x5f9a, 0x101, 0x5fcd, 0x101, 0x5fd7, 0x101, - 0x5ff9, 0x101, 0x6081, 0x101, 0x393a, 0x101, 0x391c, 0x101, - 0x6094, 0x201, 0xd849, 0xded4, 0x101, 0x60c7, 0x101, 0x6148, - 0x101, 0x614c, 0x101, 0x614e, 0x101, 0x614c, 0x101, 0x617a, - 0x101, 0x618e, 0x101, 0x61b2, 0x101, 0x61a4, 0x101, 0x61af, - 0x101, 0x61de, 0x101, 0x61f2, 0x101, 0x61f6, 0x101, 0x6210, - 0x101, 0x621b, 0x101, 0x625d, 0x101, 0x62b1, 0x101, 0x62d4, - 0x101, 0x6350, 0x201, 0xd84a, 0xdf0c, 0x101, 0x633d, 0x101, - 0x62fc, 0x101, 0x6368, 0x101, 0x6383, 0x101, 0x63e4, 0x201, - 0xd84a, 0xdff1, 0x101, 0x6422, 0x101, 0x63c5, 0x101, 0x63a9, - 0x101, 0x3a2e, 0x101, 0x6469, 0x101, 0x647e, 0x101, 0x649d, - 0x101, 0x6477, 0x101, 0x3a6c, 0x101, 0x654f, 0x101, 0x656c, - 0x201, 0xd84c, 0xdc0a, 0x101, 0x65e3, 0x101, 0x66f8, 0x101, - 0x6649, 0x101, 0x3b19, 0x101, 0x6691, 0x101, 0x3b08, 0x101, - 0x3ae4, 0x101, 0x5192, 0x101, 0x5195, 0x101, 0x6700, 0x101, - 0x669c, 0x101, 0x80ad, 0x101, 0x43d9, 0x101, 0x6717, 0x101, - 0x671b, 0x101, 0x6721, 0x101, 0x675e, 0x101, 0x6753, 0x201, - 0xd84c, 0xdfc3, 0x101, 0x3b49, 0x101, 0x67fa, 0x101, 0x6785, - 0x101, 0x6852, 0x101, 0x6885, 0x201, 0xd84d, 0xdc6d, 0x101, - 0x688e, 0x101, 0x681f, 0x101, 0x6914, 0x101, 0x3b9d, 0x101, - 0x6942, 0x101, 0x69a3, 0x101, 0x69ea, 0x101, 0x6aa8, 0x201, - 0xd84d, 0xdea3, 0x101, 0x6adb, 0x101, 0x3c18, 0x101, 0x6b21, - 0x201, 0xd84e, 0xdca7, 0x101, 0x6b54, 0x101, 0x3c4e, 0x101, - 0x6b72, 0x101, 0x6b9f, 0x101, 0x6bba, 0x101, 0x6bbb, 0x201, - 0xd84e, 0xde8d, 0x201, 0xd847, 0xdd0b, 0x201, 0xd84e, 0xdefa, - 0x101, 0x6c4e, 0x201, 0xd84f, 0xdcbc, 0x101, 0x6cbf, 0x101, - 0x6ccd, 0x101, 0x6c67, 0x101, 0x6d16, 0x101, 0x6d3e, 0x101, - 0x6d77, 0x101, 0x6d41, 0x101, 0x6d69, 0x101, 0x6d78, 0x101, - 0x6d85, 0x201, 0xd84f, 0xdd1e, 0x101, 0x6d34, 0x101, 0x6e2f, - 0x101, 0x6e6e, 0x101, 0x3d33, 0x101, 0x6ecb, 0x101, 0x6ec7, - 0x201, 0xd84f, 0xded1, 0x101, 0x6df9, 0x101, 0x6f6e, 0x201, - 0xd84f, 0xdf5e, 0x201, 0xd84f, 0xdf8e, 0x101, 0x6fc6, 0x101, - 0x7039, 0x101, 0x701e, 0x101, 0x701b, 0x101, 0x3d96, 0x101, - 0x704a, 0x101, 0x707d, 0x101, 0x7077, 0x101, 0x70ad, 0x201, - 0xd841, 0xdd25, 0x101, 0x7145, 0x201, 0xd850, 0xde63, 0x101, - 0x719c, 0x201, 0xd850, 0xdfab, 0x101, 0x7228, 0x101, 0x7235, - 0x101, 0x7250, 0x201, 0xd851, 0xde08, 0x101, 0x7280, 0x101, - 0x7295, 0x201, 0xd851, 0xdf35, 0x201, 0xd852, 0xdc14, 0x101, - 0x737a, 0x101, 0x738b, 0x101, 0x3eac, 0x101, 0x73a5, 0x101, - 0x3eb8, 0x101, 0x3eb8, 0x101, 0x7447, 0x101, 0x745c, 0x101, - 0x7471, 0x101, 0x7485, 0x101, 0x74ca, 0x101, 0x3f1b, 0x101, - 0x7524, 0x201, 0xd853, 0xdc36, 0x101, 0x753e, 0x201, 0xd853, - 0xdc92, 0x101, 0x7570, 0x201, 0xd848, 0xdd9f, 0x101, 0x7610, - 0x201, 0xd853, 0xdfa1, 0x201, 0xd853, 0xdfb8, 0x201, 0xd854, - 0xdc44, 0x101, 0x3ffc, 0x101, 0x4008, 0x101, 0x76f4, 0x201, - 0xd854, 0xdcf3, 0x201, 0xd854, 0xdcf2, 0x201, 0xd854, 0xdd19, - 0x201, 0xd854, 0xdd33, 0x101, 0x771e, 0x101, 0x771f, 0x101, - 0x771f, 0x101, 0x774a, 0x101, 0x4039, 0x101, 0x778b, 0x101, - 0x4046, 0x101, 0x4096, 0x201, 0xd855, 0xdc1d, 0x101, 0x784e, - 0x101, 0x788c, 0x101, 0x78cc, 0x101, 0x40e3, 0x201, 0xd855, - 0xde26, 0x101, 0x7956, 0x201, 0xd855, 0xde9a, 0x201, 0xd855, - 0xdec5, 0x101, 0x798f, 0x101, 0x79eb, 0x101, 0x412f, 0x101, - 0x7a40, 0x101, 0x7a4a, 0x101, 0x7a4f, 0x201, 0xd856, 0xdd7c, - 0x201, 0xd856, 0xdea7, 0x201, 0xd856, 0xdea7, 0x101, 0x7aee, - 0x101, 0x4202, 0x201, 0xd856, 0xdfab, 0x101, 0x7bc6, 0x101, - 0x7bc9, 0x101, 0x4227, 0x201, 0xd857, 0xdc80, 0x101, 0x7cd2, - 0x101, 0x42a0, 0x101, 0x7ce8, 0x101, 0x7ce3, 0x101, 0x7d00, - 0x201, 0xd857, 0xdf86, 0x101, 0x7d63, 0x101, 0x4301, 0x101, - 0x7dc7, 0x101, 0x7e02, 0x101, 0x7e45, 0x101, 0x4334, 0x201, - 0xd858, 0xde28, 0x201, 0xd858, 0xde47, 0x101, 0x4359, 0x201, - 0xd858, 0xded9, 0x101, 0x7f7a, 0x201, 0xd858, 0xdf3e, 0x101, - 0x7f95, 0x101, 0x7ffa, 0x101, 0x8005, 0x201, 0xd859, 0xdcda, - 0x201, 0xd859, 0xdd23, 0x101, 0x8060, 0x201, 0xd859, 0xdda8, - 0x101, 0x8070, 0x201, 0xd84c, 0xdf5f, 0x101, 0x43d5, 0x101, - 0x80b2, 0x101, 0x8103, 0x101, 0x440b, 0x101, 0x813e, 0x101, - 0x5ab5, 0x201, 0xd859, 0xdfa7, 0x201, 0xd859, 0xdfb5, 0x201, - 0xd84c, 0xdf93, 0x201, 0xd84c, 0xdf9c, 0x101, 0x8201, 0x101, - 0x8204, 0x101, 0x8f9e, 0x101, 0x446b, 0x101, 0x8291, 0x101, - 0x828b, 0x101, 0x829d, 0x101, 0x52b3, 0x101, 0x82b1, 0x101, - 0x82b3, 0x101, 0x82bd, 0x101, 0x82e6, 0x201, 0xd85a, 0xdf3c, - 0x101, 0x82e5, 0x101, 0x831d, 0x101, 0x8363, 0x101, 0x83ad, - 0x101, 0x8323, 0x101, 0x83bd, 0x101, 0x83e7, 0x101, 0x8457, - 0x101, 0x8353, 0x101, 0x83ca, 0x101, 0x83cc, 0x101, 0x83dc, - 0x201, 0xd85b, 0xdc36, 0x201, 0xd85b, 0xdd6b, 0x201, 0xd85b, - 0xdcd5, 0x101, 0x452b, 0x101, 0x84f1, 0x101, 0x84f3, 0x101, - 0x8516, 0x201, 0xd85c, 0xdfca, 0x101, 0x8564, 0x201, 0xd85b, - 0xdf2c, 0x101, 0x455d, 0x101, 0x4561, 0x201, 0xd85b, 0xdfb1, - 0x201, 0xd85c, 0xdcd2, 0x101, 0x456b, 0x101, 0x8650, 0x101, - 0x865c, 0x101, 0x8667, 0x101, 0x8669, 0x101, 0x86a9, 0x101, - 0x8688, 0x101, 0x870e, 0x101, 0x86e2, 0x101, 0x8779, 0x101, - 0x8728, 0x101, 0x876b, 0x101, 0x8786, 0x101, 0x45d7, 0x101, - 0x87e1, 0x101, 0x8801, 0x101, 0x45f9, 0x101, 0x8860, 0x101, - 0x8863, 0x201, 0xd85d, 0xde67, 0x101, 0x88d7, 0x101, 0x88de, - 0x101, 0x4635, 0x101, 0x88fa, 0x101, 0x34bb, 0x201, 0xd85e, - 0xdcae, 0x201, 0xd85e, 0xdd66, 0x101, 0x46be, 0x101, 0x46c7, - 0x101, 0x8aa0, 0x101, 0x8aed, 0x101, 0x8b8a, 0x101, 0x8c55, - 0x201, 0xd85f, 0xdca8, 0x101, 0x8cab, 0x101, 0x8cc1, 0x101, - 0x8d1b, 0x101, 0x8d77, 0x201, 0xd85f, 0xdf2f, 0x201, 0xd842, - 0xdc04, 0x101, 0x8dcb, 0x101, 0x8dbc, 0x101, 0x8df0, 0x201, - 0xd842, 0xdcde, 0x101, 0x8ed4, 0x101, 0x8f38, 0x201, 0xd861, - 0xddd2, 0x201, 0xd861, 0xdded, 0x101, 0x9094, 0x101, 0x90f1, - 0x101, 0x9111, 0x201, 0xd861, 0xdf2e, 0x101, 0x911b, 0x101, - 0x9238, 0x101, 0x92d7, 0x101, 0x92d8, 0x101, 0x927c, 0x101, - 0x93f9, 0x101, 0x9415, 0x201, 0xd862, 0xdffa, 0x101, 0x958b, - 0x101, 0x4995, 0x101, 0x95b7, 0x201, 0xd863, 0xdd77, 0x101, - 0x49e6, 0x101, 0x96c3, 0x101, 0x5db2, 0x101, 0x9723, 0x201, - 0xd864, 0xdd45, 0x201, 0xd864, 0xde1a, 0x101, 0x4a6e, 0x101, - 0x4a76, 0x101, 0x97e0, 0x201, 0xd865, 0xdc0a, 0x101, 0x4ab2, - 0x201, 0xd865, 0xdc96, 0x101, 0x980b, 0x101, 0x980b, 0x101, - 0x9829, 0x201, 0xd865, 0xddb6, 0x101, 0x98e2, 0x101, 0x4b33, - 0x101, 0x9929, 0x101, 0x99a7, 0x101, 0x99c2, 0x101, 0x99fe, - 0x101, 0x4bce, 0x201, 0xd866, 0xdf30, 0x101, 0x9b12, 0x101, - 0x9c40, 0x101, 0x9cfd, 0x101, 0x4cce, 0x101, 0x4ced, 0x101, - 0x9d67, 0x201, 0xd868, 0xdcce, 0x101, 0x4cf8, 0x201, 0xd868, - 0xdd05, 0x201, 0xd868, 0xde0e, 0x201, 0xd868, 0xde91, 0x101, - 0x9ebb, 0x101, 0x4d56, 0x101, 0x9ef9, 0x101, 0x9efe, 0x101, - 0x9f05, 0x101, 0x9f0f, 0x101, 0x9f16, 0x101, 0x9f3b, 0x201, - 0xd869, 0xde00, + 0x103, 0x20, 0x210, 0x20, 0x308, 0x109, 0x61, 0x210, + 0x20, 0x304, 0x109, 0x32, 0x109, 0x33, 0x210, 0x20, + 0x301, 0x110, 0x3bc, 0x210, 0x20, 0x327, 0x109, 0x31, + 0x109, 0x6f, 0x311, 0x31, 0x2044, 0x34, 0x311, 0x31, + 0x2044, 0x32, 0x311, 0x33, 0x2044, 0x34, 0x201, 0x41, + 0x300, 0x201, 0x41, 0x301, 0x201, 0x41, 0x302, 0x201, + 0x41, 0x303, 0x201, 0x41, 0x308, 0x201, 0x41, 0x30a, + 0x201, 0x43, 0x327, 0x201, 0x45, 0x300, 0x201, 0x45, + 0x301, 0x201, 0x45, 0x302, 0x201, 0x45, 0x308, 0x201, + 0x49, 0x300, 0x201, 0x49, 0x301, 0x201, 0x49, 0x302, + 0x201, 0x49, 0x308, 0x201, 0x4e, 0x303, 0x201, 0x4f, + 0x300, 0x201, 0x4f, 0x301, 0x201, 0x4f, 0x302, 0x201, + 0x4f, 0x303, 0x201, 0x4f, 0x308, 0x201, 0x55, 0x300, + 0x201, 0x55, 0x301, 0x201, 0x55, 0x302, 0x201, 0x55, + 0x308, 0x201, 0x59, 0x301, 0x201, 0x61, 0x300, 0x201, + 0x61, 0x301, 0x201, 0x61, 0x302, 0x201, 0x61, 0x303, + 0x201, 0x61, 0x308, 0x201, 0x61, 0x30a, 0x201, 0x63, + 0x327, 0x201, 0x65, 0x300, 0x201, 0x65, 0x301, 0x201, + 0x65, 0x302, 0x201, 0x65, 0x308, 0x201, 0x69, 0x300, + 0x201, 0x69, 0x301, 0x201, 0x69, 0x302, 0x201, 0x69, + 0x308, 0x201, 0x6e, 0x303, 0x201, 0x6f, 0x300, 0x201, + 0x6f, 0x301, 0x201, 0x6f, 0x302, 0x201, 0x6f, 0x303, + 0x201, 0x6f, 0x308, 0x201, 0x75, 0x300, 0x201, 0x75, + 0x301, 0x201, 0x75, 0x302, 0x201, 0x75, 0x308, 0x201, + 0x79, 0x301, 0x201, 0x79, 0x308, 0x201, 0x41, 0x304, + 0x201, 0x61, 0x304, 0x201, 0x41, 0x306, 0x201, 0x61, + 0x306, 0x201, 0x41, 0x328, 0x201, 0x61, 0x328, 0x201, + 0x43, 0x301, 0x201, 0x63, 0x301, 0x201, 0x43, 0x302, + 0x201, 0x63, 0x302, 0x201, 0x43, 0x307, 0x201, 0x63, + 0x307, 0x201, 0x43, 0x30c, 0x201, 0x63, 0x30c, 0x201, + 0x44, 0x30c, 0x201, 0x64, 0x30c, 0x201, 0x45, 0x304, + 0x201, 0x65, 0x304, 0x201, 0x45, 0x306, 0x201, 0x65, + 0x306, 0x201, 0x45, 0x307, 0x201, 0x65, 0x307, 0x201, + 0x45, 0x328, 0x201, 0x65, 0x328, 0x201, 0x45, 0x30c, + 0x201, 0x65, 0x30c, 0x201, 0x47, 0x302, 0x201, 0x67, + 0x302, 0x201, 0x47, 0x306, 0x201, 0x67, 0x306, 0x201, + 0x47, 0x307, 0x201, 0x67, 0x307, 0x201, 0x47, 0x327, + 0x201, 0x67, 0x327, 0x201, 0x48, 0x302, 0x201, 0x68, + 0x302, 0x201, 0x49, 0x303, 0x201, 0x69, 0x303, 0x201, + 0x49, 0x304, 0x201, 0x69, 0x304, 0x201, 0x49, 0x306, + 0x201, 0x69, 0x306, 0x201, 0x49, 0x328, 0x201, 0x69, + 0x328, 0x201, 0x49, 0x307, 0x210, 0x49, 0x4a, 0x210, + 0x69, 0x6a, 0x201, 0x4a, 0x302, 0x201, 0x6a, 0x302, + 0x201, 0x4b, 0x327, 0x201, 0x6b, 0x327, 0x201, 0x4c, + 0x301, 0x201, 0x6c, 0x301, 0x201, 0x4c, 0x327, 0x201, + 0x6c, 0x327, 0x201, 0x4c, 0x30c, 0x201, 0x6c, 0x30c, + 0x210, 0x4c, 0xb7, 0x210, 0x6c, 0xb7, 0x201, 0x4e, + 0x301, 0x201, 0x6e, 0x301, 0x201, 0x4e, 0x327, 0x201, + 0x6e, 0x327, 0x201, 0x4e, 0x30c, 0x201, 0x6e, 0x30c, + 0x210, 0x2bc, 0x6e, 0x201, 0x4f, 0x304, 0x201, 0x6f, + 0x304, 0x201, 0x4f, 0x306, 0x201, 0x6f, 0x306, 0x201, + 0x4f, 0x30b, 0x201, 0x6f, 0x30b, 0x201, 0x52, 0x301, + 0x201, 0x72, 0x301, 0x201, 0x52, 0x327, 0x201, 0x72, + 0x327, 0x201, 0x52, 0x30c, 0x201, 0x72, 0x30c, 0x201, + 0x53, 0x301, 0x201, 0x73, 0x301, 0x201, 0x53, 0x302, + 0x201, 0x73, 0x302, 0x201, 0x53, 0x327, 0x201, 0x73, + 0x327, 0x201, 0x53, 0x30c, 0x201, 0x73, 0x30c, 0x201, + 0x54, 0x327, 0x201, 0x74, 0x327, 0x201, 0x54, 0x30c, + 0x201, 0x74, 0x30c, 0x201, 0x55, 0x303, 0x201, 0x75, + 0x303, 0x201, 0x55, 0x304, 0x201, 0x75, 0x304, 0x201, + 0x55, 0x306, 0x201, 0x75, 0x306, 0x201, 0x55, 0x30a, + 0x201, 0x75, 0x30a, 0x201, 0x55, 0x30b, 0x201, 0x75, + 0x30b, 0x201, 0x55, 0x328, 0x201, 0x75, 0x328, 0x201, + 0x57, 0x302, 0x201, 0x77, 0x302, 0x201, 0x59, 0x302, + 0x201, 0x79, 0x302, 0x201, 0x59, 0x308, 0x201, 0x5a, + 0x301, 0x201, 0x7a, 0x301, 0x201, 0x5a, 0x307, 0x201, + 0x7a, 0x307, 0x201, 0x5a, 0x30c, 0x201, 0x7a, 0x30c, + 0x110, 0x73, 0x201, 0x4f, 0x31b, 0x201, 0x6f, 0x31b, + 0x201, 0x55, 0x31b, 0x201, 0x75, 0x31b, 0x210, 0x44, + 0x17d, 0x210, 0x44, 0x17e, 0x210, 0x64, 0x17e, 0x210, + 0x4c, 0x4a, 0x210, 0x4c, 0x6a, 0x210, 0x6c, 0x6a, + 0x210, 0x4e, 0x4a, 0x210, 0x4e, 0x6a, 0x210, 0x6e, + 0x6a, 0x201, 0x41, 0x30c, 0x201, 0x61, 0x30c, 0x201, + 0x49, 0x30c, 0x201, 0x69, 0x30c, 0x201, 0x4f, 0x30c, + 0x201, 0x6f, 0x30c, 0x201, 0x55, 0x30c, 0x201, 0x75, + 0x30c, 0x201, 0xdc, 0x304, 0x201, 0xfc, 0x304, 0x201, + 0xdc, 0x301, 0x201, 0xfc, 0x301, 0x201, 0xdc, 0x30c, + 0x201, 0xfc, 0x30c, 0x201, 0xdc, 0x300, 0x201, 0xfc, + 0x300, 0x201, 0xc4, 0x304, 0x201, 0xe4, 0x304, 0x201, + 0x226, 0x304, 0x201, 0x227, 0x304, 0x201, 0xc6, 0x304, + 0x201, 0xe6, 0x304, 0x201, 0x47, 0x30c, 0x201, 0x67, + 0x30c, 0x201, 0x4b, 0x30c, 0x201, 0x6b, 0x30c, 0x201, + 0x4f, 0x328, 0x201, 0x6f, 0x328, 0x201, 0x1ea, 0x304, + 0x201, 0x1eb, 0x304, 0x201, 0x1b7, 0x30c, 0x201, 0x292, + 0x30c, 0x201, 0x6a, 0x30c, 0x210, 0x44, 0x5a, 0x210, + 0x44, 0x7a, 0x210, 0x64, 0x7a, 0x201, 0x47, 0x301, + 0x201, 0x67, 0x301, 0x201, 0x4e, 0x300, 0x201, 0x6e, + 0x300, 0x201, 0xc5, 0x301, 0x201, 0xe5, 0x301, 0x201, + 0xc6, 0x301, 0x201, 0xe6, 0x301, 0x201, 0xd8, 0x301, + 0x201, 0xf8, 0x301, 0x201, 0x41, 0x30f, 0x201, 0x61, + 0x30f, 0x201, 0x41, 0x311, 0x201, 0x61, 0x311, 0x201, + 0x45, 0x30f, 0x201, 0x65, 0x30f, 0x201, 0x45, 0x311, + 0x201, 0x65, 0x311, 0x201, 0x49, 0x30f, 0x201, 0x69, + 0x30f, 0x201, 0x49, 0x311, 0x201, 0x69, 0x311, 0x201, + 0x4f, 0x30f, 0x201, 0x6f, 0x30f, 0x201, 0x4f, 0x311, + 0x201, 0x6f, 0x311, 0x201, 0x52, 0x30f, 0x201, 0x72, + 0x30f, 0x201, 0x52, 0x311, 0x201, 0x72, 0x311, 0x201, + 0x55, 0x30f, 0x201, 0x75, 0x30f, 0x201, 0x55, 0x311, + 0x201, 0x75, 0x311, 0x201, 0x53, 0x326, 0x201, 0x73, + 0x326, 0x201, 0x54, 0x326, 0x201, 0x74, 0x326, 0x201, + 0x48, 0x30c, 0x201, 0x68, 0x30c, 0x201, 0x41, 0x307, + 0x201, 0x61, 0x307, 0x201, 0x45, 0x327, 0x201, 0x65, + 0x327, 0x201, 0xd6, 0x304, 0x201, 0xf6, 0x304, 0x201, + 0xd5, 0x304, 0x201, 0xf5, 0x304, 0x201, 0x4f, 0x307, + 0x201, 0x6f, 0x307, 0x201, 0x22e, 0x304, 0x201, 0x22f, + 0x304, 0x201, 0x59, 0x304, 0x201, 0x79, 0x304, 0x109, + 0x68, 0x109, 0x266, 0x109, 0x6a, 0x109, 0x72, 0x109, + 0x279, 0x109, 0x27b, 0x109, 0x281, 0x109, 0x77, 0x109, + 0x79, 0x210, 0x20, 0x306, 0x210, 0x20, 0x307, 0x210, + 0x20, 0x30a, 0x210, 0x20, 0x328, 0x210, 0x20, 0x303, + 0x210, 0x20, 0x30b, 0x109, 0x263, 0x109, 0x6c, 0x109, + 0x73, 0x109, 0x78, 0x109, 0x295, 0x101, 0x300, 0x101, + 0x301, 0x101, 0x313, 0x201, 0x308, 0x301, 0x101, 0x2b9, + 0x210, 0x20, 0x345, 0x101, 0x3b, 0x210, 0x20, 0x301, + 0x201, 0xa8, 0x301, 0x201, 0x391, 0x301, 0x101, 0xb7, + 0x201, 0x395, 0x301, 0x201, 0x397, 0x301, 0x201, 0x399, + 0x301, 0x201, 0x39f, 0x301, 0x201, 0x3a5, 0x301, 0x201, + 0x3a9, 0x301, 0x201, 0x3ca, 0x301, 0x201, 0x399, 0x308, + 0x201, 0x3a5, 0x308, 0x201, 0x3b1, 0x301, 0x201, 0x3b5, + 0x301, 0x201, 0x3b7, 0x301, 0x201, 0x3b9, 0x301, 0x201, + 0x3cb, 0x301, 0x201, 0x3b9, 0x308, 0x201, 0x3c5, 0x308, + 0x201, 0x3bf, 0x301, 0x201, 0x3c5, 0x301, 0x201, 0x3c9, + 0x301, 0x110, 0x3b2, 0x110, 0x3b8, 0x110, 0x3a5, 0x201, + 0x3d2, 0x301, 0x201, 0x3d2, 0x308, 0x110, 0x3c6, 0x110, + 0x3c0, 0x110, 0x3ba, 0x110, 0x3c1, 0x110, 0x3c2, 0x110, + 0x398, 0x110, 0x3b5, 0x110, 0x3a3, 0x201, 0x415, 0x300, + 0x201, 0x415, 0x308, 0x201, 0x413, 0x301, 0x201, 0x406, + 0x308, 0x201, 0x41a, 0x301, 0x201, 0x418, 0x300, 0x201, + 0x423, 0x306, 0x201, 0x418, 0x306, 0x201, 0x438, 0x306, + 0x201, 0x435, 0x300, 0x201, 0x435, 0x308, 0x201, 0x433, + 0x301, 0x201, 0x456, 0x308, 0x201, 0x43a, 0x301, 0x201, + 0x438, 0x300, 0x201, 0x443, 0x306, 0x201, 0x474, 0x30f, + 0x201, 0x475, 0x30f, 0x201, 0x416, 0x306, 0x201, 0x436, + 0x306, 0x201, 0x410, 0x306, 0x201, 0x430, 0x306, 0x201, + 0x410, 0x308, 0x201, 0x430, 0x308, 0x201, 0x415, 0x306, + 0x201, 0x435, 0x306, 0x201, 0x4d8, 0x308, 0x201, 0x4d9, + 0x308, 0x201, 0x416, 0x308, 0x201, 0x436, 0x308, 0x201, + 0x417, 0x308, 0x201, 0x437, 0x308, 0x201, 0x418, 0x304, + 0x201, 0x438, 0x304, 0x201, 0x418, 0x308, 0x201, 0x438, + 0x308, 0x201, 0x41e, 0x308, 0x201, 0x43e, 0x308, 0x201, + 0x4e8, 0x308, 0x201, 0x4e9, 0x308, 0x201, 0x42d, 0x308, + 0x201, 0x44d, 0x308, 0x201, 0x423, 0x304, 0x201, 0x443, + 0x304, 0x201, 0x423, 0x308, 0x201, 0x443, 0x308, 0x201, + 0x423, 0x30b, 0x201, 0x443, 0x30b, 0x201, 0x427, 0x308, + 0x201, 0x447, 0x308, 0x201, 0x42b, 0x308, 0x201, 0x44b, + 0x308, 0x210, 0x565, 0x582, 0x201, 0x627, 0x653, 0x201, + 0x627, 0x654, 0x201, 0x648, 0x654, 0x201, 0x627, 0x655, + 0x201, 0x64a, 0x654, 0x210, 0x627, 0x674, 0x210, 0x648, + 0x674, 0x210, 0x6c7, 0x674, 0x210, 0x64a, 0x674, 0x201, + 0x6d5, 0x654, 0x201, 0x6c1, 0x654, 0x201, 0x6d2, 0x654, + 0x201, 0x928, 0x93c, 0x201, 0x930, 0x93c, 0x201, 0x933, + 0x93c, 0x201, 0x915, 0x93c, 0x201, 0x916, 0x93c, 0x201, + 0x917, 0x93c, 0x201, 0x91c, 0x93c, 0x201, 0x921, 0x93c, + 0x201, 0x922, 0x93c, 0x201, 0x92b, 0x93c, 0x201, 0x92f, + 0x93c, 0x201, 0x9c7, 0x9be, 0x201, 0x9c7, 0x9d7, 0x201, + 0x9a1, 0x9bc, 0x201, 0x9a2, 0x9bc, 0x201, 0x9af, 0x9bc, + 0x201, 0xa32, 0xa3c, 0x201, 0xa38, 0xa3c, 0x201, 0xa16, + 0xa3c, 0x201, 0xa17, 0xa3c, 0x201, 0xa1c, 0xa3c, 0x201, + 0xa2b, 0xa3c, 0x201, 0xb47, 0xb56, 0x201, 0xb47, 0xb3e, + 0x201, 0xb47, 0xb57, 0x201, 0xb21, 0xb3c, 0x201, 0xb22, + 0xb3c, 0x201, 0xb92, 0xbd7, 0x201, 0xbc6, 0xbbe, 0x201, + 0xbc7, 0xbbe, 0x201, 0xbc6, 0xbd7, 0x201, 0xc46, 0xc56, + 0x201, 0xcbf, 0xcd5, 0x201, 0xcc6, 0xcd5, 0x201, 0xcc6, + 0xcd6, 0x201, 0xcc6, 0xcc2, 0x201, 0xcca, 0xcd5, 0x201, + 0xd46, 0xd3e, 0x201, 0xd47, 0xd3e, 0x201, 0xd46, 0xd57, + 0x201, 0xdd9, 0xdca, 0x201, 0xdd9, 0xdcf, 0x201, 0xddc, + 0xdca, 0x201, 0xdd9, 0xddf, 0x210, 0xe4d, 0xe32, 0x210, + 0xecd, 0xeb2, 0x210, 0xeab, 0xe99, 0x210, 0xeab, 0xea1, + 0x103, 0xf0b, 0x201, 0xf42, 0xfb7, 0x201, 0xf4c, 0xfb7, + 0x201, 0xf51, 0xfb7, 0x201, 0xf56, 0xfb7, 0x201, 0xf5b, + 0xfb7, 0x201, 0xf40, 0xfb5, 0x201, 0xf71, 0xf72, 0x201, + 0xf71, 0xf74, 0x201, 0xfb2, 0xf80, 0x210, 0xfb2, 0xf81, + 0x201, 0xfb3, 0xf80, 0x210, 0xfb3, 0xf81, 0x201, 0xf71, + 0xf80, 0x201, 0xf92, 0xfb7, 0x201, 0xf9c, 0xfb7, 0x201, + 0xfa1, 0xfb7, 0x201, 0xfa6, 0xfb7, 0x201, 0xfab, 0xfb7, + 0x201, 0xf90, 0xfb5, 0x201, 0x1025, 0x102e, 0x109, 0x10dc, + 0x201, 0x1b05, 0x1b35, 0x201, 0x1b07, 0x1b35, 0x201, 0x1b09, + 0x1b35, 0x201, 0x1b0b, 0x1b35, 0x201, 0x1b0d, 0x1b35, 0x201, + 0x1b11, 0x1b35, 0x201, 0x1b3a, 0x1b35, 0x201, 0x1b3c, 0x1b35, + 0x201, 0x1b3e, 0x1b35, 0x201, 0x1b3f, 0x1b35, 0x201, 0x1b42, + 0x1b35, 0x109, 0x41, 0x109, 0xc6, 0x109, 0x42, 0x109, + 0x44, 0x109, 0x45, 0x109, 0x18e, 0x109, 0x47, 0x109, + 0x48, 0x109, 0x49, 0x109, 0x4a, 0x109, 0x4b, 0x109, + 0x4c, 0x109, 0x4d, 0x109, 0x4e, 0x109, 0x4f, 0x109, + 0x222, 0x109, 0x50, 0x109, 0x52, 0x109, 0x54, 0x109, + 0x55, 0x109, 0x57, 0x109, 0x61, 0x109, 0x250, 0x109, + 0x251, 0x109, 0x1d02, 0x109, 0x62, 0x109, 0x64, 0x109, + 0x65, 0x109, 0x259, 0x109, 0x25b, 0x109, 0x25c, 0x109, + 0x67, 0x109, 0x6b, 0x109, 0x6d, 0x109, 0x14b, 0x109, + 0x6f, 0x109, 0x254, 0x109, 0x1d16, 0x109, 0x1d17, 0x109, + 0x70, 0x109, 0x74, 0x109, 0x75, 0x109, 0x1d1d, 0x109, + 0x26f, 0x109, 0x76, 0x109, 0x1d25, 0x109, 0x3b2, 0x109, + 0x3b3, 0x109, 0x3b4, 0x109, 0x3c6, 0x109, 0x3c7, 0x10a, + 0x69, 0x10a, 0x72, 0x10a, 0x75, 0x10a, 0x76, 0x10a, + 0x3b2, 0x10a, 0x3b3, 0x10a, 0x3c1, 0x10a, 0x3c6, 0x10a, + 0x3c7, 0x109, 0x43d, 0x109, 0x252, 0x109, 0x63, 0x109, + 0x255, 0x109, 0xf0, 0x109, 0x25c, 0x109, 0x66, 0x109, + 0x25f, 0x109, 0x261, 0x109, 0x265, 0x109, 0x268, 0x109, + 0x269, 0x109, 0x26a, 0x109, 0x1d7b, 0x109, 0x29d, 0x109, + 0x26d, 0x109, 0x1d85, 0x109, 0x29f, 0x109, 0x271, 0x109, + 0x270, 0x109, 0x272, 0x109, 0x273, 0x109, 0x274, 0x109, + 0x275, 0x109, 0x278, 0x109, 0x282, 0x109, 0x283, 0x109, + 0x1ab, 0x109, 0x289, 0x109, 0x28a, 0x109, 0x1d1c, 0x109, + 0x28b, 0x109, 0x28c, 0x109, 0x7a, 0x109, 0x290, 0x109, + 0x291, 0x109, 0x292, 0x109, 0x3b8, 0x201, 0x41, 0x325, + 0x201, 0x61, 0x325, 0x201, 0x42, 0x307, 0x201, 0x62, + 0x307, 0x201, 0x42, 0x323, 0x201, 0x62, 0x323, 0x201, + 0x42, 0x331, 0x201, 0x62, 0x331, 0x201, 0xc7, 0x301, + 0x201, 0xe7, 0x301, 0x201, 0x44, 0x307, 0x201, 0x64, + 0x307, 0x201, 0x44, 0x323, 0x201, 0x64, 0x323, 0x201, + 0x44, 0x331, 0x201, 0x64, 0x331, 0x201, 0x44, 0x327, + 0x201, 0x64, 0x327, 0x201, 0x44, 0x32d, 0x201, 0x64, + 0x32d, 0x201, 0x112, 0x300, 0x201, 0x113, 0x300, 0x201, + 0x112, 0x301, 0x201, 0x113, 0x301, 0x201, 0x45, 0x32d, + 0x201, 0x65, 0x32d, 0x201, 0x45, 0x330, 0x201, 0x65, + 0x330, 0x201, 0x228, 0x306, 0x201, 0x229, 0x306, 0x201, + 0x46, 0x307, 0x201, 0x66, 0x307, 0x201, 0x47, 0x304, + 0x201, 0x67, 0x304, 0x201, 0x48, 0x307, 0x201, 0x68, + 0x307, 0x201, 0x48, 0x323, 0x201, 0x68, 0x323, 0x201, + 0x48, 0x308, 0x201, 0x68, 0x308, 0x201, 0x48, 0x327, + 0x201, 0x68, 0x327, 0x201, 0x48, 0x32e, 0x201, 0x68, + 0x32e, 0x201, 0x49, 0x330, 0x201, 0x69, 0x330, 0x201, + 0xcf, 0x301, 0x201, 0xef, 0x301, 0x201, 0x4b, 0x301, + 0x201, 0x6b, 0x301, 0x201, 0x4b, 0x323, 0x201, 0x6b, + 0x323, 0x201, 0x4b, 0x331, 0x201, 0x6b, 0x331, 0x201, + 0x4c, 0x323, 0x201, 0x6c, 0x323, 0x201, 0x1e36, 0x304, + 0x201, 0x1e37, 0x304, 0x201, 0x4c, 0x331, 0x201, 0x6c, + 0x331, 0x201, 0x4c, 0x32d, 0x201, 0x6c, 0x32d, 0x201, + 0x4d, 0x301, 0x201, 0x6d, 0x301, 0x201, 0x4d, 0x307, + 0x201, 0x6d, 0x307, 0x201, 0x4d, 0x323, 0x201, 0x6d, + 0x323, 0x201, 0x4e, 0x307, 0x201, 0x6e, 0x307, 0x201, + 0x4e, 0x323, 0x201, 0x6e, 0x323, 0x201, 0x4e, 0x331, + 0x201, 0x6e, 0x331, 0x201, 0x4e, 0x32d, 0x201, 0x6e, + 0x32d, 0x201, 0xd5, 0x301, 0x201, 0xf5, 0x301, 0x201, + 0xd5, 0x308, 0x201, 0xf5, 0x308, 0x201, 0x14c, 0x300, + 0x201, 0x14d, 0x300, 0x201, 0x14c, 0x301, 0x201, 0x14d, + 0x301, 0x201, 0x50, 0x301, 0x201, 0x70, 0x301, 0x201, + 0x50, 0x307, 0x201, 0x70, 0x307, 0x201, 0x52, 0x307, + 0x201, 0x72, 0x307, 0x201, 0x52, 0x323, 0x201, 0x72, + 0x323, 0x201, 0x1e5a, 0x304, 0x201, 0x1e5b, 0x304, 0x201, + 0x52, 0x331, 0x201, 0x72, 0x331, 0x201, 0x53, 0x307, + 0x201, 0x73, 0x307, 0x201, 0x53, 0x323, 0x201, 0x73, + 0x323, 0x201, 0x15a, 0x307, 0x201, 0x15b, 0x307, 0x201, + 0x160, 0x307, 0x201, 0x161, 0x307, 0x201, 0x1e62, 0x307, + 0x201, 0x1e63, 0x307, 0x201, 0x54, 0x307, 0x201, 0x74, + 0x307, 0x201, 0x54, 0x323, 0x201, 0x74, 0x323, 0x201, + 0x54, 0x331, 0x201, 0x74, 0x331, 0x201, 0x54, 0x32d, + 0x201, 0x74, 0x32d, 0x201, 0x55, 0x324, 0x201, 0x75, + 0x324, 0x201, 0x55, 0x330, 0x201, 0x75, 0x330, 0x201, + 0x55, 0x32d, 0x201, 0x75, 0x32d, 0x201, 0x168, 0x301, + 0x201, 0x169, 0x301, 0x201, 0x16a, 0x308, 0x201, 0x16b, + 0x308, 0x201, 0x56, 0x303, 0x201, 0x76, 0x303, 0x201, + 0x56, 0x323, 0x201, 0x76, 0x323, 0x201, 0x57, 0x300, + 0x201, 0x77, 0x300, 0x201, 0x57, 0x301, 0x201, 0x77, + 0x301, 0x201, 0x57, 0x308, 0x201, 0x77, 0x308, 0x201, + 0x57, 0x307, 0x201, 0x77, 0x307, 0x201, 0x57, 0x323, + 0x201, 0x77, 0x323, 0x201, 0x58, 0x307, 0x201, 0x78, + 0x307, 0x201, 0x58, 0x308, 0x201, 0x78, 0x308, 0x201, + 0x59, 0x307, 0x201, 0x79, 0x307, 0x201, 0x5a, 0x302, + 0x201, 0x7a, 0x302, 0x201, 0x5a, 0x323, 0x201, 0x7a, + 0x323, 0x201, 0x5a, 0x331, 0x201, 0x7a, 0x331, 0x201, + 0x68, 0x331, 0x201, 0x74, 0x308, 0x201, 0x77, 0x30a, + 0x201, 0x79, 0x30a, 0x210, 0x61, 0x2be, 0x201, 0x17f, + 0x307, 0x201, 0x41, 0x323, 0x201, 0x61, 0x323, 0x201, + 0x41, 0x309, 0x201, 0x61, 0x309, 0x201, 0xc2, 0x301, + 0x201, 0xe2, 0x301, 0x201, 0xc2, 0x300, 0x201, 0xe2, + 0x300, 0x201, 0xc2, 0x309, 0x201, 0xe2, 0x309, 0x201, + 0xc2, 0x303, 0x201, 0xe2, 0x303, 0x201, 0x1ea0, 0x302, + 0x201, 0x1ea1, 0x302, 0x201, 0x102, 0x301, 0x201, 0x103, + 0x301, 0x201, 0x102, 0x300, 0x201, 0x103, 0x300, 0x201, + 0x102, 0x309, 0x201, 0x103, 0x309, 0x201, 0x102, 0x303, + 0x201, 0x103, 0x303, 0x201, 0x1ea0, 0x306, 0x201, 0x1ea1, + 0x306, 0x201, 0x45, 0x323, 0x201, 0x65, 0x323, 0x201, + 0x45, 0x309, 0x201, 0x65, 0x309, 0x201, 0x45, 0x303, + 0x201, 0x65, 0x303, 0x201, 0xca, 0x301, 0x201, 0xea, + 0x301, 0x201, 0xca, 0x300, 0x201, 0xea, 0x300, 0x201, + 0xca, 0x309, 0x201, 0xea, 0x309, 0x201, 0xca, 0x303, + 0x201, 0xea, 0x303, 0x201, 0x1eb8, 0x302, 0x201, 0x1eb9, + 0x302, 0x201, 0x49, 0x309, 0x201, 0x69, 0x309, 0x201, + 0x49, 0x323, 0x201, 0x69, 0x323, 0x201, 0x4f, 0x323, + 0x201, 0x6f, 0x323, 0x201, 0x4f, 0x309, 0x201, 0x6f, + 0x309, 0x201, 0xd4, 0x301, 0x201, 0xf4, 0x301, 0x201, + 0xd4, 0x300, 0x201, 0xf4, 0x300, 0x201, 0xd4, 0x309, + 0x201, 0xf4, 0x309, 0x201, 0xd4, 0x303, 0x201, 0xf4, + 0x303, 0x201, 0x1ecc, 0x302, 0x201, 0x1ecd, 0x302, 0x201, + 0x1a0, 0x301, 0x201, 0x1a1, 0x301, 0x201, 0x1a0, 0x300, + 0x201, 0x1a1, 0x300, 0x201, 0x1a0, 0x309, 0x201, 0x1a1, + 0x309, 0x201, 0x1a0, 0x303, 0x201, 0x1a1, 0x303, 0x201, + 0x1a0, 0x323, 0x201, 0x1a1, 0x323, 0x201, 0x55, 0x323, + 0x201, 0x75, 0x323, 0x201, 0x55, 0x309, 0x201, 0x75, + 0x309, 0x201, 0x1af, 0x301, 0x201, 0x1b0, 0x301, 0x201, + 0x1af, 0x300, 0x201, 0x1b0, 0x300, 0x201, 0x1af, 0x309, + 0x201, 0x1b0, 0x309, 0x201, 0x1af, 0x303, 0x201, 0x1b0, + 0x303, 0x201, 0x1af, 0x323, 0x201, 0x1b0, 0x323, 0x201, + 0x59, 0x300, 0x201, 0x79, 0x300, 0x201, 0x59, 0x323, + 0x201, 0x79, 0x323, 0x201, 0x59, 0x309, 0x201, 0x79, + 0x309, 0x201, 0x59, 0x303, 0x201, 0x79, 0x303, 0x201, + 0x3b1, 0x313, 0x201, 0x3b1, 0x314, 0x201, 0x1f00, 0x300, + 0x201, 0x1f01, 0x300, 0x201, 0x1f00, 0x301, 0x201, 0x1f01, + 0x301, 0x201, 0x1f00, 0x342, 0x201, 0x1f01, 0x342, 0x201, + 0x391, 0x313, 0x201, 0x391, 0x314, 0x201, 0x1f08, 0x300, + 0x201, 0x1f09, 0x300, 0x201, 0x1f08, 0x301, 0x201, 0x1f09, + 0x301, 0x201, 0x1f08, 0x342, 0x201, 0x1f09, 0x342, 0x201, + 0x3b5, 0x313, 0x201, 0x3b5, 0x314, 0x201, 0x1f10, 0x300, + 0x201, 0x1f11, 0x300, 0x201, 0x1f10, 0x301, 0x201, 0x1f11, + 0x301, 0x201, 0x395, 0x313, 0x201, 0x395, 0x314, 0x201, + 0x1f18, 0x300, 0x201, 0x1f19, 0x300, 0x201, 0x1f18, 0x301, + 0x201, 0x1f19, 0x301, 0x201, 0x3b7, 0x313, 0x201, 0x3b7, + 0x314, 0x201, 0x1f20, 0x300, 0x201, 0x1f21, 0x300, 0x201, + 0x1f20, 0x301, 0x201, 0x1f21, 0x301, 0x201, 0x1f20, 0x342, + 0x201, 0x1f21, 0x342, 0x201, 0x397, 0x313, 0x201, 0x397, + 0x314, 0x201, 0x1f28, 0x300, 0x201, 0x1f29, 0x300, 0x201, + 0x1f28, 0x301, 0x201, 0x1f29, 0x301, 0x201, 0x1f28, 0x342, + 0x201, 0x1f29, 0x342, 0x201, 0x3b9, 0x313, 0x201, 0x3b9, + 0x314, 0x201, 0x1f30, 0x300, 0x201, 0x1f31, 0x300, 0x201, + 0x1f30, 0x301, 0x201, 0x1f31, 0x301, 0x201, 0x1f30, 0x342, + 0x201, 0x1f31, 0x342, 0x201, 0x399, 0x313, 0x201, 0x399, + 0x314, 0x201, 0x1f38, 0x300, 0x201, 0x1f39, 0x300, 0x201, + 0x1f38, 0x301, 0x201, 0x1f39, 0x301, 0x201, 0x1f38, 0x342, + 0x201, 0x1f39, 0x342, 0x201, 0x3bf, 0x313, 0x201, 0x3bf, + 0x314, 0x201, 0x1f40, 0x300, 0x201, 0x1f41, 0x300, 0x201, + 0x1f40, 0x301, 0x201, 0x1f41, 0x301, 0x201, 0x39f, 0x313, + 0x201, 0x39f, 0x314, 0x201, 0x1f48, 0x300, 0x201, 0x1f49, + 0x300, 0x201, 0x1f48, 0x301, 0x201, 0x1f49, 0x301, 0x201, + 0x3c5, 0x313, 0x201, 0x3c5, 0x314, 0x201, 0x1f50, 0x300, + 0x201, 0x1f51, 0x300, 0x201, 0x1f50, 0x301, 0x201, 0x1f51, + 0x301, 0x201, 0x1f50, 0x342, 0x201, 0x1f51, 0x342, 0x201, + 0x3a5, 0x314, 0x201, 0x1f59, 0x300, 0x201, 0x1f59, 0x301, + 0x201, 0x1f59, 0x342, 0x201, 0x3c9, 0x313, 0x201, 0x3c9, + 0x314, 0x201, 0x1f60, 0x300, 0x201, 0x1f61, 0x300, 0x201, + 0x1f60, 0x301, 0x201, 0x1f61, 0x301, 0x201, 0x1f60, 0x342, + 0x201, 0x1f61, 0x342, 0x201, 0x3a9, 0x313, 0x201, 0x3a9, + 0x314, 0x201, 0x1f68, 0x300, 0x201, 0x1f69, 0x300, 0x201, + 0x1f68, 0x301, 0x201, 0x1f69, 0x301, 0x201, 0x1f68, 0x342, + 0x201, 0x1f69, 0x342, 0x201, 0x3b1, 0x300, 0x101, 0x3ac, + 0x201, 0x3b5, 0x300, 0x101, 0x3ad, 0x201, 0x3b7, 0x300, + 0x101, 0x3ae, 0x201, 0x3b9, 0x300, 0x101, 0x3af, 0x201, + 0x3bf, 0x300, 0x101, 0x3cc, 0x201, 0x3c5, 0x300, 0x101, + 0x3cd, 0x201, 0x3c9, 0x300, 0x101, 0x3ce, 0x201, 0x1f00, + 0x345, 0x201, 0x1f01, 0x345, 0x201, 0x1f02, 0x345, 0x201, + 0x1f03, 0x345, 0x201, 0x1f04, 0x345, 0x201, 0x1f05, 0x345, + 0x201, 0x1f06, 0x345, 0x201, 0x1f07, 0x345, 0x201, 0x1f08, + 0x345, 0x201, 0x1f09, 0x345, 0x201, 0x1f0a, 0x345, 0x201, + 0x1f0b, 0x345, 0x201, 0x1f0c, 0x345, 0x201, 0x1f0d, 0x345, + 0x201, 0x1f0e, 0x345, 0x201, 0x1f0f, 0x345, 0x201, 0x1f20, + 0x345, 0x201, 0x1f21, 0x345, 0x201, 0x1f22, 0x345, 0x201, + 0x1f23, 0x345, 0x201, 0x1f24, 0x345, 0x201, 0x1f25, 0x345, + 0x201, 0x1f26, 0x345, 0x201, 0x1f27, 0x345, 0x201, 0x1f28, + 0x345, 0x201, 0x1f29, 0x345, 0x201, 0x1f2a, 0x345, 0x201, + 0x1f2b, 0x345, 0x201, 0x1f2c, 0x345, 0x201, 0x1f2d, 0x345, + 0x201, 0x1f2e, 0x345, 0x201, 0x1f2f, 0x345, 0x201, 0x1f60, + 0x345, 0x201, 0x1f61, 0x345, 0x201, 0x1f62, 0x345, 0x201, + 0x1f63, 0x345, 0x201, 0x1f64, 0x345, 0x201, 0x1f65, 0x345, + 0x201, 0x1f66, 0x345, 0x201, 0x1f67, 0x345, 0x201, 0x1f68, + 0x345, 0x201, 0x1f69, 0x345, 0x201, 0x1f6a, 0x345, 0x201, + 0x1f6b, 0x345, 0x201, 0x1f6c, 0x345, 0x201, 0x1f6d, 0x345, + 0x201, 0x1f6e, 0x345, 0x201, 0x1f6f, 0x345, 0x201, 0x3b1, + 0x306, 0x201, 0x3b1, 0x304, 0x201, 0x1f70, 0x345, 0x201, + 0x3b1, 0x345, 0x201, 0x3ac, 0x345, 0x201, 0x3b1, 0x342, + 0x201, 0x1fb6, 0x345, 0x201, 0x391, 0x306, 0x201, 0x391, + 0x304, 0x201, 0x391, 0x300, 0x101, 0x386, 0x201, 0x391, + 0x345, 0x210, 0x20, 0x313, 0x101, 0x3b9, 0x210, 0x20, + 0x313, 0x210, 0x20, 0x342, 0x201, 0xa8, 0x342, 0x201, + 0x1f74, 0x345, 0x201, 0x3b7, 0x345, 0x201, 0x3ae, 0x345, + 0x201, 0x3b7, 0x342, 0x201, 0x1fc6, 0x345, 0x201, 0x395, + 0x300, 0x101, 0x388, 0x201, 0x397, 0x300, 0x101, 0x389, + 0x201, 0x397, 0x345, 0x201, 0x1fbf, 0x300, 0x201, 0x1fbf, + 0x301, 0x201, 0x1fbf, 0x342, 0x201, 0x3b9, 0x306, 0x201, + 0x3b9, 0x304, 0x201, 0x3ca, 0x300, 0x101, 0x390, 0x201, + 0x3b9, 0x342, 0x201, 0x3ca, 0x342, 0x201, 0x399, 0x306, + 0x201, 0x399, 0x304, 0x201, 0x399, 0x300, 0x101, 0x38a, + 0x201, 0x1ffe, 0x300, 0x201, 0x1ffe, 0x301, 0x201, 0x1ffe, + 0x342, 0x201, 0x3c5, 0x306, 0x201, 0x3c5, 0x304, 0x201, + 0x3cb, 0x300, 0x101, 0x3b0, 0x201, 0x3c1, 0x313, 0x201, + 0x3c1, 0x314, 0x201, 0x3c5, 0x342, 0x201, 0x3cb, 0x342, + 0x201, 0x3a5, 0x306, 0x201, 0x3a5, 0x304, 0x201, 0x3a5, + 0x300, 0x101, 0x38e, 0x201, 0x3a1, 0x314, 0x201, 0xa8, + 0x300, 0x101, 0x385, 0x101, 0x60, 0x201, 0x1f7c, 0x345, + 0x201, 0x3c9, 0x345, 0x201, 0x3ce, 0x345, 0x201, 0x3c9, + 0x342, 0x201, 0x1ff6, 0x345, 0x201, 0x39f, 0x300, 0x101, + 0x38c, 0x201, 0x3a9, 0x300, 0x101, 0x38f, 0x201, 0x3a9, + 0x345, 0x101, 0xb4, 0x210, 0x20, 0x314, 0x101, 0x2002, + 0x101, 0x2003, 0x110, 0x20, 0x110, 0x20, 0x110, 0x20, + 0x110, 0x20, 0x110, 0x20, 0x103, 0x20, 0x110, 0x20, + 0x110, 0x20, 0x110, 0x20, 0x103, 0x2010, 0x210, 0x20, + 0x333, 0x110, 0x2e, 0x210, 0x2e, 0x2e, 0x310, 0x2e, + 0x2e, 0x2e, 0x103, 0x20, 0x210, 0x2032, 0x2032, 0x310, + 0x2032, 0x2032, 0x2032, 0x210, 0x2035, 0x2035, 0x310, 0x2035, + 0x2035, 0x2035, 0x210, 0x21, 0x21, 0x210, 0x20, 0x305, + 0x210, 0x3f, 0x3f, 0x210, 0x3f, 0x21, 0x210, 0x21, + 0x3f, 0x410, 0x2032, 0x2032, 0x2032, 0x2032, 0x110, 0x20, + 0x109, 0x30, 0x109, 0x69, 0x109, 0x34, 0x109, 0x35, + 0x109, 0x36, 0x109, 0x37, 0x109, 0x38, 0x109, 0x39, + 0x109, 0x2b, 0x109, 0x2212, 0x109, 0x3d, 0x109, 0x28, + 0x109, 0x29, 0x109, 0x6e, 0x10a, 0x30, 0x10a, 0x31, + 0x10a, 0x32, 0x10a, 0x33, 0x10a, 0x34, 0x10a, 0x35, + 0x10a, 0x36, 0x10a, 0x37, 0x10a, 0x38, 0x10a, 0x39, + 0x10a, 0x2b, 0x10a, 0x2212, 0x10a, 0x3d, 0x10a, 0x28, + 0x10a, 0x29, 0x10a, 0x61, 0x10a, 0x65, 0x10a, 0x6f, + 0x10a, 0x78, 0x10a, 0x259, 0x210, 0x52, 0x73, 0x310, + 0x61, 0x2f, 0x63, 0x310, 0x61, 0x2f, 0x73, 0x102, + 0x43, 0x210, 0xb0, 0x43, 0x310, 0x63, 0x2f, 0x6f, + 0x310, 0x63, 0x2f, 0x75, 0x110, 0x190, 0x210, 0xb0, + 0x46, 0x102, 0x67, 0x102, 0x48, 0x102, 0x48, 0x102, + 0x48, 0x102, 0x68, 0x102, 0x127, 0x102, 0x49, 0x102, + 0x49, 0x102, 0x4c, 0x102, 0x6c, 0x102, 0x4e, 0x210, + 0x4e, 0x6f, 0x102, 0x50, 0x102, 0x51, 0x102, 0x52, + 0x102, 0x52, 0x102, 0x52, 0x209, 0x53, 0x4d, 0x310, + 0x54, 0x45, 0x4c, 0x209, 0x54, 0x4d, 0x102, 0x5a, + 0x101, 0x3a9, 0x102, 0x5a, 0x101, 0x4b, 0x101, 0xc5, + 0x102, 0x42, 0x102, 0x43, 0x102, 0x65, 0x102, 0x45, + 0x102, 0x46, 0x102, 0x4d, 0x102, 0x6f, 0x110, 0x5d0, + 0x110, 0x5d1, 0x110, 0x5d2, 0x110, 0x5d3, 0x102, 0x69, + 0x310, 0x46, 0x41, 0x58, 0x102, 0x3c0, 0x102, 0x3b3, + 0x102, 0x393, 0x102, 0x3a0, 0x102, 0x2211, 0x102, 0x44, + 0x102, 0x64, 0x102, 0x65, 0x102, 0x69, 0x102, 0x6a, + 0x311, 0x31, 0x2044, 0x33, 0x311, 0x32, 0x2044, 0x33, + 0x311, 0x31, 0x2044, 0x35, 0x311, 0x32, 0x2044, 0x35, + 0x311, 0x33, 0x2044, 0x35, 0x311, 0x34, 0x2044, 0x35, + 0x311, 0x31, 0x2044, 0x36, 0x311, 0x35, 0x2044, 0x36, + 0x311, 0x31, 0x2044, 0x38, 0x311, 0x33, 0x2044, 0x38, + 0x311, 0x35, 0x2044, 0x38, 0x311, 0x37, 0x2044, 0x38, + 0x211, 0x31, 0x2044, 0x110, 0x49, 0x210, 0x49, 0x49, + 0x310, 0x49, 0x49, 0x49, 0x210, 0x49, 0x56, 0x110, + 0x56, 0x210, 0x56, 0x49, 0x310, 0x56, 0x49, 0x49, + 0x410, 0x56, 0x49, 0x49, 0x49, 0x210, 0x49, 0x58, + 0x110, 0x58, 0x210, 0x58, 0x49, 0x310, 0x58, 0x49, + 0x49, 0x110, 0x4c, 0x110, 0x43, 0x110, 0x44, 0x110, + 0x4d, 0x110, 0x69, 0x210, 0x69, 0x69, 0x310, 0x69, + 0x69, 0x69, 0x210, 0x69, 0x76, 0x110, 0x76, 0x210, + 0x76, 0x69, 0x310, 0x76, 0x69, 0x69, 0x410, 0x76, + 0x69, 0x69, 0x69, 0x210, 0x69, 0x78, 0x110, 0x78, + 0x210, 0x78, 0x69, 0x310, 0x78, 0x69, 0x69, 0x110, + 0x6c, 0x110, 0x63, 0x110, 0x64, 0x110, 0x6d, 0x201, + 0x2190, 0x338, 0x201, 0x2192, 0x338, 0x201, 0x2194, 0x338, + 0x201, 0x21d0, 0x338, 0x201, 0x21d4, 0x338, 0x201, 0x21d2, + 0x338, 0x201, 0x2203, 0x338, 0x201, 0x2208, 0x338, 0x201, + 0x220b, 0x338, 0x201, 0x2223, 0x338, 0x201, 0x2225, 0x338, + 0x210, 0x222b, 0x222b, 0x310, 0x222b, 0x222b, 0x222b, 0x210, + 0x222e, 0x222e, 0x310, 0x222e, 0x222e, 0x222e, 0x201, 0x223c, + 0x338, 0x201, 0x2243, 0x338, 0x201, 0x2245, 0x338, 0x201, + 0x2248, 0x338, 0x201, 0x3d, 0x338, 0x201, 0x2261, 0x338, + 0x201, 0x224d, 0x338, 0x201, 0x3c, 0x338, 0x201, 0x3e, + 0x338, 0x201, 0x2264, 0x338, 0x201, 0x2265, 0x338, 0x201, + 0x2272, 0x338, 0x201, 0x2273, 0x338, 0x201, 0x2276, 0x338, + 0x201, 0x2277, 0x338, 0x201, 0x227a, 0x338, 0x201, 0x227b, + 0x338, 0x201, 0x2282, 0x338, 0x201, 0x2283, 0x338, 0x201, + 0x2286, 0x338, 0x201, 0x2287, 0x338, 0x201, 0x22a2, 0x338, + 0x201, 0x22a8, 0x338, 0x201, 0x22a9, 0x338, 0x201, 0x22ab, + 0x338, 0x201, 0x227c, 0x338, 0x201, 0x227d, 0x338, 0x201, + 0x2291, 0x338, 0x201, 0x2292, 0x338, 0x201, 0x22b2, 0x338, + 0x201, 0x22b3, 0x338, 0x201, 0x22b4, 0x338, 0x201, 0x22b5, + 0x338, 0x101, 0x3008, 0x101, 0x3009, 0x108, 0x31, 0x108, + 0x32, 0x108, 0x33, 0x108, 0x34, 0x108, 0x35, 0x108, + 0x36, 0x108, 0x37, 0x108, 0x38, 0x108, 0x39, 0x208, + 0x31, 0x30, 0x208, 0x31, 0x31, 0x208, 0x31, 0x32, + 0x208, 0x31, 0x33, 0x208, 0x31, 0x34, 0x208, 0x31, + 0x35, 0x208, 0x31, 0x36, 0x208, 0x31, 0x37, 0x208, + 0x31, 0x38, 0x208, 0x31, 0x39, 0x208, 0x32, 0x30, + 0x310, 0x28, 0x31, 0x29, 0x310, 0x28, 0x32, 0x29, + 0x310, 0x28, 0x33, 0x29, 0x310, 0x28, 0x34, 0x29, + 0x310, 0x28, 0x35, 0x29, 0x310, 0x28, 0x36, 0x29, + 0x310, 0x28, 0x37, 0x29, 0x310, 0x28, 0x38, 0x29, + 0x310, 0x28, 0x39, 0x29, 0x410, 0x28, 0x31, 0x30, + 0x29, 0x410, 0x28, 0x31, 0x31, 0x29, 0x410, 0x28, + 0x31, 0x32, 0x29, 0x410, 0x28, 0x31, 0x33, 0x29, + 0x410, 0x28, 0x31, 0x34, 0x29, 0x410, 0x28, 0x31, + 0x35, 0x29, 0x410, 0x28, 0x31, 0x36, 0x29, 0x410, + 0x28, 0x31, 0x37, 0x29, 0x410, 0x28, 0x31, 0x38, + 0x29, 0x410, 0x28, 0x31, 0x39, 0x29, 0x410, 0x28, + 0x32, 0x30, 0x29, 0x210, 0x31, 0x2e, 0x210, 0x32, + 0x2e, 0x210, 0x33, 0x2e, 0x210, 0x34, 0x2e, 0x210, + 0x35, 0x2e, 0x210, 0x36, 0x2e, 0x210, 0x37, 0x2e, + 0x210, 0x38, 0x2e, 0x210, 0x39, 0x2e, 0x310, 0x31, + 0x30, 0x2e, 0x310, 0x31, 0x31, 0x2e, 0x310, 0x31, + 0x32, 0x2e, 0x310, 0x31, 0x33, 0x2e, 0x310, 0x31, + 0x34, 0x2e, 0x310, 0x31, 0x35, 0x2e, 0x310, 0x31, + 0x36, 0x2e, 0x310, 0x31, 0x37, 0x2e, 0x310, 0x31, + 0x38, 0x2e, 0x310, 0x31, 0x39, 0x2e, 0x310, 0x32, + 0x30, 0x2e, 0x310, 0x28, 0x61, 0x29, 0x310, 0x28, + 0x62, 0x29, 0x310, 0x28, 0x63, 0x29, 0x310, 0x28, + 0x64, 0x29, 0x310, 0x28, 0x65, 0x29, 0x310, 0x28, + 0x66, 0x29, 0x310, 0x28, 0x67, 0x29, 0x310, 0x28, + 0x68, 0x29, 0x310, 0x28, 0x69, 0x29, 0x310, 0x28, + 0x6a, 0x29, 0x310, 0x28, 0x6b, 0x29, 0x310, 0x28, + 0x6c, 0x29, 0x310, 0x28, 0x6d, 0x29, 0x310, 0x28, + 0x6e, 0x29, 0x310, 0x28, 0x6f, 0x29, 0x310, 0x28, + 0x70, 0x29, 0x310, 0x28, 0x71, 0x29, 0x310, 0x28, + 0x72, 0x29, 0x310, 0x28, 0x73, 0x29, 0x310, 0x28, + 0x74, 0x29, 0x310, 0x28, 0x75, 0x29, 0x310, 0x28, + 0x76, 0x29, 0x310, 0x28, 0x77, 0x29, 0x310, 0x28, + 0x78, 0x29, 0x310, 0x28, 0x79, 0x29, 0x310, 0x28, + 0x7a, 0x29, 0x108, 0x41, 0x108, 0x42, 0x108, 0x43, + 0x108, 0x44, 0x108, 0x45, 0x108, 0x46, 0x108, 0x47, + 0x108, 0x48, 0x108, 0x49, 0x108, 0x4a, 0x108, 0x4b, + 0x108, 0x4c, 0x108, 0x4d, 0x108, 0x4e, 0x108, 0x4f, + 0x108, 0x50, 0x108, 0x51, 0x108, 0x52, 0x108, 0x53, + 0x108, 0x54, 0x108, 0x55, 0x108, 0x56, 0x108, 0x57, + 0x108, 0x58, 0x108, 0x59, 0x108, 0x5a, 0x108, 0x61, + 0x108, 0x62, 0x108, 0x63, 0x108, 0x64, 0x108, 0x65, + 0x108, 0x66, 0x108, 0x67, 0x108, 0x68, 0x108, 0x69, + 0x108, 0x6a, 0x108, 0x6b, 0x108, 0x6c, 0x108, 0x6d, + 0x108, 0x6e, 0x108, 0x6f, 0x108, 0x70, 0x108, 0x71, + 0x108, 0x72, 0x108, 0x73, 0x108, 0x74, 0x108, 0x75, + 0x108, 0x76, 0x108, 0x77, 0x108, 0x78, 0x108, 0x79, + 0x108, 0x7a, 0x108, 0x30, 0x410, 0x222b, 0x222b, 0x222b, + 0x222b, 0x310, 0x3a, 0x3a, 0x3d, 0x210, 0x3d, 0x3d, + 0x310, 0x3d, 0x3d, 0x3d, 0x201, 0x2add, 0x338, 0x109, + 0x2d61, 0x110, 0x6bcd, 0x110, 0x9f9f, 0x110, 0x4e00, 0x110, + 0x4e28, 0x110, 0x4e36, 0x110, 0x4e3f, 0x110, 0x4e59, 0x110, + 0x4e85, 0x110, 0x4e8c, 0x110, 0x4ea0, 0x110, 0x4eba, 0x110, + 0x513f, 0x110, 0x5165, 0x110, 0x516b, 0x110, 0x5182, 0x110, + 0x5196, 0x110, 0x51ab, 0x110, 0x51e0, 0x110, 0x51f5, 0x110, + 0x5200, 0x110, 0x529b, 0x110, 0x52f9, 0x110, 0x5315, 0x110, + 0x531a, 0x110, 0x5338, 0x110, 0x5341, 0x110, 0x535c, 0x110, + 0x5369, 0x110, 0x5382, 0x110, 0x53b6, 0x110, 0x53c8, 0x110, + 0x53e3, 0x110, 0x56d7, 0x110, 0x571f, 0x110, 0x58eb, 0x110, + 0x5902, 0x110, 0x590a, 0x110, 0x5915, 0x110, 0x5927, 0x110, + 0x5973, 0x110, 0x5b50, 0x110, 0x5b80, 0x110, 0x5bf8, 0x110, + 0x5c0f, 0x110, 0x5c22, 0x110, 0x5c38, 0x110, 0x5c6e, 0x110, + 0x5c71, 0x110, 0x5ddb, 0x110, 0x5de5, 0x110, 0x5df1, 0x110, + 0x5dfe, 0x110, 0x5e72, 0x110, 0x5e7a, 0x110, 0x5e7f, 0x110, + 0x5ef4, 0x110, 0x5efe, 0x110, 0x5f0b, 0x110, 0x5f13, 0x110, + 0x5f50, 0x110, 0x5f61, 0x110, 0x5f73, 0x110, 0x5fc3, 0x110, + 0x6208, 0x110, 0x6236, 0x110, 0x624b, 0x110, 0x652f, 0x110, + 0x6534, 0x110, 0x6587, 0x110, 0x6597, 0x110, 0x65a4, 0x110, + 0x65b9, 0x110, 0x65e0, 0x110, 0x65e5, 0x110, 0x66f0, 0x110, + 0x6708, 0x110, 0x6728, 0x110, 0x6b20, 0x110, 0x6b62, 0x110, + 0x6b79, 0x110, 0x6bb3, 0x110, 0x6bcb, 0x110, 0x6bd4, 0x110, + 0x6bdb, 0x110, 0x6c0f, 0x110, 0x6c14, 0x110, 0x6c34, 0x110, + 0x706b, 0x110, 0x722a, 0x110, 0x7236, 0x110, 0x723b, 0x110, + 0x723f, 0x110, 0x7247, 0x110, 0x7259, 0x110, 0x725b, 0x110, + 0x72ac, 0x110, 0x7384, 0x110, 0x7389, 0x110, 0x74dc, 0x110, + 0x74e6, 0x110, 0x7518, 0x110, 0x751f, 0x110, 0x7528, 0x110, + 0x7530, 0x110, 0x758b, 0x110, 0x7592, 0x110, 0x7676, 0x110, + 0x767d, 0x110, 0x76ae, 0x110, 0x76bf, 0x110, 0x76ee, 0x110, + 0x77db, 0x110, 0x77e2, 0x110, 0x77f3, 0x110, 0x793a, 0x110, + 0x79b8, 0x110, 0x79be, 0x110, 0x7a74, 0x110, 0x7acb, 0x110, + 0x7af9, 0x110, 0x7c73, 0x110, 0x7cf8, 0x110, 0x7f36, 0x110, + 0x7f51, 0x110, 0x7f8a, 0x110, 0x7fbd, 0x110, 0x8001, 0x110, + 0x800c, 0x110, 0x8012, 0x110, 0x8033, 0x110, 0x807f, 0x110, + 0x8089, 0x110, 0x81e3, 0x110, 0x81ea, 0x110, 0x81f3, 0x110, + 0x81fc, 0x110, 0x820c, 0x110, 0x821b, 0x110, 0x821f, 0x110, + 0x826e, 0x110, 0x8272, 0x110, 0x8278, 0x110, 0x864d, 0x110, + 0x866b, 0x110, 0x8840, 0x110, 0x884c, 0x110, 0x8863, 0x110, + 0x897e, 0x110, 0x898b, 0x110, 0x89d2, 0x110, 0x8a00, 0x110, + 0x8c37, 0x110, 0x8c46, 0x110, 0x8c55, 0x110, 0x8c78, 0x110, + 0x8c9d, 0x110, 0x8d64, 0x110, 0x8d70, 0x110, 0x8db3, 0x110, + 0x8eab, 0x110, 0x8eca, 0x110, 0x8f9b, 0x110, 0x8fb0, 0x110, + 0x8fb5, 0x110, 0x9091, 0x110, 0x9149, 0x110, 0x91c6, 0x110, + 0x91cc, 0x110, 0x91d1, 0x110, 0x9577, 0x110, 0x9580, 0x110, + 0x961c, 0x110, 0x96b6, 0x110, 0x96b9, 0x110, 0x96e8, 0x110, + 0x9751, 0x110, 0x975e, 0x110, 0x9762, 0x110, 0x9769, 0x110, + 0x97cb, 0x110, 0x97ed, 0x110, 0x97f3, 0x110, 0x9801, 0x110, + 0x98a8, 0x110, 0x98db, 0x110, 0x98df, 0x110, 0x9996, 0x110, + 0x9999, 0x110, 0x99ac, 0x110, 0x9aa8, 0x110, 0x9ad8, 0x110, + 0x9adf, 0x110, 0x9b25, 0x110, 0x9b2f, 0x110, 0x9b32, 0x110, + 0x9b3c, 0x110, 0x9b5a, 0x110, 0x9ce5, 0x110, 0x9e75, 0x110, + 0x9e7f, 0x110, 0x9ea5, 0x110, 0x9ebb, 0x110, 0x9ec3, 0x110, + 0x9ecd, 0x110, 0x9ed1, 0x110, 0x9ef9, 0x110, 0x9efd, 0x110, + 0x9f0e, 0x110, 0x9f13, 0x110, 0x9f20, 0x110, 0x9f3b, 0x110, + 0x9f4a, 0x110, 0x9f52, 0x110, 0x9f8d, 0x110, 0x9f9c, 0x110, + 0x9fa0, 0x10c, 0x20, 0x110, 0x3012, 0x110, 0x5341, 0x110, + 0x5344, 0x110, 0x5345, 0x201, 0x304b, 0x3099, 0x201, 0x304d, + 0x3099, 0x201, 0x304f, 0x3099, 0x201, 0x3051, 0x3099, 0x201, + 0x3053, 0x3099, 0x201, 0x3055, 0x3099, 0x201, 0x3057, 0x3099, + 0x201, 0x3059, 0x3099, 0x201, 0x305b, 0x3099, 0x201, 0x305d, + 0x3099, 0x201, 0x305f, 0x3099, 0x201, 0x3061, 0x3099, 0x201, + 0x3064, 0x3099, 0x201, 0x3066, 0x3099, 0x201, 0x3068, 0x3099, + 0x201, 0x306f, 0x3099, 0x201, 0x306f, 0x309a, 0x201, 0x3072, + 0x3099, 0x201, 0x3072, 0x309a, 0x201, 0x3075, 0x3099, 0x201, + 0x3075, 0x309a, 0x201, 0x3078, 0x3099, 0x201, 0x3078, 0x309a, + 0x201, 0x307b, 0x3099, 0x201, 0x307b, 0x309a, 0x201, 0x3046, + 0x3099, 0x210, 0x20, 0x3099, 0x210, 0x20, 0x309a, 0x201, + 0x309d, 0x3099, 0x20b, 0x3088, 0x308a, 0x201, 0x30ab, 0x3099, + 0x201, 0x30ad, 0x3099, 0x201, 0x30af, 0x3099, 0x201, 0x30b1, + 0x3099, 0x201, 0x30b3, 0x3099, 0x201, 0x30b5, 0x3099, 0x201, + 0x30b7, 0x3099, 0x201, 0x30b9, 0x3099, 0x201, 0x30bb, 0x3099, + 0x201, 0x30bd, 0x3099, 0x201, 0x30bf, 0x3099, 0x201, 0x30c1, + 0x3099, 0x201, 0x30c4, 0x3099, 0x201, 0x30c6, 0x3099, 0x201, + 0x30c8, 0x3099, 0x201, 0x30cf, 0x3099, 0x201, 0x30cf, 0x309a, + 0x201, 0x30d2, 0x3099, 0x201, 0x30d2, 0x309a, 0x201, 0x30d5, + 0x3099, 0x201, 0x30d5, 0x309a, 0x201, 0x30d8, 0x3099, 0x201, + 0x30d8, 0x309a, 0x201, 0x30db, 0x3099, 0x201, 0x30db, 0x309a, + 0x201, 0x30a6, 0x3099, 0x201, 0x30ef, 0x3099, 0x201, 0x30f0, + 0x3099, 0x201, 0x30f1, 0x3099, 0x201, 0x30f2, 0x3099, 0x201, + 0x30fd, 0x3099, 0x20b, 0x30b3, 0x30c8, 0x110, 0x1100, 0x110, + 0x1101, 0x110, 0x11aa, 0x110, 0x1102, 0x110, 0x11ac, 0x110, + 0x11ad, 0x110, 0x1103, 0x110, 0x1104, 0x110, 0x1105, 0x110, + 0x11b0, 0x110, 0x11b1, 0x110, 0x11b2, 0x110, 0x11b3, 0x110, + 0x11b4, 0x110, 0x11b5, 0x110, 0x111a, 0x110, 0x1106, 0x110, + 0x1107, 0x110, 0x1108, 0x110, 0x1121, 0x110, 0x1109, 0x110, + 0x110a, 0x110, 0x110b, 0x110, 0x110c, 0x110, 0x110d, 0x110, + 0x110e, 0x110, 0x110f, 0x110, 0x1110, 0x110, 0x1111, 0x110, + 0x1112, 0x110, 0x1161, 0x110, 0x1162, 0x110, 0x1163, 0x110, + 0x1164, 0x110, 0x1165, 0x110, 0x1166, 0x110, 0x1167, 0x110, + 0x1168, 0x110, 0x1169, 0x110, 0x116a, 0x110, 0x116b, 0x110, + 0x116c, 0x110, 0x116d, 0x110, 0x116e, 0x110, 0x116f, 0x110, + 0x1170, 0x110, 0x1171, 0x110, 0x1172, 0x110, 0x1173, 0x110, + 0x1174, 0x110, 0x1175, 0x110, 0x1160, 0x110, 0x1114, 0x110, + 0x1115, 0x110, 0x11c7, 0x110, 0x11c8, 0x110, 0x11cc, 0x110, + 0x11ce, 0x110, 0x11d3, 0x110, 0x11d7, 0x110, 0x11d9, 0x110, + 0x111c, 0x110, 0x11dd, 0x110, 0x11df, 0x110, 0x111d, 0x110, + 0x111e, 0x110, 0x1120, 0x110, 0x1122, 0x110, 0x1123, 0x110, + 0x1127, 0x110, 0x1129, 0x110, 0x112b, 0x110, 0x112c, 0x110, + 0x112d, 0x110, 0x112e, 0x110, 0x112f, 0x110, 0x1132, 0x110, + 0x1136, 0x110, 0x1140, 0x110, 0x1147, 0x110, 0x114c, 0x110, + 0x11f1, 0x110, 0x11f2, 0x110, 0x1157, 0x110, 0x1158, 0x110, + 0x1159, 0x110, 0x1184, 0x110, 0x1185, 0x110, 0x1188, 0x110, + 0x1191, 0x110, 0x1192, 0x110, 0x1194, 0x110, 0x119e, 0x110, + 0x11a1, 0x109, 0x4e00, 0x109, 0x4e8c, 0x109, 0x4e09, 0x109, + 0x56db, 0x109, 0x4e0a, 0x109, 0x4e2d, 0x109, 0x4e0b, 0x109, + 0x7532, 0x109, 0x4e59, 0x109, 0x4e19, 0x109, 0x4e01, 0x109, + 0x5929, 0x109, 0x5730, 0x109, 0x4eba, 0x310, 0x28, 0x1100, + 0x29, 0x310, 0x28, 0x1102, 0x29, 0x310, 0x28, 0x1103, + 0x29, 0x310, 0x28, 0x1105, 0x29, 0x310, 0x28, 0x1106, + 0x29, 0x310, 0x28, 0x1107, 0x29, 0x310, 0x28, 0x1109, + 0x29, 0x310, 0x28, 0x110b, 0x29, 0x310, 0x28, 0x110c, + 0x29, 0x310, 0x28, 0x110e, 0x29, 0x310, 0x28, 0x110f, + 0x29, 0x310, 0x28, 0x1110, 0x29, 0x310, 0x28, 0x1111, + 0x29, 0x310, 0x28, 0x1112, 0x29, 0x410, 0x28, 0x1100, + 0x1161, 0x29, 0x410, 0x28, 0x1102, 0x1161, 0x29, 0x410, + 0x28, 0x1103, 0x1161, 0x29, 0x410, 0x28, 0x1105, 0x1161, + 0x29, 0x410, 0x28, 0x1106, 0x1161, 0x29, 0x410, 0x28, + 0x1107, 0x1161, 0x29, 0x410, 0x28, 0x1109, 0x1161, 0x29, + 0x410, 0x28, 0x110b, 0x1161, 0x29, 0x410, 0x28, 0x110c, + 0x1161, 0x29, 0x410, 0x28, 0x110e, 0x1161, 0x29, 0x410, + 0x28, 0x110f, 0x1161, 0x29, 0x410, 0x28, 0x1110, 0x1161, + 0x29, 0x410, 0x28, 0x1111, 0x1161, 0x29, 0x410, 0x28, + 0x1112, 0x1161, 0x29, 0x410, 0x28, 0x110c, 0x116e, 0x29, + 0x710, 0x28, 0x110b, 0x1169, 0x110c, 0x1165, 0x11ab, 0x29, + 0x610, 0x28, 0x110b, 0x1169, 0x1112, 0x116e, 0x29, 0x310, + 0x28, 0x4e00, 0x29, 0x310, 0x28, 0x4e8c, 0x29, 0x310, + 0x28, 0x4e09, 0x29, 0x310, 0x28, 0x56db, 0x29, 0x310, + 0x28, 0x4e94, 0x29, 0x310, 0x28, 0x516d, 0x29, 0x310, + 0x28, 0x4e03, 0x29, 0x310, 0x28, 0x516b, 0x29, 0x310, + 0x28, 0x4e5d, 0x29, 0x310, 0x28, 0x5341, 0x29, 0x310, + 0x28, 0x6708, 0x29, 0x310, 0x28, 0x706b, 0x29, 0x310, + 0x28, 0x6c34, 0x29, 0x310, 0x28, 0x6728, 0x29, 0x310, + 0x28, 0x91d1, 0x29, 0x310, 0x28, 0x571f, 0x29, 0x310, + 0x28, 0x65e5, 0x29, 0x310, 0x28, 0x682a, 0x29, 0x310, + 0x28, 0x6709, 0x29, 0x310, 0x28, 0x793e, 0x29, 0x310, + 0x28, 0x540d, 0x29, 0x310, 0x28, 0x7279, 0x29, 0x310, + 0x28, 0x8ca1, 0x29, 0x310, 0x28, 0x795d, 0x29, 0x310, + 0x28, 0x52b4, 0x29, 0x310, 0x28, 0x4ee3, 0x29, 0x310, + 0x28, 0x547c, 0x29, 0x310, 0x28, 0x5b66, 0x29, 0x310, + 0x28, 0x76e3, 0x29, 0x310, 0x28, 0x4f01, 0x29, 0x310, + 0x28, 0x8cc7, 0x29, 0x310, 0x28, 0x5354, 0x29, 0x310, + 0x28, 0x796d, 0x29, 0x310, 0x28, 0x4f11, 0x29, 0x310, + 0x28, 0x81ea, 0x29, 0x310, 0x28, 0x81f3, 0x29, 0x30f, + 0x50, 0x54, 0x45, 0x208, 0x32, 0x31, 0x208, 0x32, + 0x32, 0x208, 0x32, 0x33, 0x208, 0x32, 0x34, 0x208, + 0x32, 0x35, 0x208, 0x32, 0x36, 0x208, 0x32, 0x37, + 0x208, 0x32, 0x38, 0x208, 0x32, 0x39, 0x208, 0x33, + 0x30, 0x208, 0x33, 0x31, 0x208, 0x33, 0x32, 0x208, + 0x33, 0x33, 0x208, 0x33, 0x34, 0x208, 0x33, 0x35, + 0x108, 0x1100, 0x108, 0x1102, 0x108, 0x1103, 0x108, 0x1105, + 0x108, 0x1106, 0x108, 0x1107, 0x108, 0x1109, 0x108, 0x110b, + 0x108, 0x110c, 0x108, 0x110e, 0x108, 0x110f, 0x108, 0x1110, + 0x108, 0x1111, 0x108, 0x1112, 0x208, 0x1100, 0x1161, 0x208, + 0x1102, 0x1161, 0x208, 0x1103, 0x1161, 0x208, 0x1105, 0x1161, + 0x208, 0x1106, 0x1161, 0x208, 0x1107, 0x1161, 0x208, 0x1109, + 0x1161, 0x208, 0x110b, 0x1161, 0x208, 0x110c, 0x1161, 0x208, + 0x110e, 0x1161, 0x208, 0x110f, 0x1161, 0x208, 0x1110, 0x1161, + 0x208, 0x1111, 0x1161, 0x208, 0x1112, 0x1161, 0x508, 0x110e, + 0x1161, 0x11b7, 0x1100, 0x1169, 0x408, 0x110c, 0x116e, 0x110b, + 0x1174, 0x208, 0x110b, 0x116e, 0x108, 0x4e00, 0x108, 0x4e8c, + 0x108, 0x4e09, 0x108, 0x56db, 0x108, 0x4e94, 0x108, 0x516d, + 0x108, 0x4e03, 0x108, 0x516b, 0x108, 0x4e5d, 0x108, 0x5341, + 0x108, 0x6708, 0x108, 0x706b, 0x108, 0x6c34, 0x108, 0x6728, + 0x108, 0x91d1, 0x108, 0x571f, 0x108, 0x65e5, 0x108, 0x682a, + 0x108, 0x6709, 0x108, 0x793e, 0x108, 0x540d, 0x108, 0x7279, + 0x108, 0x8ca1, 0x108, 0x795d, 0x108, 0x52b4, 0x108, 0x79d8, + 0x108, 0x7537, 0x108, 0x5973, 0x108, 0x9069, 0x108, 0x512a, + 0x108, 0x5370, 0x108, 0x6ce8, 0x108, 0x9805, 0x108, 0x4f11, + 0x108, 0x5199, 0x108, 0x6b63, 0x108, 0x4e0a, 0x108, 0x4e2d, + 0x108, 0x4e0b, 0x108, 0x5de6, 0x108, 0x53f3, 0x108, 0x533b, + 0x108, 0x5b97, 0x108, 0x5b66, 0x108, 0x76e3, 0x108, 0x4f01, + 0x108, 0x8cc7, 0x108, 0x5354, 0x108, 0x591c, 0x208, 0x33, + 0x36, 0x208, 0x33, 0x37, 0x208, 0x33, 0x38, 0x208, + 0x33, 0x39, 0x208, 0x34, 0x30, 0x208, 0x34, 0x31, + 0x208, 0x34, 0x32, 0x208, 0x34, 0x33, 0x208, 0x34, + 0x34, 0x208, 0x34, 0x35, 0x208, 0x34, 0x36, 0x208, + 0x34, 0x37, 0x208, 0x34, 0x38, 0x208, 0x34, 0x39, + 0x208, 0x35, 0x30, 0x210, 0x31, 0x6708, 0x210, 0x32, + 0x6708, 0x210, 0x33, 0x6708, 0x210, 0x34, 0x6708, 0x210, + 0x35, 0x6708, 0x210, 0x36, 0x6708, 0x210, 0x37, 0x6708, + 0x210, 0x38, 0x6708, 0x210, 0x39, 0x6708, 0x310, 0x31, + 0x30, 0x6708, 0x310, 0x31, 0x31, 0x6708, 0x310, 0x31, + 0x32, 0x6708, 0x20f, 0x48, 0x67, 0x30f, 0x65, 0x72, + 0x67, 0x20f, 0x65, 0x56, 0x30f, 0x4c, 0x54, 0x44, + 0x108, 0x30a2, 0x108, 0x30a4, 0x108, 0x30a6, 0x108, 0x30a8, + 0x108, 0x30aa, 0x108, 0x30ab, 0x108, 0x30ad, 0x108, 0x30af, + 0x108, 0x30b1, 0x108, 0x30b3, 0x108, 0x30b5, 0x108, 0x30b7, + 0x108, 0x30b9, 0x108, 0x30bb, 0x108, 0x30bd, 0x108, 0x30bf, + 0x108, 0x30c1, 0x108, 0x30c4, 0x108, 0x30c6, 0x108, 0x30c8, + 0x108, 0x30ca, 0x108, 0x30cb, 0x108, 0x30cc, 0x108, 0x30cd, + 0x108, 0x30ce, 0x108, 0x30cf, 0x108, 0x30d2, 0x108, 0x30d5, + 0x108, 0x30d8, 0x108, 0x30db, 0x108, 0x30de, 0x108, 0x30df, + 0x108, 0x30e0, 0x108, 0x30e1, 0x108, 0x30e2, 0x108, 0x30e4, + 0x108, 0x30e6, 0x108, 0x30e8, 0x108, 0x30e9, 0x108, 0x30ea, + 0x108, 0x30eb, 0x108, 0x30ec, 0x108, 0x30ed, 0x108, 0x30ef, + 0x108, 0x30f0, 0x108, 0x30f1, 0x108, 0x30f2, 0x40f, 0x30a2, + 0x30d1, 0x30fc, 0x30c8, 0x40f, 0x30a2, 0x30eb, 0x30d5, 0x30a1, + 0x40f, 0x30a2, 0x30f3, 0x30da, 0x30a2, 0x30f, 0x30a2, 0x30fc, + 0x30eb, 0x40f, 0x30a4, 0x30cb, 0x30f3, 0x30b0, 0x30f, 0x30a4, + 0x30f3, 0x30c1, 0x30f, 0x30a6, 0x30a9, 0x30f3, 0x50f, 0x30a8, + 0x30b9, 0x30af, 0x30fc, 0x30c9, 0x40f, 0x30a8, 0x30fc, 0x30ab, + 0x30fc, 0x30f, 0x30aa, 0x30f3, 0x30b9, 0x30f, 0x30aa, 0x30fc, + 0x30e0, 0x30f, 0x30ab, 0x30a4, 0x30ea, 0x40f, 0x30ab, 0x30e9, + 0x30c3, 0x30c8, 0x40f, 0x30ab, 0x30ed, 0x30ea, 0x30fc, 0x30f, + 0x30ac, 0x30ed, 0x30f3, 0x30f, 0x30ac, 0x30f3, 0x30de, 0x20f, + 0x30ae, 0x30ac, 0x30f, 0x30ae, 0x30cb, 0x30fc, 0x40f, 0x30ad, + 0x30e5, 0x30ea, 0x30fc, 0x40f, 0x30ae, 0x30eb, 0x30c0, 0x30fc, + 0x20f, 0x30ad, 0x30ed, 0x50f, 0x30ad, 0x30ed, 0x30b0, 0x30e9, + 0x30e0, 0x60f, 0x30ad, 0x30ed, 0x30e1, 0x30fc, 0x30c8, 0x30eb, + 0x50f, 0x30ad, 0x30ed, 0x30ef, 0x30c3, 0x30c8, 0x30f, 0x30b0, + 0x30e9, 0x30e0, 0x50f, 0x30b0, 0x30e9, 0x30e0, 0x30c8, 0x30f3, + 0x50f, 0x30af, 0x30eb, 0x30bc, 0x30a4, 0x30ed, 0x40f, 0x30af, + 0x30ed, 0x30fc, 0x30cd, 0x30f, 0x30b1, 0x30fc, 0x30b9, 0x30f, + 0x30b3, 0x30eb, 0x30ca, 0x30f, 0x30b3, 0x30fc, 0x30dd, 0x40f, + 0x30b5, 0x30a4, 0x30af, 0x30eb, 0x50f, 0x30b5, 0x30f3, 0x30c1, + 0x30fc, 0x30e0, 0x40f, 0x30b7, 0x30ea, 0x30f3, 0x30b0, 0x30f, + 0x30bb, 0x30f3, 0x30c1, 0x30f, 0x30bb, 0x30f3, 0x30c8, 0x30f, + 0x30c0, 0x30fc, 0x30b9, 0x20f, 0x30c7, 0x30b7, 0x20f, 0x30c9, + 0x30eb, 0x20f, 0x30c8, 0x30f3, 0x20f, 0x30ca, 0x30ce, 0x30f, + 0x30ce, 0x30c3, 0x30c8, 0x30f, 0x30cf, 0x30a4, 0x30c4, 0x50f, + 0x30d1, 0x30fc, 0x30bb, 0x30f3, 0x30c8, 0x30f, 0x30d1, 0x30fc, + 0x30c4, 0x40f, 0x30d0, 0x30fc, 0x30ec, 0x30eb, 0x50f, 0x30d4, + 0x30a2, 0x30b9, 0x30c8, 0x30eb, 0x30f, 0x30d4, 0x30af, 0x30eb, + 0x20f, 0x30d4, 0x30b3, 0x20f, 0x30d3, 0x30eb, 0x50f, 0x30d5, + 0x30a1, 0x30e9, 0x30c3, 0x30c9, 0x40f, 0x30d5, 0x30a3, 0x30fc, + 0x30c8, 0x50f, 0x30d6, 0x30c3, 0x30b7, 0x30a7, 0x30eb, 0x30f, + 0x30d5, 0x30e9, 0x30f3, 0x50f, 0x30d8, 0x30af, 0x30bf, 0x30fc, + 0x30eb, 0x20f, 0x30da, 0x30bd, 0x30f, 0x30da, 0x30cb, 0x30d2, + 0x30f, 0x30d8, 0x30eb, 0x30c4, 0x30f, 0x30da, 0x30f3, 0x30b9, + 0x30f, 0x30da, 0x30fc, 0x30b8, 0x30f, 0x30d9, 0x30fc, 0x30bf, + 0x40f, 0x30dd, 0x30a4, 0x30f3, 0x30c8, 0x30f, 0x30dc, 0x30eb, + 0x30c8, 0x20f, 0x30db, 0x30f3, 0x30f, 0x30dd, 0x30f3, 0x30c9, + 0x30f, 0x30db, 0x30fc, 0x30eb, 0x30f, 0x30db, 0x30fc, 0x30f3, + 0x40f, 0x30de, 0x30a4, 0x30af, 0x30ed, 0x30f, 0x30de, 0x30a4, + 0x30eb, 0x30f, 0x30de, 0x30c3, 0x30cf, 0x30f, 0x30de, 0x30eb, + 0x30af, 0x50f, 0x30de, 0x30f3, 0x30b7, 0x30e7, 0x30f3, 0x40f, + 0x30df, 0x30af, 0x30ed, 0x30f3, 0x20f, 0x30df, 0x30ea, 0x50f, + 0x30df, 0x30ea, 0x30d0, 0x30fc, 0x30eb, 0x20f, 0x30e1, 0x30ac, + 0x40f, 0x30e1, 0x30ac, 0x30c8, 0x30f3, 0x40f, 0x30e1, 0x30fc, + 0x30c8, 0x30eb, 0x30f, 0x30e4, 0x30fc, 0x30c9, 0x30f, 0x30e4, + 0x30fc, 0x30eb, 0x30f, 0x30e6, 0x30a2, 0x30f3, 0x40f, 0x30ea, + 0x30c3, 0x30c8, 0x30eb, 0x20f, 0x30ea, 0x30e9, 0x30f, 0x30eb, + 0x30d4, 0x30fc, 0x40f, 0x30eb, 0x30fc, 0x30d6, 0x30eb, 0x20f, + 0x30ec, 0x30e0, 0x50f, 0x30ec, 0x30f3, 0x30c8, 0x30b2, 0x30f3, + 0x30f, 0x30ef, 0x30c3, 0x30c8, 0x210, 0x30, 0x70b9, 0x210, + 0x31, 0x70b9, 0x210, 0x32, 0x70b9, 0x210, 0x33, 0x70b9, + 0x210, 0x34, 0x70b9, 0x210, 0x35, 0x70b9, 0x210, 0x36, + 0x70b9, 0x210, 0x37, 0x70b9, 0x210, 0x38, 0x70b9, 0x210, + 0x39, 0x70b9, 0x310, 0x31, 0x30, 0x70b9, 0x310, 0x31, + 0x31, 0x70b9, 0x310, 0x31, 0x32, 0x70b9, 0x310, 0x31, + 0x33, 0x70b9, 0x310, 0x31, 0x34, 0x70b9, 0x310, 0x31, + 0x35, 0x70b9, 0x310, 0x31, 0x36, 0x70b9, 0x310, 0x31, + 0x37, 0x70b9, 0x310, 0x31, 0x38, 0x70b9, 0x310, 0x31, + 0x39, 0x70b9, 0x310, 0x32, 0x30, 0x70b9, 0x310, 0x32, + 0x31, 0x70b9, 0x310, 0x32, 0x32, 0x70b9, 0x310, 0x32, + 0x33, 0x70b9, 0x310, 0x32, 0x34, 0x70b9, 0x30f, 0x68, + 0x50, 0x61, 0x20f, 0x64, 0x61, 0x20f, 0x41, 0x55, + 0x30f, 0x62, 0x61, 0x72, 0x20f, 0x6f, 0x56, 0x20f, + 0x70, 0x63, 0x20f, 0x64, 0x6d, 0x30f, 0x64, 0x6d, + 0xb2, 0x30f, 0x64, 0x6d, 0xb3, 0x20f, 0x49, 0x55, + 0x20f, 0x5e73, 0x6210, 0x20f, 0x662d, 0x548c, 0x20f, 0x5927, + 0x6b63, 0x20f, 0x660e, 0x6cbb, 0x40f, 0x682a, 0x5f0f, 0x4f1a, + 0x793e, 0x20f, 0x70, 0x41, 0x20f, 0x6e, 0x41, 0x20f, + 0x3bc, 0x41, 0x20f, 0x6d, 0x41, 0x20f, 0x6b, 0x41, + 0x20f, 0x4b, 0x42, 0x20f, 0x4d, 0x42, 0x20f, 0x47, + 0x42, 0x30f, 0x63, 0x61, 0x6c, 0x40f, 0x6b, 0x63, + 0x61, 0x6c, 0x20f, 0x70, 0x46, 0x20f, 0x6e, 0x46, + 0x20f, 0x3bc, 0x46, 0x20f, 0x3bc, 0x67, 0x20f, 0x6d, + 0x67, 0x20f, 0x6b, 0x67, 0x20f, 0x48, 0x7a, 0x30f, + 0x6b, 0x48, 0x7a, 0x30f, 0x4d, 0x48, 0x7a, 0x30f, + 0x47, 0x48, 0x7a, 0x30f, 0x54, 0x48, 0x7a, 0x20f, + 0x3bc, 0x2113, 0x20f, 0x6d, 0x2113, 0x20f, 0x64, 0x2113, + 0x20f, 0x6b, 0x2113, 0x20f, 0x66, 0x6d, 0x20f, 0x6e, + 0x6d, 0x20f, 0x3bc, 0x6d, 0x20f, 0x6d, 0x6d, 0x20f, + 0x63, 0x6d, 0x20f, 0x6b, 0x6d, 0x30f, 0x6d, 0x6d, + 0xb2, 0x30f, 0x63, 0x6d, 0xb2, 0x20f, 0x6d, 0xb2, + 0x30f, 0x6b, 0x6d, 0xb2, 0x30f, 0x6d, 0x6d, 0xb3, + 0x30f, 0x63, 0x6d, 0xb3, 0x20f, 0x6d, 0xb3, 0x30f, + 0x6b, 0x6d, 0xb3, 0x30f, 0x6d, 0x2215, 0x73, 0x40f, + 0x6d, 0x2215, 0x73, 0xb2, 0x20f, 0x50, 0x61, 0x30f, + 0x6b, 0x50, 0x61, 0x30f, 0x4d, 0x50, 0x61, 0x30f, + 0x47, 0x50, 0x61, 0x30f, 0x72, 0x61, 0x64, 0x50f, + 0x72, 0x61, 0x64, 0x2215, 0x73, 0x60f, 0x72, 0x61, + 0x64, 0x2215, 0x73, 0xb2, 0x20f, 0x70, 0x73, 0x20f, + 0x6e, 0x73, 0x20f, 0x3bc, 0x73, 0x20f, 0x6d, 0x73, + 0x20f, 0x70, 0x56, 0x20f, 0x6e, 0x56, 0x20f, 0x3bc, + 0x56, 0x20f, 0x6d, 0x56, 0x20f, 0x6b, 0x56, 0x20f, + 0x4d, 0x56, 0x20f, 0x70, 0x57, 0x20f, 0x6e, 0x57, + 0x20f, 0x3bc, 0x57, 0x20f, 0x6d, 0x57, 0x20f, 0x6b, + 0x57, 0x20f, 0x4d, 0x57, 0x20f, 0x6b, 0x3a9, 0x20f, + 0x4d, 0x3a9, 0x40f, 0x61, 0x2e, 0x6d, 0x2e, 0x20f, + 0x42, 0x71, 0x20f, 0x63, 0x63, 0x20f, 0x63, 0x64, + 0x40f, 0x43, 0x2215, 0x6b, 0x67, 0x30f, 0x43, 0x6f, + 0x2e, 0x20f, 0x64, 0x42, 0x20f, 0x47, 0x79, 0x20f, + 0x68, 0x61, 0x20f, 0x48, 0x50, 0x20f, 0x69, 0x6e, + 0x20f, 0x4b, 0x4b, 0x20f, 0x4b, 0x4d, 0x20f, 0x6b, + 0x74, 0x20f, 0x6c, 0x6d, 0x20f, 0x6c, 0x6e, 0x30f, + 0x6c, 0x6f, 0x67, 0x20f, 0x6c, 0x78, 0x20f, 0x6d, + 0x62, 0x30f, 0x6d, 0x69, 0x6c, 0x30f, 0x6d, 0x6f, + 0x6c, 0x20f, 0x50, 0x48, 0x40f, 0x70, 0x2e, 0x6d, + 0x2e, 0x30f, 0x50, 0x50, 0x4d, 0x20f, 0x50, 0x52, + 0x20f, 0x73, 0x72, 0x20f, 0x53, 0x76, 0x20f, 0x57, + 0x62, 0x30f, 0x56, 0x2215, 0x6d, 0x30f, 0x41, 0x2215, + 0x6d, 0x210, 0x31, 0x65e5, 0x210, 0x32, 0x65e5, 0x210, + 0x33, 0x65e5, 0x210, 0x34, 0x65e5, 0x210, 0x35, 0x65e5, + 0x210, 0x36, 0x65e5, 0x210, 0x37, 0x65e5, 0x210, 0x38, + 0x65e5, 0x210, 0x39, 0x65e5, 0x310, 0x31, 0x30, 0x65e5, + 0x310, 0x31, 0x31, 0x65e5, 0x310, 0x31, 0x32, 0x65e5, + 0x310, 0x31, 0x33, 0x65e5, 0x310, 0x31, 0x34, 0x65e5, + 0x310, 0x31, 0x35, 0x65e5, 0x310, 0x31, 0x36, 0x65e5, + 0x310, 0x31, 0x37, 0x65e5, 0x310, 0x31, 0x38, 0x65e5, + 0x310, 0x31, 0x39, 0x65e5, 0x310, 0x32, 0x30, 0x65e5, + 0x310, 0x32, 0x31, 0x65e5, 0x310, 0x32, 0x32, 0x65e5, + 0x310, 0x32, 0x33, 0x65e5, 0x310, 0x32, 0x34, 0x65e5, + 0x310, 0x32, 0x35, 0x65e5, 0x310, 0x32, 0x36, 0x65e5, + 0x310, 0x32, 0x37, 0x65e5, 0x310, 0x32, 0x38, 0x65e5, + 0x310, 0x32, 0x39, 0x65e5, 0x310, 0x33, 0x30, 0x65e5, + 0x310, 0x33, 0x31, 0x65e5, 0x30f, 0x67, 0x61, 0x6c, + 0x101, 0x8c48, 0x101, 0x66f4, 0x101, 0x8eca, 0x101, 0x8cc8, + 0x101, 0x6ed1, 0x101, 0x4e32, 0x101, 0x53e5, 0x101, 0x9f9c, + 0x101, 0x9f9c, 0x101, 0x5951, 0x101, 0x91d1, 0x101, 0x5587, + 0x101, 0x5948, 0x101, 0x61f6, 0x101, 0x7669, 0x101, 0x7f85, + 0x101, 0x863f, 0x101, 0x87ba, 0x101, 0x88f8, 0x101, 0x908f, + 0x101, 0x6a02, 0x101, 0x6d1b, 0x101, 0x70d9, 0x101, 0x73de, + 0x101, 0x843d, 0x101, 0x916a, 0x101, 0x99f1, 0x101, 0x4e82, + 0x101, 0x5375, 0x101, 0x6b04, 0x101, 0x721b, 0x101, 0x862d, + 0x101, 0x9e1e, 0x101, 0x5d50, 0x101, 0x6feb, 0x101, 0x85cd, + 0x101, 0x8964, 0x101, 0x62c9, 0x101, 0x81d8, 0x101, 0x881f, + 0x101, 0x5eca, 0x101, 0x6717, 0x101, 0x6d6a, 0x101, 0x72fc, + 0x101, 0x90ce, 0x101, 0x4f86, 0x101, 0x51b7, 0x101, 0x52de, + 0x101, 0x64c4, 0x101, 0x6ad3, 0x101, 0x7210, 0x101, 0x76e7, + 0x101, 0x8001, 0x101, 0x8606, 0x101, 0x865c, 0x101, 0x8def, + 0x101, 0x9732, 0x101, 0x9b6f, 0x101, 0x9dfa, 0x101, 0x788c, + 0x101, 0x797f, 0x101, 0x7da0, 0x101, 0x83c9, 0x101, 0x9304, + 0x101, 0x9e7f, 0x101, 0x8ad6, 0x101, 0x58df, 0x101, 0x5f04, + 0x101, 0x7c60, 0x101, 0x807e, 0x101, 0x7262, 0x101, 0x78ca, + 0x101, 0x8cc2, 0x101, 0x96f7, 0x101, 0x58d8, 0x101, 0x5c62, + 0x101, 0x6a13, 0x101, 0x6dda, 0x101, 0x6f0f, 0x101, 0x7d2f, + 0x101, 0x7e37, 0x101, 0x964b, 0x101, 0x52d2, 0x101, 0x808b, + 0x101, 0x51dc, 0x101, 0x51cc, 0x101, 0x7a1c, 0x101, 0x7dbe, + 0x101, 0x83f1, 0x101, 0x9675, 0x101, 0x8b80, 0x101, 0x62cf, + 0x101, 0x6a02, 0x101, 0x8afe, 0x101, 0x4e39, 0x101, 0x5be7, + 0x101, 0x6012, 0x101, 0x7387, 0x101, 0x7570, 0x101, 0x5317, + 0x101, 0x78fb, 0x101, 0x4fbf, 0x101, 0x5fa9, 0x101, 0x4e0d, + 0x101, 0x6ccc, 0x101, 0x6578, 0x101, 0x7d22, 0x101, 0x53c3, + 0x101, 0x585e, 0x101, 0x7701, 0x101, 0x8449, 0x101, 0x8aaa, + 0x101, 0x6bba, 0x101, 0x8fb0, 0x101, 0x6c88, 0x101, 0x62fe, + 0x101, 0x82e5, 0x101, 0x63a0, 0x101, 0x7565, 0x101, 0x4eae, + 0x101, 0x5169, 0x101, 0x51c9, 0x101, 0x6881, 0x101, 0x7ce7, + 0x101, 0x826f, 0x101, 0x8ad2, 0x101, 0x91cf, 0x101, 0x52f5, + 0x101, 0x5442, 0x101, 0x5973, 0x101, 0x5eec, 0x101, 0x65c5, + 0x101, 0x6ffe, 0x101, 0x792a, 0x101, 0x95ad, 0x101, 0x9a6a, + 0x101, 0x9e97, 0x101, 0x9ece, 0x101, 0x529b, 0x101, 0x66c6, + 0x101, 0x6b77, 0x101, 0x8f62, 0x101, 0x5e74, 0x101, 0x6190, + 0x101, 0x6200, 0x101, 0x649a, 0x101, 0x6f23, 0x101, 0x7149, + 0x101, 0x7489, 0x101, 0x79ca, 0x101, 0x7df4, 0x101, 0x806f, + 0x101, 0x8f26, 0x101, 0x84ee, 0x101, 0x9023, 0x101, 0x934a, + 0x101, 0x5217, 0x101, 0x52a3, 0x101, 0x54bd, 0x101, 0x70c8, + 0x101, 0x88c2, 0x101, 0x8aaa, 0x101, 0x5ec9, 0x101, 0x5ff5, + 0x101, 0x637b, 0x101, 0x6bae, 0x101, 0x7c3e, 0x101, 0x7375, + 0x101, 0x4ee4, 0x101, 0x56f9, 0x101, 0x5be7, 0x101, 0x5dba, + 0x101, 0x601c, 0x101, 0x73b2, 0x101, 0x7469, 0x101, 0x7f9a, + 0x101, 0x8046, 0x101, 0x9234, 0x101, 0x96f6, 0x101, 0x9748, + 0x101, 0x9818, 0x101, 0x4f8b, 0x101, 0x79ae, 0x101, 0x91b4, + 0x101, 0x96b8, 0x101, 0x60e1, 0x101, 0x4e86, 0x101, 0x50da, + 0x101, 0x5bee, 0x101, 0x5c3f, 0x101, 0x6599, 0x101, 0x6a02, + 0x101, 0x71ce, 0x101, 0x7642, 0x101, 0x84fc, 0x101, 0x907c, + 0x101, 0x9f8d, 0x101, 0x6688, 0x101, 0x962e, 0x101, 0x5289, + 0x101, 0x677b, 0x101, 0x67f3, 0x101, 0x6d41, 0x101, 0x6e9c, + 0x101, 0x7409, 0x101, 0x7559, 0x101, 0x786b, 0x101, 0x7d10, + 0x101, 0x985e, 0x101, 0x516d, 0x101, 0x622e, 0x101, 0x9678, + 0x101, 0x502b, 0x101, 0x5d19, 0x101, 0x6dea, 0x101, 0x8f2a, + 0x101, 0x5f8b, 0x101, 0x6144, 0x101, 0x6817, 0x101, 0x7387, + 0x101, 0x9686, 0x101, 0x5229, 0x101, 0x540f, 0x101, 0x5c65, + 0x101, 0x6613, 0x101, 0x674e, 0x101, 0x68a8, 0x101, 0x6ce5, + 0x101, 0x7406, 0x101, 0x75e2, 0x101, 0x7f79, 0x101, 0x88cf, + 0x101, 0x88e1, 0x101, 0x91cc, 0x101, 0x96e2, 0x101, 0x533f, + 0x101, 0x6eba, 0x101, 0x541d, 0x101, 0x71d0, 0x101, 0x7498, + 0x101, 0x85fa, 0x101, 0x96a3, 0x101, 0x9c57, 0x101, 0x9e9f, + 0x101, 0x6797, 0x101, 0x6dcb, 0x101, 0x81e8, 0x101, 0x7acb, + 0x101, 0x7b20, 0x101, 0x7c92, 0x101, 0x72c0, 0x101, 0x7099, + 0x101, 0x8b58, 0x101, 0x4ec0, 0x101, 0x8336, 0x101, 0x523a, + 0x101, 0x5207, 0x101, 0x5ea6, 0x101, 0x62d3, 0x101, 0x7cd6, + 0x101, 0x5b85, 0x101, 0x6d1e, 0x101, 0x66b4, 0x101, 0x8f3b, + 0x101, 0x884c, 0x101, 0x964d, 0x101, 0x898b, 0x101, 0x5ed3, + 0x101, 0x5140, 0x101, 0x55c0, 0x101, 0x585a, 0x101, 0x6674, + 0x101, 0x51de, 0x101, 0x732a, 0x101, 0x76ca, 0x101, 0x793c, + 0x101, 0x795e, 0x101, 0x7965, 0x101, 0x798f, 0x101, 0x9756, + 0x101, 0x7cbe, 0x101, 0x7fbd, 0x101, 0x8612, 0x101, 0x8af8, + 0x101, 0x9038, 0x101, 0x90fd, 0x101, 0x98ef, 0x101, 0x98fc, + 0x101, 0x9928, 0x101, 0x9db4, 0x101, 0x4fae, 0x101, 0x50e7, + 0x101, 0x514d, 0x101, 0x52c9, 0x101, 0x52e4, 0x101, 0x5351, + 0x101, 0x559d, 0x101, 0x5606, 0x101, 0x5668, 0x101, 0x5840, + 0x101, 0x58a8, 0x101, 0x5c64, 0x101, 0x5c6e, 0x101, 0x6094, + 0x101, 0x6168, 0x101, 0x618e, 0x101, 0x61f2, 0x101, 0x654f, + 0x101, 0x65e2, 0x101, 0x6691, 0x101, 0x6885, 0x101, 0x6d77, + 0x101, 0x6e1a, 0x101, 0x6f22, 0x101, 0x716e, 0x101, 0x722b, + 0x101, 0x7422, 0x101, 0x7891, 0x101, 0x793e, 0x101, 0x7949, + 0x101, 0x7948, 0x101, 0x7950, 0x101, 0x7956, 0x101, 0x795d, + 0x101, 0x798d, 0x101, 0x798e, 0x101, 0x7a40, 0x101, 0x7a81, + 0x101, 0x7bc0, 0x101, 0x7df4, 0x101, 0x7e09, 0x101, 0x7e41, + 0x101, 0x7f72, 0x101, 0x8005, 0x101, 0x81ed, 0x101, 0x8279, + 0x101, 0x8279, 0x101, 0x8457, 0x101, 0x8910, 0x101, 0x8996, + 0x101, 0x8b01, 0x101, 0x8b39, 0x101, 0x8cd3, 0x101, 0x8d08, + 0x101, 0x8fb6, 0x101, 0x9038, 0x101, 0x96e3, 0x101, 0x97ff, + 0x101, 0x983b, 0x101, 0x4e26, 0x101, 0x51b5, 0x101, 0x5168, + 0x101, 0x4f80, 0x101, 0x5145, 0x101, 0x5180, 0x101, 0x52c7, + 0x101, 0x52fa, 0x101, 0x559d, 0x101, 0x5555, 0x101, 0x5599, + 0x101, 0x55e2, 0x101, 0x585a, 0x101, 0x58b3, 0x101, 0x5944, + 0x101, 0x5954, 0x101, 0x5a62, 0x101, 0x5b28, 0x101, 0x5ed2, + 0x101, 0x5ed9, 0x101, 0x5f69, 0x101, 0x5fad, 0x101, 0x60d8, + 0x101, 0x614e, 0x101, 0x6108, 0x101, 0x618e, 0x101, 0x6160, + 0x101, 0x61f2, 0x101, 0x6234, 0x101, 0x63c4, 0x101, 0x641c, + 0x101, 0x6452, 0x101, 0x6556, 0x101, 0x6674, 0x101, 0x6717, + 0x101, 0x671b, 0x101, 0x6756, 0x101, 0x6b79, 0x101, 0x6bba, + 0x101, 0x6d41, 0x101, 0x6edb, 0x101, 0x6ecb, 0x101, 0x6f22, + 0x101, 0x701e, 0x101, 0x716e, 0x101, 0x77a7, 0x101, 0x7235, + 0x101, 0x72af, 0x101, 0x732a, 0x101, 0x7471, 0x101, 0x7506, + 0x101, 0x753b, 0x101, 0x761d, 0x101, 0x761f, 0x101, 0x76ca, + 0x101, 0x76db, 0x101, 0x76f4, 0x101, 0x774a, 0x101, 0x7740, + 0x101, 0x78cc, 0x101, 0x7ab1, 0x101, 0x7bc0, 0x101, 0x7c7b, + 0x101, 0x7d5b, 0x101, 0x7df4, 0x101, 0x7f3e, 0x101, 0x8005, + 0x101, 0x8352, 0x101, 0x83ef, 0x101, 0x8779, 0x101, 0x8941, + 0x101, 0x8986, 0x101, 0x8996, 0x101, 0x8abf, 0x101, 0x8af8, + 0x101, 0x8acb, 0x101, 0x8b01, 0x101, 0x8afe, 0x101, 0x8aed, + 0x101, 0x8b39, 0x101, 0x8b8a, 0x101, 0x8d08, 0x101, 0x8f38, + 0x101, 0x9072, 0x101, 0x9199, 0x101, 0x9276, 0x101, 0x967c, + 0x101, 0x96e3, 0x101, 0x9756, 0x101, 0x97db, 0x101, 0x97ff, + 0x101, 0x980b, 0x101, 0x983b, 0x101, 0x9b12, 0x101, 0x9f9c, + 0x201, 0xd84a, 0xdc4a, 0x201, 0xd84a, 0xdc44, 0x201, 0xd84c, + 0xdfd5, 0x101, 0x3b9d, 0x101, 0x4018, 0x101, 0x4039, 0x201, + 0xd854, 0xde49, 0x201, 0xd857, 0xdcd0, 0x201, 0xd85f, 0xded3, + 0x101, 0x9f43, 0x101, 0x9f8e, 0x210, 0x66, 0x66, 0x210, + 0x66, 0x69, 0x210, 0x66, 0x6c, 0x310, 0x66, 0x66, + 0x69, 0x310, 0x66, 0x66, 0x6c, 0x210, 0x17f, 0x74, + 0x210, 0x73, 0x74, 0x210, 0x574, 0x576, 0x210, 0x574, + 0x565, 0x210, 0x574, 0x56b, 0x210, 0x57e, 0x576, 0x210, + 0x574, 0x56d, 0x201, 0x5d9, 0x5b4, 0x201, 0x5f2, 0x5b7, + 0x102, 0x5e2, 0x102, 0x5d0, 0x102, 0x5d3, 0x102, 0x5d4, + 0x102, 0x5db, 0x102, 0x5dc, 0x102, 0x5dd, 0x102, 0x5e8, + 0x102, 0x5ea, 0x102, 0x2b, 0x201, 0x5e9, 0x5c1, 0x201, + 0x5e9, 0x5c2, 0x201, 0xfb49, 0x5c1, 0x201, 0xfb49, 0x5c2, + 0x201, 0x5d0, 0x5b7, 0x201, 0x5d0, 0x5b8, 0x201, 0x5d0, + 0x5bc, 0x201, 0x5d1, 0x5bc, 0x201, 0x5d2, 0x5bc, 0x201, + 0x5d3, 0x5bc, 0x201, 0x5d4, 0x5bc, 0x201, 0x5d5, 0x5bc, + 0x201, 0x5d6, 0x5bc, 0x201, 0x5d8, 0x5bc, 0x201, 0x5d9, + 0x5bc, 0x201, 0x5da, 0x5bc, 0x201, 0x5db, 0x5bc, 0x201, + 0x5dc, 0x5bc, 0x201, 0x5de, 0x5bc, 0x201, 0x5e0, 0x5bc, + 0x201, 0x5e1, 0x5bc, 0x201, 0x5e3, 0x5bc, 0x201, 0x5e4, + 0x5bc, 0x201, 0x5e6, 0x5bc, 0x201, 0x5e7, 0x5bc, 0x201, + 0x5e8, 0x5bc, 0x201, 0x5e9, 0x5bc, 0x201, 0x5ea, 0x5bc, + 0x201, 0x5d5, 0x5b9, 0x201, 0x5d1, 0x5bf, 0x201, 0x5db, + 0x5bf, 0x201, 0x5e4, 0x5bf, 0x210, 0x5d0, 0x5dc, 0x107, + 0x671, 0x106, 0x671, 0x107, 0x67b, 0x106, 0x67b, 0x104, + 0x67b, 0x105, 0x67b, 0x107, 0x67e, 0x106, 0x67e, 0x104, + 0x67e, 0x105, 0x67e, 0x107, 0x680, 0x106, 0x680, 0x104, + 0x680, 0x105, 0x680, 0x107, 0x67a, 0x106, 0x67a, 0x104, + 0x67a, 0x105, 0x67a, 0x107, 0x67f, 0x106, 0x67f, 0x104, + 0x67f, 0x105, 0x67f, 0x107, 0x679, 0x106, 0x679, 0x104, + 0x679, 0x105, 0x679, 0x107, 0x6a4, 0x106, 0x6a4, 0x104, + 0x6a4, 0x105, 0x6a4, 0x107, 0x6a6, 0x106, 0x6a6, 0x104, + 0x6a6, 0x105, 0x6a6, 0x107, 0x684, 0x106, 0x684, 0x104, + 0x684, 0x105, 0x684, 0x107, 0x683, 0x106, 0x683, 0x104, + 0x683, 0x105, 0x683, 0x107, 0x686, 0x106, 0x686, 0x104, + 0x686, 0x105, 0x686, 0x107, 0x687, 0x106, 0x687, 0x104, + 0x687, 0x105, 0x687, 0x107, 0x68d, 0x106, 0x68d, 0x107, + 0x68c, 0x106, 0x68c, 0x107, 0x68e, 0x106, 0x68e, 0x107, + 0x688, 0x106, 0x688, 0x107, 0x698, 0x106, 0x698, 0x107, + 0x691, 0x106, 0x691, 0x107, 0x6a9, 0x106, 0x6a9, 0x104, + 0x6a9, 0x105, 0x6a9, 0x107, 0x6af, 0x106, 0x6af, 0x104, + 0x6af, 0x105, 0x6af, 0x107, 0x6b3, 0x106, 0x6b3, 0x104, + 0x6b3, 0x105, 0x6b3, 0x107, 0x6b1, 0x106, 0x6b1, 0x104, + 0x6b1, 0x105, 0x6b1, 0x107, 0x6ba, 0x106, 0x6ba, 0x107, + 0x6bb, 0x106, 0x6bb, 0x104, 0x6bb, 0x105, 0x6bb, 0x107, + 0x6c0, 0x106, 0x6c0, 0x107, 0x6c1, 0x106, 0x6c1, 0x104, + 0x6c1, 0x105, 0x6c1, 0x107, 0x6be, 0x106, 0x6be, 0x104, + 0x6be, 0x105, 0x6be, 0x107, 0x6d2, 0x106, 0x6d2, 0x107, + 0x6d3, 0x106, 0x6d3, 0x107, 0x6ad, 0x106, 0x6ad, 0x104, + 0x6ad, 0x105, 0x6ad, 0x107, 0x6c7, 0x106, 0x6c7, 0x107, + 0x6c6, 0x106, 0x6c6, 0x107, 0x6c8, 0x106, 0x6c8, 0x107, + 0x677, 0x107, 0x6cb, 0x106, 0x6cb, 0x107, 0x6c5, 0x106, + 0x6c5, 0x107, 0x6c9, 0x106, 0x6c9, 0x107, 0x6d0, 0x106, + 0x6d0, 0x104, 0x6d0, 0x105, 0x6d0, 0x104, 0x649, 0x105, + 0x649, 0x207, 0x626, 0x627, 0x206, 0x626, 0x627, 0x207, + 0x626, 0x6d5, 0x206, 0x626, 0x6d5, 0x207, 0x626, 0x648, + 0x206, 0x626, 0x648, 0x207, 0x626, 0x6c7, 0x206, 0x626, + 0x6c7, 0x207, 0x626, 0x6c6, 0x206, 0x626, 0x6c6, 0x207, + 0x626, 0x6c8, 0x206, 0x626, 0x6c8, 0x207, 0x626, 0x6d0, + 0x206, 0x626, 0x6d0, 0x204, 0x626, 0x6d0, 0x207, 0x626, + 0x649, 0x206, 0x626, 0x649, 0x204, 0x626, 0x649, 0x107, + 0x6cc, 0x106, 0x6cc, 0x104, 0x6cc, 0x105, 0x6cc, 0x207, + 0x626, 0x62c, 0x207, 0x626, 0x62d, 0x207, 0x626, 0x645, + 0x207, 0x626, 0x649, 0x207, 0x626, 0x64a, 0x207, 0x628, + 0x62c, 0x207, 0x628, 0x62d, 0x207, 0x628, 0x62e, 0x207, + 0x628, 0x645, 0x207, 0x628, 0x649, 0x207, 0x628, 0x64a, + 0x207, 0x62a, 0x62c, 0x207, 0x62a, 0x62d, 0x207, 0x62a, + 0x62e, 0x207, 0x62a, 0x645, 0x207, 0x62a, 0x649, 0x207, + 0x62a, 0x64a, 0x207, 0x62b, 0x62c, 0x207, 0x62b, 0x645, + 0x207, 0x62b, 0x649, 0x207, 0x62b, 0x64a, 0x207, 0x62c, + 0x62d, 0x207, 0x62c, 0x645, 0x207, 0x62d, 0x62c, 0x207, + 0x62d, 0x645, 0x207, 0x62e, 0x62c, 0x207, 0x62e, 0x62d, + 0x207, 0x62e, 0x645, 0x207, 0x633, 0x62c, 0x207, 0x633, + 0x62d, 0x207, 0x633, 0x62e, 0x207, 0x633, 0x645, 0x207, + 0x635, 0x62d, 0x207, 0x635, 0x645, 0x207, 0x636, 0x62c, + 0x207, 0x636, 0x62d, 0x207, 0x636, 0x62e, 0x207, 0x636, + 0x645, 0x207, 0x637, 0x62d, 0x207, 0x637, 0x645, 0x207, + 0x638, 0x645, 0x207, 0x639, 0x62c, 0x207, 0x639, 0x645, + 0x207, 0x63a, 0x62c, 0x207, 0x63a, 0x645, 0x207, 0x641, + 0x62c, 0x207, 0x641, 0x62d, 0x207, 0x641, 0x62e, 0x207, + 0x641, 0x645, 0x207, 0x641, 0x649, 0x207, 0x641, 0x64a, + 0x207, 0x642, 0x62d, 0x207, 0x642, 0x645, 0x207, 0x642, + 0x649, 0x207, 0x642, 0x64a, 0x207, 0x643, 0x627, 0x207, + 0x643, 0x62c, 0x207, 0x643, 0x62d, 0x207, 0x643, 0x62e, + 0x207, 0x643, 0x644, 0x207, 0x643, 0x645, 0x207, 0x643, + 0x649, 0x207, 0x643, 0x64a, 0x207, 0x644, 0x62c, 0x207, + 0x644, 0x62d, 0x207, 0x644, 0x62e, 0x207, 0x644, 0x645, + 0x207, 0x644, 0x649, 0x207, 0x644, 0x64a, 0x207, 0x645, + 0x62c, 0x207, 0x645, 0x62d, 0x207, 0x645, 0x62e, 0x207, + 0x645, 0x645, 0x207, 0x645, 0x649, 0x207, 0x645, 0x64a, + 0x207, 0x646, 0x62c, 0x207, 0x646, 0x62d, 0x207, 0x646, + 0x62e, 0x207, 0x646, 0x645, 0x207, 0x646, 0x649, 0x207, + 0x646, 0x64a, 0x207, 0x647, 0x62c, 0x207, 0x647, 0x645, + 0x207, 0x647, 0x649, 0x207, 0x647, 0x64a, 0x207, 0x64a, + 0x62c, 0x207, 0x64a, 0x62d, 0x207, 0x64a, 0x62e, 0x207, + 0x64a, 0x645, 0x207, 0x64a, 0x649, 0x207, 0x64a, 0x64a, + 0x207, 0x630, 0x670, 0x207, 0x631, 0x670, 0x207, 0x649, + 0x670, 0x307, 0x20, 0x64c, 0x651, 0x307, 0x20, 0x64d, + 0x651, 0x307, 0x20, 0x64e, 0x651, 0x307, 0x20, 0x64f, + 0x651, 0x307, 0x20, 0x650, 0x651, 0x307, 0x20, 0x651, + 0x670, 0x206, 0x626, 0x631, 0x206, 0x626, 0x632, 0x206, + 0x626, 0x645, 0x206, 0x626, 0x646, 0x206, 0x626, 0x649, + 0x206, 0x626, 0x64a, 0x206, 0x628, 0x631, 0x206, 0x628, + 0x632, 0x206, 0x628, 0x645, 0x206, 0x628, 0x646, 0x206, + 0x628, 0x649, 0x206, 0x628, 0x64a, 0x206, 0x62a, 0x631, + 0x206, 0x62a, 0x632, 0x206, 0x62a, 0x645, 0x206, 0x62a, + 0x646, 0x206, 0x62a, 0x649, 0x206, 0x62a, 0x64a, 0x206, + 0x62b, 0x631, 0x206, 0x62b, 0x632, 0x206, 0x62b, 0x645, + 0x206, 0x62b, 0x646, 0x206, 0x62b, 0x649, 0x206, 0x62b, + 0x64a, 0x206, 0x641, 0x649, 0x206, 0x641, 0x64a, 0x206, + 0x642, 0x649, 0x206, 0x642, 0x64a, 0x206, 0x643, 0x627, + 0x206, 0x643, 0x644, 0x206, 0x643, 0x645, 0x206, 0x643, + 0x649, 0x206, 0x643, 0x64a, 0x206, 0x644, 0x645, 0x206, + 0x644, 0x649, 0x206, 0x644, 0x64a, 0x206, 0x645, 0x627, + 0x206, 0x645, 0x645, 0x206, 0x646, 0x631, 0x206, 0x646, + 0x632, 0x206, 0x646, 0x645, 0x206, 0x646, 0x646, 0x206, + 0x646, 0x649, 0x206, 0x646, 0x64a, 0x206, 0x649, 0x670, + 0x206, 0x64a, 0x631, 0x206, 0x64a, 0x632, 0x206, 0x64a, + 0x645, 0x206, 0x64a, 0x646, 0x206, 0x64a, 0x649, 0x206, + 0x64a, 0x64a, 0x204, 0x626, 0x62c, 0x204, 0x626, 0x62d, + 0x204, 0x626, 0x62e, 0x204, 0x626, 0x645, 0x204, 0x626, + 0x647, 0x204, 0x628, 0x62c, 0x204, 0x628, 0x62d, 0x204, + 0x628, 0x62e, 0x204, 0x628, 0x645, 0x204, 0x628, 0x647, + 0x204, 0x62a, 0x62c, 0x204, 0x62a, 0x62d, 0x204, 0x62a, + 0x62e, 0x204, 0x62a, 0x645, 0x204, 0x62a, 0x647, 0x204, + 0x62b, 0x645, 0x204, 0x62c, 0x62d, 0x204, 0x62c, 0x645, + 0x204, 0x62d, 0x62c, 0x204, 0x62d, 0x645, 0x204, 0x62e, + 0x62c, 0x204, 0x62e, 0x645, 0x204, 0x633, 0x62c, 0x204, + 0x633, 0x62d, 0x204, 0x633, 0x62e, 0x204, 0x633, 0x645, + 0x204, 0x635, 0x62d, 0x204, 0x635, 0x62e, 0x204, 0x635, + 0x645, 0x204, 0x636, 0x62c, 0x204, 0x636, 0x62d, 0x204, + 0x636, 0x62e, 0x204, 0x636, 0x645, 0x204, 0x637, 0x62d, + 0x204, 0x638, 0x645, 0x204, 0x639, 0x62c, 0x204, 0x639, + 0x645, 0x204, 0x63a, 0x62c, 0x204, 0x63a, 0x645, 0x204, + 0x641, 0x62c, 0x204, 0x641, 0x62d, 0x204, 0x641, 0x62e, + 0x204, 0x641, 0x645, 0x204, 0x642, 0x62d, 0x204, 0x642, + 0x645, 0x204, 0x643, 0x62c, 0x204, 0x643, 0x62d, 0x204, + 0x643, 0x62e, 0x204, 0x643, 0x644, 0x204, 0x643, 0x645, + 0x204, 0x644, 0x62c, 0x204, 0x644, 0x62d, 0x204, 0x644, + 0x62e, 0x204, 0x644, 0x645, 0x204, 0x644, 0x647, 0x204, + 0x645, 0x62c, 0x204, 0x645, 0x62d, 0x204, 0x645, 0x62e, + 0x204, 0x645, 0x645, 0x204, 0x646, 0x62c, 0x204, 0x646, + 0x62d, 0x204, 0x646, 0x62e, 0x204, 0x646, 0x645, 0x204, + 0x646, 0x647, 0x204, 0x647, 0x62c, 0x204, 0x647, 0x645, + 0x204, 0x647, 0x670, 0x204, 0x64a, 0x62c, 0x204, 0x64a, + 0x62d, 0x204, 0x64a, 0x62e, 0x204, 0x64a, 0x645, 0x204, + 0x64a, 0x647, 0x205, 0x626, 0x645, 0x205, 0x626, 0x647, + 0x205, 0x628, 0x645, 0x205, 0x628, 0x647, 0x205, 0x62a, + 0x645, 0x205, 0x62a, 0x647, 0x205, 0x62b, 0x645, 0x205, + 0x62b, 0x647, 0x205, 0x633, 0x645, 0x205, 0x633, 0x647, + 0x205, 0x634, 0x645, 0x205, 0x634, 0x647, 0x205, 0x643, + 0x644, 0x205, 0x643, 0x645, 0x205, 0x644, 0x645, 0x205, + 0x646, 0x645, 0x205, 0x646, 0x647, 0x205, 0x64a, 0x645, + 0x205, 0x64a, 0x647, 0x305, 0x640, 0x64e, 0x651, 0x305, + 0x640, 0x64f, 0x651, 0x305, 0x640, 0x650, 0x651, 0x207, + 0x637, 0x649, 0x207, 0x637, 0x64a, 0x207, 0x639, 0x649, + 0x207, 0x639, 0x64a, 0x207, 0x63a, 0x649, 0x207, 0x63a, + 0x64a, 0x207, 0x633, 0x649, 0x207, 0x633, 0x64a, 0x207, + 0x634, 0x649, 0x207, 0x634, 0x64a, 0x207, 0x62d, 0x649, + 0x207, 0x62d, 0x64a, 0x207, 0x62c, 0x649, 0x207, 0x62c, + 0x64a, 0x207, 0x62e, 0x649, 0x207, 0x62e, 0x64a, 0x207, + 0x635, 0x649, 0x207, 0x635, 0x64a, 0x207, 0x636, 0x649, + 0x207, 0x636, 0x64a, 0x207, 0x634, 0x62c, 0x207, 0x634, + 0x62d, 0x207, 0x634, 0x62e, 0x207, 0x634, 0x645, 0x207, + 0x634, 0x631, 0x207, 0x633, 0x631, 0x207, 0x635, 0x631, + 0x207, 0x636, 0x631, 0x206, 0x637, 0x649, 0x206, 0x637, + 0x64a, 0x206, 0x639, 0x649, 0x206, 0x639, 0x64a, 0x206, + 0x63a, 0x649, 0x206, 0x63a, 0x64a, 0x206, 0x633, 0x649, + 0x206, 0x633, 0x64a, 0x206, 0x634, 0x649, 0x206, 0x634, + 0x64a, 0x206, 0x62d, 0x649, 0x206, 0x62d, 0x64a, 0x206, + 0x62c, 0x649, 0x206, 0x62c, 0x64a, 0x206, 0x62e, 0x649, + 0x206, 0x62e, 0x64a, 0x206, 0x635, 0x649, 0x206, 0x635, + 0x64a, 0x206, 0x636, 0x649, 0x206, 0x636, 0x64a, 0x206, + 0x634, 0x62c, 0x206, 0x634, 0x62d, 0x206, 0x634, 0x62e, + 0x206, 0x634, 0x645, 0x206, 0x634, 0x631, 0x206, 0x633, + 0x631, 0x206, 0x635, 0x631, 0x206, 0x636, 0x631, 0x204, + 0x634, 0x62c, 0x204, 0x634, 0x62d, 0x204, 0x634, 0x62e, + 0x204, 0x634, 0x645, 0x204, 0x633, 0x647, 0x204, 0x634, + 0x647, 0x204, 0x637, 0x645, 0x205, 0x633, 0x62c, 0x205, + 0x633, 0x62d, 0x205, 0x633, 0x62e, 0x205, 0x634, 0x62c, + 0x205, 0x634, 0x62d, 0x205, 0x634, 0x62e, 0x205, 0x637, + 0x645, 0x205, 0x638, 0x645, 0x206, 0x627, 0x64b, 0x207, + 0x627, 0x64b, 0x304, 0x62a, 0x62c, 0x645, 0x306, 0x62a, + 0x62d, 0x62c, 0x304, 0x62a, 0x62d, 0x62c, 0x304, 0x62a, + 0x62d, 0x645, 0x304, 0x62a, 0x62e, 0x645, 0x304, 0x62a, + 0x645, 0x62c, 0x304, 0x62a, 0x645, 0x62d, 0x304, 0x62a, + 0x645, 0x62e, 0x306, 0x62c, 0x645, 0x62d, 0x304, 0x62c, + 0x645, 0x62d, 0x306, 0x62d, 0x645, 0x64a, 0x306, 0x62d, + 0x645, 0x649, 0x304, 0x633, 0x62d, 0x62c, 0x304, 0x633, + 0x62c, 0x62d, 0x306, 0x633, 0x62c, 0x649, 0x306, 0x633, + 0x645, 0x62d, 0x304, 0x633, 0x645, 0x62d, 0x304, 0x633, + 0x645, 0x62c, 0x306, 0x633, 0x645, 0x645, 0x304, 0x633, + 0x645, 0x645, 0x306, 0x635, 0x62d, 0x62d, 0x304, 0x635, + 0x62d, 0x62d, 0x306, 0x635, 0x645, 0x645, 0x306, 0x634, + 0x62d, 0x645, 0x304, 0x634, 0x62d, 0x645, 0x306, 0x634, + 0x62c, 0x64a, 0x306, 0x634, 0x645, 0x62e, 0x304, 0x634, + 0x645, 0x62e, 0x306, 0x634, 0x645, 0x645, 0x304, 0x634, + 0x645, 0x645, 0x306, 0x636, 0x62d, 0x649, 0x306, 0x636, + 0x62e, 0x645, 0x304, 0x636, 0x62e, 0x645, 0x306, 0x637, + 0x645, 0x62d, 0x304, 0x637, 0x645, 0x62d, 0x304, 0x637, + 0x645, 0x645, 0x306, 0x637, 0x645, 0x64a, 0x306, 0x639, + 0x62c, 0x645, 0x306, 0x639, 0x645, 0x645, 0x304, 0x639, + 0x645, 0x645, 0x306, 0x639, 0x645, 0x649, 0x306, 0x63a, + 0x645, 0x645, 0x306, 0x63a, 0x645, 0x64a, 0x306, 0x63a, + 0x645, 0x649, 0x306, 0x641, 0x62e, 0x645, 0x304, 0x641, + 0x62e, 0x645, 0x306, 0x642, 0x645, 0x62d, 0x306, 0x642, + 0x645, 0x645, 0x306, 0x644, 0x62d, 0x645, 0x306, 0x644, + 0x62d, 0x64a, 0x306, 0x644, 0x62d, 0x649, 0x304, 0x644, + 0x62c, 0x62c, 0x306, 0x644, 0x62c, 0x62c, 0x306, 0x644, + 0x62e, 0x645, 0x304, 0x644, 0x62e, 0x645, 0x306, 0x644, + 0x645, 0x62d, 0x304, 0x644, 0x645, 0x62d, 0x304, 0x645, + 0x62d, 0x62c, 0x304, 0x645, 0x62d, 0x645, 0x306, 0x645, + 0x62d, 0x64a, 0x304, 0x645, 0x62c, 0x62d, 0x304, 0x645, + 0x62c, 0x645, 0x304, 0x645, 0x62e, 0x62c, 0x304, 0x645, + 0x62e, 0x645, 0x304, 0x645, 0x62c, 0x62e, 0x304, 0x647, + 0x645, 0x62c, 0x304, 0x647, 0x645, 0x645, 0x304, 0x646, + 0x62d, 0x645, 0x306, 0x646, 0x62d, 0x649, 0x306, 0x646, + 0x62c, 0x645, 0x304, 0x646, 0x62c, 0x645, 0x306, 0x646, + 0x62c, 0x649, 0x306, 0x646, 0x645, 0x64a, 0x306, 0x646, + 0x645, 0x649, 0x306, 0x64a, 0x645, 0x645, 0x304, 0x64a, + 0x645, 0x645, 0x306, 0x628, 0x62e, 0x64a, 0x306, 0x62a, + 0x62c, 0x64a, 0x306, 0x62a, 0x62c, 0x649, 0x306, 0x62a, + 0x62e, 0x64a, 0x306, 0x62a, 0x62e, 0x649, 0x306, 0x62a, + 0x645, 0x64a, 0x306, 0x62a, 0x645, 0x649, 0x306, 0x62c, + 0x645, 0x64a, 0x306, 0x62c, 0x62d, 0x649, 0x306, 0x62c, + 0x645, 0x649, 0x306, 0x633, 0x62e, 0x649, 0x306, 0x635, + 0x62d, 0x64a, 0x306, 0x634, 0x62d, 0x64a, 0x306, 0x636, + 0x62d, 0x64a, 0x306, 0x644, 0x62c, 0x64a, 0x306, 0x644, + 0x645, 0x64a, 0x306, 0x64a, 0x62d, 0x64a, 0x306, 0x64a, + 0x62c, 0x64a, 0x306, 0x64a, 0x645, 0x64a, 0x306, 0x645, + 0x645, 0x64a, 0x306, 0x642, 0x645, 0x64a, 0x306, 0x646, + 0x62d, 0x64a, 0x304, 0x642, 0x645, 0x62d, 0x304, 0x644, + 0x62d, 0x645, 0x306, 0x639, 0x645, 0x64a, 0x306, 0x643, + 0x645, 0x64a, 0x304, 0x646, 0x62c, 0x62d, 0x306, 0x645, + 0x62e, 0x64a, 0x304, 0x644, 0x62c, 0x645, 0x306, 0x643, + 0x645, 0x645, 0x306, 0x644, 0x62c, 0x645, 0x306, 0x646, + 0x62c, 0x62d, 0x306, 0x62c, 0x62d, 0x64a, 0x306, 0x62d, + 0x62c, 0x64a, 0x306, 0x645, 0x62c, 0x64a, 0x306, 0x641, + 0x645, 0x64a, 0x306, 0x628, 0x62d, 0x64a, 0x304, 0x643, + 0x645, 0x645, 0x304, 0x639, 0x62c, 0x645, 0x304, 0x635, + 0x645, 0x645, 0x306, 0x633, 0x62e, 0x64a, 0x306, 0x646, + 0x62c, 0x64a, 0x307, 0x635, 0x644, 0x6d2, 0x307, 0x642, + 0x644, 0x6d2, 0x407, 0x627, 0x644, 0x644, 0x647, 0x407, + 0x627, 0x643, 0x628, 0x631, 0x407, 0x645, 0x62d, 0x645, + 0x62f, 0x407, 0x635, 0x644, 0x639, 0x645, 0x407, 0x631, + 0x633, 0x648, 0x644, 0x407, 0x639, 0x644, 0x64a, 0x647, + 0x407, 0x648, 0x633, 0x644, 0x645, 0x307, 0x635, 0x644, + 0x649, 0x1207, 0x635, 0x644, 0x649, 0x20, 0x627, 0x644, + 0x644, 0x647, 0x20, 0x639, 0x644, 0x64a, 0x647, 0x20, + 0x648, 0x633, 0x644, 0x645, 0x807, 0x62c, 0x644, 0x20, + 0x62c, 0x644, 0x627, 0x644, 0x647, 0x407, 0x631, 0x6cc, + 0x627, 0x644, 0x10b, 0x2c, 0x10b, 0x3001, 0x10b, 0x3002, + 0x10b, 0x3a, 0x10b, 0x3b, 0x10b, 0x21, 0x10b, 0x3f, + 0x10b, 0x3016, 0x10b, 0x3017, 0x10b, 0x2026, 0x10b, 0x2025, + 0x10b, 0x2014, 0x10b, 0x2013, 0x10b, 0x5f, 0x10b, 0x5f, + 0x10b, 0x28, 0x10b, 0x29, 0x10b, 0x7b, 0x10b, 0x7d, + 0x10b, 0x3014, 0x10b, 0x3015, 0x10b, 0x3010, 0x10b, 0x3011, + 0x10b, 0x300a, 0x10b, 0x300b, 0x10b, 0x3008, 0x10b, 0x3009, + 0x10b, 0x300c, 0x10b, 0x300d, 0x10b, 0x300e, 0x10b, 0x300f, + 0x10b, 0x5b, 0x10b, 0x5d, 0x110, 0x203e, 0x110, 0x203e, + 0x110, 0x203e, 0x110, 0x203e, 0x110, 0x5f, 0x110, 0x5f, + 0x110, 0x5f, 0x10e, 0x2c, 0x10e, 0x3001, 0x10e, 0x2e, + 0x10e, 0x3b, 0x10e, 0x3a, 0x10e, 0x3f, 0x10e, 0x21, + 0x10e, 0x2014, 0x10e, 0x28, 0x10e, 0x29, 0x10e, 0x7b, + 0x10e, 0x7d, 0x10e, 0x3014, 0x10e, 0x3015, 0x10e, 0x23, + 0x10e, 0x26, 0x10e, 0x2a, 0x10e, 0x2b, 0x10e, 0x2d, + 0x10e, 0x3c, 0x10e, 0x3e, 0x10e, 0x3d, 0x10e, 0x5c, + 0x10e, 0x24, 0x10e, 0x25, 0x10e, 0x40, 0x207, 0x20, + 0x64b, 0x205, 0x640, 0x64b, 0x207, 0x20, 0x64c, 0x207, + 0x20, 0x64d, 0x207, 0x20, 0x64e, 0x205, 0x640, 0x64e, + 0x207, 0x20, 0x64f, 0x205, 0x640, 0x64f, 0x207, 0x20, + 0x650, 0x205, 0x640, 0x650, 0x207, 0x20, 0x651, 0x205, + 0x640, 0x651, 0x207, 0x20, 0x652, 0x205, 0x640, 0x652, + 0x107, 0x621, 0x107, 0x622, 0x106, 0x622, 0x107, 0x623, + 0x106, 0x623, 0x107, 0x624, 0x106, 0x624, 0x107, 0x625, + 0x106, 0x625, 0x107, 0x626, 0x106, 0x626, 0x104, 0x626, + 0x105, 0x626, 0x107, 0x627, 0x106, 0x627, 0x107, 0x628, + 0x106, 0x628, 0x104, 0x628, 0x105, 0x628, 0x107, 0x629, + 0x106, 0x629, 0x107, 0x62a, 0x106, 0x62a, 0x104, 0x62a, + 0x105, 0x62a, 0x107, 0x62b, 0x106, 0x62b, 0x104, 0x62b, + 0x105, 0x62b, 0x107, 0x62c, 0x106, 0x62c, 0x104, 0x62c, + 0x105, 0x62c, 0x107, 0x62d, 0x106, 0x62d, 0x104, 0x62d, + 0x105, 0x62d, 0x107, 0x62e, 0x106, 0x62e, 0x104, 0x62e, + 0x105, 0x62e, 0x107, 0x62f, 0x106, 0x62f, 0x107, 0x630, + 0x106, 0x630, 0x107, 0x631, 0x106, 0x631, 0x107, 0x632, + 0x106, 0x632, 0x107, 0x633, 0x106, 0x633, 0x104, 0x633, + 0x105, 0x633, 0x107, 0x634, 0x106, 0x634, 0x104, 0x634, + 0x105, 0x634, 0x107, 0x635, 0x106, 0x635, 0x104, 0x635, + 0x105, 0x635, 0x107, 0x636, 0x106, 0x636, 0x104, 0x636, + 0x105, 0x636, 0x107, 0x637, 0x106, 0x637, 0x104, 0x637, + 0x105, 0x637, 0x107, 0x638, 0x106, 0x638, 0x104, 0x638, + 0x105, 0x638, 0x107, 0x639, 0x106, 0x639, 0x104, 0x639, + 0x105, 0x639, 0x107, 0x63a, 0x106, 0x63a, 0x104, 0x63a, + 0x105, 0x63a, 0x107, 0x641, 0x106, 0x641, 0x104, 0x641, + 0x105, 0x641, 0x107, 0x642, 0x106, 0x642, 0x104, 0x642, + 0x105, 0x642, 0x107, 0x643, 0x106, 0x643, 0x104, 0x643, + 0x105, 0x643, 0x107, 0x644, 0x106, 0x644, 0x104, 0x644, + 0x105, 0x644, 0x107, 0x645, 0x106, 0x645, 0x104, 0x645, + 0x105, 0x645, 0x107, 0x646, 0x106, 0x646, 0x104, 0x646, + 0x105, 0x646, 0x107, 0x647, 0x106, 0x647, 0x104, 0x647, + 0x105, 0x647, 0x107, 0x648, 0x106, 0x648, 0x107, 0x649, + 0x106, 0x649, 0x107, 0x64a, 0x106, 0x64a, 0x104, 0x64a, + 0x105, 0x64a, 0x207, 0x644, 0x622, 0x206, 0x644, 0x622, + 0x207, 0x644, 0x623, 0x206, 0x644, 0x623, 0x207, 0x644, + 0x625, 0x206, 0x644, 0x625, 0x207, 0x644, 0x627, 0x206, + 0x644, 0x627, 0x10c, 0x21, 0x10c, 0x22, 0x10c, 0x23, + 0x10c, 0x24, 0x10c, 0x25, 0x10c, 0x26, 0x10c, 0x27, + 0x10c, 0x28, 0x10c, 0x29, 0x10c, 0x2a, 0x10c, 0x2b, + 0x10c, 0x2c, 0x10c, 0x2d, 0x10c, 0x2e, 0x10c, 0x2f, + 0x10c, 0x30, 0x10c, 0x31, 0x10c, 0x32, 0x10c, 0x33, + 0x10c, 0x34, 0x10c, 0x35, 0x10c, 0x36, 0x10c, 0x37, + 0x10c, 0x38, 0x10c, 0x39, 0x10c, 0x3a, 0x10c, 0x3b, + 0x10c, 0x3c, 0x10c, 0x3d, 0x10c, 0x3e, 0x10c, 0x3f, + 0x10c, 0x40, 0x10c, 0x41, 0x10c, 0x42, 0x10c, 0x43, + 0x10c, 0x44, 0x10c, 0x45, 0x10c, 0x46, 0x10c, 0x47, + 0x10c, 0x48, 0x10c, 0x49, 0x10c, 0x4a, 0x10c, 0x4b, + 0x10c, 0x4c, 0x10c, 0x4d, 0x10c, 0x4e, 0x10c, 0x4f, + 0x10c, 0x50, 0x10c, 0x51, 0x10c, 0x52, 0x10c, 0x53, + 0x10c, 0x54, 0x10c, 0x55, 0x10c, 0x56, 0x10c, 0x57, + 0x10c, 0x58, 0x10c, 0x59, 0x10c, 0x5a, 0x10c, 0x5b, + 0x10c, 0x5c, 0x10c, 0x5d, 0x10c, 0x5e, 0x10c, 0x5f, + 0x10c, 0x60, 0x10c, 0x61, 0x10c, 0x62, 0x10c, 0x63, + 0x10c, 0x64, 0x10c, 0x65, 0x10c, 0x66, 0x10c, 0x67, + 0x10c, 0x68, 0x10c, 0x69, 0x10c, 0x6a, 0x10c, 0x6b, + 0x10c, 0x6c, 0x10c, 0x6d, 0x10c, 0x6e, 0x10c, 0x6f, + 0x10c, 0x70, 0x10c, 0x71, 0x10c, 0x72, 0x10c, 0x73, + 0x10c, 0x74, 0x10c, 0x75, 0x10c, 0x76, 0x10c, 0x77, + 0x10c, 0x78, 0x10c, 0x79, 0x10c, 0x7a, 0x10c, 0x7b, + 0x10c, 0x7c, 0x10c, 0x7d, 0x10c, 0x7e, 0x10c, 0x2985, + 0x10c, 0x2986, 0x10d, 0x3002, 0x10d, 0x300c, 0x10d, 0x300d, + 0x10d, 0x3001, 0x10d, 0x30fb, 0x10d, 0x30f2, 0x10d, 0x30a1, + 0x10d, 0x30a3, 0x10d, 0x30a5, 0x10d, 0x30a7, 0x10d, 0x30a9, + 0x10d, 0x30e3, 0x10d, 0x30e5, 0x10d, 0x30e7, 0x10d, 0x30c3, + 0x10d, 0x30fc, 0x10d, 0x30a2, 0x10d, 0x30a4, 0x10d, 0x30a6, + 0x10d, 0x30a8, 0x10d, 0x30aa, 0x10d, 0x30ab, 0x10d, 0x30ad, + 0x10d, 0x30af, 0x10d, 0x30b1, 0x10d, 0x30b3, 0x10d, 0x30b5, + 0x10d, 0x30b7, 0x10d, 0x30b9, 0x10d, 0x30bb, 0x10d, 0x30bd, + 0x10d, 0x30bf, 0x10d, 0x30c1, 0x10d, 0x30c4, 0x10d, 0x30c6, + 0x10d, 0x30c8, 0x10d, 0x30ca, 0x10d, 0x30cb, 0x10d, 0x30cc, + 0x10d, 0x30cd, 0x10d, 0x30ce, 0x10d, 0x30cf, 0x10d, 0x30d2, + 0x10d, 0x30d5, 0x10d, 0x30d8, 0x10d, 0x30db, 0x10d, 0x30de, + 0x10d, 0x30df, 0x10d, 0x30e0, 0x10d, 0x30e1, 0x10d, 0x30e2, + 0x10d, 0x30e4, 0x10d, 0x30e6, 0x10d, 0x30e8, 0x10d, 0x30e9, + 0x10d, 0x30ea, 0x10d, 0x30eb, 0x10d, 0x30ec, 0x10d, 0x30ed, + 0x10d, 0x30ef, 0x10d, 0x30f3, 0x10d, 0x3099, 0x10d, 0x309a, + 0x10d, 0x3164, 0x10d, 0x3131, 0x10d, 0x3132, 0x10d, 0x3133, + 0x10d, 0x3134, 0x10d, 0x3135, 0x10d, 0x3136, 0x10d, 0x3137, + 0x10d, 0x3138, 0x10d, 0x3139, 0x10d, 0x313a, 0x10d, 0x313b, + 0x10d, 0x313c, 0x10d, 0x313d, 0x10d, 0x313e, 0x10d, 0x313f, + 0x10d, 0x3140, 0x10d, 0x3141, 0x10d, 0x3142, 0x10d, 0x3143, + 0x10d, 0x3144, 0x10d, 0x3145, 0x10d, 0x3146, 0x10d, 0x3147, + 0x10d, 0x3148, 0x10d, 0x3149, 0x10d, 0x314a, 0x10d, 0x314b, + 0x10d, 0x314c, 0x10d, 0x314d, 0x10d, 0x314e, 0x10d, 0x314f, + 0x10d, 0x3150, 0x10d, 0x3151, 0x10d, 0x3152, 0x10d, 0x3153, + 0x10d, 0x3154, 0x10d, 0x3155, 0x10d, 0x3156, 0x10d, 0x3157, + 0x10d, 0x3158, 0x10d, 0x3159, 0x10d, 0x315a, 0x10d, 0x315b, + 0x10d, 0x315c, 0x10d, 0x315d, 0x10d, 0x315e, 0x10d, 0x315f, + 0x10d, 0x3160, 0x10d, 0x3161, 0x10d, 0x3162, 0x10d, 0x3163, + 0x10c, 0xa2, 0x10c, 0xa3, 0x10c, 0xac, 0x10c, 0xaf, + 0x10c, 0xa6, 0x10c, 0xa5, 0x10c, 0x20a9, 0x10d, 0x2502, + 0x10d, 0x2190, 0x10d, 0x2191, 0x10d, 0x2192, 0x10d, 0x2193, + 0x10d, 0x25a0, 0x10d, 0x25cb, 0x401, 0xd834, 0xdd57, 0xd834, + 0xdd65, 0x401, 0xd834, 0xdd58, 0xd834, 0xdd65, 0x401, 0xd834, + 0xdd5f, 0xd834, 0xdd6e, 0x401, 0xd834, 0xdd5f, 0xd834, 0xdd6f, + 0x401, 0xd834, 0xdd5f, 0xd834, 0xdd70, 0x401, 0xd834, 0xdd5f, + 0xd834, 0xdd71, 0x401, 0xd834, 0xdd5f, 0xd834, 0xdd72, 0x401, + 0xd834, 0xddb9, 0xd834, 0xdd65, 0x401, 0xd834, 0xddba, 0xd834, + 0xdd65, 0x401, 0xd834, 0xddbb, 0xd834, 0xdd6e, 0x401, 0xd834, + 0xddbc, 0xd834, 0xdd6e, 0x401, 0xd834, 0xddbb, 0xd834, 0xdd6f, + 0x401, 0xd834, 0xddbc, 0xd834, 0xdd6f, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, 0x6c, 0x102, + 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, 0x70, 0x102, + 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, 0x74, 0x102, + 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, 0x78, 0x102, + 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, 0x42, 0x102, + 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, 0x46, 0x102, + 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, 0x4a, 0x102, + 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, 0x4e, 0x102, + 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, 0x52, 0x102, + 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, 0x56, 0x102, + 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, 0x5a, 0x102, + 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, 0x64, 0x102, + 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, 0x68, 0x102, + 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, 0x6c, 0x102, + 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, 0x70, 0x102, + 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, 0x74, 0x102, + 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, 0x78, 0x102, + 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, 0x43, 0x102, + 0x44, 0x102, 0x47, 0x102, 0x4a, 0x102, 0x4b, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, 0x56, 0x102, + 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, 0x5a, 0x102, + 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, 0x64, 0x102, + 0x66, 0x102, 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, + 0x6b, 0x102, 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x44, 0x102, 0x45, 0x102, 0x46, 0x102, + 0x47, 0x102, 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, + 0x4d, 0x102, 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, + 0x51, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, 0x64, 0x102, + 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, 0x68, 0x102, + 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, 0x6c, 0x102, + 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, 0x70, 0x102, + 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, 0x74, 0x102, + 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, 0x78, 0x102, + 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, 0x42, 0x102, + 0x44, 0x102, 0x45, 0x102, 0x46, 0x102, 0x47, 0x102, + 0x49, 0x102, 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, + 0x4d, 0x102, 0x4f, 0x102, 0x53, 0x102, 0x54, 0x102, + 0x55, 0x102, 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, + 0x59, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x41, 0x102, + 0x42, 0x102, 0x43, 0x102, 0x44, 0x102, 0x45, 0x102, + 0x46, 0x102, 0x47, 0x102, 0x48, 0x102, 0x49, 0x102, + 0x4a, 0x102, 0x4b, 0x102, 0x4c, 0x102, 0x4d, 0x102, + 0x4e, 0x102, 0x4f, 0x102, 0x50, 0x102, 0x51, 0x102, + 0x52, 0x102, 0x53, 0x102, 0x54, 0x102, 0x55, 0x102, + 0x56, 0x102, 0x57, 0x102, 0x58, 0x102, 0x59, 0x102, + 0x5a, 0x102, 0x61, 0x102, 0x62, 0x102, 0x63, 0x102, + 0x64, 0x102, 0x65, 0x102, 0x66, 0x102, 0x67, 0x102, + 0x68, 0x102, 0x69, 0x102, 0x6a, 0x102, 0x6b, 0x102, + 0x6c, 0x102, 0x6d, 0x102, 0x6e, 0x102, 0x6f, 0x102, + 0x70, 0x102, 0x71, 0x102, 0x72, 0x102, 0x73, 0x102, + 0x74, 0x102, 0x75, 0x102, 0x76, 0x102, 0x77, 0x102, + 0x78, 0x102, 0x79, 0x102, 0x7a, 0x102, 0x131, 0x102, + 0x237, 0x102, 0x391, 0x102, 0x392, 0x102, 0x393, 0x102, + 0x394, 0x102, 0x395, 0x102, 0x396, 0x102, 0x397, 0x102, + 0x398, 0x102, 0x399, 0x102, 0x39a, 0x102, 0x39b, 0x102, + 0x39c, 0x102, 0x39d, 0x102, 0x39e, 0x102, 0x39f, 0x102, + 0x3a0, 0x102, 0x3a1, 0x102, 0x3f4, 0x102, 0x3a3, 0x102, + 0x3a4, 0x102, 0x3a5, 0x102, 0x3a6, 0x102, 0x3a7, 0x102, + 0x3a8, 0x102, 0x3a9, 0x102, 0x2207, 0x102, 0x3b1, 0x102, + 0x3b2, 0x102, 0x3b3, 0x102, 0x3b4, 0x102, 0x3b5, 0x102, + 0x3b6, 0x102, 0x3b7, 0x102, 0x3b8, 0x102, 0x3b9, 0x102, + 0x3ba, 0x102, 0x3bb, 0x102, 0x3bc, 0x102, 0x3bd, 0x102, + 0x3be, 0x102, 0x3bf, 0x102, 0x3c0, 0x102, 0x3c1, 0x102, + 0x3c2, 0x102, 0x3c3, 0x102, 0x3c4, 0x102, 0x3c5, 0x102, + 0x3c6, 0x102, 0x3c7, 0x102, 0x3c8, 0x102, 0x3c9, 0x102, + 0x2202, 0x102, 0x3f5, 0x102, 0x3d1, 0x102, 0x3f0, 0x102, + 0x3d5, 0x102, 0x3f1, 0x102, 0x3d6, 0x102, 0x391, 0x102, + 0x392, 0x102, 0x393, 0x102, 0x394, 0x102, 0x395, 0x102, + 0x396, 0x102, 0x397, 0x102, 0x398, 0x102, 0x399, 0x102, + 0x39a, 0x102, 0x39b, 0x102, 0x39c, 0x102, 0x39d, 0x102, + 0x39e, 0x102, 0x39f, 0x102, 0x3a0, 0x102, 0x3a1, 0x102, + 0x3f4, 0x102, 0x3a3, 0x102, 0x3a4, 0x102, 0x3a5, 0x102, + 0x3a6, 0x102, 0x3a7, 0x102, 0x3a8, 0x102, 0x3a9, 0x102, + 0x2207, 0x102, 0x3b1, 0x102, 0x3b2, 0x102, 0x3b3, 0x102, + 0x3b4, 0x102, 0x3b5, 0x102, 0x3b6, 0x102, 0x3b7, 0x102, + 0x3b8, 0x102, 0x3b9, 0x102, 0x3ba, 0x102, 0x3bb, 0x102, + 0x3bc, 0x102, 0x3bd, 0x102, 0x3be, 0x102, 0x3bf, 0x102, + 0x3c0, 0x102, 0x3c1, 0x102, 0x3c2, 0x102, 0x3c3, 0x102, + 0x3c4, 0x102, 0x3c5, 0x102, 0x3c6, 0x102, 0x3c7, 0x102, + 0x3c8, 0x102, 0x3c9, 0x102, 0x2202, 0x102, 0x3f5, 0x102, + 0x3d1, 0x102, 0x3f0, 0x102, 0x3d5, 0x102, 0x3f1, 0x102, + 0x3d6, 0x102, 0x391, 0x102, 0x392, 0x102, 0x393, 0x102, + 0x394, 0x102, 0x395, 0x102, 0x396, 0x102, 0x397, 0x102, + 0x398, 0x102, 0x399, 0x102, 0x39a, 0x102, 0x39b, 0x102, + 0x39c, 0x102, 0x39d, 0x102, 0x39e, 0x102, 0x39f, 0x102, + 0x3a0, 0x102, 0x3a1, 0x102, 0x3f4, 0x102, 0x3a3, 0x102, + 0x3a4, 0x102, 0x3a5, 0x102, 0x3a6, 0x102, 0x3a7, 0x102, + 0x3a8, 0x102, 0x3a9, 0x102, 0x2207, 0x102, 0x3b1, 0x102, + 0x3b2, 0x102, 0x3b3, 0x102, 0x3b4, 0x102, 0x3b5, 0x102, + 0x3b6, 0x102, 0x3b7, 0x102, 0x3b8, 0x102, 0x3b9, 0x102, + 0x3ba, 0x102, 0x3bb, 0x102, 0x3bc, 0x102, 0x3bd, 0x102, + 0x3be, 0x102, 0x3bf, 0x102, 0x3c0, 0x102, 0x3c1, 0x102, + 0x3c2, 0x102, 0x3c3, 0x102, 0x3c4, 0x102, 0x3c5, 0x102, + 0x3c6, 0x102, 0x3c7, 0x102, 0x3c8, 0x102, 0x3c9, 0x102, + 0x2202, 0x102, 0x3f5, 0x102, 0x3d1, 0x102, 0x3f0, 0x102, + 0x3d5, 0x102, 0x3f1, 0x102, 0x3d6, 0x102, 0x391, 0x102, + 0x392, 0x102, 0x393, 0x102, 0x394, 0x102, 0x395, 0x102, + 0x396, 0x102, 0x397, 0x102, 0x398, 0x102, 0x399, 0x102, + 0x39a, 0x102, 0x39b, 0x102, 0x39c, 0x102, 0x39d, 0x102, + 0x39e, 0x102, 0x39f, 0x102, 0x3a0, 0x102, 0x3a1, 0x102, + 0x3f4, 0x102, 0x3a3, 0x102, 0x3a4, 0x102, 0x3a5, 0x102, + 0x3a6, 0x102, 0x3a7, 0x102, 0x3a8, 0x102, 0x3a9, 0x102, + 0x2207, 0x102, 0x3b1, 0x102, 0x3b2, 0x102, 0x3b3, 0x102, + 0x3b4, 0x102, 0x3b5, 0x102, 0x3b6, 0x102, 0x3b7, 0x102, + 0x3b8, 0x102, 0x3b9, 0x102, 0x3ba, 0x102, 0x3bb, 0x102, + 0x3bc, 0x102, 0x3bd, 0x102, 0x3be, 0x102, 0x3bf, 0x102, + 0x3c0, 0x102, 0x3c1, 0x102, 0x3c2, 0x102, 0x3c3, 0x102, + 0x3c4, 0x102, 0x3c5, 0x102, 0x3c6, 0x102, 0x3c7, 0x102, + 0x3c8, 0x102, 0x3c9, 0x102, 0x2202, 0x102, 0x3f5, 0x102, + 0x3d1, 0x102, 0x3f0, 0x102, 0x3d5, 0x102, 0x3f1, 0x102, + 0x3d6, 0x102, 0x391, 0x102, 0x392, 0x102, 0x393, 0x102, + 0x394, 0x102, 0x395, 0x102, 0x396, 0x102, 0x397, 0x102, + 0x398, 0x102, 0x399, 0x102, 0x39a, 0x102, 0x39b, 0x102, + 0x39c, 0x102, 0x39d, 0x102, 0x39e, 0x102, 0x39f, 0x102, + 0x3a0, 0x102, 0x3a1, 0x102, 0x3f4, 0x102, 0x3a3, 0x102, + 0x3a4, 0x102, 0x3a5, 0x102, 0x3a6, 0x102, 0x3a7, 0x102, + 0x3a8, 0x102, 0x3a9, 0x102, 0x2207, 0x102, 0x3b1, 0x102, + 0x3b2, 0x102, 0x3b3, 0x102, 0x3b4, 0x102, 0x3b5, 0x102, + 0x3b6, 0x102, 0x3b7, 0x102, 0x3b8, 0x102, 0x3b9, 0x102, + 0x3ba, 0x102, 0x3bb, 0x102, 0x3bc, 0x102, 0x3bd, 0x102, + 0x3be, 0x102, 0x3bf, 0x102, 0x3c0, 0x102, 0x3c1, 0x102, + 0x3c2, 0x102, 0x3c3, 0x102, 0x3c4, 0x102, 0x3c5, 0x102, + 0x3c6, 0x102, 0x3c7, 0x102, 0x3c8, 0x102, 0x3c9, 0x102, + 0x2202, 0x102, 0x3f5, 0x102, 0x3d1, 0x102, 0x3f0, 0x102, + 0x3d5, 0x102, 0x3f1, 0x102, 0x3d6, 0x102, 0x3dc, 0x102, + 0x3dd, 0x102, 0x30, 0x102, 0x31, 0x102, 0x32, 0x102, + 0x33, 0x102, 0x34, 0x102, 0x35, 0x102, 0x36, 0x102, + 0x37, 0x102, 0x38, 0x102, 0x39, 0x102, 0x30, 0x102, + 0x31, 0x102, 0x32, 0x102, 0x33, 0x102, 0x34, 0x102, + 0x35, 0x102, 0x36, 0x102, 0x37, 0x102, 0x38, 0x102, + 0x39, 0x102, 0x30, 0x102, 0x31, 0x102, 0x32, 0x102, + 0x33, 0x102, 0x34, 0x102, 0x35, 0x102, 0x36, 0x102, + 0x37, 0x102, 0x38, 0x102, 0x39, 0x102, 0x30, 0x102, + 0x31, 0x102, 0x32, 0x102, 0x33, 0x102, 0x34, 0x102, + 0x35, 0x102, 0x36, 0x102, 0x37, 0x102, 0x38, 0x102, + 0x39, 0x102, 0x30, 0x102, 0x31, 0x102, 0x32, 0x102, + 0x33, 0x102, 0x34, 0x102, 0x35, 0x102, 0x36, 0x102, + 0x37, 0x102, 0x38, 0x102, 0x39, 0x101, 0x4e3d, 0x101, + 0x4e38, 0x101, 0x4e41, 0x201, 0xd840, 0xdd22, 0x101, 0x4f60, + 0x101, 0x4fae, 0x101, 0x4fbb, 0x101, 0x5002, 0x101, 0x507a, + 0x101, 0x5099, 0x101, 0x50e7, 0x101, 0x50cf, 0x101, 0x349e, + 0x201, 0xd841, 0xde3a, 0x101, 0x514d, 0x101, 0x5154, 0x101, + 0x5164, 0x101, 0x5177, 0x201, 0xd841, 0xdd1c, 0x101, 0x34b9, + 0x101, 0x5167, 0x101, 0x518d, 0x201, 0xd841, 0xdd4b, 0x101, + 0x5197, 0x101, 0x51a4, 0x101, 0x4ecc, 0x101, 0x51ac, 0x101, + 0x51b5, 0x201, 0xd864, 0xdddf, 0x101, 0x51f5, 0x101, 0x5203, + 0x101, 0x34df, 0x101, 0x523b, 0x101, 0x5246, 0x101, 0x5272, + 0x101, 0x5277, 0x101, 0x3515, 0x101, 0x52c7, 0x101, 0x52c9, + 0x101, 0x52e4, 0x101, 0x52fa, 0x101, 0x5305, 0x101, 0x5306, + 0x101, 0x5317, 0x101, 0x5349, 0x101, 0x5351, 0x101, 0x535a, + 0x101, 0x5373, 0x101, 0x537d, 0x101, 0x537f, 0x101, 0x537f, + 0x101, 0x537f, 0x201, 0xd842, 0xde2c, 0x101, 0x7070, 0x101, + 0x53ca, 0x101, 0x53df, 0x201, 0xd842, 0xdf63, 0x101, 0x53eb, + 0x101, 0x53f1, 0x101, 0x5406, 0x101, 0x549e, 0x101, 0x5438, + 0x101, 0x5448, 0x101, 0x5468, 0x101, 0x54a2, 0x101, 0x54f6, + 0x101, 0x5510, 0x101, 0x5553, 0x101, 0x5563, 0x101, 0x5584, + 0x101, 0x5584, 0x101, 0x5599, 0x101, 0x55ab, 0x101, 0x55b3, + 0x101, 0x55c2, 0x101, 0x5716, 0x101, 0x5606, 0x101, 0x5717, + 0x101, 0x5651, 0x101, 0x5674, 0x101, 0x5207, 0x101, 0x58ee, + 0x101, 0x57ce, 0x101, 0x57f4, 0x101, 0x580d, 0x101, 0x578b, + 0x101, 0x5832, 0x101, 0x5831, 0x101, 0x58ac, 0x201, 0xd845, + 0xdce4, 0x101, 0x58f2, 0x101, 0x58f7, 0x101, 0x5906, 0x101, + 0x591a, 0x101, 0x5922, 0x101, 0x5962, 0x201, 0xd845, 0xdea8, + 0x201, 0xd845, 0xdeea, 0x101, 0x59ec, 0x101, 0x5a1b, 0x101, + 0x5a27, 0x101, 0x59d8, 0x101, 0x5a66, 0x101, 0x36ee, 0x101, + 0x36fc, 0x101, 0x5b08, 0x101, 0x5b3e, 0x101, 0x5b3e, 0x201, + 0xd846, 0xddc8, 0x101, 0x5bc3, 0x101, 0x5bd8, 0x101, 0x5be7, + 0x101, 0x5bf3, 0x201, 0xd846, 0xdf18, 0x101, 0x5bff, 0x101, + 0x5c06, 0x101, 0x5f53, 0x101, 0x5c22, 0x101, 0x3781, 0x101, + 0x5c60, 0x101, 0x5c6e, 0x101, 0x5cc0, 0x101, 0x5c8d, 0x201, + 0xd847, 0xdde4, 0x101, 0x5d43, 0x201, 0xd847, 0xdde6, 0x101, + 0x5d6e, 0x101, 0x5d6b, 0x101, 0x5d7c, 0x101, 0x5de1, 0x101, + 0x5de2, 0x101, 0x382f, 0x101, 0x5dfd, 0x101, 0x5e28, 0x101, + 0x5e3d, 0x101, 0x5e69, 0x101, 0x3862, 0x201, 0xd848, 0xdd83, + 0x101, 0x387c, 0x101, 0x5eb0, 0x101, 0x5eb3, 0x101, 0x5eb6, + 0x101, 0x5eca, 0x201, 0xd868, 0xdf92, 0x101, 0x5efe, 0x201, + 0xd848, 0xdf31, 0x201, 0xd848, 0xdf31, 0x101, 0x8201, 0x101, + 0x5f22, 0x101, 0x5f22, 0x101, 0x38c7, 0x201, 0xd84c, 0xdeb8, + 0x201, 0xd858, 0xddda, 0x101, 0x5f62, 0x101, 0x5f6b, 0x101, + 0x38e3, 0x101, 0x5f9a, 0x101, 0x5fcd, 0x101, 0x5fd7, 0x101, + 0x5ff9, 0x101, 0x6081, 0x101, 0x393a, 0x101, 0x391c, 0x101, + 0x6094, 0x201, 0xd849, 0xded4, 0x101, 0x60c7, 0x101, 0x6148, + 0x101, 0x614c, 0x101, 0x614e, 0x101, 0x614c, 0x101, 0x617a, + 0x101, 0x618e, 0x101, 0x61b2, 0x101, 0x61a4, 0x101, 0x61af, + 0x101, 0x61de, 0x101, 0x61f2, 0x101, 0x61f6, 0x101, 0x6210, + 0x101, 0x621b, 0x101, 0x625d, 0x101, 0x62b1, 0x101, 0x62d4, + 0x101, 0x6350, 0x201, 0xd84a, 0xdf0c, 0x101, 0x633d, 0x101, + 0x62fc, 0x101, 0x6368, 0x101, 0x6383, 0x101, 0x63e4, 0x201, + 0xd84a, 0xdff1, 0x101, 0x6422, 0x101, 0x63c5, 0x101, 0x63a9, + 0x101, 0x3a2e, 0x101, 0x6469, 0x101, 0x647e, 0x101, 0x649d, + 0x101, 0x6477, 0x101, 0x3a6c, 0x101, 0x654f, 0x101, 0x656c, + 0x201, 0xd84c, 0xdc0a, 0x101, 0x65e3, 0x101, 0x66f8, 0x101, + 0x6649, 0x101, 0x3b19, 0x101, 0x6691, 0x101, 0x3b08, 0x101, + 0x3ae4, 0x101, 0x5192, 0x101, 0x5195, 0x101, 0x6700, 0x101, + 0x669c, 0x101, 0x80ad, 0x101, 0x43d9, 0x101, 0x6717, 0x101, + 0x671b, 0x101, 0x6721, 0x101, 0x675e, 0x101, 0x6753, 0x201, + 0xd84c, 0xdfc3, 0x101, 0x3b49, 0x101, 0x67fa, 0x101, 0x6785, + 0x101, 0x6852, 0x101, 0x6885, 0x201, 0xd84d, 0xdc6d, 0x101, + 0x688e, 0x101, 0x681f, 0x101, 0x6914, 0x101, 0x3b9d, 0x101, + 0x6942, 0x101, 0x69a3, 0x101, 0x69ea, 0x101, 0x6aa8, 0x201, + 0xd84d, 0xdea3, 0x101, 0x6adb, 0x101, 0x3c18, 0x101, 0x6b21, + 0x201, 0xd84e, 0xdca7, 0x101, 0x6b54, 0x101, 0x3c4e, 0x101, + 0x6b72, 0x101, 0x6b9f, 0x101, 0x6bba, 0x101, 0x6bbb, 0x201, + 0xd84e, 0xde8d, 0x201, 0xd847, 0xdd0b, 0x201, 0xd84e, 0xdefa, + 0x101, 0x6c4e, 0x201, 0xd84f, 0xdcbc, 0x101, 0x6cbf, 0x101, + 0x6ccd, 0x101, 0x6c67, 0x101, 0x6d16, 0x101, 0x6d3e, 0x101, + 0x6d77, 0x101, 0x6d41, 0x101, 0x6d69, 0x101, 0x6d78, 0x101, + 0x6d85, 0x201, 0xd84f, 0xdd1e, 0x101, 0x6d34, 0x101, 0x6e2f, + 0x101, 0x6e6e, 0x101, 0x3d33, 0x101, 0x6ecb, 0x101, 0x6ec7, + 0x201, 0xd84f, 0xded1, 0x101, 0x6df9, 0x101, 0x6f6e, 0x201, + 0xd84f, 0xdf5e, 0x201, 0xd84f, 0xdf8e, 0x101, 0x6fc6, 0x101, + 0x7039, 0x101, 0x701e, 0x101, 0x701b, 0x101, 0x3d96, 0x101, + 0x704a, 0x101, 0x707d, 0x101, 0x7077, 0x101, 0x70ad, 0x201, + 0xd841, 0xdd25, 0x101, 0x7145, 0x201, 0xd850, 0xde63, 0x101, + 0x719c, 0x201, 0xd850, 0xdfab, 0x101, 0x7228, 0x101, 0x7235, + 0x101, 0x7250, 0x201, 0xd851, 0xde08, 0x101, 0x7280, 0x101, + 0x7295, 0x201, 0xd851, 0xdf35, 0x201, 0xd852, 0xdc14, 0x101, + 0x737a, 0x101, 0x738b, 0x101, 0x3eac, 0x101, 0x73a5, 0x101, + 0x3eb8, 0x101, 0x3eb8, 0x101, 0x7447, 0x101, 0x745c, 0x101, + 0x7471, 0x101, 0x7485, 0x101, 0x74ca, 0x101, 0x3f1b, 0x101, + 0x7524, 0x201, 0xd853, 0xdc36, 0x101, 0x753e, 0x201, 0xd853, + 0xdc92, 0x101, 0x7570, 0x201, 0xd848, 0xdd9f, 0x101, 0x7610, + 0x201, 0xd853, 0xdfa1, 0x201, 0xd853, 0xdfb8, 0x201, 0xd854, + 0xdc44, 0x101, 0x3ffc, 0x101, 0x4008, 0x101, 0x76f4, 0x201, + 0xd854, 0xdcf3, 0x201, 0xd854, 0xdcf2, 0x201, 0xd854, 0xdd19, + 0x201, 0xd854, 0xdd33, 0x101, 0x771e, 0x101, 0x771f, 0x101, + 0x771f, 0x101, 0x774a, 0x101, 0x4039, 0x101, 0x778b, 0x101, + 0x4046, 0x101, 0x4096, 0x201, 0xd855, 0xdc1d, 0x101, 0x784e, + 0x101, 0x788c, 0x101, 0x78cc, 0x101, 0x40e3, 0x201, 0xd855, + 0xde26, 0x101, 0x7956, 0x201, 0xd855, 0xde9a, 0x201, 0xd855, + 0xdec5, 0x101, 0x798f, 0x101, 0x79eb, 0x101, 0x412f, 0x101, + 0x7a40, 0x101, 0x7a4a, 0x101, 0x7a4f, 0x201, 0xd856, 0xdd7c, + 0x201, 0xd856, 0xdea7, 0x201, 0xd856, 0xdea7, 0x101, 0x7aee, + 0x101, 0x4202, 0x201, 0xd856, 0xdfab, 0x101, 0x7bc6, 0x101, + 0x7bc9, 0x101, 0x4227, 0x201, 0xd857, 0xdc80, 0x101, 0x7cd2, + 0x101, 0x42a0, 0x101, 0x7ce8, 0x101, 0x7ce3, 0x101, 0x7d00, + 0x201, 0xd857, 0xdf86, 0x101, 0x7d63, 0x101, 0x4301, 0x101, + 0x7dc7, 0x101, 0x7e02, 0x101, 0x7e45, 0x101, 0x4334, 0x201, + 0xd858, 0xde28, 0x201, 0xd858, 0xde47, 0x101, 0x4359, 0x201, + 0xd858, 0xded9, 0x101, 0x7f7a, 0x201, 0xd858, 0xdf3e, 0x101, + 0x7f95, 0x101, 0x7ffa, 0x101, 0x8005, 0x201, 0xd859, 0xdcda, + 0x201, 0xd859, 0xdd23, 0x101, 0x8060, 0x201, 0xd859, 0xdda8, + 0x101, 0x8070, 0x201, 0xd84c, 0xdf5f, 0x101, 0x43d5, 0x101, + 0x80b2, 0x101, 0x8103, 0x101, 0x440b, 0x101, 0x813e, 0x101, + 0x5ab5, 0x201, 0xd859, 0xdfa7, 0x201, 0xd859, 0xdfb5, 0x201, + 0xd84c, 0xdf93, 0x201, 0xd84c, 0xdf9c, 0x101, 0x8201, 0x101, + 0x8204, 0x101, 0x8f9e, 0x101, 0x446b, 0x101, 0x8291, 0x101, + 0x828b, 0x101, 0x829d, 0x101, 0x52b3, 0x101, 0x82b1, 0x101, + 0x82b3, 0x101, 0x82bd, 0x101, 0x82e6, 0x201, 0xd85a, 0xdf3c, + 0x101, 0x82e5, 0x101, 0x831d, 0x101, 0x8363, 0x101, 0x83ad, + 0x101, 0x8323, 0x101, 0x83bd, 0x101, 0x83e7, 0x101, 0x8457, + 0x101, 0x8353, 0x101, 0x83ca, 0x101, 0x83cc, 0x101, 0x83dc, + 0x201, 0xd85b, 0xdc36, 0x201, 0xd85b, 0xdd6b, 0x201, 0xd85b, + 0xdcd5, 0x101, 0x452b, 0x101, 0x84f1, 0x101, 0x84f3, 0x101, + 0x8516, 0x201, 0xd85c, 0xdfca, 0x101, 0x8564, 0x201, 0xd85b, + 0xdf2c, 0x101, 0x455d, 0x101, 0x4561, 0x201, 0xd85b, 0xdfb1, + 0x201, 0xd85c, 0xdcd2, 0x101, 0x456b, 0x101, 0x8650, 0x101, + 0x865c, 0x101, 0x8667, 0x101, 0x8669, 0x101, 0x86a9, 0x101, + 0x8688, 0x101, 0x870e, 0x101, 0x86e2, 0x101, 0x8779, 0x101, + 0x8728, 0x101, 0x876b, 0x101, 0x8786, 0x101, 0x45d7, 0x101, + 0x87e1, 0x101, 0x8801, 0x101, 0x45f9, 0x101, 0x8860, 0x101, + 0x8863, 0x201, 0xd85d, 0xde67, 0x101, 0x88d7, 0x101, 0x88de, + 0x101, 0x4635, 0x101, 0x88fa, 0x101, 0x34bb, 0x201, 0xd85e, + 0xdcae, 0x201, 0xd85e, 0xdd66, 0x101, 0x46be, 0x101, 0x46c7, + 0x101, 0x8aa0, 0x101, 0x8aed, 0x101, 0x8b8a, 0x101, 0x8c55, + 0x201, 0xd85f, 0xdca8, 0x101, 0x8cab, 0x101, 0x8cc1, 0x101, + 0x8d1b, 0x101, 0x8d77, 0x201, 0xd85f, 0xdf2f, 0x201, 0xd842, + 0xdc04, 0x101, 0x8dcb, 0x101, 0x8dbc, 0x101, 0x8df0, 0x201, + 0xd842, 0xdcde, 0x101, 0x8ed4, 0x101, 0x8f38, 0x201, 0xd861, + 0xddd2, 0x201, 0xd861, 0xdded, 0x101, 0x9094, 0x101, 0x90f1, + 0x101, 0x9111, 0x201, 0xd861, 0xdf2e, 0x101, 0x911b, 0x101, + 0x9238, 0x101, 0x92d7, 0x101, 0x92d8, 0x101, 0x927c, 0x101, + 0x93f9, 0x101, 0x9415, 0x201, 0xd862, 0xdffa, 0x101, 0x958b, + 0x101, 0x4995, 0x101, 0x95b7, 0x201, 0xd863, 0xdd77, 0x101, + 0x49e6, 0x101, 0x96c3, 0x101, 0x5db2, 0x101, 0x9723, 0x201, + 0xd864, 0xdd45, 0x201, 0xd864, 0xde1a, 0x101, 0x4a6e, 0x101, + 0x4a76, 0x101, 0x97e0, 0x201, 0xd865, 0xdc0a, 0x101, 0x4ab2, + 0x201, 0xd865, 0xdc96, 0x101, 0x980b, 0x101, 0x980b, 0x101, + 0x9829, 0x201, 0xd865, 0xddb6, 0x101, 0x98e2, 0x101, 0x4b33, + 0x101, 0x9929, 0x101, 0x99a7, 0x101, 0x99c2, 0x101, 0x99fe, + 0x101, 0x4bce, 0x201, 0xd866, 0xdf30, 0x101, 0x9b12, 0x101, + 0x9c40, 0x101, 0x9cfd, 0x101, 0x4cce, 0x101, 0x4ced, 0x101, + 0x9d67, 0x201, 0xd868, 0xdcce, 0x101, 0x4cf8, 0x201, 0xd868, + 0xdd05, 0x201, 0xd868, 0xde0e, 0x201, 0xd868, 0xde91, 0x101, + 0x9ebb, 0x101, 0x4d56, 0x101, 0x9ef9, 0x101, 0x9efe, 0x101, + 0x9f05, 0x101, 0x9f0f, 0x101, 0x9f16, 0x101, 0x9f3b, 0x201, + 0xd869, 0xde00, }; static const unsigned short uc_ligature_trie[] = { // 0 - 0x3100 - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 424, 456, 488, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 520, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 552, 392, 392, 392, 584, 616, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 648, 680, 392, 392, 712, 744, 392, - 392, 392, 776, 392, 392, 392, 808, 392, - 392, 840, 872, 392, 392, 392, 904, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - - 392, 936, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 968, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - 392, 392, 392, 392, 392, 392, 392, 392, - - 392, 392, 392, 392, 1000, 392, 392, 392, - - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0x0, 0xa9, 0x194, 0x1d5, 0x20e, 0xffff, 0x267, 0x2a8, - 0x305, 0x372, 0x3a3, 0x3b0, 0x3bd, 0xffff, 0xffff, 0x408, - 0xffff, 0x425, 0xffff, 0x43e, 0x45b, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x47c, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0x485, 0x4da, 0x4df, 0x4e4, 0x4ed, - 0x51a, 0xffff, 0xffff, 0xffff, 0xffff, 0x52f, 0x548, 0xffff, - 0x54d, 0x55a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0x57d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0x5d6, 0xffff, 0xffff, 0x611, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x690, 0x693, 0x6a0, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0x6a3, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6aa, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6ad, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6b0, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6b3, 0x6b6, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6b9, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6be, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6c3, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0x6c6, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6c9, 0x6d0, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6d3, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6d8, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x6db, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e0, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e3, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e6, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e9, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0x700, 0x761, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 424, 456, 488, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 520, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 552, 392, 392, 392, 584, 616, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 648, 680, 392, 392, 712, 744, 392, + 392, 392, 776, 392, 392, 392, 808, 392, + 392, 840, 872, 392, 392, 392, 904, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + + 392, 936, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 968, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392, 392, 392, 392, 392, 392, + + 392, 392, 392, 392, 1000, 392, 392, 392, + + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0x0, 0xa9, 0x194, 0x1d5, 0x20e, 0xffff, 0x267, 0x2a8, + 0x305, 0x372, 0x3a3, 0x3b0, 0x3bd, 0xffff, 0xffff, 0x408, + 0xffff, 0x425, 0xffff, 0x43e, 0x45b, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x47c, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0x485, 0x4da, 0x4df, 0x4e4, 0x4ed, + 0x51a, 0xffff, 0xffff, 0xffff, 0xffff, 0x52f, 0x548, 0xffff, + 0x54d, 0x55a, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0x57d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0x5d6, 0xffff, 0xffff, 0x611, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0x690, 0x693, 0x6a0, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0x6a3, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6aa, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6ad, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6b0, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6b3, 0x6b6, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6b9, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6be, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6c3, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0x6c6, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6c9, 0x6d0, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6d3, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6d8, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0x6db, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e0, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e3, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e6, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x6e9, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0x700, 0x761, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, }; #define GET_LIGATURE_INDEX(u2) (u2 < 0x3100 ? uc_ligature_trie[uc_ligature_trie[u2>>5] + (u2 & 0x1f)] : 0xffff); static const unsigned short uc_ligature_map [] = { - 0x54, 0x41, 0xc0, 0x45, 0xc8, 0x49, 0xcc, 0x4e, - 0x1f8, 0x4f, 0xd2, 0x55, 0xd9, 0x57, 0x1e80, 0x59, - 0x1ef2, 0x61, 0xe0, 0x65, 0xe8, 0x69, 0xec, 0x6e, - 0x1f9, 0x6f, 0xf2, 0x75, 0xf9, 0x77, 0x1e81, 0x79, - 0x1ef3, 0xa8, 0x1fed, 0xc2, 0x1ea6, 0xca, 0x1ec0, 0xd4, - 0x1ed2, 0xdc, 0x1db, 0xe2, 0x1ea7, 0xea, 0x1ec1, 0xf4, - 0x1ed3, 0xfc, 0x1dc, 0x102, 0x1eb0, 0x103, 0x1eb1, 0x112, - 0x1e14, 0x113, 0x1e15, 0x14c, 0x1e50, 0x14d, 0x1e51, 0x1a0, - 0x1edc, 0x1a1, 0x1edd, 0x1af, 0x1eea, 0x1b0, 0x1eeb, 0x391, - 0x1fba, 0x395, 0x1fc8, 0x397, 0x1fca, 0x399, 0x1fda, 0x39f, - 0x1ff8, 0x3a5, 0x1fea, 0x3a9, 0x1ffa, 0x3b1, 0x1f70, 0x3b5, - 0x1f72, 0x3b7, 0x1f74, 0x3b9, 0x1f76, 0x3bf, 0x1f78, 0x3c5, - 0x1f7a, 0x3c9, 0x1f7c, 0x3ca, 0x1fd2, 0x3cb, 0x1fe2, 0x415, - 0x400, 0x418, 0x40d, 0x435, 0x450, 0x438, 0x45d, 0x1f00, - 0x1f02, 0x1f01, 0x1f03, 0x1f08, 0x1f0a, 0x1f09, 0x1f0b, 0x1f10, - 0x1f12, 0x1f11, 0x1f13, 0x1f18, 0x1f1a, 0x1f19, 0x1f1b, 0x1f20, - 0x1f22, 0x1f21, 0x1f23, 0x1f28, 0x1f2a, 0x1f29, 0x1f2b, 0x1f30, - 0x1f32, 0x1f31, 0x1f33, 0x1f38, 0x1f3a, 0x1f39, 0x1f3b, 0x1f40, - 0x1f42, 0x1f41, 0x1f43, 0x1f48, 0x1f4a, 0x1f49, 0x1f4b, 0x1f50, - 0x1f52, 0x1f51, 0x1f53, 0x1f59, 0x1f5b, 0x1f60, 0x1f62, 0x1f61, - 0x1f63, 0x1f68, 0x1f6a, 0x1f69, 0x1f6b, 0x1fbf, 0x1fcd, 0x1ffe, - 0x1fdd, 0x75, 0x41, 0xc1, 0x43, 0x106, 0x45, 0xc9, - 0x47, 0x1f4, 0x49, 0xcd, 0x4b, 0x1e30, 0x4c, 0x139, - 0x4d, 0x1e3e, 0x4e, 0x143, 0x4f, 0xd3, 0x50, 0x1e54, - 0x52, 0x154, 0x53, 0x15a, 0x55, 0xda, 0x57, 0x1e82, - 0x59, 0xdd, 0x5a, 0x179, 0x61, 0xe1, 0x63, 0x107, - 0x65, 0xe9, 0x67, 0x1f5, 0x69, 0xed, 0x6b, 0x1e31, - 0x6c, 0x13a, 0x6d, 0x1e3f, 0x6e, 0x144, 0x6f, 0xf3, - 0x70, 0x1e55, 0x72, 0x155, 0x73, 0x15b, 0x75, 0xfa, - 0x77, 0x1e83, 0x79, 0xfd, 0x7a, 0x17a, 0xa8, 0x385, - 0xc2, 0x1ea4, 0xc5, 0x1fa, 0xc6, 0x1fc, 0xc7, 0x1e08, - 0xca, 0x1ebe, 0xcf, 0x1e2e, 0xd4, 0x1ed0, 0xd5, 0x1e4c, - 0xd8, 0x1fe, 0xdc, 0x1d7, 0xe2, 0x1ea5, 0xe5, 0x1fb, - 0xe6, 0x1fd, 0xe7, 0x1e09, 0xea, 0x1ebf, 0xef, 0x1e2f, - 0xf4, 0x1ed1, 0xf5, 0x1e4d, 0xf8, 0x1ff, 0xfc, 0x1d8, - 0x102, 0x1eae, 0x103, 0x1eaf, 0x112, 0x1e16, 0x113, 0x1e17, - 0x14c, 0x1e52, 0x14d, 0x1e53, 0x168, 0x1e78, 0x169, 0x1e79, - 0x1a0, 0x1eda, 0x1a1, 0x1edb, 0x1af, 0x1ee8, 0x1b0, 0x1ee9, - 0x391, 0x386, 0x395, 0x388, 0x397, 0x389, 0x399, 0x38a, - 0x39f, 0x38c, 0x3a5, 0x38e, 0x3a9, 0x38f, 0x3b1, 0x3ac, - 0x3b5, 0x3ad, 0x3b7, 0x3ae, 0x3b9, 0x3af, 0x3bf, 0x3cc, - 0x3c5, 0x3cd, 0x3c9, 0x3ce, 0x3ca, 0x390, 0x3cb, 0x3b0, - 0x3d2, 0x3d3, 0x413, 0x403, 0x41a, 0x40c, 0x433, 0x453, - 0x43a, 0x45c, 0x1f00, 0x1f04, 0x1f01, 0x1f05, 0x1f08, 0x1f0c, - 0x1f09, 0x1f0d, 0x1f10, 0x1f14, 0x1f11, 0x1f15, 0x1f18, 0x1f1c, - 0x1f19, 0x1f1d, 0x1f20, 0x1f24, 0x1f21, 0x1f25, 0x1f28, 0x1f2c, - 0x1f29, 0x1f2d, 0x1f30, 0x1f34, 0x1f31, 0x1f35, 0x1f38, 0x1f3c, - 0x1f39, 0x1f3d, 0x1f40, 0x1f44, 0x1f41, 0x1f45, 0x1f48, 0x1f4c, - 0x1f49, 0x1f4d, 0x1f50, 0x1f54, 0x1f51, 0x1f55, 0x1f59, 0x1f5d, - 0x1f60, 0x1f64, 0x1f61, 0x1f65, 0x1f68, 0x1f6c, 0x1f69, 0x1f6d, - 0x1fbf, 0x1fce, 0x1ffe, 0x1fde, 0x20, 0x41, 0xc2, 0x43, - 0x108, 0x45, 0xca, 0x47, 0x11c, 0x48, 0x124, 0x49, - 0xce, 0x4a, 0x134, 0x4f, 0xd4, 0x53, 0x15c, 0x55, - 0xdb, 0x57, 0x174, 0x59, 0x176, 0x5a, 0x1e90, 0x61, - 0xe2, 0x63, 0x109, 0x65, 0xea, 0x67, 0x11d, 0x68, - 0x125, 0x69, 0xee, 0x6a, 0x135, 0x6f, 0xf4, 0x73, - 0x15d, 0x75, 0xfb, 0x77, 0x175, 0x79, 0x177, 0x7a, - 0x1e91, 0x1ea0, 0x1eac, 0x1ea1, 0x1ead, 0x1eb8, 0x1ec6, 0x1eb9, - 0x1ec7, 0x1ecc, 0x1ed8, 0x1ecd, 0x1ed9, 0x1c, 0x41, 0xc3, - 0x45, 0x1ebc, 0x49, 0x128, 0x4e, 0xd1, 0x4f, 0xd5, - 0x55, 0x168, 0x56, 0x1e7c, 0x59, 0x1ef8, 0x61, 0xe3, - 0x65, 0x1ebd, 0x69, 0x129, 0x6e, 0xf1, 0x6f, 0xf5, - 0x75, 0x169, 0x76, 0x1e7d, 0x79, 0x1ef9, 0xc2, 0x1eaa, - 0xca, 0x1ec4, 0xd4, 0x1ed6, 0xe2, 0x1eab, 0xea, 0x1ec5, - 0xf4, 0x1ed7, 0x102, 0x1eb4, 0x103, 0x1eb5, 0x1a0, 0x1ee0, - 0x1a1, 0x1ee1, 0x1af, 0x1eee, 0x1b0, 0x1eef, 0x2c, 0x41, - 0x100, 0x45, 0x112, 0x47, 0x1e20, 0x49, 0x12a, 0x4f, - 0x14c, 0x55, 0x16a, 0x59, 0x232, 0x61, 0x101, 0x65, - 0x113, 0x67, 0x1e21, 0x69, 0x12b, 0x6f, 0x14d, 0x75, - 0x16b, 0x79, 0x233, 0xc4, 0x1de, 0xc6, 0x1e2, 0xd5, - 0x22c, 0xd6, 0x22a, 0xdc, 0x1d5, 0xe4, 0x1df, 0xe6, - 0x1e3, 0xf5, 0x22d, 0xf6, 0x22b, 0xfc, 0x1d6, 0x1ea, - 0x1ec, 0x1eb, 0x1ed, 0x226, 0x1e0, 0x227, 0x1e1, 0x22e, - 0x230, 0x22f, 0x231, 0x391, 0x1fb9, 0x399, 0x1fd9, 0x3a5, - 0x1fe9, 0x3b1, 0x1fb1, 0x3b9, 0x1fd1, 0x3c5, 0x1fe1, 0x418, - 0x4e2, 0x423, 0x4ee, 0x438, 0x4e3, 0x443, 0x4ef, 0x1e36, - 0x1e38, 0x1e37, 0x1e39, 0x1e5a, 0x1e5c, 0x1e5b, 0x1e5d, 0x20, - 0x41, 0x102, 0x45, 0x114, 0x47, 0x11e, 0x49, 0x12c, - 0x4f, 0x14e, 0x55, 0x16c, 0x61, 0x103, 0x65, 0x115, - 0x67, 0x11f, 0x69, 0x12d, 0x6f, 0x14f, 0x75, 0x16d, - 0x228, 0x1e1c, 0x229, 0x1e1d, 0x391, 0x1fb8, 0x399, 0x1fd8, - 0x3a5, 0x1fe8, 0x3b1, 0x1fb0, 0x3b9, 0x1fd0, 0x3c5, 0x1fe0, - 0x410, 0x4d0, 0x415, 0x4d6, 0x416, 0x4c1, 0x418, 0x419, - 0x423, 0x40e, 0x430, 0x4d1, 0x435, 0x4d7, 0x436, 0x4c2, - 0x438, 0x439, 0x443, 0x45e, 0x1ea0, 0x1eb6, 0x1ea1, 0x1eb7, - 0x2e, 0x41, 0x226, 0x42, 0x1e02, 0x43, 0x10a, 0x44, - 0x1e0a, 0x45, 0x116, 0x46, 0x1e1e, 0x47, 0x120, 0x48, - 0x1e22, 0x49, 0x130, 0x4d, 0x1e40, 0x4e, 0x1e44, 0x4f, - 0x22e, 0x50, 0x1e56, 0x52, 0x1e58, 0x53, 0x1e60, 0x54, - 0x1e6a, 0x57, 0x1e86, 0x58, 0x1e8a, 0x59, 0x1e8e, 0x5a, - 0x17b, 0x61, 0x227, 0x62, 0x1e03, 0x63, 0x10b, 0x64, - 0x1e0b, 0x65, 0x117, 0x66, 0x1e1f, 0x67, 0x121, 0x68, - 0x1e23, 0x6d, 0x1e41, 0x6e, 0x1e45, 0x6f, 0x22f, 0x70, - 0x1e57, 0x72, 0x1e59, 0x73, 0x1e61, 0x74, 0x1e6b, 0x77, - 0x1e87, 0x78, 0x1e8b, 0x79, 0x1e8f, 0x7a, 0x17c, 0x15a, - 0x1e64, 0x15b, 0x1e65, 0x160, 0x1e66, 0x161, 0x1e67, 0x17f, - 0x1e9b, 0x1e62, 0x1e68, 0x1e63, 0x1e69, 0x36, 0x41, 0xc4, - 0x45, 0xcb, 0x48, 0x1e26, 0x49, 0xcf, 0x4f, 0xd6, - 0x55, 0xdc, 0x57, 0x1e84, 0x58, 0x1e8c, 0x59, 0x178, - 0x61, 0xe4, 0x65, 0xeb, 0x68, 0x1e27, 0x69, 0xef, - 0x6f, 0xf6, 0x74, 0x1e97, 0x75, 0xfc, 0x77, 0x1e85, - 0x78, 0x1e8d, 0x79, 0xff, 0xd5, 0x1e4e, 0xf5, 0x1e4f, - 0x16a, 0x1e7a, 0x16b, 0x1e7b, 0x399, 0x3aa, 0x3a5, 0x3ab, - 0x3b9, 0x3ca, 0x3c5, 0x3cb, 0x3d2, 0x3d4, 0x406, 0x407, - 0x410, 0x4d2, 0x415, 0x401, 0x416, 0x4dc, 0x417, 0x4de, - 0x418, 0x4e4, 0x41e, 0x4e6, 0x423, 0x4f0, 0x427, 0x4f4, - 0x42b, 0x4f8, 0x42d, 0x4ec, 0x430, 0x4d3, 0x435, 0x451, - 0x436, 0x4dd, 0x437, 0x4df, 0x438, 0x4e5, 0x43e, 0x4e7, - 0x443, 0x4f1, 0x447, 0x4f5, 0x44b, 0x4f9, 0x44d, 0x4ed, - 0x456, 0x457, 0x4d8, 0x4da, 0x4d9, 0x4db, 0x4e8, 0x4ea, - 0x4e9, 0x4eb, 0x18, 0x41, 0x1ea2, 0x45, 0x1eba, 0x49, - 0x1ec8, 0x4f, 0x1ece, 0x55, 0x1ee6, 0x59, 0x1ef6, 0x61, - 0x1ea3, 0x65, 0x1ebb, 0x69, 0x1ec9, 0x6f, 0x1ecf, 0x75, - 0x1ee7, 0x79, 0x1ef7, 0xc2, 0x1ea8, 0xca, 0x1ec2, 0xd4, - 0x1ed4, 0xe2, 0x1ea9, 0xea, 0x1ec3, 0xf4, 0x1ed5, 0x102, - 0x1eb2, 0x103, 0x1eb3, 0x1a0, 0x1ede, 0x1a1, 0x1edf, 0x1af, - 0x1eec, 0x1b0, 0x1eed, 0x6, 0x41, 0xc5, 0x55, 0x16e, - 0x61, 0xe5, 0x75, 0x16f, 0x77, 0x1e98, 0x79, 0x1e99, - 0x6, 0x4f, 0x150, 0x55, 0x170, 0x6f, 0x151, 0x75, - 0x171, 0x423, 0x4f2, 0x443, 0x4f3, 0x25, 0x41, 0x1cd, - 0x43, 0x10c, 0x44, 0x10e, 0x45, 0x11a, 0x47, 0x1e6, - 0x48, 0x21e, 0x49, 0x1cf, 0x4b, 0x1e8, 0x4c, 0x13d, - 0x4e, 0x147, 0x4f, 0x1d1, 0x52, 0x158, 0x53, 0x160, - 0x54, 0x164, 0x55, 0x1d3, 0x5a, 0x17d, 0x61, 0x1ce, - 0x63, 0x10d, 0x64, 0x10f, 0x65, 0x11b, 0x67, 0x1e7, - 0x68, 0x21f, 0x69, 0x1d0, 0x6a, 0x1f0, 0x6b, 0x1e9, - 0x6c, 0x13e, 0x6e, 0x148, 0x6f, 0x1d2, 0x72, 0x159, - 0x73, 0x161, 0x74, 0x165, 0x75, 0x1d4, 0x7a, 0x17e, - 0xdc, 0x1d9, 0xfc, 0x1da, 0x1b7, 0x1ee, 0x292, 0x1ef, - 0xe, 0x41, 0x200, 0x45, 0x204, 0x49, 0x208, 0x4f, - 0x20c, 0x52, 0x210, 0x55, 0x214, 0x61, 0x201, 0x65, - 0x205, 0x69, 0x209, 0x6f, 0x20d, 0x72, 0x211, 0x75, - 0x215, 0x474, 0x476, 0x475, 0x477, 0xc, 0x41, 0x202, - 0x45, 0x206, 0x49, 0x20a, 0x4f, 0x20e, 0x52, 0x212, - 0x55, 0x216, 0x61, 0x203, 0x65, 0x207, 0x69, 0x20b, - 0x6f, 0x20f, 0x72, 0x213, 0x75, 0x217, 0xe, 0x391, - 0x1f08, 0x395, 0x1f18, 0x397, 0x1f28, 0x399, 0x1f38, 0x39f, - 0x1f48, 0x3a9, 0x1f68, 0x3b1, 0x1f00, 0x3b5, 0x1f10, 0x3b7, - 0x1f20, 0x3b9, 0x1f30, 0x3bf, 0x1f40, 0x3c1, 0x1fe4, 0x3c5, - 0x1f50, 0x3c9, 0x1f60, 0x10, 0x391, 0x1f09, 0x395, 0x1f19, - 0x397, 0x1f29, 0x399, 0x1f39, 0x39f, 0x1f49, 0x3a1, 0x1fec, - 0x3a5, 0x1f59, 0x3a9, 0x1f69, 0x3b1, 0x1f01, 0x3b5, 0x1f11, - 0x3b7, 0x1f21, 0x3b9, 0x1f31, 0x3bf, 0x1f41, 0x3c1, 0x1fe5, - 0x3c5, 0x1f51, 0x3c9, 0x1f61, 0x4, 0x4f, 0x1a0, 0x55, - 0x1af, 0x6f, 0x1a1, 0x75, 0x1b0, 0x2a, 0x41, 0x1ea0, - 0x42, 0x1e04, 0x44, 0x1e0c, 0x45, 0x1eb8, 0x48, 0x1e24, - 0x49, 0x1eca, 0x4b, 0x1e32, 0x4c, 0x1e36, 0x4d, 0x1e42, - 0x4e, 0x1e46, 0x4f, 0x1ecc, 0x52, 0x1e5a, 0x53, 0x1e62, - 0x54, 0x1e6c, 0x55, 0x1ee4, 0x56, 0x1e7e, 0x57, 0x1e88, - 0x59, 0x1ef4, 0x5a, 0x1e92, 0x61, 0x1ea1, 0x62, 0x1e05, - 0x64, 0x1e0d, 0x65, 0x1eb9, 0x68, 0x1e25, 0x69, 0x1ecb, - 0x6b, 0x1e33, 0x6c, 0x1e37, 0x6d, 0x1e43, 0x6e, 0x1e47, - 0x6f, 0x1ecd, 0x72, 0x1e5b, 0x73, 0x1e63, 0x74, 0x1e6d, - 0x75, 0x1ee5, 0x76, 0x1e7f, 0x77, 0x1e89, 0x79, 0x1ef5, - 0x7a, 0x1e93, 0x1a0, 0x1ee2, 0x1a1, 0x1ee3, 0x1af, 0x1ef0, - 0x1b0, 0x1ef1, 0x2, 0x55, 0x1e72, 0x75, 0x1e73, 0x2, - 0x41, 0x1e00, 0x61, 0x1e01, 0x4, 0x53, 0x218, 0x54, - 0x21a, 0x73, 0x219, 0x74, 0x21b, 0x16, 0x43, 0xc7, - 0x44, 0x1e10, 0x45, 0x228, 0x47, 0x122, 0x48, 0x1e28, - 0x4b, 0x136, 0x4c, 0x13b, 0x4e, 0x145, 0x52, 0x156, - 0x53, 0x15e, 0x54, 0x162, 0x63, 0xe7, 0x64, 0x1e11, - 0x65, 0x229, 0x67, 0x123, 0x68, 0x1e29, 0x6b, 0x137, - 0x6c, 0x13c, 0x6e, 0x146, 0x72, 0x157, 0x73, 0x15f, - 0x74, 0x163, 0xa, 0x41, 0x104, 0x45, 0x118, 0x49, - 0x12e, 0x4f, 0x1ea, 0x55, 0x172, 0x61, 0x105, 0x65, - 0x119, 0x69, 0x12f, 0x6f, 0x1eb, 0x75, 0x173, 0xc, - 0x44, 0x1e12, 0x45, 0x1e18, 0x4c, 0x1e3c, 0x4e, 0x1e4a, - 0x54, 0x1e70, 0x55, 0x1e76, 0x64, 0x1e13, 0x65, 0x1e19, - 0x6c, 0x1e3d, 0x6e, 0x1e4b, 0x74, 0x1e71, 0x75, 0x1e77, - 0x2, 0x48, 0x1e2a, 0x68, 0x1e2b, 0x6, 0x45, 0x1e1a, - 0x49, 0x1e2c, 0x55, 0x1e74, 0x65, 0x1e1b, 0x69, 0x1e2d, - 0x75, 0x1e75, 0x11, 0x42, 0x1e06, 0x44, 0x1e0e, 0x4b, - 0x1e34, 0x4c, 0x1e3a, 0x4e, 0x1e48, 0x52, 0x1e5e, 0x54, - 0x1e6e, 0x5a, 0x1e94, 0x62, 0x1e07, 0x64, 0x1e0f, 0x68, - 0x1e96, 0x6b, 0x1e35, 0x6c, 0x1e3b, 0x6e, 0x1e49, 0x72, - 0x1e5f, 0x74, 0x1e6f, 0x7a, 0x1e95, 0x2c, 0x3c, 0x226e, - 0x3d, 0x2260, 0x3e, 0x226f, 0x2190, 0x219a, 0x2192, 0x219b, - 0x2194, 0x21ae, 0x21d0, 0x21cd, 0x21d2, 0x21cf, 0x21d4, 0x21ce, - 0x2203, 0x2204, 0x2208, 0x2209, 0x220b, 0x220c, 0x2223, 0x2224, - 0x2225, 0x2226, 0x223c, 0x2241, 0x2243, 0x2244, 0x2245, 0x2247, - 0x2248, 0x2249, 0x224d, 0x226d, 0x2261, 0x2262, 0x2264, 0x2270, - 0x2265, 0x2271, 0x2272, 0x2274, 0x2273, 0x2275, 0x2276, 0x2278, - 0x2277, 0x2279, 0x227a, 0x2280, 0x227b, 0x2281, 0x227c, 0x22e0, - 0x227d, 0x22e1, 0x2282, 0x2284, 0x2283, 0x2285, 0x2286, 0x2288, - 0x2287, 0x2289, 0x2291, 0x22e2, 0x2292, 0x22e3, 0x22a2, 0x22ac, - 0x22a8, 0x22ad, 0x22a9, 0x22ae, 0x22ab, 0x22af, 0x22b2, 0x22ea, - 0x22b3, 0x22eb, 0x22b4, 0x22ec, 0x22b5, 0x22ed, 0x1d, 0xa8, - 0x1fc1, 0x3b1, 0x1fb6, 0x3b7, 0x1fc6, 0x3b9, 0x1fd6, 0x3c5, - 0x1fe6, 0x3c9, 0x1ff6, 0x3ca, 0x1fd7, 0x3cb, 0x1fe7, 0x1f00, - 0x1f06, 0x1f01, 0x1f07, 0x1f08, 0x1f0e, 0x1f09, 0x1f0f, 0x1f20, - 0x1f26, 0x1f21, 0x1f27, 0x1f28, 0x1f2e, 0x1f29, 0x1f2f, 0x1f30, - 0x1f36, 0x1f31, 0x1f37, 0x1f38, 0x1f3e, 0x1f39, 0x1f3f, 0x1f50, - 0x1f56, 0x1f51, 0x1f57, 0x1f59, 0x1f5f, 0x1f60, 0x1f66, 0x1f61, - 0x1f67, 0x1f68, 0x1f6e, 0x1f69, 0x1f6f, 0x1fbf, 0x1fcf, 0x1ffe, - 0x1fdf, 0x3f, 0x391, 0x1fbc, 0x397, 0x1fcc, 0x3a9, 0x1ffc, - 0x3ac, 0x1fb4, 0x3ae, 0x1fc4, 0x3b1, 0x1fb3, 0x3b7, 0x1fc3, - 0x3c9, 0x1ff3, 0x3ce, 0x1ff4, 0x1f00, 0x1f80, 0x1f01, 0x1f81, - 0x1f02, 0x1f82, 0x1f03, 0x1f83, 0x1f04, 0x1f84, 0x1f05, 0x1f85, - 0x1f06, 0x1f86, 0x1f07, 0x1f87, 0x1f08, 0x1f88, 0x1f09, 0x1f89, - 0x1f0a, 0x1f8a, 0x1f0b, 0x1f8b, 0x1f0c, 0x1f8c, 0x1f0d, 0x1f8d, - 0x1f0e, 0x1f8e, 0x1f0f, 0x1f8f, 0x1f20, 0x1f90, 0x1f21, 0x1f91, - 0x1f22, 0x1f92, 0x1f23, 0x1f93, 0x1f24, 0x1f94, 0x1f25, 0x1f95, - 0x1f26, 0x1f96, 0x1f27, 0x1f97, 0x1f28, 0x1f98, 0x1f29, 0x1f99, - 0x1f2a, 0x1f9a, 0x1f2b, 0x1f9b, 0x1f2c, 0x1f9c, 0x1f2d, 0x1f9d, - 0x1f2e, 0x1f9e, 0x1f2f, 0x1f9f, 0x1f60, 0x1fa0, 0x1f61, 0x1fa1, - 0x1f62, 0x1fa2, 0x1f63, 0x1fa3, 0x1f64, 0x1fa4, 0x1f65, 0x1fa5, - 0x1f66, 0x1fa6, 0x1f67, 0x1fa7, 0x1f68, 0x1fa8, 0x1f69, 0x1fa9, - 0x1f6a, 0x1faa, 0x1f6b, 0x1fab, 0x1f6c, 0x1fac, 0x1f6d, 0x1fad, - 0x1f6e, 0x1fae, 0x1f6f, 0x1faf, 0x1f70, 0x1fb2, 0x1f74, 0x1fc2, - 0x1f7c, 0x1ff2, 0x1fb6, 0x1fb7, 0x1fc6, 0x1fc7, 0x1ff6, 0x1ff7, - 0x1, 0x627, 0x622, 0x6, 0x627, 0x623, 0x648, 0x624, - 0x64a, 0x626, 0x6c1, 0x6c2, 0x6d2, 0x6d3, 0x6d5, 0x6c0, - 0x1, 0x627, 0x625, 0x3, 0x928, 0x929, 0x930, 0x931, - 0x933, 0x934, 0x1, 0x9c7, 0x9cb, 0x1, 0x9c7, 0x9cc, - 0x1, 0xb47, 0xb4b, 0x1, 0xb47, 0xb48, 0x1, 0xb47, - 0xb4c, 0x2, 0xbc6, 0xbca, 0xbc7, 0xbcb, 0x2, 0xb92, - 0xb94, 0xbc6, 0xbcc, 0x1, 0xc46, 0xc48, 0x1, 0xcc6, - 0xcca, 0x3, 0xcbf, 0xcc0, 0xcc6, 0xcc7, 0xcca, 0xccb, - 0x1, 0xcc6, 0xcc8, 0x2, 0xd46, 0xd4a, 0xd47, 0xd4b, - 0x1, 0xd46, 0xd4c, 0x2, 0xdd9, 0xdda, 0xddc, 0xddd, - 0x1, 0xdd9, 0xddc, 0x1, 0xdd9, 0xdde, 0x1, 0x1025, - 0x1026, 0xb, 0x1b05, 0x1b06, 0x1b07, 0x1b08, 0x1b09, 0x1b0a, - 0x1b0b, 0x1b0c, 0x1b0d, 0x1b0e, 0x1b11, 0x1b12, 0x1b3a, 0x1b3b, - 0x1b3c, 0x1b3d, 0x1b3e, 0x1b40, 0x1b3f, 0x1b41, 0x1b42, 0x1b43, - 0x30, 0x3046, 0x3094, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, - 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, - 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, - 0x3060, 0x3061, 0x3062, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, - 0x3069, 0x306f, 0x3070, 0x3072, 0x3073, 0x3075, 0x3076, 0x3078, - 0x3079, 0x307b, 0x307c, 0x309d, 0x309e, 0x30a6, 0x30f4, 0x30ab, - 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, - 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, - 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c4, - 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30cf, 0x30d0, 0x30d2, - 0x30d3, 0x30d5, 0x30d6, 0x30d8, 0x30d9, 0x30db, 0x30dc, 0x30ef, - 0x30f7, 0x30f0, 0x30f8, 0x30f1, 0x30f9, 0x30f2, 0x30fa, 0x30fd, - 0x30fe, 0xa, 0x306f, 0x3071, 0x3072, 0x3074, 0x3075, 0x3077, - 0x3078, 0x307a, 0x307b, 0x307d, 0x30cf, 0x30d1, 0x30d2, 0x30d4, - 0x30d5, 0x30d7, 0x30d8, 0x30da, 0x30db, 0x30dd, + 0x54, 0x41, 0xc0, 0x45, 0xc8, 0x49, 0xcc, 0x4e, + 0x1f8, 0x4f, 0xd2, 0x55, 0xd9, 0x57, 0x1e80, 0x59, + 0x1ef2, 0x61, 0xe0, 0x65, 0xe8, 0x69, 0xec, 0x6e, + 0x1f9, 0x6f, 0xf2, 0x75, 0xf9, 0x77, 0x1e81, 0x79, + 0x1ef3, 0xa8, 0x1fed, 0xc2, 0x1ea6, 0xca, 0x1ec0, 0xd4, + 0x1ed2, 0xdc, 0x1db, 0xe2, 0x1ea7, 0xea, 0x1ec1, 0xf4, + 0x1ed3, 0xfc, 0x1dc, 0x102, 0x1eb0, 0x103, 0x1eb1, 0x112, + 0x1e14, 0x113, 0x1e15, 0x14c, 0x1e50, 0x14d, 0x1e51, 0x1a0, + 0x1edc, 0x1a1, 0x1edd, 0x1af, 0x1eea, 0x1b0, 0x1eeb, 0x391, + 0x1fba, 0x395, 0x1fc8, 0x397, 0x1fca, 0x399, 0x1fda, 0x39f, + 0x1ff8, 0x3a5, 0x1fea, 0x3a9, 0x1ffa, 0x3b1, 0x1f70, 0x3b5, + 0x1f72, 0x3b7, 0x1f74, 0x3b9, 0x1f76, 0x3bf, 0x1f78, 0x3c5, + 0x1f7a, 0x3c9, 0x1f7c, 0x3ca, 0x1fd2, 0x3cb, 0x1fe2, 0x415, + 0x400, 0x418, 0x40d, 0x435, 0x450, 0x438, 0x45d, 0x1f00, + 0x1f02, 0x1f01, 0x1f03, 0x1f08, 0x1f0a, 0x1f09, 0x1f0b, 0x1f10, + 0x1f12, 0x1f11, 0x1f13, 0x1f18, 0x1f1a, 0x1f19, 0x1f1b, 0x1f20, + 0x1f22, 0x1f21, 0x1f23, 0x1f28, 0x1f2a, 0x1f29, 0x1f2b, 0x1f30, + 0x1f32, 0x1f31, 0x1f33, 0x1f38, 0x1f3a, 0x1f39, 0x1f3b, 0x1f40, + 0x1f42, 0x1f41, 0x1f43, 0x1f48, 0x1f4a, 0x1f49, 0x1f4b, 0x1f50, + 0x1f52, 0x1f51, 0x1f53, 0x1f59, 0x1f5b, 0x1f60, 0x1f62, 0x1f61, + 0x1f63, 0x1f68, 0x1f6a, 0x1f69, 0x1f6b, 0x1fbf, 0x1fcd, 0x1ffe, + 0x1fdd, 0x75, 0x41, 0xc1, 0x43, 0x106, 0x45, 0xc9, + 0x47, 0x1f4, 0x49, 0xcd, 0x4b, 0x1e30, 0x4c, 0x139, + 0x4d, 0x1e3e, 0x4e, 0x143, 0x4f, 0xd3, 0x50, 0x1e54, + 0x52, 0x154, 0x53, 0x15a, 0x55, 0xda, 0x57, 0x1e82, + 0x59, 0xdd, 0x5a, 0x179, 0x61, 0xe1, 0x63, 0x107, + 0x65, 0xe9, 0x67, 0x1f5, 0x69, 0xed, 0x6b, 0x1e31, + 0x6c, 0x13a, 0x6d, 0x1e3f, 0x6e, 0x144, 0x6f, 0xf3, + 0x70, 0x1e55, 0x72, 0x155, 0x73, 0x15b, 0x75, 0xfa, + 0x77, 0x1e83, 0x79, 0xfd, 0x7a, 0x17a, 0xa8, 0x385, + 0xc2, 0x1ea4, 0xc5, 0x1fa, 0xc6, 0x1fc, 0xc7, 0x1e08, + 0xca, 0x1ebe, 0xcf, 0x1e2e, 0xd4, 0x1ed0, 0xd5, 0x1e4c, + 0xd8, 0x1fe, 0xdc, 0x1d7, 0xe2, 0x1ea5, 0xe5, 0x1fb, + 0xe6, 0x1fd, 0xe7, 0x1e09, 0xea, 0x1ebf, 0xef, 0x1e2f, + 0xf4, 0x1ed1, 0xf5, 0x1e4d, 0xf8, 0x1ff, 0xfc, 0x1d8, + 0x102, 0x1eae, 0x103, 0x1eaf, 0x112, 0x1e16, 0x113, 0x1e17, + 0x14c, 0x1e52, 0x14d, 0x1e53, 0x168, 0x1e78, 0x169, 0x1e79, + 0x1a0, 0x1eda, 0x1a1, 0x1edb, 0x1af, 0x1ee8, 0x1b0, 0x1ee9, + 0x391, 0x386, 0x395, 0x388, 0x397, 0x389, 0x399, 0x38a, + 0x39f, 0x38c, 0x3a5, 0x38e, 0x3a9, 0x38f, 0x3b1, 0x3ac, + 0x3b5, 0x3ad, 0x3b7, 0x3ae, 0x3b9, 0x3af, 0x3bf, 0x3cc, + 0x3c5, 0x3cd, 0x3c9, 0x3ce, 0x3ca, 0x390, 0x3cb, 0x3b0, + 0x3d2, 0x3d3, 0x413, 0x403, 0x41a, 0x40c, 0x433, 0x453, + 0x43a, 0x45c, 0x1f00, 0x1f04, 0x1f01, 0x1f05, 0x1f08, 0x1f0c, + 0x1f09, 0x1f0d, 0x1f10, 0x1f14, 0x1f11, 0x1f15, 0x1f18, 0x1f1c, + 0x1f19, 0x1f1d, 0x1f20, 0x1f24, 0x1f21, 0x1f25, 0x1f28, 0x1f2c, + 0x1f29, 0x1f2d, 0x1f30, 0x1f34, 0x1f31, 0x1f35, 0x1f38, 0x1f3c, + 0x1f39, 0x1f3d, 0x1f40, 0x1f44, 0x1f41, 0x1f45, 0x1f48, 0x1f4c, + 0x1f49, 0x1f4d, 0x1f50, 0x1f54, 0x1f51, 0x1f55, 0x1f59, 0x1f5d, + 0x1f60, 0x1f64, 0x1f61, 0x1f65, 0x1f68, 0x1f6c, 0x1f69, 0x1f6d, + 0x1fbf, 0x1fce, 0x1ffe, 0x1fde, 0x20, 0x41, 0xc2, 0x43, + 0x108, 0x45, 0xca, 0x47, 0x11c, 0x48, 0x124, 0x49, + 0xce, 0x4a, 0x134, 0x4f, 0xd4, 0x53, 0x15c, 0x55, + 0xdb, 0x57, 0x174, 0x59, 0x176, 0x5a, 0x1e90, 0x61, + 0xe2, 0x63, 0x109, 0x65, 0xea, 0x67, 0x11d, 0x68, + 0x125, 0x69, 0xee, 0x6a, 0x135, 0x6f, 0xf4, 0x73, + 0x15d, 0x75, 0xfb, 0x77, 0x175, 0x79, 0x177, 0x7a, + 0x1e91, 0x1ea0, 0x1eac, 0x1ea1, 0x1ead, 0x1eb8, 0x1ec6, 0x1eb9, + 0x1ec7, 0x1ecc, 0x1ed8, 0x1ecd, 0x1ed9, 0x1c, 0x41, 0xc3, + 0x45, 0x1ebc, 0x49, 0x128, 0x4e, 0xd1, 0x4f, 0xd5, + 0x55, 0x168, 0x56, 0x1e7c, 0x59, 0x1ef8, 0x61, 0xe3, + 0x65, 0x1ebd, 0x69, 0x129, 0x6e, 0xf1, 0x6f, 0xf5, + 0x75, 0x169, 0x76, 0x1e7d, 0x79, 0x1ef9, 0xc2, 0x1eaa, + 0xca, 0x1ec4, 0xd4, 0x1ed6, 0xe2, 0x1eab, 0xea, 0x1ec5, + 0xf4, 0x1ed7, 0x102, 0x1eb4, 0x103, 0x1eb5, 0x1a0, 0x1ee0, + 0x1a1, 0x1ee1, 0x1af, 0x1eee, 0x1b0, 0x1eef, 0x2c, 0x41, + 0x100, 0x45, 0x112, 0x47, 0x1e20, 0x49, 0x12a, 0x4f, + 0x14c, 0x55, 0x16a, 0x59, 0x232, 0x61, 0x101, 0x65, + 0x113, 0x67, 0x1e21, 0x69, 0x12b, 0x6f, 0x14d, 0x75, + 0x16b, 0x79, 0x233, 0xc4, 0x1de, 0xc6, 0x1e2, 0xd5, + 0x22c, 0xd6, 0x22a, 0xdc, 0x1d5, 0xe4, 0x1df, 0xe6, + 0x1e3, 0xf5, 0x22d, 0xf6, 0x22b, 0xfc, 0x1d6, 0x1ea, + 0x1ec, 0x1eb, 0x1ed, 0x226, 0x1e0, 0x227, 0x1e1, 0x22e, + 0x230, 0x22f, 0x231, 0x391, 0x1fb9, 0x399, 0x1fd9, 0x3a5, + 0x1fe9, 0x3b1, 0x1fb1, 0x3b9, 0x1fd1, 0x3c5, 0x1fe1, 0x418, + 0x4e2, 0x423, 0x4ee, 0x438, 0x4e3, 0x443, 0x4ef, 0x1e36, + 0x1e38, 0x1e37, 0x1e39, 0x1e5a, 0x1e5c, 0x1e5b, 0x1e5d, 0x20, + 0x41, 0x102, 0x45, 0x114, 0x47, 0x11e, 0x49, 0x12c, + 0x4f, 0x14e, 0x55, 0x16c, 0x61, 0x103, 0x65, 0x115, + 0x67, 0x11f, 0x69, 0x12d, 0x6f, 0x14f, 0x75, 0x16d, + 0x228, 0x1e1c, 0x229, 0x1e1d, 0x391, 0x1fb8, 0x399, 0x1fd8, + 0x3a5, 0x1fe8, 0x3b1, 0x1fb0, 0x3b9, 0x1fd0, 0x3c5, 0x1fe0, + 0x410, 0x4d0, 0x415, 0x4d6, 0x416, 0x4c1, 0x418, 0x419, + 0x423, 0x40e, 0x430, 0x4d1, 0x435, 0x4d7, 0x436, 0x4c2, + 0x438, 0x439, 0x443, 0x45e, 0x1ea0, 0x1eb6, 0x1ea1, 0x1eb7, + 0x2e, 0x41, 0x226, 0x42, 0x1e02, 0x43, 0x10a, 0x44, + 0x1e0a, 0x45, 0x116, 0x46, 0x1e1e, 0x47, 0x120, 0x48, + 0x1e22, 0x49, 0x130, 0x4d, 0x1e40, 0x4e, 0x1e44, 0x4f, + 0x22e, 0x50, 0x1e56, 0x52, 0x1e58, 0x53, 0x1e60, 0x54, + 0x1e6a, 0x57, 0x1e86, 0x58, 0x1e8a, 0x59, 0x1e8e, 0x5a, + 0x17b, 0x61, 0x227, 0x62, 0x1e03, 0x63, 0x10b, 0x64, + 0x1e0b, 0x65, 0x117, 0x66, 0x1e1f, 0x67, 0x121, 0x68, + 0x1e23, 0x6d, 0x1e41, 0x6e, 0x1e45, 0x6f, 0x22f, 0x70, + 0x1e57, 0x72, 0x1e59, 0x73, 0x1e61, 0x74, 0x1e6b, 0x77, + 0x1e87, 0x78, 0x1e8b, 0x79, 0x1e8f, 0x7a, 0x17c, 0x15a, + 0x1e64, 0x15b, 0x1e65, 0x160, 0x1e66, 0x161, 0x1e67, 0x17f, + 0x1e9b, 0x1e62, 0x1e68, 0x1e63, 0x1e69, 0x36, 0x41, 0xc4, + 0x45, 0xcb, 0x48, 0x1e26, 0x49, 0xcf, 0x4f, 0xd6, + 0x55, 0xdc, 0x57, 0x1e84, 0x58, 0x1e8c, 0x59, 0x178, + 0x61, 0xe4, 0x65, 0xeb, 0x68, 0x1e27, 0x69, 0xef, + 0x6f, 0xf6, 0x74, 0x1e97, 0x75, 0xfc, 0x77, 0x1e85, + 0x78, 0x1e8d, 0x79, 0xff, 0xd5, 0x1e4e, 0xf5, 0x1e4f, + 0x16a, 0x1e7a, 0x16b, 0x1e7b, 0x399, 0x3aa, 0x3a5, 0x3ab, + 0x3b9, 0x3ca, 0x3c5, 0x3cb, 0x3d2, 0x3d4, 0x406, 0x407, + 0x410, 0x4d2, 0x415, 0x401, 0x416, 0x4dc, 0x417, 0x4de, + 0x418, 0x4e4, 0x41e, 0x4e6, 0x423, 0x4f0, 0x427, 0x4f4, + 0x42b, 0x4f8, 0x42d, 0x4ec, 0x430, 0x4d3, 0x435, 0x451, + 0x436, 0x4dd, 0x437, 0x4df, 0x438, 0x4e5, 0x43e, 0x4e7, + 0x443, 0x4f1, 0x447, 0x4f5, 0x44b, 0x4f9, 0x44d, 0x4ed, + 0x456, 0x457, 0x4d8, 0x4da, 0x4d9, 0x4db, 0x4e8, 0x4ea, + 0x4e9, 0x4eb, 0x18, 0x41, 0x1ea2, 0x45, 0x1eba, 0x49, + 0x1ec8, 0x4f, 0x1ece, 0x55, 0x1ee6, 0x59, 0x1ef6, 0x61, + 0x1ea3, 0x65, 0x1ebb, 0x69, 0x1ec9, 0x6f, 0x1ecf, 0x75, + 0x1ee7, 0x79, 0x1ef7, 0xc2, 0x1ea8, 0xca, 0x1ec2, 0xd4, + 0x1ed4, 0xe2, 0x1ea9, 0xea, 0x1ec3, 0xf4, 0x1ed5, 0x102, + 0x1eb2, 0x103, 0x1eb3, 0x1a0, 0x1ede, 0x1a1, 0x1edf, 0x1af, + 0x1eec, 0x1b0, 0x1eed, 0x6, 0x41, 0xc5, 0x55, 0x16e, + 0x61, 0xe5, 0x75, 0x16f, 0x77, 0x1e98, 0x79, 0x1e99, + 0x6, 0x4f, 0x150, 0x55, 0x170, 0x6f, 0x151, 0x75, + 0x171, 0x423, 0x4f2, 0x443, 0x4f3, 0x25, 0x41, 0x1cd, + 0x43, 0x10c, 0x44, 0x10e, 0x45, 0x11a, 0x47, 0x1e6, + 0x48, 0x21e, 0x49, 0x1cf, 0x4b, 0x1e8, 0x4c, 0x13d, + 0x4e, 0x147, 0x4f, 0x1d1, 0x52, 0x158, 0x53, 0x160, + 0x54, 0x164, 0x55, 0x1d3, 0x5a, 0x17d, 0x61, 0x1ce, + 0x63, 0x10d, 0x64, 0x10f, 0x65, 0x11b, 0x67, 0x1e7, + 0x68, 0x21f, 0x69, 0x1d0, 0x6a, 0x1f0, 0x6b, 0x1e9, + 0x6c, 0x13e, 0x6e, 0x148, 0x6f, 0x1d2, 0x72, 0x159, + 0x73, 0x161, 0x74, 0x165, 0x75, 0x1d4, 0x7a, 0x17e, + 0xdc, 0x1d9, 0xfc, 0x1da, 0x1b7, 0x1ee, 0x292, 0x1ef, + 0xe, 0x41, 0x200, 0x45, 0x204, 0x49, 0x208, 0x4f, + 0x20c, 0x52, 0x210, 0x55, 0x214, 0x61, 0x201, 0x65, + 0x205, 0x69, 0x209, 0x6f, 0x20d, 0x72, 0x211, 0x75, + 0x215, 0x474, 0x476, 0x475, 0x477, 0xc, 0x41, 0x202, + 0x45, 0x206, 0x49, 0x20a, 0x4f, 0x20e, 0x52, 0x212, + 0x55, 0x216, 0x61, 0x203, 0x65, 0x207, 0x69, 0x20b, + 0x6f, 0x20f, 0x72, 0x213, 0x75, 0x217, 0xe, 0x391, + 0x1f08, 0x395, 0x1f18, 0x397, 0x1f28, 0x399, 0x1f38, 0x39f, + 0x1f48, 0x3a9, 0x1f68, 0x3b1, 0x1f00, 0x3b5, 0x1f10, 0x3b7, + 0x1f20, 0x3b9, 0x1f30, 0x3bf, 0x1f40, 0x3c1, 0x1fe4, 0x3c5, + 0x1f50, 0x3c9, 0x1f60, 0x10, 0x391, 0x1f09, 0x395, 0x1f19, + 0x397, 0x1f29, 0x399, 0x1f39, 0x39f, 0x1f49, 0x3a1, 0x1fec, + 0x3a5, 0x1f59, 0x3a9, 0x1f69, 0x3b1, 0x1f01, 0x3b5, 0x1f11, + 0x3b7, 0x1f21, 0x3b9, 0x1f31, 0x3bf, 0x1f41, 0x3c1, 0x1fe5, + 0x3c5, 0x1f51, 0x3c9, 0x1f61, 0x4, 0x4f, 0x1a0, 0x55, + 0x1af, 0x6f, 0x1a1, 0x75, 0x1b0, 0x2a, 0x41, 0x1ea0, + 0x42, 0x1e04, 0x44, 0x1e0c, 0x45, 0x1eb8, 0x48, 0x1e24, + 0x49, 0x1eca, 0x4b, 0x1e32, 0x4c, 0x1e36, 0x4d, 0x1e42, + 0x4e, 0x1e46, 0x4f, 0x1ecc, 0x52, 0x1e5a, 0x53, 0x1e62, + 0x54, 0x1e6c, 0x55, 0x1ee4, 0x56, 0x1e7e, 0x57, 0x1e88, + 0x59, 0x1ef4, 0x5a, 0x1e92, 0x61, 0x1ea1, 0x62, 0x1e05, + 0x64, 0x1e0d, 0x65, 0x1eb9, 0x68, 0x1e25, 0x69, 0x1ecb, + 0x6b, 0x1e33, 0x6c, 0x1e37, 0x6d, 0x1e43, 0x6e, 0x1e47, + 0x6f, 0x1ecd, 0x72, 0x1e5b, 0x73, 0x1e63, 0x74, 0x1e6d, + 0x75, 0x1ee5, 0x76, 0x1e7f, 0x77, 0x1e89, 0x79, 0x1ef5, + 0x7a, 0x1e93, 0x1a0, 0x1ee2, 0x1a1, 0x1ee3, 0x1af, 0x1ef0, + 0x1b0, 0x1ef1, 0x2, 0x55, 0x1e72, 0x75, 0x1e73, 0x2, + 0x41, 0x1e00, 0x61, 0x1e01, 0x4, 0x53, 0x218, 0x54, + 0x21a, 0x73, 0x219, 0x74, 0x21b, 0x16, 0x43, 0xc7, + 0x44, 0x1e10, 0x45, 0x228, 0x47, 0x122, 0x48, 0x1e28, + 0x4b, 0x136, 0x4c, 0x13b, 0x4e, 0x145, 0x52, 0x156, + 0x53, 0x15e, 0x54, 0x162, 0x63, 0xe7, 0x64, 0x1e11, + 0x65, 0x229, 0x67, 0x123, 0x68, 0x1e29, 0x6b, 0x137, + 0x6c, 0x13c, 0x6e, 0x146, 0x72, 0x157, 0x73, 0x15f, + 0x74, 0x163, 0xa, 0x41, 0x104, 0x45, 0x118, 0x49, + 0x12e, 0x4f, 0x1ea, 0x55, 0x172, 0x61, 0x105, 0x65, + 0x119, 0x69, 0x12f, 0x6f, 0x1eb, 0x75, 0x173, 0xc, + 0x44, 0x1e12, 0x45, 0x1e18, 0x4c, 0x1e3c, 0x4e, 0x1e4a, + 0x54, 0x1e70, 0x55, 0x1e76, 0x64, 0x1e13, 0x65, 0x1e19, + 0x6c, 0x1e3d, 0x6e, 0x1e4b, 0x74, 0x1e71, 0x75, 0x1e77, + 0x2, 0x48, 0x1e2a, 0x68, 0x1e2b, 0x6, 0x45, 0x1e1a, + 0x49, 0x1e2c, 0x55, 0x1e74, 0x65, 0x1e1b, 0x69, 0x1e2d, + 0x75, 0x1e75, 0x11, 0x42, 0x1e06, 0x44, 0x1e0e, 0x4b, + 0x1e34, 0x4c, 0x1e3a, 0x4e, 0x1e48, 0x52, 0x1e5e, 0x54, + 0x1e6e, 0x5a, 0x1e94, 0x62, 0x1e07, 0x64, 0x1e0f, 0x68, + 0x1e96, 0x6b, 0x1e35, 0x6c, 0x1e3b, 0x6e, 0x1e49, 0x72, + 0x1e5f, 0x74, 0x1e6f, 0x7a, 0x1e95, 0x2c, 0x3c, 0x226e, + 0x3d, 0x2260, 0x3e, 0x226f, 0x2190, 0x219a, 0x2192, 0x219b, + 0x2194, 0x21ae, 0x21d0, 0x21cd, 0x21d2, 0x21cf, 0x21d4, 0x21ce, + 0x2203, 0x2204, 0x2208, 0x2209, 0x220b, 0x220c, 0x2223, 0x2224, + 0x2225, 0x2226, 0x223c, 0x2241, 0x2243, 0x2244, 0x2245, 0x2247, + 0x2248, 0x2249, 0x224d, 0x226d, 0x2261, 0x2262, 0x2264, 0x2270, + 0x2265, 0x2271, 0x2272, 0x2274, 0x2273, 0x2275, 0x2276, 0x2278, + 0x2277, 0x2279, 0x227a, 0x2280, 0x227b, 0x2281, 0x227c, 0x22e0, + 0x227d, 0x22e1, 0x2282, 0x2284, 0x2283, 0x2285, 0x2286, 0x2288, + 0x2287, 0x2289, 0x2291, 0x22e2, 0x2292, 0x22e3, 0x22a2, 0x22ac, + 0x22a8, 0x22ad, 0x22a9, 0x22ae, 0x22ab, 0x22af, 0x22b2, 0x22ea, + 0x22b3, 0x22eb, 0x22b4, 0x22ec, 0x22b5, 0x22ed, 0x1d, 0xa8, + 0x1fc1, 0x3b1, 0x1fb6, 0x3b7, 0x1fc6, 0x3b9, 0x1fd6, 0x3c5, + 0x1fe6, 0x3c9, 0x1ff6, 0x3ca, 0x1fd7, 0x3cb, 0x1fe7, 0x1f00, + 0x1f06, 0x1f01, 0x1f07, 0x1f08, 0x1f0e, 0x1f09, 0x1f0f, 0x1f20, + 0x1f26, 0x1f21, 0x1f27, 0x1f28, 0x1f2e, 0x1f29, 0x1f2f, 0x1f30, + 0x1f36, 0x1f31, 0x1f37, 0x1f38, 0x1f3e, 0x1f39, 0x1f3f, 0x1f50, + 0x1f56, 0x1f51, 0x1f57, 0x1f59, 0x1f5f, 0x1f60, 0x1f66, 0x1f61, + 0x1f67, 0x1f68, 0x1f6e, 0x1f69, 0x1f6f, 0x1fbf, 0x1fcf, 0x1ffe, + 0x1fdf, 0x3f, 0x391, 0x1fbc, 0x397, 0x1fcc, 0x3a9, 0x1ffc, + 0x3ac, 0x1fb4, 0x3ae, 0x1fc4, 0x3b1, 0x1fb3, 0x3b7, 0x1fc3, + 0x3c9, 0x1ff3, 0x3ce, 0x1ff4, 0x1f00, 0x1f80, 0x1f01, 0x1f81, + 0x1f02, 0x1f82, 0x1f03, 0x1f83, 0x1f04, 0x1f84, 0x1f05, 0x1f85, + 0x1f06, 0x1f86, 0x1f07, 0x1f87, 0x1f08, 0x1f88, 0x1f09, 0x1f89, + 0x1f0a, 0x1f8a, 0x1f0b, 0x1f8b, 0x1f0c, 0x1f8c, 0x1f0d, 0x1f8d, + 0x1f0e, 0x1f8e, 0x1f0f, 0x1f8f, 0x1f20, 0x1f90, 0x1f21, 0x1f91, + 0x1f22, 0x1f92, 0x1f23, 0x1f93, 0x1f24, 0x1f94, 0x1f25, 0x1f95, + 0x1f26, 0x1f96, 0x1f27, 0x1f97, 0x1f28, 0x1f98, 0x1f29, 0x1f99, + 0x1f2a, 0x1f9a, 0x1f2b, 0x1f9b, 0x1f2c, 0x1f9c, 0x1f2d, 0x1f9d, + 0x1f2e, 0x1f9e, 0x1f2f, 0x1f9f, 0x1f60, 0x1fa0, 0x1f61, 0x1fa1, + 0x1f62, 0x1fa2, 0x1f63, 0x1fa3, 0x1f64, 0x1fa4, 0x1f65, 0x1fa5, + 0x1f66, 0x1fa6, 0x1f67, 0x1fa7, 0x1f68, 0x1fa8, 0x1f69, 0x1fa9, + 0x1f6a, 0x1faa, 0x1f6b, 0x1fab, 0x1f6c, 0x1fac, 0x1f6d, 0x1fad, + 0x1f6e, 0x1fae, 0x1f6f, 0x1faf, 0x1f70, 0x1fb2, 0x1f74, 0x1fc2, + 0x1f7c, 0x1ff2, 0x1fb6, 0x1fb7, 0x1fc6, 0x1fc7, 0x1ff6, 0x1ff7, + 0x1, 0x627, 0x622, 0x6, 0x627, 0x623, 0x648, 0x624, + 0x64a, 0x626, 0x6c1, 0x6c2, 0x6d2, 0x6d3, 0x6d5, 0x6c0, + 0x1, 0x627, 0x625, 0x3, 0x928, 0x929, 0x930, 0x931, + 0x933, 0x934, 0x1, 0x9c7, 0x9cb, 0x1, 0x9c7, 0x9cc, + 0x1, 0xb47, 0xb4b, 0x1, 0xb47, 0xb48, 0x1, 0xb47, + 0xb4c, 0x2, 0xbc6, 0xbca, 0xbc7, 0xbcb, 0x2, 0xb92, + 0xb94, 0xbc6, 0xbcc, 0x1, 0xc46, 0xc48, 0x1, 0xcc6, + 0xcca, 0x3, 0xcbf, 0xcc0, 0xcc6, 0xcc7, 0xcca, 0xccb, + 0x1, 0xcc6, 0xcc8, 0x2, 0xd46, 0xd4a, 0xd47, 0xd4b, + 0x1, 0xd46, 0xd4c, 0x2, 0xdd9, 0xdda, 0xddc, 0xddd, + 0x1, 0xdd9, 0xddc, 0x1, 0xdd9, 0xdde, 0x1, 0x1025, + 0x1026, 0xb, 0x1b05, 0x1b06, 0x1b07, 0x1b08, 0x1b09, 0x1b0a, + 0x1b0b, 0x1b0c, 0x1b0d, 0x1b0e, 0x1b11, 0x1b12, 0x1b3a, 0x1b3b, + 0x1b3c, 0x1b3d, 0x1b3e, 0x1b40, 0x1b3f, 0x1b41, 0x1b42, 0x1b43, + 0x30, 0x3046, 0x3094, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, + 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, + 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, + 0x3060, 0x3061, 0x3062, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, + 0x3069, 0x306f, 0x3070, 0x3072, 0x3073, 0x3075, 0x3076, 0x3078, + 0x3079, 0x307b, 0x307c, 0x309d, 0x309e, 0x30a6, 0x30f4, 0x30ab, + 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, + 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, + 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c4, + 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30cf, 0x30d0, 0x30d2, + 0x30d3, 0x30d5, 0x30d6, 0x30d8, 0x30d9, 0x30db, 0x30dc, 0x30ef, + 0x30f7, 0x30f0, 0x30f8, 0x30f1, 0x30f9, 0x30f2, 0x30fa, 0x30fd, + 0x30fe, 0xa, 0x306f, 0x3071, 0x3072, 0x3074, 0x3075, 0x3077, + 0x3078, 0x307a, 0x307b, 0x307d, 0x30cf, 0x30d1, 0x30d2, 0x30d4, + 0x30d5, 0x30d7, 0x30d8, 0x30da, 0x30db, 0x30dd, }; struct NormalizationCorrection { diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index ce426e7..625dee7 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -81,8 +81,8 @@ namespace QUnicodeTables { ushort wordBreak : 8; ushort sentenceBreak : 8; }; - Q_CORE_EXPORT const Properties* QT_FASTCALL properties(uint ucs4); - Q_CORE_EXPORT const Properties* QT_FASTCALL properties(ushort ucs2); + Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4); + Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2); // See http://www.unicode.org/reports/tr24/tr24-5.html -- cgit v0.12 From 8a8c9a2f668bedc7dd7ecf1f4f025a1587ca9fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Wed, 1 Jul 2009 12:03:52 +0200 Subject: Fix a few typos Merge-request: 788 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qapplication_mac.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index ad9f220..e7d5a79 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1069,7 +1069,7 @@ void qt_init(QApplicationPrivate *priv, int) if (GetCurrentProcess(&psn) == noErr) { // Jambi needs to transform itself since most people aren't "used" // to putting things in bundles, but other people may actually not - // want to tranform the process (running as a helper or somethng) + // want to tranform the process (running as a helper or something) // so don't do that for them. This means checking both LSUIElement // and LSBackgroundOnly. If you set them both... well, you // shouldn't do that. @@ -1760,7 +1760,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event if(window) { HIViewRef hiview; if(HIViewGetViewForMouseEvent(HIViewGetRoot(window), event, &hiview) == noErr) { - widget = QWidget::find((WId)hiview);; + widget = QWidget::find((WId)hiview); if (widget) { // Make sure we didn't pass over a widget with a "fake hole" in it. QWidget *otherWidget = QApplication::widgetAt(where.h, where.v); @@ -1878,8 +1878,8 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event QMacTabletHash *tabletHash = qt_mac_tablet_hash(); if (!tabletHash->contains(tabletPointRec.deviceID)) { - qWarning("QCocoaView handleTabletEvent: This tablet device is unknown" - " (received no proximity event for it). Discarding event."); + qWarning("handleTabletEvent: This tablet device is unknown" + " (received no proximity event for it). Discarding event."); return false; } QTabletDeviceData &deviceData = tabletHash->operator[](tabletPointRec.deviceID); @@ -1922,7 +1922,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event QApplication::sendSpontaneousEvent(widget, &e); if (e.isAccepted()) { #if defined(DEBUG_MOUSE_MAPS) - qDebug("Bail out early due to table acceptance"); + qDebug("Bail out early due to tablet acceptance"); #endif break; } -- cgit v0.12 From 82e825ed841bce324a6892fcbace03f9936d4f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Wed, 1 Jul 2009 12:03:54 +0200 Subject: Fix tablet events Tablet events should set the qt_button_down, otherwise if the tablet moves onto a widget that does not accept a tablet event, it will set qt_button_down and effectively "grab" the mouse. However, we should only do this if we accept the tablet event. Merge-request: 788 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qapplication_mac.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index e7d5a79..04f4cc9 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1921,6 +1921,11 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event tp, rotation, z, modifiers, deviceData.tabletUniqueID); QApplication::sendSpontaneousEvent(widget, &e); if (e.isAccepted()) { + if (t == QEvent::TabletPress) { + qt_button_down = widget; + } else if (t == QEvent::TabletRelease) { + qt_button_down = 0; + } #if defined(DEBUG_MOUSE_MAPS) qDebug("Bail out early due to tablet acceptance"); #endif -- cgit v0.12 From 3618227de7036a091ea8187a20434470c0c792dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Wed, 1 Jul 2009 12:03:55 +0200 Subject: Never discard TabletRelease events as they may be delivered *after* TabletLeaveProximity events Merge-request: 788 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qapplication_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 04f4cc9..ce4e422 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1877,7 +1877,8 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event tablet_button_state = new_tablet_button_state; QMacTabletHash *tabletHash = qt_mac_tablet_hash(); - if (!tabletHash->contains(tabletPointRec.deviceID)) { + if (!tabletHash->contains(tabletPointRec.deviceID) && t != QEvent::TabletRelease) { + // Never discard TabletRelease events as they may be delivered *after* TabletLeaveProximity events qWarning("handleTabletEvent: This tablet device is unknown" " (received no proximity event for it). Discarding event."); return false; -- cgit v0.12 From ac8e76bc6d7cc3dbb1e64949bc6034697d9d9ba1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 1 Jul 2009 12:29:26 +0200 Subject: doc: Changed wording in some stub callbacks. --- src/xml/sax/qxml.cpp | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index d776cc4..6be6988 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -2403,7 +2403,7 @@ events are reported. /*! \reimp - Does nothing. + This reimplementation does nothing. */ void QXmlDefaultHandler::setDocumentLocator(QXmlLocator*) { @@ -2412,7 +2412,7 @@ void QXmlDefaultHandler::setDocumentLocator(QXmlLocator*) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::startDocument() { @@ -2422,7 +2422,7 @@ bool QXmlDefaultHandler::startDocument() /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::endDocument() { @@ -2432,7 +2432,7 @@ bool QXmlDefaultHandler::endDocument() /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::startPrefixMapping(const QString&, const QString&) { @@ -2442,7 +2442,7 @@ bool QXmlDefaultHandler::startPrefixMapping(const QString&, const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::endPrefixMapping(const QString&) { @@ -2452,7 +2452,7 @@ bool QXmlDefaultHandler::endPrefixMapping(const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::startElement(const QString&, const QString&, const QString&, const QXmlAttributes&) @@ -2463,7 +2463,7 @@ bool QXmlDefaultHandler::startElement(const QString&, const QString&, /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::endElement(const QString&, const QString&, const QString&) @@ -2474,7 +2474,7 @@ bool QXmlDefaultHandler::endElement(const QString&, const QString&, /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::characters(const QString&) { @@ -2484,7 +2484,7 @@ bool QXmlDefaultHandler::characters(const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::ignorableWhitespace(const QString&) { @@ -2494,7 +2494,7 @@ bool QXmlDefaultHandler::ignorableWhitespace(const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::processingInstruction(const QString&, const QString&) @@ -2505,7 +2505,7 @@ bool QXmlDefaultHandler::processingInstruction(const QString&, /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::skippedEntity(const QString&) { @@ -2515,7 +2515,7 @@ bool QXmlDefaultHandler::skippedEntity(const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::warning(const QXmlParseException&) { @@ -2525,7 +2525,7 @@ bool QXmlDefaultHandler::warning(const QXmlParseException&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::error(const QXmlParseException&) { @@ -2535,7 +2535,7 @@ bool QXmlDefaultHandler::error(const QXmlParseException&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::fatalError(const QXmlParseException&) { @@ -2545,7 +2545,7 @@ bool QXmlDefaultHandler::fatalError(const QXmlParseException&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::notationDecl(const QString&, const QString&, const QString&) @@ -2556,7 +2556,7 @@ bool QXmlDefaultHandler::notationDecl(const QString&, const QString&, /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::unparsedEntityDecl(const QString&, const QString&, const QString&, const QString&) @@ -2590,7 +2590,7 @@ QString QXmlDefaultHandler::errorString() const /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::startDTD(const QString&, const QString&, const QString&) { @@ -2600,7 +2600,7 @@ bool QXmlDefaultHandler::startDTD(const QString&, const QString&, const QString& /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::endDTD() { @@ -2610,7 +2610,7 @@ bool QXmlDefaultHandler::endDTD() /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::startEntity(const QString&) { @@ -2620,7 +2620,7 @@ bool QXmlDefaultHandler::startEntity(const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::endEntity(const QString&) { @@ -2630,7 +2630,7 @@ bool QXmlDefaultHandler::endEntity(const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::startCDATA() { @@ -2640,7 +2640,7 @@ bool QXmlDefaultHandler::startCDATA() /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::endCDATA() { @@ -2650,7 +2650,7 @@ bool QXmlDefaultHandler::endCDATA() /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::comment(const QString&) { @@ -2660,7 +2660,7 @@ bool QXmlDefaultHandler::comment(const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::attributeDecl(const QString&, const QString&, const QString&, const QString&, const QString&) { @@ -2670,7 +2670,7 @@ bool QXmlDefaultHandler::attributeDecl(const QString&, const QString&, const QSt /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::internalEntityDecl(const QString&, const QString&) { @@ -2680,7 +2680,7 @@ bool QXmlDefaultHandler::internalEntityDecl(const QString&, const QString&) /*! \reimp - Does nothing. + This reimplementation does nothing. */ bool QXmlDefaultHandler::externalEntityDecl(const QString&, const QString&, const QString&) { -- cgit v0.12 From 9da6a1d34f1d06879ba9d72e9ad15bf261aea8c9 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 1 Jul 2009 13:29:58 +0200 Subject: Doc: correcting typo Correcting typos Task-number: 257225 --- src/gui/itemviews/qitemdelegate.cpp | 2 +- src/gui/itemviews/qstyleditemdelegate.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 264fa37..2dd5540 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -574,7 +574,7 @@ void QItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) con } /*! - Gets data drom the \a editor widget and stores it in the specified + Gets data from the \a editor widget and stores it in the specified \a model at the item \a index. The default implementation gets the value to be stored in the data diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index e528e58..edca724 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -508,7 +508,7 @@ void QStyledItemDelegate::setEditorData(QWidget *editor, const QModelIndex &inde } /*! - Gets data drom the \a editor widget and stores it in the specified + Gets data from the \a editor widget and stores it in the specified \a model at the item \a index. The default implementation gets the value to be stored in the data -- cgit v0.12 From f3a6f4dc01f9d6c5c167a94ae49acff35ccc0c11 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 1 Jul 2009 13:53:28 +0200 Subject: Fixed the build on Windows after regenerating the unicode tables. Reviewed-by: trustme --- src/corelib/tools/qunicodetables.cpp | 4 ++-- util/unicode/main.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp index 0387181..c103016 100644 --- a/src/corelib/tools/qunicodetables.cpp +++ b/src/corelib/tools/qunicodetables.cpp @@ -4336,13 +4336,13 @@ static inline const QUnicodeTables::Properties *qGetProp(ushort ucs2) return uc_properties + index; } -Q_CORE_EXPORT const QUnicodeTables::Properties *QUnicodeTables::properties(uint ucs4) +Q_CORE_EXPORT const QUnicodeTables::Properties * QT_FASTCALL QUnicodeTables::properties(uint ucs4) { int index = GET_PROP_INDEX(ucs4); return uc_properties + index; } -Q_CORE_EXPORT const QUnicodeTables::Properties *QUnicodeTables::properties(ushort ucs2) +Q_CORE_EXPORT const QUnicodeTables::Properties * QT_FASTCALL QUnicodeTables::properties(ushort ucs2) { int index = GET_PROP_INDEX_UCS2(ucs2); return uc_properties + index; diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index 3c32e6d..c24486b 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -2052,13 +2052,13 @@ static QByteArray createPropertyInfo() " return uc_properties + index;\n" "}\n" "\n" - "Q_CORE_EXPORT const QUnicodeTables::Properties *QUnicodeTables::properties(uint ucs4)\n" + "Q_CORE_EXPORT const QUnicodeTables::Properties * QT_FASTCALL QUnicodeTables::properties(uint ucs4)\n" "{\n" " int index = GET_PROP_INDEX(ucs4);\n" " return uc_properties + index;\n" "}\n" "\n" - "Q_CORE_EXPORT const QUnicodeTables::Properties *QUnicodeTables::properties(ushort ucs2)\n" + "Q_CORE_EXPORT const QUnicodeTables::Properties * QT_FASTCALL QUnicodeTables::properties(ushort ucs2)\n" "{\n" " int index = GET_PROP_INDEX_UCS2(ucs2);\n" " return uc_properties + index;\n" -- cgit v0.12 From d43a10d6d9a5f13fc8deac052926720927e09e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 1 Jul 2009 13:53:41 +0200 Subject: Compiler warnings. --- src/gui/graphicsview/qgraphicsitem.cpp | 2 ++ src/gui/graphicsview/qgraphicsproxywidget.cpp | 1 - src/gui/graphicsview/qgraphicsscene.cpp | 2 +- src/gui/kernel/qwidget.cpp | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e8ed97f..2223f5d 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -6329,6 +6329,8 @@ void QGraphicsItem::releaseGesture(int gestureId) */ void QGraphicsItem::setGestureEnabled(int gestureId, bool enable) { + Q_UNUSED(gestureId); + Q_UNUSED(enable); //### } diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index ab94679..f081222 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -878,7 +878,6 @@ bool QGraphicsProxyWidget::event(QEvent *event) case QEvent::GraphicsSceneGesture: { qDebug() << "QGraphicsProxyWidget: graphicsscenegesture"; if (d->widget && d->widget->isVisible()) { - QGraphicsSceneGestureEvent *ge = static_cast(event); //### TODO: widget->childAt(): decompose gesture event and find widget under hotspots. //QGestureManager::instance()->sendGestureEvent(d->widget, ge->gestures().toSet(), ge->cancelledGestures()); return true; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index d790640..e50ee94 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4122,7 +4122,6 @@ void QGraphicsScenePrivate::sendGestureEvent(const QSet &gestures, co continue; } QGesturePrivate *gd = g->d_func(); - QGraphicsItem *item = gd->graphicsItem; gd->graphicsItem = 0; //### THIS IS BS, DONT FORGET TO REWRITE THIS CODE @@ -6042,6 +6041,7 @@ void QGraphicsScenePrivate::grabGesture(QGraphicsItem *item, int gestureId) void QGraphicsScenePrivate::releaseGesture(QGraphicsItem *item, int gestureId) { + Q_UNUSED(gestureId); itemsWithGestures.remove(item); //### } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 1b31318..9a834aa 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11110,6 +11110,8 @@ void QWidget::releaseGesture(int gestureId) */ void QWidget::setGestureEnabled(int gestureId, bool enable) { + Q_UNUSED(gestureId); + Q_UNUSED(enable); //### } -- cgit v0.12 From 7bf505a54379388b292df528114d6e2dd8d9d4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 1 Jul 2009 13:55:16 +0200 Subject: Fixed cleanup of glyph cache textures in the GL 2 engine. This could potentially crash when a context was destroyed before the actual font engine holding the QGLTextureGlyphCache was destroyed. Reviewed-by: Samuel --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 29 +++++++++++++++++++--- src/opengl/qgl_p.h | 4 +++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 4bf5d4c..edc7c44 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -88,8 +88,9 @@ static const GLuint QT_IMAGE_TEXTURE_UNIT = 0; //Can be the same as brush static const GLuint QT_MASK_TEXTURE_UNIT = 1; static const GLuint QT_BACKGROUND_TEXTURE_UNIT = 2; -class QGLTextureGlyphCache : public QTextureGlyphCache +class QGLTextureGlyphCache : public QObject, public QTextureGlyphCache { + Q_OBJECT public: QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix); ~QGLTextureGlyphCache(); @@ -105,6 +106,24 @@ public: inline void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p) { pex = p; } + +public Q_SLOTS: + void contextDestroyed(const QGLContext *context) { + if (context == ctx) { + QList shares = qgl_share_reg()->shares(ctx); + if (shares.isEmpty()) { + glDeleteFramebuffers(1, &m_fbo); + if (m_width || m_height) + glDeleteTextures(1, &m_texture); + } else { + // since the context holding the texture is shared, and + // about to be destroyed, we have to transfer ownership + // of the texture to one of the share contexts + ctx = const_cast(shares.at(0)); + } + } + } + private: QGLContext *ctx; @@ -126,6 +145,8 @@ QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyph , m_height(0) { glGenFramebuffers(1, &m_fbo); + connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext *)), + SLOT(contextDestroyed(const QGLContext *))); } QGLTextureGlyphCache::~QGLTextureGlyphCache() @@ -251,7 +272,7 @@ QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate() void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id) { // glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit? - if (id != -1 && id == lastTexture) + if (id != GLuint(-1) && id == lastTexture) return; lastTexture = id; @@ -1408,7 +1429,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) if (state()->matrix.type() <= QTransform::TxScale) { rect = state()->matrix.mapRect(rect); - if (d->use_system_clip && rect.contains(d->systemClip.boundingRect()) + if ((d->use_system_clip && rect.contains(d->systemClip.boundingRect())) || rect.contains(QRect(0, 0, d->width, d->height))) return; } @@ -1606,3 +1627,5 @@ QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState() } QT_END_NAMESPACE + +#include "qpaintengineex_opengl2.moc" diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 85e9bd7..ac19d64 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -421,6 +421,10 @@ public: removeShare(oldContext); } + QList shares(const QGLContext *context) { + return reg.values(context); + } + private: QGLSharingHash reg; }; -- cgit v0.12 From fe889557bcf3f4744205ba65b330276b5dc41c61 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 1 Jul 2009 13:57:46 +0200 Subject: Doc: clearifying docs - QProgressDialog Clearifying details on a warning about a function call (setValue()) Task-number: qtp 4.5Workarea --- src/gui/dialogs/qprogressdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index 959cdbc..580794b 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -626,7 +626,7 @@ int QProgressDialog::value() const \warning If the progress dialog is modal (see QProgressDialog::QProgressDialog()), - this function calls QApplication::processEvents(), so take care that + setValue() calls QApplication::processEvents(), so take care that this does not cause undesirable re-entrancy in your code. For example, don't use a QProgressDialog inside a paintEvent()! -- cgit v0.12 From 145e17f6cc405dd935451f0151b1a8a451c78f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 1 Jul 2009 14:01:54 +0200 Subject: Compiler warning. --- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9de6598..8fdf651 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -297,8 +297,8 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() allItemsIgnoreHoverEvents(true), allItemsUseDefaultCursor(true), painterStateProtection(true), - style(0), sortCacheEnabled(false), + style(0), allItemsIgnoreTouchEvents(true) { } -- cgit v0.12 From f6872e6b7a18b946c7428916c7096b82560a9cc6 Mon Sep 17 00:00:00 2001 From: kh Date: Wed, 1 Jul 2009 14:18:57 +0200 Subject: Do not start Assistant without at least an empty page. Noticed while looking into task 256903, since in case there are no recent shown pages,we would start Assistant only showning the search. Task-number: 256903 Reviewed-by: kh --- tools/assistant/tools/assistant/centralwidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 385f0bb..64c2a80 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -427,8 +427,11 @@ void CentralWidget::setLastShownPages() QString::SkipEmptyParts); const int pageCount = lastShownPageList.count(); - if (pageCount == 0 && usesDefaultCollection) { - setSource(QUrl(QLatin1String("help"))); + if (pageCount == 0) { + if (usesDefaultCollection) + setSource(QUrl(QLatin1String("help"))); + else + setSource(QUrl(QLatin1String("about:blank"))); return; } -- cgit v0.12 From 66a281ab76303074cd9cbb6cd22dcc5f3dbe8454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 1 Jul 2009 14:40:51 +0200 Subject: Made QPainter / OpenGL intermixing in hellogl_es2 work properly again. Need to call syncState() to let the paint engine set depth clipping state parameters back to their OpenGL defaults. Reviewed-by: Trond --- examples/opengl/hellogl_es2/glwidget.cpp | 3 +++ src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp index 6b08662..bb07b22 100644 --- a/examples/opengl/hellogl_es2/glwidget.cpp +++ b/examples/opengl/hellogl_es2/glwidget.cpp @@ -41,6 +41,7 @@ #include "glwidget.h" #include +#include #include #include "bubble.h" @@ -265,6 +266,8 @@ void GLWidget::paintGL() QPainter painter; painter.begin(this); + painter.paintEngine()->syncState(); + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index edc7c44..f261ca2 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -676,6 +676,11 @@ void QGL2PaintEngineEx::sync() glDisable(GL_BLEND); glActiveTexture(GL_TEXTURE0); + glDisable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + glDepthMask(true); + glClearDepth(1); + d->needsSync = true; } -- cgit v0.12 From 1813a6d2bc0ba611cecd2d74dea75cd4644a9f95 Mon Sep 17 00:00:00 2001 From: kh Date: Wed, 1 Jul 2009 14:49:10 +0200 Subject: Sync with QtCreator. --- tools/assistant/tools/assistant/centralwidget.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 64c2a80..a384544 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -286,6 +286,10 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent) CentralWidget::~CentralWidget() { +#ifndef QT_NO_PRINTER + delete printer; +#endif + QHelpEngineCore engine(collectionFile, 0); if (!engine.setupData()) return; @@ -357,10 +361,10 @@ void CentralWidget::findNext() void CentralWidget::nextPage() { - if(tabWidget->currentIndex() < tabWidget->count() -1) - tabWidget->setCurrentIndex(tabWidget->currentIndex() +1); - else - tabWidget->setCurrentIndex(0); + int index = tabWidget->currentIndex() + 1; + if (index >= tabWidget->count()) + index = 0; + tabWidget->setCurrentIndex(index); } void CentralWidget::resetZoom() @@ -376,10 +380,9 @@ void CentralWidget::resetZoom() void CentralWidget::previousPage() { int index = tabWidget->currentIndex() -1; - if(index >= 0) - tabWidget->setCurrentIndex(index); - else - tabWidget->setCurrentIndex(tabWidget->count() -1); + if (index < 0) + index = tabWidget->count() -1; + tabWidget->setCurrentIndex(index); } void CentralWidget::findPrevious() @@ -400,7 +403,8 @@ void CentralWidget::closeTab() void CentralWidget::setSource(const QUrl &url) { HelpViewer *viewer = currentHelpViewer(); - HelpViewer *lastViewer = qobject_cast(tabWidget->widget(lastTabPage)); + HelpViewer *lastViewer = + qobject_cast(tabWidget->widget(lastTabPage)); if (!viewer && !lastViewer) { viewer = new HelpViewer(helpEngine, this); -- cgit v0.12 From e14d27dc775d508dc7300e36ba6a3809eb3f61e4 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 1 Jul 2009 14:34:21 +0200 Subject: Implement hitTest Cocoa calls hitTest on our view to determine if the view should get the mouse press. We always said, "yes" and did all the logic ourselves. Turns out that we can say "no" if I'm transparent to mouse events and remove all that code where we do all the work ourselves. Big maintenance win! For the time being I've kept the "transparentViewForEvent" method since it might be useful for others, but no one is using it at the moment and we may just kill it soon. HitTest should handle this situation correctly. --- src/gui/kernel/qcocoaview_mac.mm | 17 ++++++------- src/gui/kernel/qt_cocoa_helpers_mac.mm | 44 ---------------------------------- 2 files changed, 7 insertions(+), 54 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 28179b7..64cdae6 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -557,6 +557,13 @@ extern "C" { return !qwidget->testAttribute(Qt::WA_MacNoClickThrough); } +- (NSView *)hitTest:(NSPoint)aPoint +{ + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) + return nil; // You cannot hit a transparent for mouse event widget. + return [super hitTest:aPoint]; +} + - (void)updateTrackingAreas { QMacCocoaAutoReleasePool pool; @@ -793,16 +800,6 @@ extern "C" { Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]); QWidget *widgetToGetMouse = qwidget; - if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) { - // Simulate passing the event through since Cocoa doesn't do that for us. - // Start by building a tree up. - NSView *candidateView = [self viewUnderTransparentForMouseView:self - widget:widgetToGetMouse - withWindowPoint:windowPoint]; - if (candidateView != nil) { - widgetToGetMouse = QWidget::find(WId(candidateView)); - } - } // Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets // expect the delta to be a multiple of 120. diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index f5f381e..073a00e 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -894,50 +894,6 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil]; QPoint qlocalPoint(localPoint.x, localPoint.y); - if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) { - // Simulate passing the event through since Cocoa doesn't do that for us. - // Start by building a tree up. - NSView *candidateView = [theView viewUnderTransparentForMouseView:tmpView - widget:widgetToGetMouse - withWindowPoint:windowPoint]; - if (candidateView != nil) { - // Fast-track our views, since dispatching trough the normal ways - // would just end up going through here anyway. - if ([candidateView isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) { - return qt_mac_handleMouseEvent(candidateView, theEvent, eventType, button); - } else { - switch (eventType) { - default: - qWarning("not handled! %d", eventType); - break; - case QEvent::MouseMove: - [candidateView mouseMoved:theEvent]; - break; - case QEvent::MouseButtonPress: - if (button == Qt::LeftButton) - [candidateView mouseDown:theEvent]; - else if (button == Qt::RightButton) - [candidateView rightMouseDown:theEvent]; - else - [candidateView otherMouseDown:theEvent]; - break; - case QEvent::MouseButtonRelease: - if (button == Qt::LeftButton) - [candidateView mouseUp:theEvent]; - else if (button == Qt::RightButton) - [candidateView rightMouseUp:theEvent]; - else - [candidateView otherMouseUp:theEvent]; - break; - } - return true; // We've done the dispatching, no need go further. - } - } - // Nothing below me return false - return false; - } - - EventRef carbonEvent = static_cast(const_cast([theEvent eventRef])); if (qt_mac_sendMacEventToWidget(widgetToGetMouse, carbonEvent)) return true; -- cgit v0.12 From 1d32cdf73843ba98104fdbc6d5d0a296dbb689b0 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 1 Jul 2009 14:34:43 +0200 Subject: Remove this stale function. --- src/gui/kernel/qapplication_mac.mm | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index ce4e422..0884976 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1367,29 +1367,6 @@ QWidget *QApplication::topLevelAt(const QPoint &p) #endif } -static QWidget *qt_mac_recursive_widgetAt(QWidget *widget, int x, int y) -{ - if (!widget) - return 0; - const QObjectList kids = widget->children(); - for(int i = kids.size()-1; i >= 0; --i) { - if ( QWidget *kid = qobject_cast(kids.at(i)) ) { - if (kid->isVisible() && !kid->isTopLevel() && - !kid->testAttribute(Qt::WA_TransparentForMouseEvents)) { - const int wx=kid->x(), wy=kid->y(), - wx2=wx+kid->width(), wy2=wy+kid->height(); - if (x >= wx && y >= wy && x < wx2 && y < wy2) { - const QRegion mask = kid->mask(); - if (!mask.isEmpty() && !mask.contains(QPoint(x-wx, y-wy))) - continue; - return qt_mac_recursive_widgetAt(kid, x-wx, y-wy); - } - } - } - } - return widget; -} - /***************************************************************************** Main event loop *****************************************************************************/ -- cgit v0.12 From 7c6ae7d93b2fe7fb3054798ad77b411608801388 Mon Sep 17 00:00:00 2001 From: kh Date: Wed, 1 Jul 2009 15:05:49 +0200 Subject: Sync with QtCreator. Reviewed-by: kh --- .../assistant/tools/assistant/bookmarkmanager.cpp | 54 +++++++++++++++++++--- tools/assistant/tools/assistant/bookmarkmanager.h | 8 ++++ tools/assistant/tools/assistant/mainwindow.cpp | 37 +++++++++++++-- tools/assistant/tools/assistant/mainwindow.h | 5 ++ 4 files changed, 94 insertions(+), 10 deletions(-) diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index 3bca573..250262e 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -347,7 +347,7 @@ void BookmarkWidget::filterChanged() filterBookmarkModel->setFilterRegExp(regExp); - QModelIndex index = treeView->indexAt(QPoint(1, 1)); + const QModelIndex &index = treeView->indexAt(QPoint(1, 1)); if (index.isValid()) treeView->setCurrentIndex(index); @@ -445,9 +445,10 @@ void BookmarkWidget::setup(bool showButtons) treeView = new TreeView(this); vlayout->addWidget(treeView); - QString system = QLatin1String("win"); #ifdef Q_OS_MAC - system = QLatin1String("mac"); +# define SYSTEM "mac" +#else +# define SYSTEM "win" #endif if (showButtons) { @@ -458,8 +459,8 @@ void BookmarkWidget::setup(bool showButtons) addButton = new QToolButton(this); addButton->setText(tr("Add")); - addButton->setIcon(QIcon(QString::fromUtf8( - ":/trolltech/assistant/images/%1/addtab.png").arg(system))); + addButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/" + SYSTEM "/addtab.png"))); addButton->setAutoRaise(true); addButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); hlayout->addWidget(addButton); @@ -467,8 +468,8 @@ void BookmarkWidget::setup(bool showButtons) removeButton = new QToolButton(this); removeButton->setText(tr("Remove")); - removeButton->setIcon(QIcon(QString::fromUtf8( - ":/trolltech/assistant/images/%1/closetab.png").arg(system))); + removeButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/" + SYSTEM "/closetab.png"))); removeButton->setAutoRaise(true); removeButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); hlayout->addWidget(removeButton); @@ -626,6 +627,10 @@ BookmarkManager::BookmarkManager(QHelpEngineCore *_helpEngine) connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemChanged(QStandardItem*))); + connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this, + SIGNAL(bookmarksChanged())); + connect(treeModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SIGNAL(bookmarksChanged())); } BookmarkManager::~BookmarkManager() @@ -736,6 +741,41 @@ void BookmarkManager::addNewBookmark(const QModelIndex &index, else treeModel->appendRow(item); listModel->appendRow(item->clone()); + emit bookmarksChanged(); +} + +void BookmarkManager::fillBookmarkMenu(QMenu *menu) +{ + if (!menu || !treeModel) + return; + + map.clear(); + fillBookmarkMenu(menu, treeModel->invisibleRootItem()); +} + +void BookmarkManager::fillBookmarkMenu(QMenu *menu, QStandardItem *root) +{ + for (int i = 0; i < root->rowCount(); ++i) { + QStandardItem *item = root->child(i); + if (item && item->data(Qt::UserRole + 10) + .toString() == QLatin1String("Folder")) { + QMenu* newMenu = menu->addMenu(folderIcon, item->text()); + if (item->rowCount() > 0) + fillBookmarkMenu(newMenu, item); + } else { + map.insert(menu->addAction(item->text()), item->index()); + } + } +} + +QUrl BookmarkManager::urlForAction(QAction* action) const +{ + if (map.contains(action)) { + const QModelIndex &index = map.value(action); + if (QStandardItem* item = treeModel->itemFromIndex(index)) + return QUrl(item->data(Qt::UserRole + 10).toString()); + } + return QUrl(); } void BookmarkManager::itemChanged(QStandardItem *item) diff --git a/tools/assistant/tools/assistant/bookmarkmanager.h b/tools/assistant/tools/assistant/bookmarkmanager.h index bf7af41..33db5b6 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.h +++ b/tools/assistant/tools/assistant/bookmarkmanager.h @@ -183,6 +183,12 @@ public: const QString &url); void setupBookmarkModels(); + void fillBookmarkMenu(QMenu *menu); + QUrl urlForAction(QAction* action) const; + +signals: + void bookmarksChanged(); + private slots: void itemChanged(QStandardItem *item); @@ -191,6 +197,7 @@ private: void removeBookmarkFolderItems(QStandardItem *item); void readBookmarksRecursive(const QStandardItem *item, QDataStream &stream, const qint32 depth) const; + void fillBookmarkMenu(QMenu *menu, QStandardItem *root); private: QString oldText; @@ -200,6 +207,7 @@ private: BookmarkModel *listModel; QStandardItem *renameItem; QHelpEngineCore *helpEngine; + QMap map; }; QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 5b3e731..0340297 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -137,7 +137,14 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) if (initHelpDB()) { setupFilterToolbar(); setupAddressToolbar(); + m_bookmarkManager->setupBookmarkModels(); + m_bookmarkMenu->addSeparator(); + m_bookmarkManager->fillBookmarkMenu(m_bookmarkMenu); + connect(m_bookmarkMenu, SIGNAL(triggered(QAction*)), this, + SLOT(showBookmark(QAction*))); + connect(m_bookmarkManager, SIGNAL(bookmarksChanged()), this, + SLOT(updateBookmarkMenu())); setWindowTitle(m_helpEngine->customValue(QLatin1String("WindowTitle"), defWindowTitle).toString()); @@ -370,6 +377,29 @@ void MainWindow::checkInitState() } } +void MainWindow::updateBookmarkMenu() +{ + if (m_bookmarkManager) { + m_bookmarkMenu->removeAction(m_bookmarkMenuAction); + + m_bookmarkMenu->clear(); + + m_bookmarkMenu->addAction(m_bookmarkMenuAction); + m_bookmarkMenu->addSeparator(); + + m_bookmarkManager->fillBookmarkMenu(m_bookmarkMenu); + } +} + +void MainWindow::showBookmark(QAction *action) +{ + if (m_bookmarkManager) { + const QUrl &url = m_bookmarkManager->urlForAction(action); + if (url.isValid()) + m_centralWidget->setSource(url); + } +} + void MainWindow::insertLastPages() { if (m_cmdLine->url().isValid()) @@ -495,9 +525,10 @@ void MainWindow::setupActions() tmp->setShortcuts(QList() << QKeySequence(tr("Ctrl+Alt+Left")) << QKeySequence(Qt::CTRL + Qt::Key_PageUp)); - menu = menuBar()->addMenu(tr("&Bookmarks")); - tmp = menu->addAction(tr("Add Bookmark..."), this, SLOT(addBookmark())); - tmp->setShortcut(tr("CTRL+D")); + m_bookmarkMenu = menuBar()->addMenu(tr("&Bookmarks")); + m_bookmarkMenuAction = m_bookmarkMenu->addAction(tr("Add Bookmark..."), + this, SLOT(addBookmark())); + m_bookmarkMenuAction->setShortcut(tr("CTRL+D")); menu = menuBar()->addMenu(tr("&Help")); m_aboutAction = menu->addAction(tr("About..."), this, SLOT(showAboutDialog())); diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 9ab3185..f7df724 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -119,6 +119,9 @@ private slots: void qtDocumentationInstalled(bool newDocsInstalled); void checkInitState(); + void updateBookmarkMenu(); + void showBookmark(QAction *action); + private: bool initHelpDB(); void setupActions(); @@ -157,6 +160,8 @@ private: QMenu *m_viewMenu; QMenu *m_toolBarMenu; + QMenu *m_bookmarkMenu; + QAction *m_bookmarkMenuAction; CmdLineParser *m_cmdLine; -- cgit v0.12 From 7ab895f576b8ef8380838778958fae651a550f79 Mon Sep 17 00:00:00 2001 From: Suneel BS Date: Fri, 8 May 2009 11:09:45 +0530 Subject: Fixed inheritance of some attributes in SVG. Fixed inheritance of stroke attributes, the font-size and text-anchor attribute. Autotest added by Kim. Reviewed-by: Kim --- src/svg/qsvghandler.cpp | 244 +++++++++++++++++---------- src/svg/qsvgnode.cpp | 2 +- src/svg/qsvgstyle.cpp | 8 +- src/svg/qsvgstyle_p.h | 12 +- tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 124 ++++++++++++++ 5 files changed, 294 insertions(+), 96 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 345dcf3..5950fac 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -908,103 +908,155 @@ static void parsePen(QSvgNode *node, //qDebug()<<"Node "<type()<<", attrs are "<(node->styleProperty( - QSvgStyleProperty::STROKE)); - if (!inherited) - inherited = static_cast(node->parent()->styleProperty( - QSvgStyleProperty::STROKE)); - QPen pen(handler->defaultPen()); - if (inherited) - pen = inherited->qpen(); + /* All the below checks needed because g (or any container element) can have only one of these attributes. + * If it doesn't has any one of these, then processing below not needed */ + + if (!value.isEmpty() || !width.isEmpty() || !dashArray.isEmpty() || !linecap.isEmpty() || + !linejoin.isEmpty() || !miterlimit.isEmpty() || !opacity.isEmpty() || !dashOffset.isEmpty() ) { + //if (value != QLatin1String("none")) { + /* If stroke = "none" then also, we need to parse below, because elements like 'g' may + have other defined stroke attributes, which will be inherited by its children */ + QSvgStrokeStyle *inherited = + static_cast(node->parent()->styleProperty( + QSvgStyleProperty::STROKE)); + + QPen pen(handler->defaultPen()); + bool stroke = false; + if (inherited) { + pen = inherited->qpen(); + stroke = inherited->strokePresent(); + } - if (!value.isEmpty()) { - if (value.startsWith(QLatin1String("url"))) { - value = value.remove(0, 3); - QSvgStyleProperty *style = styleFromUrl(node, value); - if (style) { - if (style->type() == QSvgStyleProperty::GRADIENT) { - QBrush b(*((QSvgGradientStyle*)style)->qgradient()); - pen.setBrush(b); - } else if (style->type() == QSvgStyleProperty::SOLID_COLOR) { - pen.setColor( - ((QSvgSolidColorStyle*)style)->qcolor()); - } - } else { - qWarning() << "QSvgHandler::parsePen could not resolve property" << idFromUrl(value); + // stroke-opacity attribute handling + qreal strokeAlpha; + if (!opacity.isEmpty() && opacity != QLatin1String("inherit")) { + strokeAlpha = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity))); + } else { + strokeAlpha = pen.color().alphaF(); + } + + //stroke attribute handling + if (!value.isEmpty() && value != QLatin1String("inherit")) { + if (value.startsWith(QLatin1String("url"))) { + value = value.remove(0, 3); + QSvgStyleProperty *style = styleFromUrl(node, value); + if (style) { + if (style->type() == QSvgStyleProperty::GRADIENT) { + QBrush b(*((QSvgGradientStyle*)style)->qgradient()); + pen.setBrush(b); + } else if (style->type() == QSvgStyleProperty::SOLID_COLOR) { + pen.setColor( + ((QSvgSolidColorStyle*)style)->qcolor()); } + pen.setStyle(Qt::SolidLine); + stroke = true; } else { - QColor color; - if (constructColor(value, opacity, color, handler)) - pen.setColor(color); + qWarning() << "QSvgHandler::parsePen could not resolve property" << idFromUrl(value); } - //since we could inherit stroke="none" - //we need to reset the style of our stroke to something - pen.setStyle(Qt::SolidLine); - } - if (!width.isEmpty()) { - QSvgHandler::LengthType lt; - qreal widthF = parseLength(width, lt, handler); - //### fixme - if (!widthF) { - pen.setStyle(Qt::NoPen); - return; + } else if (value == QLatin1String("none")) { + QColor color; //### fixme: dafalut value for color. + color.setAlphaF(strokeAlpha); + pen.setColor(color); + stroke = false; // This is required because, parent may have a valid stroke but the child may have stroke = "none" + } else { + QColor color; + if (resolveColor(value, color, handler)) { + color.setAlphaF(strokeAlpha); + pen.setColor(color); } - pen.setWidthF(widthF); - } - - if (!linejoin.isEmpty()) { - if (linejoin == QLatin1String("miter")) - pen.setJoinStyle(Qt::SvgMiterJoin); - else if (linejoin == QLatin1String("round")) - pen.setJoinStyle(Qt::RoundJoin); - else if (linejoin == QLatin1String("bevel")) - pen.setJoinStyle(Qt::BevelJoin); + stroke = true; } + } else { + QColor color = pen.color(); + color.setAlphaF(strokeAlpha); + pen.setColor(color); + } - if (!linecap.isEmpty()) { - if (linecap == QLatin1String("butt")) - pen.setCapStyle(Qt::FlatCap); - else if (linecap == QLatin1String("round")) - pen.setCapStyle(Qt::RoundCap); - else if (linecap == QLatin1String("square")) - pen.setCapStyle(Qt::SquareCap); - } + //stroke-width handling + if (!width.isEmpty() && width != QLatin1String("inherit")) { + qreal widthF; + QSvgHandler::LengthType lt; + widthF = parseLength(width, lt, handler); + pen.setWidthF(widthF); + } else if (inherited){ + qreal widthF = inherited->qpen().widthF(); + pen.setWidthF(widthF); + } - qreal penw = pen.widthF(); - if (!dashArray.isEmpty()) { - const QChar *s = dashArray.constData(); - QVector dashes = parseNumbersList(s); - qreal *d = dashes.data(); - if(penw != 0) - for (int i = 0; i < dashes.size(); ++i) { - *d /= penw; - ++d; - } + //stroke-linejoin attribute handling + if (!linejoin.isEmpty()) { + if (linejoin == QLatin1String("miter")) + pen.setJoinStyle(Qt::SvgMiterJoin); + else if (linejoin == QLatin1String("round")) + pen.setJoinStyle(Qt::RoundJoin); + else if (linejoin == QLatin1String("bevel")) + pen.setJoinStyle(Qt::BevelJoin); + } - // if the dash count is odd the dashes should be duplicated - if (dashes.size() % 2 != 0) - dashes << QVector(dashes); + //stroke-linecap attribute handling + if (!linecap.isEmpty()) { + if (linecap == QLatin1String("butt")) + pen.setCapStyle(Qt::FlatCap); + else if (linecap == QLatin1String("round")) + pen.setCapStyle(Qt::RoundCap); + else if (linecap == QLatin1String("square")) + pen.setCapStyle(Qt::SquareCap); + } - pen.setDashPattern(dashes); - } - if (!dashOffset.isEmpty()) { - qreal doffset = toDouble(dashOffset); - if (penw != 0) - doffset /= penw; - pen.setDashOffset(doffset); + //strok-dasharray attribute handling + qreal penw = pen.widthF(); + if (!dashArray.isEmpty() && dashArray != QLatin1String("inherit")) { + const QChar *s = dashArray.constData(); + QVector dashes = parseNumbersList(s); + qreal *d = dashes.data(); + if (penw != 0) + for (int i = 0; i < dashes.size(); ++i) { + *d /= penw; + ++d; + } + // if the dash count is odd the dashes should be duplicated + if (dashes.size() % 2 != 0) + dashes << QVector(dashes); + pen.setDashPattern(dashes); + } else if (inherited) { + QVector dashes(inherited->qpen().dashPattern()); + qreal *d = dashes.data(); + if (!penw) + penw = 1.0; + qreal inheritpenw = inherited->qpen().widthF(); + if (!inheritpenw) + inheritpenw = 1.0; + for ( int i = 0; i < dashes.size(); ++i) { + *d *= (inheritpenw/ penw); + ++d; } - if (!miterlimit.isEmpty()) - pen.setMiterLimit(toDouble(miterlimit)); + pen.setDashPattern(dashes); + } - node->appendStyleProperty(new QSvgStrokeStyle(pen), myId); - } else { - QPen pen(handler->defaultPen()); - pen.setStyle(Qt::NoPen); - node->appendStyleProperty(new QSvgStrokeStyle(pen), myId); + + //stroke-dashoffset attribute handling + if (!dashOffset.isEmpty() && dashOffset != QLatin1String("inherit")) { + qreal doffset = toDouble(dashOffset); + if (penw != 0) + doffset /= penw; + pen.setDashOffset(doffset); + } else if (inherited) { + qreal doffset = pen.dashOffset(); + if (!penw) + penw = 1.0; + qreal inheritpenw = inherited->qpen().widthF(); + if (!inheritpenw) + inheritpenw = 1.0; + doffset *= (inheritpenw/ penw); + pen.setDashOffset(doffset); } + + if (!miterlimit.isEmpty() && miterlimit != QLatin1String("inherit")) + pen.setMiterLimit(toDouble(miterlimit)); + + QSvgStrokeStyle *prop = new QSvgStrokeStyle(pen); + prop->setStroke(stroke); + node->appendStyleProperty(prop, myId); } } @@ -1071,10 +1123,14 @@ static bool parseQFont(const QSvgAttributes &attributes, font.setFamily(family.trimmed()); } if (!size.isEmpty()) { - QSvgHandler::LengthType dummy; // should always be pixel size - fontSize = parseLength(size, dummy, handler); - if (fontSize <= 0) - fontSize = 1; + if (size == QLatin1String("inherit")) { + //inherited already + } else { + QSvgHandler::LengthType dummy; // should always be pixel size + fontSize = parseLength(size, dummy, handler); + if (fontSize <= 0) + fontSize = 1; + } font.setPixelSize(qMax(1, int(fontSize))); } if (!style.isEmpty()) { @@ -1154,9 +1210,13 @@ static void parseFont(QSvgNode *node, font = inherited->qfont(); fontSize = inherited->pointSize(); } - if (parseQFont(attributes, font, fontSize, handler)) { + // group or any container element can have only text-anchor and should + // be processed, because its children can inherit from it. + // So checking for text-anchor before parseQfont() + QString anchor = attributes.value(QLatin1String("text-anchor")).toString(); + if (parseQFont(attributes, font, fontSize, handler) || (!anchor.isEmpty())) { QString myId = someId(attributes); - QString anchor = attributes.value(QLatin1String("text-anchor")).toString(); + //QString anchor = attributes.value(QLatin1String("text-anchor")).toString(); QSvgTinyDocument *doc = node->document(); QSvgFontStyle *fontStyle = 0; QString family = (font.family().isEmpty())?myId:font.family(); @@ -1865,7 +1925,7 @@ static bool parseDefaultTextStyle(QSvgNode *node, if (fontStyle) { font = fontStyle->qfont(); fontSize = fontStyle->pointSize(); - if (anchor.isEmpty()) + if (anchor.isEmpty() || anchor == QLatin1String("inherit")) anchor = fontStyle->textAnchor(); } @@ -3395,7 +3455,7 @@ void QSvgHandler::init() m_style = 0; m_animEnd = 0; m_defaultCoords = LT_PX; - m_defaultPen = QPen(Qt::black, 1, Qt::NoPen, Qt::FlatCap, Qt::SvgMiterJoin); + m_defaultPen = QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::SvgMiterJoin); m_defaultPen.setMiterLimit(4); parse(); } diff --git a/src/svg/qsvgnode.cpp b/src/svg/qsvgnode.cpp index 75c01a9..ce8b3fa 100644 --- a/src/svg/qsvgnode.cpp +++ b/src/svg/qsvgnode.cpp @@ -320,7 +320,7 @@ qreal QSvgNode::strokeWidth() const { QSvgStrokeStyle *stroke = static_cast( styleProperty(QSvgStyleProperty::STROKE)); - if (!stroke || stroke->qpen().style() == Qt::NoPen) + if (!stroke || !stroke->strokePresent()) return 0; return stroke->qpen().widthF(); } diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index fec6231..556201b 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -195,14 +195,18 @@ void QSvgFontStyle::revert(QPainter *p, QSvgExtraStates &) } QSvgStrokeStyle::QSvgStrokeStyle(const QPen &pen) - : m_stroke(pen) + : m_stroke(pen), m_strokePresent(true) { } void QSvgStrokeStyle::apply(QPainter *p, const QRectF &, QSvgNode *, QSvgExtraStates &) { m_oldStroke = p->pen(); - p->setPen(m_stroke); + if (!m_strokePresent || !m_stroke.widthF() || !m_stroke.color().alphaF()) { + p->setPen(Qt::NoPen); + } else { + p->setPen(m_stroke); + } } void QSvgStrokeStyle::revert(QPainter *p, QSvgExtraStates &) diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index e65b6f5..f1d0811 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -345,6 +345,16 @@ public: virtual void revert(QPainter *p, QSvgExtraStates &states); virtual Type type() const; + void setStroke(bool stroke) + { + m_strokePresent = stroke; + } + + bool strokePresent() const + { + return m_strokePresent; + } + const QPen & qpen() const { return m_stroke; @@ -359,8 +369,8 @@ private: // stroke-opacity v v 'inherit' | // stroke-width v v 'inherit' | QPen m_stroke; - QPen m_oldStroke; + bool m_strokePresent; }; diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index f11aff9..7b62eae 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -80,6 +80,7 @@ private slots: void opacity(); void paths(); void displayMode(); + void strokeInherit(); #ifndef QT_NO_COMPRESS void testGzLoading(); @@ -925,5 +926,128 @@ void tst_QSvgRenderer::displayMode() } } +void tst_QSvgRenderer::strokeInherit() +{ + static const char *svgs[] = { + // Reference. + "" + " " + " " + " " + " " + " " + " " + "", + // stroke + "" + " " + " " + " " + " " + " " + " " + "", + // stroke-width + "" + " " + " " + " " + " " + " " + " " + "", + // stroke-linecap + "" + " " + " " + " " + " " + " " + " " + "", + // stroke-linejoin + "" + " " + " " + " " + " " + " " + " " + "", + // stroke-miterlimit + "" + " " + " " + " " + " " + " " + " " + "", + // stroke-dasharray + "" + " " + " " + " " + " " + " " + " " + "", + // stroke-dashoffset + "" + " " + " " + " " + " " + " " + " " + "", + // stroke-opacity + "" + " " + " " + " " + " " + " " + " " + "" + }; + + const int COUNT = sizeof(svgs) / sizeof(svgs[0]); + QImage images[COUNT]; + QPainter p; + + for (int i = 0; i < COUNT; ++i) { + QByteArray data(svgs[i]); + QSvgRenderer renderer(data); + QVERIFY(renderer.isValid()); + images[i] = QImage(200, 30, QImage::Format_ARGB32_Premultiplied); + images[i].fill(-1); + p.begin(&images[i]); + renderer.render(&p); + p.end(); + if (i != 0) { + QCOMPARE(images[0], images[i]); + } + } +} + QTEST_MAIN(tst_QSvgRenderer) #include "tst_qsvgrenderer.moc" -- cgit v0.12 From 0b3eaca3f40bde96380544f19c9b8874a60bbdeb Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 1 Jul 2009 15:50:04 +0200 Subject: Make "make docs" in QTDIR work on Windows, independent of configure -debug/release/debug_and_release - build qdoc3 always into tools\qdoc3 rathern than release/debug subdirs - call it from there Reviewed-by: Marius SO --- doc/doc.pri | 11 ++--------- tools/qdoc3/qdoc3.pro | 1 + 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index a4c77fe..13d481f 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -2,13 +2,6 @@ # Qt documentation build ##################################################################### -win32 { - QT_WINCONFIG = release/ - !CONFIG(release, debug|release) { - QT_WINCONFIG = debug/ - } -} - DOCS_GENERATION_DEFINES = -Dopensourceedition GENERATOR = $$QT_BUILD_TREE/bin/qhelpgenerator @@ -21,9 +14,9 @@ win32:!win32-g++ { } $$unixstyle { - QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && QT_BUILD_TREE=$$QT_BUILD_TREE QT_SOURCE_TREE=$$QT_SOURCE_TREE $$QT_BUILD_TREE/tools/qdoc3/$${QT_WINCONFIG}qdoc3 $$DOCS_GENERATION_DEFINES + QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && QT_BUILD_TREE=$$QT_BUILD_TREE QT_SOURCE_TREE=$$QT_SOURCE_TREE $$QT_BUILD_TREE/tools/qdoc3/qdoc3 $$DOCS_GENERATION_DEFINES } else { - QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/tools/qdoc3/$${QT_WINCONFIG}qdoc3.exe $$DOCS_GENERATION_DEFINES + QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/tools/qdoc3/qdoc3.exe $$DOCS_GENERATION_DEFINES QDOC = $$replace(QDOC, "/", "\\") } macx { diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index ed27669..6c1cfd2 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -6,6 +6,7 @@ DEFINES += QT_NO_CAST_TO_ASCII QT = core xml CONFIG += console +CONFIG -= debug_and_release_target build_all:!build_pass { CONFIG -= build_all CONFIG += release -- cgit v0.12 From 5b1f4197d380718a15b3aa176f148bd6324bb1cb Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 1 Jul 2009 12:19:19 +0200 Subject: QNAM: Direct transfer of HTTP buffer to the QNetworkReply buffer Directly put a QRingBuffer from one QRingBuffer to another QRingBuffer. Reviewed-by: Thiago Macieira --- src/corelib/tools/qringbuffer_p.h | 47 +++++++++++++++++++++++- src/network/access/qhttpnetworkreply.cpp | 8 +++- src/network/access/qhttpnetworkreply_p.h | 1 + src/network/access/qnetworkaccesshttpbackend.cpp | 16 ++++---- src/network/access/qnetworkreplyimpl.cpp | 3 +- 5 files changed, 62 insertions(+), 13 deletions(-) diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index b8e08ac..f3daca7 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -301,6 +301,51 @@ public: return read(size()); } + // read an unspecified amount (will read the first buffer) + inline QByteArray read() { + // multiple buffers, just take the first one + if (head == 0 && tailBuffer != 0) { + QByteArray qba = buffers.takeFirst(); + --tailBuffer; + bufferSize -= qba.length(); + return qba; + } + + // one buffer with good value for head. Just take it. + if (head == 0 && tailBuffer == 0) { + QByteArray qba = buffers.takeFirst(); + qba.resize(tail); + buffers << QByteArray(); + bufferSize = 0; + tail = 0; + return qba; + } + + // Bad case: We have to memcpy. + // We can avoid by initializing the QRingBuffer with basicBlockSize of 0 + // and only using this read() function. + QByteArray qba(readPointer(), nextDataBlockSize()); + buffers.takeFirst(); + head = 0; + if (tailBuffer == 0) { + buffers << QByteArray(); + tail = 0; + } else { + --tailBuffer; + } + bufferSize -= qba.length(); + return qba; + } + + // append a new buffer to the end + inline void append(const QByteArray &qba) { + buffers[tailBuffer].resize(tail); + buffers << qba; + ++tailBuffer; + tail = qba.length(); + bufferSize += qba.length(); + } + inline QByteArray peek(int maxLength) const { int bytesToRead = qMin(size(), maxLength); if(maxLength <= 0) @@ -355,7 +400,7 @@ public: private: QList buffers; int head, tail; - int tailBuffer; + int tailBuffer; // always buffers.size() - 1 int basicBlockSize; int bufferSize; }; diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 72aec99..483589b 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -185,6 +185,12 @@ QByteArray QHttpNetworkReply::read(qint64 maxSize) return data; } +QByteArray QHttpNetworkReply::readAny() +{ + Q_D(QHttpNetworkReply); + return d->responseData.read(); +} + bool QHttpNetworkReply::isFinished() const { return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState; @@ -196,7 +202,7 @@ QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) : QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100), majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0), currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), - autoDecompress(false), requestIsPrepared(false) + autoDecompress(false), responseData(0), requestIsPrepared(false) { } diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index 26e1047..b86cfaa 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -123,6 +123,7 @@ public: qint64 bytesAvailable() const; qint64 bytesAvailableNextBlock() const; QByteArray read(qint64 maxSize = -1); + QByteArray readAny(); bool isFinished() const; diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 71808d4..db84e58 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -649,16 +649,14 @@ void QNetworkAccessHttpBackend::readFromHttp() if (!httpReply) return; - // We implement the download rate control - // Don't read from QHttpNetworkAccess more than QNetworkAccessBackend wants - // One of the two functions above will be called when we can read again + // We read possibly more than nextDownstreamBlockSize(), but + // this is not a critical thing since it is already in the + // memory anyway - qint64 bytesToRead = qBound(0, httpReply->bytesAvailable(), nextDownstreamBlockSize()); - if (!bytesToRead) - return; - - QByteArray data = httpReply->read(bytesToRead); - writeDownstreamData(data); + while (httpReply->bytesAvailable() != 0 && nextDownstreamBlockSize() != 0) { + const QByteArray data = httpReply->readAny(); + writeDownstreamData(data); + } } void QNetworkAccessHttpBackend::replyFinished() diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 6eacdf1..de39970 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -393,8 +393,7 @@ void QNetworkReplyImplPrivate::appendDownstreamData(const QByteArray &data) if (!q->isOpen()) return; - char *ptr = readBuffer.reserve(data.size()); - memcpy(ptr, data.constData(), data.size()); + readBuffer.append(data); if (cacheEnabled && !cacheSaveDevice) { // save the meta data -- cgit v0.12 From fef6f4469d4c856abdaaefe1d914c120396ff365 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Wed, 1 Jul 2009 16:20:52 +0200 Subject: Doc - some minor fixes to the sentences Reviewed-By: TrustMe --- doc/src/tutorials/addressbook.qdoc | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index 23dabb3..33832da 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -818,21 +818,23 @@ \image addressbook-tutorial-part6-screenshot.png - Although browsing and searching for contacts are useful features, our address - book is not really fully ready for use until we can saving existing contacts - and load them again at a later time. - Qt provides a number of classes for \l{Input/Output and Networking}{input and output}, - but we have chosen to use two which are simple to use in combination: QFile and - QDataStream. - - A QFile object represents a file on disk that can be read from and written to. - QFile is a subclass of the more general QIODevice class which represents many - different kinds of devices. - - A QDataStream object is used to serialize binary data so that it can be stored - in a QIODevice and retrieved again later. Reading from a QIODevice and writing - to it is as simple as opening the stream - with the respective device as a - parameter - and reading from or writing to it. + Although browsing and searching for contacts are useful features, our + address book is not ready for use until we can save existing contacts and + load them again at a later time. + + Qt provides a number of classes for \l{Input/Output and Networking} + {input and output}, but we have chosen to use two which are simple to use + in combination: QFile and QDataStream. + + A QFile object represents a file on disk that can be read from and written + to. QFile is a subclass of the more general QIODevice class which + represents many different kinds of devices. + + A QDataStream object is used to serialize binary data so that it can be + stored in a QIODevice and retrieved again later. Reading from a QIODevice + and writing to it is as simple as opening the stream - with the respective + device as a parameter - and reading from or writing to it. + \section1 Defining the AddressBook Class -- cgit v0.12 From f4a95e6d6e4c046ac4857cbd54f9488d3b67ce5a Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 1 Jul 2009 17:09:17 +0200 Subject: Fix a regression with extended style option items. We basically passed an unitialized transform to construct the styleoptions for items that use the useExtendedStyleOption flag. We had an auto-test to cover that but for some reason view.show() was removed by me so the auto-test did nothing. oops. Reviewed-by:bnilsen --- src/gui/graphicsview/qgraphicsscene.cpp | 8 ++++---- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 8fdf651..8a032f4 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4312,7 +4312,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (drawItem) { Q_ASSERT(!itemIsFullyTransparent); Q_ASSERT(itemHasContents); - item->d_ptr->initStyleOption(&styleOptionTmp, transform, exposedRegion + ENSURE_TRANSFORM_PTR + item->d_ptr->initStyleOption(&styleOptionTmp, *transformPtr, exposedRegion ? *exposedRegion : QRegion(), exposedRegion == 0); const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; @@ -4320,10 +4321,9 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (savePainter) painter->save(); - if (!itemHasChildren || !itemClipsChildrenToShape) { - ENSURE_TRANSFORM_PTR + if (!itemHasChildren || !itemClipsChildrenToShape) painter->setWorldTransform(*transformPtr); - } + if (itemClipsToShape) painter->setClipPath(item->shape(), Qt::IntersectClip); painter->setOpacity(opacity); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 7552f18..3f7a50b 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6837,9 +6837,11 @@ public: //Doesn't use the extended style option so the exposed rect is the boundingRect if (!(flags() & QGraphicsItem::ItemUsesExtendedStyleOption)) { QCOMPARE(option->exposedRect, boundingRect()); + QCOMPARE(option->matrix, QMatrix()); } else { QVERIFY(option->exposedRect != QRect()); QVERIFY(option->exposedRect != boundingRect()); + QCOMPARE(option->matrix, sceneTransform().toAffine()); } } QGraphicsRectItem::paint(painter, option, widget); @@ -6861,6 +6863,8 @@ void tst_QGraphicsItem::itemUsesExtendedStyleOption() scene.addItem(rect); rect->setPos(200, 200); QGraphicsView view(&scene); + rect->startTrack = false; + view.show(); QTest::qWait(500); rect->startTrack = true; rect->update(10, 10, 10, 10); -- cgit v0.12 From d0299745e511640df3e0a26e8c447d0960ac4546 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 1 Jul 2009 12:14:29 +0200 Subject: QMainWindow: cleanup of code in QWidgetAnimator --- src/gui/widgets/qdockarealayout.cpp | 10 ++--- src/gui/widgets/qmainwindowlayout.cpp | 50 +++++++-------------- src/gui/widgets/qmainwindowlayout_p.h | 11 ++--- src/gui/widgets/qtoolbararealayout.cpp | 2 +- src/gui/widgets/qwidgetanimator.cpp | 79 +++++++++++++--------------------- src/gui/widgets/qwidgetanimator_p.h | 21 ++++----- 6 files changed, 66 insertions(+), 107 deletions(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index f245d64..b905ccd 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1488,7 +1488,7 @@ bool QDockAreaLayoutInfo::hasFixedSize() const void QDockAreaLayoutInfo::apply(bool animate) { - QWidgetAnimator *widgetAnimator = mainWindowLayout()->widgetAnimator; + QWidgetAnimator &widgetAnimator = mainWindowLayout()->widgetAnimator; #ifndef QT_NO_TABBAR if (tabbed) { @@ -1521,7 +1521,7 @@ void QDockAreaLayoutInfo::apply(bool animate) } } - widgetAnimator->animate(tabBar, tab_rect, animate); + widgetAnimator.animate(tabBar, tab_rect, animate); } #endif // QT_NO_TABBAR @@ -1544,7 +1544,7 @@ void QDockAreaLayoutInfo::apply(bool animate) QWidget *w = item.widgetItem->widget(); QRect geo = w->geometry(); - widgetAnimator->animate(w, r, animate); + widgetAnimator.animate(w, r, animate); if (!w->isHidden()) { QDockWidget *dw = qobject_cast(w); if (!r.isValid() && geo.right() >= 0 && geo.bottom() >= 0) { @@ -3064,13 +3064,13 @@ void QDockAreaLayout::splitDockWidget(QDockWidget *after, void QDockAreaLayout::apply(bool animate) { - QWidgetAnimator *widgetAnimator + QWidgetAnimator &widgetAnimator = qobject_cast(mainWindow->layout())->widgetAnimator; for (int i = 0; i < QInternal::DockCount; ++i) docks[i].apply(animate); if (centralWidgetItem != 0 && !centralWidgetItem->isEmpty()) { - widgetAnimator->animate(centralWidgetItem->widget(), centralWidgetRect, + widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect, animate); } diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 526e7a5..0318f53 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1361,7 +1361,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index) if (QLayoutItem *ret = layoutState.takeAt(index, &x)) { // the widget might in fact have been destroyed by now if (QWidget *w = ret->widget()) { - widgetAnimator->abort(w); + widgetAnimator.abort(w); if (w == pluggingWidget) pluggingWidget = 0; } @@ -1542,25 +1542,9 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) } } #endif - widgetAnimator->animate(widget, globalRect, - dockOptions & QMainWindow::AnimatedDocks); + widgetAnimator.animate(widget, globalRect, true); } else { -#ifndef QT_NO_DOCKWIDGET - if (QDockWidget *dw = qobject_cast(widget)) - dw->d_func()->plug(currentGapRect); -#endif -#ifndef QT_NO_TOOLBAR - if (QToolBar *tb = qobject_cast(widget)) - tb->d_func()->plug(currentGapRect); -#endif - applyState(layoutState); - savedState.clear(); -#ifndef QT_NO_DOCKWIDGET - parentWidget()->update(layoutState.dockAreaLayout.separatorRegion()); -#endif - currentGapPos.clear(); - updateGapIndicator(); - pluggingWidget = 0; + animationFinished(widget); } return true; @@ -1667,6 +1651,11 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow) #endif #endif #endif // QT_NO_DOCKWIDGET + , widgetAnimator(this) + , pluggingWidget(0) +#ifndef QT_NO_RUBBERBAND + , gapIndicator(QRubberBand::Rectangle, mainwindow) +#endif //QT_NO_RUBBERBAND { #ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_TABBAR @@ -1680,20 +1669,13 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow) #endif // QT_NO_DOCKWIDGET #ifndef QT_NO_RUBBERBAND - gapIndicator = new QRubberBand(QRubberBand::Rectangle, mainwindow); // For accessibility to identify this special widget. - gapIndicator->setObjectName(QLatin1String("qt_rubberband")); - - gapIndicator->hide(); + gapIndicator.setObjectName(QLatin1String("qt_rubberband")); + gapIndicator.hide(); #endif pluggingWidget = 0; setObjectName(mainwindow->objectName() + QLatin1String("_layout")); - widgetAnimator = new QWidgetAnimator(this); - connect(widgetAnimator, SIGNAL(finished(QWidget*)), - this, SLOT(animationFinished(QWidget*)), Qt::QueuedConnection); - connect(widgetAnimator, SIGNAL(finishedAll()), - this, SLOT(allAnimationsFinished())); } QMainWindowLayout::~QMainWindowLayout() @@ -1795,13 +1777,13 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget) void QMainWindowLayout::updateGapIndicator() { #ifndef QT_NO_RUBBERBAND - if (widgetAnimator->animating() || currentGapPos.isEmpty()) { - gapIndicator->hide(); + if (widgetAnimator.animating() || currentGapPos.isEmpty()) { + gapIndicator.hide(); } else { - if (gapIndicator->geometry() != currentGapRect) - gapIndicator->setGeometry(currentGapRect); - if (!gapIndicator->isVisible()) - gapIndicator->show(); + if (gapIndicator.geometry() != currentGapRect) + gapIndicator.setGeometry(currentGapRect); + if (!gapIndicator.isVisible()) + gapIndicator.show(); } #endif } diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index 26f8633..5c5965a 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -59,10 +59,12 @@ #include "QtGui/qlayout.h" #include "QtGui/qtabbar.h" +#include "QtGui/qrubberband.h" #include "QtCore/qvector.h" #include "QtCore/qset.h" #include "QtCore/qbasictimer.h" #include "private/qlayoutengine_p.h" +#include "private/qwidgetanimator_p.h" #include "qdockarealayout_p.h" #include "qtoolbararealayout_p.h" @@ -89,7 +91,6 @@ typedef const struct __CFString * CFStringRef; QT_BEGIN_NAMESPACE class QToolBar; -class QWidgetAnimator; class QRubberBand; /* This data structure represents the state of all the tool-bars and dock-widgets. It's value based @@ -278,12 +279,12 @@ public: // animations - QWidgetAnimator *widgetAnimator; + QWidgetAnimator widgetAnimator; QList currentGapPos; QRect currentGapRect; QWidget *pluggingWidget; #ifndef QT_NO_RUBBERBAND - QRubberBand *gapIndicator; + QRubberBand gapIndicator; #endif QList hover(QLayoutItem *widgetItem, const QPoint &mousePos); @@ -295,10 +296,10 @@ public: void applyState(QMainWindowLayoutState &newState, bool animate = true); void restore(bool keepSavedState = false); void updateHIToolBarStatus(); - -private slots: void animationFinished(QWidget *widget); void allAnimationsFinished(); + +private slots: #ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_TABBAR void tabChanged(); diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index db2afd6..0c11700 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -932,7 +932,7 @@ void QToolBarAreaLayout::apply(bool animate) if (visible && dock.o == Qt::Horizontal) geo = QStyle::visualRect(dir, line.rect, geo); - layout->widgetAnimator->animate(widget, geo, animate); + layout->widgetAnimator.animate(widget, geo, animate); } } } diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index c67be4a..56b3f43 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -39,12 +39,8 @@ ** ****************************************************************************/ -#include -#include #include -#include -#include -#include +#include #include "qwidgetanimator_p.h" @@ -75,18 +71,12 @@ static inline int animateHelper(int start, int stop, int step, int steps) return start + g_animate_function[x]*(stop - start)/1000; } -QWidgetAnimator::QWidgetAnimator(QObject *parent) - : QObject(parent) +QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout(layout) { - m_time = new QTime(); - m_timer = new QTimer(this); - m_timer->setInterval(g_animation_interval); - connect(m_timer, SIGNAL(timeout()), this, SLOT(animationStep())); } QWidgetAnimator::~QWidgetAnimator() { - delete m_time; } void QWidgetAnimator::abort(QWidget *w) @@ -94,8 +84,8 @@ void QWidgetAnimator::abort(QWidget *w) if (m_animation_map.remove(w) == 0) return; if (m_animation_map.isEmpty()) { - m_timer->stop(); - emit finishedAll(); + m_timer.stop(); + m_mainWindowLayout->allAnimationsFinished(); } } @@ -107,32 +97,21 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo if (r.right() < 0 || r.bottom() < 0) r = QRect(); - if (r.isNull() || final_geometry.isNull()) + if (r.isNull() || final_geometry.isNull() || r == final_geometry) animate = false; AnimationMap::const_iterator it = m_animation_map.constFind(widget); - if (it == m_animation_map.constEnd()) { - if (r == final_geometry) { - emit finished(widget); - return; - } - } else { - if ((*it).r2 == final_geometry) - return; - } + if (it != m_animation_map.constEnd() && (*it).r2 == final_geometry) + return; if (animate) { AnimationItem item(widget, r, final_geometry); m_animation_map[widget] = item; - if (!m_timer->isActive()) { - m_timer->start(); - m_time->start(); + if (!m_timer.isActive()) { + m_timer.start(g_animation_interval, this); + m_time.start(); } } else { - m_animation_map.remove(widget); - if (m_animation_map.isEmpty()) - m_timer->stop(); - if (!final_geometry.isValid() && !widget->isWindow()) { // Make the wigdet go away by sending it to negative space QSize s = widget->size(); @@ -140,18 +119,19 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo } widget->setGeometry(final_geometry); - emit finished(widget); - - if (m_animation_map.isEmpty()) - emit finishedAll(); - - return; + if (m_animation_map.remove(widget)) { + m_mainWindowLayout->animationFinished(widget); + if (m_animation_map.isEmpty()) { + m_timer.stop(); + m_mainWindowLayout->allAnimationsFinished(); + } + } } } -void QWidgetAnimator::animationStep() +void QWidgetAnimator::timerEvent(QTimerEvent *) { - int steps = (1 + m_time->restart())/g_animation_interval; + int steps = (1 + m_time.restart())/g_animation_interval; AnimationMap::iterator it = m_animation_map.begin(); while (it != m_animation_map.end()) { AnimationItem &item = *it; @@ -159,35 +139,34 @@ void QWidgetAnimator::animationStep() item.step = qMin(item.step + steps, g_animation_steps); int x = animateHelper(item.r1.left(), item.r2.left(), - item.step, g_animation_steps); + item.step, g_animation_steps); int y = animateHelper(item.r1.top(), item.r2.top(), - item.step, g_animation_steps); + item.step, g_animation_steps); int w = animateHelper(item.r1.width(), item.r2.width(), - item.step, g_animation_steps); + item.step, g_animation_steps); int h = animateHelper(item.r1.height(), item.r2.height(), - item.step, g_animation_steps); + item.step, g_animation_steps); item.widget->setGeometry(x, y, w, h); if (item.step == g_animation_steps) { - emit finished(item.widget); - AnimationMap::iterator tmp = it; - ++it; - m_animation_map.erase(tmp); + QWidget *widget = item.widget; + it = m_animation_map.erase(it); + m_mainWindowLayout->animationFinished(widget); } else { ++it; } } if (m_animation_map.isEmpty()) { - m_timer->stop(); - emit finishedAll(); + m_timer.stop(); + m_mainWindowLayout->allAnimationsFinished(); } } bool QWidgetAnimator::animating() const { - return m_timer->isActive(); + return m_timer.isActive(); } bool QWidgetAnimator::animating(QWidget *widget) diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h index 6ee150b..0c68e00 100644 --- a/src/gui/widgets/qwidgetanimator_p.h +++ b/src/gui/widgets/qwidgetanimator_p.h @@ -56,18 +56,18 @@ #include #include #include +#include +#include QT_BEGIN_NAMESPACE class QWidget; -class QTimer; -class QTime; +class QMainWindowLayout; class QWidgetAnimator : public QObject { - Q_OBJECT public: - QWidgetAnimator(QObject *parent = 0); + QWidgetAnimator(QMainWindowLayout *layout); ~QWidgetAnimator(); void animate(QWidget *widget, const QRect &final_geometry, bool animate); bool animating() const; @@ -75,12 +75,8 @@ public: void abort(QWidget *widget); -signals: - void finished(QWidget *widget); - void finishedAll(); - -private slots: - void animationStep(); +protected: + void timerEvent(QTimerEvent *e); private: struct AnimationItem { @@ -93,8 +89,9 @@ private: }; typedef QMap AnimationMap; AnimationMap m_animation_map; - QTimer *m_timer; - QTime *m_time; + QBasicTimer m_timer; + QTime m_time; + QMainWindowLayout *m_mainWindowLayout; }; QT_END_NAMESPACE -- cgit v0.12 From 5077f0be81128ee81e8c7875eb9d1e9423868808 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 1 Jul 2009 15:54:10 +0200 Subject: Animation: fixed a NOTIFY signal name that was wrong Also slightly updated a demo --- examples/animation/animatedtiles/main.cpp | 12 ++++++------ src/corelib/animation/qvariantanimation.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp index 9360d7c..c0d55f3 100644 --- a/examples/animation/animatedtiles/main.cpp +++ b/examples/animation/animatedtiles/main.cpp @@ -178,7 +178,7 @@ int main(int argc, char **argv) QState *centeredState = new QState(rootState); // Values - for (int i = 0; i < 64; ++i) { + for (int i = 0; i < items.count(); ++i) { Pixmap *item = items.at(i); // Ellipse ellipseState->assignProperty(item, "pos", @@ -219,7 +219,7 @@ int main(int argc, char **argv) rootState->setInitialState(centeredState); QParallelAnimationGroup *group = new QParallelAnimationGroup; - for (int i = 0; i < 64; ++i) { + for (int i = 0; i < items.count(); ++i) { QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos"); anim->setDuration(750 + i * 25); anim->setEasingCurve(QEasingCurve::InOutBack); @@ -229,7 +229,7 @@ int main(int argc, char **argv) trans->addAnimation(group); group = new QParallelAnimationGroup; - for (int i = 0; i < 64; ++i) { + for (int i = 0; i < items.count(); ++i) { QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos"); anim->setDuration(750 + i * 25); anim->setEasingCurve(QEasingCurve::InOutBack); @@ -239,7 +239,7 @@ int main(int argc, char **argv) trans->addAnimation(group); group = new QParallelAnimationGroup; - for (int i = 0; i < 64; ++i) { + for (int i = 0; i < items.count(); ++i) { QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos"); anim->setDuration(750 + i * 25); anim->setEasingCurve(QEasingCurve::InOutBack); @@ -249,7 +249,7 @@ int main(int argc, char **argv) trans->addAnimation(group); group = new QParallelAnimationGroup; - for (int i = 0; i < 64; ++i) { + for (int i = 0; i < items.count(); ++i) { QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos"); anim->setDuration(750 + i * 25); anim->setEasingCurve(QEasingCurve::InOutBack); @@ -259,7 +259,7 @@ int main(int argc, char **argv) trans->addAnimation(group); group = new QParallelAnimationGroup; - for (int i = 0; i < 64; ++i) { + for (int i = 0; i < items.count(); ++i) { QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos"); anim->setDuration(750 + i * 25); anim->setEasingCurve(QEasingCurve::InOutBack); diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h index b2d52d5..3e397ca 100644 --- a/src/corelib/animation/qvariantanimation.h +++ b/src/corelib/animation/qvariantanimation.h @@ -62,7 +62,7 @@ class Q_CORE_EXPORT QVariantAnimation : public QAbstractAnimation Q_OBJECT Q_PROPERTY(QVariant startValue READ startValue WRITE setStartValue) Q_PROPERTY(QVariant endValue READ endValue WRITE setEndValue) - Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY currentValueChanged) + Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY valueChanged) Q_PROPERTY(int duration READ duration WRITE setDuration) Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve) -- cgit v0.12 From 0ee90990c24bf965317918074a5af683e94bdd40 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 1 Jul 2009 16:38:37 +0200 Subject: Animations: adding an autotest for jumping values when restarting The problem is that when restarting, the time is at the end. So the current value changes to the end value instead of the initial value. --- .../qpropertyanimation/tst_qpropertyanimation.cpp | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index a30e9f9..09e12c3 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -111,6 +111,7 @@ private slots: void operationsInStates(); void oneKeyValue(); void updateOnSetKeyValues(); + void restart(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -559,6 +560,9 @@ void tst_QPropertyAnimation::startWithoutStartValue() QTest::qWait(200); QCOMPARE(anim.state(), QVariantAnimation::Stopped); + current = anim.currentValue().toInt(); + QCOMPARE(current, 100); + QCOMPARE(o.property("ole").toInt(), current); anim.setEndValue(110); anim.start(); @@ -954,5 +958,53 @@ void tst_QPropertyAnimation::updateOnSetKeyValues() QCOMPARE(animation2.currentValue().toInt(), animation.currentValue().toInt()); } + +//this class will 'throw' an error in the test lib +// if the property ole is set to ErrorValue +class MyErrorObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int ole READ ole WRITE setOle) +public: + + static const int ErrorValue = 10000; + + MyErrorObject() : m_ole(0) { } + int ole() const { return m_ole; } + void setOle(int o) + { + QVERIFY(o != ErrorValue); + m_ole = o; + } + +private: + int m_ole; + + +}; + +void tst_QPropertyAnimation::restart() +{ + //here we check that be restarting an animation + //it doesn't get an bogus intermediate value (end value) + //because the time is not yet reset to 0 + MyErrorObject o; + o.setOle(100); + QCOMPARE(o.property("ole").toInt(), 100); + + QPropertyAnimation anim(&o, "ole"); + anim.setEndValue(200); + anim.start(); + anim.setCurrentTime(anim.duration()); + QCOMPARE(anim.state(), QAbstractAnimation::Stopped); + QCOMPARE(o.property("ole").toInt(), 200); + + //we'll check that the animation never gets a wrong value when starting it + //after having changed the end value + anim.setEndValue(MyErrorObject::ErrorValue); + anim.start(); +} + + QTEST_MAIN(tst_QPropertyAnimation) #include "tst_qpropertyanimation.moc" -- cgit v0.12 From 29b71240d17a1557fd9a8d2ce7dcd450b07b57a8 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 1 Jul 2009 17:15:17 +0200 Subject: QAnimation: fix a jump in values when restarting an animation --- src/corelib/animation/qabstractanimation.cpp | 47 ++++++++++------------ .../qpropertyanimation/tst_qpropertyanimation.cpp | 5 +++ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 3720984..75decf8 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -254,8 +254,17 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) int oldCurrentLoop = currentLoop; QAbstractAnimation::Direction oldDirection = direction; - state = newState; + // check if we should Rewind + if ((newState == QAbstractAnimation::Paused || newState == QAbstractAnimation::Running) + && oldState == QAbstractAnimation::Stopped) { + //here we reset the time if needed + //we don't call setCurrentTime because this might change the way the animation + //behaves: changing the state or changing the current value + totalCurrentTime = currentTime =(direction == QAbstractAnimation::Forward) ? + 0 : (loopCount == -1 ? q->duration() : q->totalDuration()); + } + state = newState; QPointer guard(q); guard->updateState(oldState, newState); @@ -268,36 +277,22 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) if (guard) emit guard->stateChanged(oldState, newState); - // Enter running state. switch (state) { case QAbstractAnimation::Paused: case QAbstractAnimation::Running: - { - // Rewind - if (oldState == QAbstractAnimation::Stopped) { - if (guard) { - if (direction == QAbstractAnimation::Forward) - q->setCurrentTime(0); - else - q->setCurrentTime(loopCount == -1 ? q->duration() : q->totalDuration()); - } - - // Check if the setCurrentTime() function called stop(). - // This can happen for a 0-duration animation - if (state == QAbstractAnimation::Stopped) - return; - } - - // Register timer if our parent is not running. - if (state == QAbstractAnimation::Running && guard) { - if (!group || group->state() == QAbstractAnimation::Stopped) { - QUnifiedTimer::instance()->registerAnimation(q); - } - } else { - //new state is paused - QUnifiedTimer::instance()->unregisterAnimation(q); + //this ensures that the value is updated now that the animation is running + if(oldState == QAbstractAnimation::Stopped && guard) + guard->setCurrentTime(currentTime); + + // Register timer if our parent is not running. + if (state == QAbstractAnimation::Running && guard) { + if (!group || group->state() == QAbstractAnimation::Stopped) { + QUnifiedTimer::instance()->registerAnimation(q); } + } else { + //new state is paused + QUnifiedTimer::instance()->unregisterAnimation(q); } break; case QAbstractAnimation::Stopped: diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 09e12c3..e76c8ef 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -396,8 +396,13 @@ void tst_QPropertyAnimation::duration0() animation.setEndValue(43); QVERIFY(!animation.currentValue().isValid()); QCOMPARE(animation.currentValue().toInt(), 0); + animation.setStartValue(42); + QVERIFY(animation.currentValue().isValid()); + QCOMPARE(animation.currentValue().toInt(), 42); + QCOMPARE(o.property("ole").toInt(), 42); animation.setDuration(0); + QCOMPARE(animation.currentValue().toInt(), 43); //it is at the end animation.start(); QCOMPARE(animation.state(), QAnimationGroup::Stopped); QCOMPARE(animation.currentTime(), 0); -- cgit v0.12 From 2b9294a2b47c4a193ef83be60a07a3e61b8531b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 1 Jul 2009 17:30:46 +0200 Subject: Fixes broken BSP lookup in QGraphicsSceneBspTreeIndex. The chip demo was unbelievable slow, so I investigated and found out the bsp always returned almost all items in the tree (40 000 in this particular case). It did so because the tree was initialized with an empty sceneRect. The sceneRect was empty due to a lacking signal-slot connection, resulting in QGraphicsSceneBspTreeIndex::updateSceneRect never being invoked. Auto-test included. --- src/gui/graphicsview/qgraphicssceneindex.cpp | 17 ++++++++++++----- src/gui/graphicsview/qgraphicssceneindex_p.h | 3 ++- .../qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 13 +++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 2f2f05e..b317e8e 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -303,24 +303,31 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe } } +void QGraphicsSceneIndexPrivate::init() +{ + if (!scene) + return; + + QObject::connect(scene, SIGNAL(sceneRectChanged(const QRectF&)), + q_func(), SLOT(updateSceneRect(const QRectF&))); +} + /*! Constructs an abstract scene index for a given \a scene. */ QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene) : QObject(*new QGraphicsSceneIndexPrivate(scene), scene) { - if (scene) { - connect(scene, SIGNAL(sceneRectChanged(const QRectF&)), - this, SLOT(updateSceneRect(const QRectF&))); - } + d_func()->init(); } /*! \internal */ -QGraphicsSceneIndex::QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene) +QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsSceneIndexPrivate &dd, QGraphicsScene *scene) : QObject(dd, scene) { + d_func()->init(); } /*! diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index 122d7ae..aabfa79 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -114,7 +114,7 @@ protected: virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value); virtual void prepareBoundingRectChange(const QGraphicsItem *item); - QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene); + QGraphicsSceneIndex(QGraphicsSceneIndexPrivate &dd, QGraphicsScene *scene); friend class QGraphicsScene; friend class QGraphicsScenePrivate; @@ -133,6 +133,7 @@ public: QGraphicsSceneIndexPrivate(QGraphicsScene *scene); ~QGraphicsSceneIndexPrivate(); + void init(); static bool itemCollidesWithPath(const QGraphicsItem *item, const QPainterPath &path, Qt::ItemSelectionMode mode); void recursive_items_helper(QGraphicsItem *item, QRectF exposeRect, diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index ac21e20..9d0675d 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -64,6 +64,7 @@ private slots: void overlappedItems(); void movingItems_data(); void movingItems(); + void connectedToSceneRectChanged(); private: void common_data(); @@ -214,6 +215,18 @@ void tst_QGraphicsSceneIndex::movingItems() QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 11); } +void tst_QGraphicsSceneIndex::connectedToSceneRectChanged() +{ + + class MyScene : public QGraphicsScene + { public: using QGraphicsScene::receivers; }; + + MyScene scene; // Uses QGraphicsSceneBspTreeIndex by default. + QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1); + + scene.setItemIndexMethod(QGraphicsScene::NoIndex); // QGraphicsSceneLinearIndex + QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1); +} QTEST_MAIN(tst_QGraphicsSceneIndex) #include "tst_qgraphicssceneindex.moc" -- cgit v0.12 From 3e303b195a79d555b907a6badbe4df5d4b8686b4 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 1 Jul 2009 16:07:01 -0700 Subject: Code cleanup Move the code from QDirectFBPaintEnginePrivate::(end|begin) into QDirectFBPaintEngine::(end|begin) Reviewed-by: TrustMe --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 84 ++++++++++------------ 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 40bec0e..bac9f09 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -244,9 +244,6 @@ public: inline void updateClip(); void systemStateChanged(); - void begin(QPaintDevice *device); - void end(); - static IDirectFBSurface *getSurface(const QImage &img, bool *release); #ifdef QT_DIRECTFB_IMAGECACHE @@ -299,7 +296,34 @@ QDirectFBPaintEngine::~QDirectFBPaintEngine() bool QDirectFBPaintEngine::begin(QPaintDevice *device) { Q_D(QDirectFBPaintEngine); - d->begin(device); + d->lastLockedHeight = -1; + if (device->devType() == QInternal::CustomRaster) { + d->dfbDevice = static_cast(device); + } else if (d->device->devType() == QInternal::Pixmap) { + QPixmapData *data = static_cast(device)->pixmapData(); + Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData *dfbPixmapData = static_cast(data); + d->dfbDevice = static_cast(dfbPixmapData); + } + + if (d->dfbDevice) + d->surface = d->dfbDevice->directFBSurface(); + + if (!d->surface) { + qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", + device->devType()); + } + d->lockedMemory = 0; + + d->surface->GetSize(d->surface, &d->fbWidth, &d->fbHeight); + + d->setTransform(QTransform()); + d->antialiased = false; + d->setOpacity(255); + d->setCompositionMode(state()->compositionMode()); + d->dirtyClip = true; + d->setPen(state()->pen); + const bool status = QRasterPaintEngine::begin(device); // XXX: QRasterPaintEngine::begin() resets the capabilities @@ -311,8 +335,14 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device) bool QDirectFBPaintEngine::end() { Q_D(QDirectFBPaintEngine); - d->end(); - return QRasterPaintEngine::end(); + d->unlock(); + d->dfbDevice = 0; +#if (Q_DIRECTFB_VERSION >= 0x010000) + d->surface->ReleaseSource(d->surface); +#endif + d->surface->SetClip(d->surface, NULL); + d->surface = 0; + return true; } void QDirectFBPaintEngine::clipEnabledChanged() @@ -873,48 +903,6 @@ void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m) } } -void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) -{ - lastLockedHeight = -1; - if (device->devType() == QInternal::CustomRaster) - dfbDevice = static_cast(device); - else if (device->devType() == QInternal::Pixmap) { - QPixmapData *data = static_cast(device)->pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData* dfbPixmapData = static_cast(data); - dfbDevice = static_cast(dfbPixmapData); - } - - if (dfbDevice) - surface = dfbDevice->directFBSurface(); - - if (!surface) { - qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", - device->devType()); - } - lockedMemory = 0; - - surface->GetSize(surface, &fbWidth, &fbHeight); - - setTransform(QTransform()); - antialiased = false; - setOpacity(255); - setCompositionMode(q->state()->compositionMode()); - dirtyClip = true; - setPen(q->state()->pen); -} - -void QDirectFBPaintEnginePrivate::end() -{ - lockedMemory = 0; - dfbDevice = 0; -#if (Q_DIRECTFB_VERSION >= 0x010000) - surface->ReleaseSource(surface); -#endif - surface->SetClip(surface, NULL); - surface = 0; -} - void QDirectFBPaintEnginePrivate::setPen(const QPen &p) { pen = p; -- cgit v0.12 From 765a6676e04b19a9af298096f9d4f0a6e571ccbd Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 1 Jul 2009 16:11:50 -0700 Subject: Make sure we check the right device Also. Make sure to call QRasterPaintEngine::end() Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index bac9f09..e4ce230 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -299,7 +299,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device) d->lastLockedHeight = -1; if (device->devType() == QInternal::CustomRaster) { d->dfbDevice = static_cast(device); - } else if (d->device->devType() == QInternal::Pixmap) { + } else if (device->devType() == QInternal::Pixmap) { QPixmapData *data = static_cast(device)->pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbPixmapData = static_cast(data); @@ -342,7 +342,7 @@ bool QDirectFBPaintEngine::end() #endif d->surface->SetClip(d->surface, NULL); d->surface = 0; - return true; + return QRasterPaintEngine::end(); } void QDirectFBPaintEngine::clipEnabledChanged() -- cgit v0.12 From f31d2c01e5998a9fcf4345fa66e0349921e115da Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 2 Jul 2009 09:57:52 +1000 Subject: OpenVG: use the correct clip region to detect single-rect clips "Special case: if the intersection of the system clip and the region is a single rectangle, then use the scissor for clipping." It was doing the intersection but then didn't use the intersection to test for the single-rectangle case. Task-number: QT-64 Reviewed-by: trustme --- src/openvg/qpaintengine_vg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index c7fe604..8ce3f69 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1656,10 +1656,10 @@ void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) clip = r; else clip = clip.intersect(r); - if (r.numRects() == 1) { + if (clip.numRects() == 1) { d->maskValid = false; d->maskIsSet = false; - d->maskRect = r.boundingRect(); + d->maskRect = clip.boundingRect(); vgSeti(VG_MASKING, VG_FALSE); updateScissor(); } else { -- cgit v0.12 From 0b5c4c4352d0419113cf152b7ae5bbee5a45fd5c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 2 Jul 2009 10:36:19 +1000 Subject: OpenVG: override QPaintEngineEx::clip(QRect) and handle specially. This change should improve performance of single-rectangle clip regions by avoiding the overhead of creating and intersecting QRegion objects. Task-number: QT-64 Reviewed-by: trustme --- src/openvg/qpaintengine_vg.cpp | 130 ++++++++++++++++++++++++++++++++++++++++- src/openvg/qpaintengine_vg_p.h | 1 + 2 files changed, 129 insertions(+), 2 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 8ce3f69..48953ac 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -142,6 +142,8 @@ public: void ensureMask(QVGPaintEngine *engine, int width, int height); void modifyMask (QVGPaintEngine *engine, VGMaskOperation op, const QRegion& region); + void modifyMask + (QVGPaintEngine *engine, VGMaskOperation op, const QRect& rect); #endif VGint maxScissorRects; // Maximum scissor rectangles for clipping. @@ -1611,13 +1613,106 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) { - clip(QRegion(rect), op); + Q_D(QVGPaintEngine); + + d->dirty |= QPaintEngine::DirtyClipRegion; + + // If we have a non-simple transform, then use path-based clipping. + if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { + QPaintEngineEx::clip(rect, op); + return; + } + + switch (op) { + case Qt::NoClip: + { + d->maskValid = false; + d->maskIsSet = true; + d->maskRect = QRect(); + vgSeti(VG_MASKING, VG_FALSE); + } + break; + + case Qt::ReplaceClip: + { + QRect r = d->transform.mapRect(rect); + if (isDefaultClipRect(r)) { + // Replacing the clip with a full-window region is the + // same as turning off clipping. + if (d->maskValid) + vgSeti(VG_MASKING, VG_FALSE); + d->maskValid = false; + d->maskIsSet = true; + d->maskRect = QRect(); + } else { + // Special case: if the intersection of the system + // clip and "r" is a single rectangle, then use the + // scissor for clipping. We try to avoid allocating a + // QRegion copy on the heap for the test if we can. + QRegion clip = d->systemClip; // Reference-counted, no alloc. + QRect clipRect; + if (clip.numRects() == 1) { + clipRect = clip.boundingRect().intersected(r); + } else if (clip.isEmpty()) { + clipRect = r; + } else { + clip = clip.intersect(r); + if (clip.numRects() != 1) { + d->maskValid = false; + d->maskIsSet = false; + d->maskRect = QRect(); + d->modifyMask(this, VG_FILL_MASK, r); + break; + } + clipRect = clip.boundingRect(); + } + d->maskValid = false; + d->maskIsSet = false; + d->maskRect = clipRect; + vgSeti(VG_MASKING, VG_FALSE); + updateScissor(); + } + } + break; + + case Qt::IntersectClip: + { + QRect r = d->transform.mapRect(rect); + if (d->maskIsSet && isDefaultClipRect(r)) { + // Intersecting a full-window clip with a full-window + // region is the same as turning off clipping. + if (d->maskValid) + vgSeti(VG_MASKING, VG_FALSE); + d->maskValid = false; + d->maskIsSet = true; + d->maskRect = QRect(); + } else { + d->modifyMask(this, VG_INTERSECT_MASK, r); + } + } + break; + + case Qt::UniteClip: + { + // If we already have a full-window clip, then uniting a + // region with it will do nothing. Otherwise union. + if (!(d->maskIsSet)) + d->modifyMask(this, VG_UNION_MASK, d->transform.mapRect(rect)); + } + break; + } } void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) { Q_D(QVGPaintEngine); + // Use the QRect case if the region consists of a single rectangle. + if (region.numRects() == 1) { + clip(region.boundingRect(), op); + return; + } + d->dirty |= QPaintEngine::DirtyClipRegion; // If we have a non-simple transform, then use path-based clipping. @@ -1765,7 +1860,7 @@ void QVGPaintEnginePrivate::ensureMask maskRect = QRect(); } else { vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height); - if (!maskRect.isNull()) { + if (maskRect.isValid()) { vgMask(VG_INVALID_HANDLE, VG_FILL_MASK, maskRect.x(), height - maskRect.y() - maskRect.height(), maskRect.width(), maskRect.height()); @@ -1797,6 +1892,27 @@ void QVGPaintEnginePrivate::modifyMask maskIsSet = false; } +void QVGPaintEnginePrivate::modifyMask + (QVGPaintEngine *engine, VGMaskOperation op, const QRect& rect) +{ + QPaintDevice *pdev = engine->paintDevice(); + int width = pdev->width(); + int height = pdev->height(); + + if (!maskValid) + ensureMask(engine, width, height); + + if (rect.isValid()) { + vgMask(VG_INVALID_HANDLE, op, + rect.x(), height - rect.y() - rect.height(), + rect.width(), rect.height()); + } + + vgSeti(VG_MASKING, VG_TRUE); + maskValid = true; + maskIsSet = false; +} + #endif // !QVG_SCISSOR_CLIP void QVGPaintEngine::updateScissor() @@ -1892,6 +2008,16 @@ bool QVGPaintEngine::isDefaultClipRegion(const QRegion& region) rect.width() == width && rect.height() == height); } +bool QVGPaintEngine::isDefaultClipRect(const QRect& rect) +{ + QPaintDevice *pdev = paintDevice(); + int width = pdev->width(); + int height = pdev->height(); + + return (rect.x() == 0 && rect.y() == 0 && + rect.width() == width && rect.height() == height); +} + void QVGPaintEngine::clipEnabledChanged() { #if defined(QVG_SCISSOR_CLIP) diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index a390c80..bde06e5 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -154,6 +154,7 @@ private: void updateScissor(); QRegion defaultClipRegion(); bool isDefaultClipRegion(const QRegion& region); + bool isDefaultClipRect(const QRect& rect); bool clearRect(const QRectF &rect, const QColor &color); }; -- cgit v0.12 From 6c9647f6673fd5738001c5bbe416b116442fbc41 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 2 Jul 2009 10:50:03 +1000 Subject: OpenVG: short-cut clipping for QPainterPath's that are just rects If the QPainterPath contains a structure that looks like a simple rectangle, then use the faster clip(QRect) function instead of a full VGPath-based render call. Task-number: QT-64 Reviewed-by: trustme --- src/openvg/qpaintengine_vg.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 48953ac..7a962e4 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1802,11 +1802,61 @@ void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) } } +#if !defined(QVG_NO_RENDER_TO_MASK) + +// Copied from qpathclipper.cpp. +static bool qt_vg_pathToRect(const QPainterPath &path, QRectF *rect) +{ + if (path.elementCount() != 5) + return false; + + const bool mightBeRect = path.elementAt(0).isMoveTo() + && path.elementAt(1).isLineTo() + && path.elementAt(2).isLineTo() + && path.elementAt(3).isLineTo() + && path.elementAt(4).isLineTo(); + + if (!mightBeRect) + return false; + + const qreal x1 = path.elementAt(0).x; + const qreal y1 = path.elementAt(0).y; + + const qreal x2 = path.elementAt(1).x; + const qreal y2 = path.elementAt(2).y; + + if (path.elementAt(1).y != y1) + return false; + + if (path.elementAt(2).x != x2) + return false; + + if (path.elementAt(3).x != x1 || path.elementAt(3).y != y2) + return false; + + if (path.elementAt(4).x != x1 || path.elementAt(4).y != y1) + return false; + + if (rect) + *rect = QRectF(QPointF(x1, y1), QPointF(x2, y2)); + + return true; +} + +#endif + void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op) { #if !defined(QVG_NO_RENDER_TO_MASK) Q_D(QVGPaintEngine); + // If the path is a simple rectangle, then use clip(QRect) instead. + QRectF simpleRect; + if (qt_vg_pathToRect(path, &simpleRect)) { + clip(simpleRect.toRect(), op); + return; + } + d->dirty |= QPaintEngine::DirtyClipRegion; if (op == Qt::NoClip) { -- cgit v0.12 From 35a4141f01ab9db910c85ccb89e76058aa3ac5cf Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 1 Jul 2009 17:58:49 -0700 Subject: We still need to Flip in NO_WM mode This ifdef was simply in the wrong place. Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 71e1fde..86ee62c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -364,6 +364,7 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, if (winOpacity != opacity) dfbWindow->SetOpacity(dfbWindow, winOpacity); } +#endif if (!(flipFlags & DSFLIP_BLIT)) { dfbSurface->Flip(dfbSurface, 0, flipFlags); } else { @@ -385,7 +386,6 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, dfbSurface->Flip(dfbSurface, &dfbReg, flipFlags); } } -#endif #ifdef QT_DIRECTFB_TIMING enum { Secs = 3 }; ++frames; -- cgit v0.12 From a24b8166631a9b1d80f8205cd0e450824166a25d Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 2 Jul 2009 14:59:14 +1000 Subject: Get more autotests passing/fixed up. --- src/sql/drivers/oci/qsql_oci.cpp | 7 +++++-- tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 4 ++++ tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index bbbbc22..8d34dd8 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -1588,9 +1588,12 @@ void QOCICols::getValues(QVector &v, int index) } else if ((d->precisionPolicy == QSql::LowPrecisionInt64) && (fld.typ == QVariant::LongLong)) { qint64 qll = 0; - OCINumberToInt(d->err, reinterpret_cast(fld.data), sizeof(qint64), + int r = OCINumberToInt(d->err, reinterpret_cast(fld.data), sizeof(qint64), OCI_NUMBER_SIGNED, &qll); - v[index + i] = qll; + if(r == OCI_SUCCESS) + v[index + i] = qll; + else + v[index + i] = QVariant(); break; } else if ((d->precisionPolicy == QSql::LowPrecisionInt32) && (fld.typ == QVariant::Int)) { diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index a2f4a66..91533dd 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -132,6 +132,10 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) if ( !db.isValid() ) return; QSqlQuery q( db ); + if (tst_Databases::isSqlServer(db)) { + QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); + QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); + } // please never ever change this table; otherwise fix all tests ;) if ( tst_Databases::isMSAccess( db ) ) { QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index a286fb9..28a2191 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -298,6 +298,7 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db) q.exec("set table_type=innodb"); if (tst_Databases::isSqlServer(db)) { QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); + QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); } // please never ever change this table; otherwise fix all tests ;) @@ -1244,7 +1245,7 @@ void tst_QSqlDatabase::recordSQLServer() FieldDef("varchar(20)", QVariant::String, QString("Blah1")), FieldDef("bigint", QVariant::LongLong, 12345), FieldDef("int", QVariant::Int, 123456), - FieldDef("tinyint", QVariant::Int, 255), + FieldDef("tinyint", QVariant::UInt, 255), #ifdef QT3_SUPPORT FieldDef("image", QVariant::ByteArray, Q3CString("Blah1")), #endif @@ -1359,11 +1360,13 @@ void tst_QSqlDatabase::bigIntField() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + QString drvName = db.driverName(); QSqlQuery q(db); q.setForwardOnly(true); + if (drvName.startsWith("QOCI")) + q.setNumericalPrecisionPolicy(QSql::LowPrecisionInt64); - QString drvName = db.driverName(); if (drvName.startsWith("QMYSQL")) { QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + " (id int, t_s64bit bigint, t_u64bit bigint unsigned)")); } else if (drvName.startsWith("QPSQL") @@ -1372,6 +1375,8 @@ void tst_QSqlDatabase::bigIntField() QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + "(id int, t_s64bit bigint, t_u64bit bigint)")); } else if (drvName.startsWith("QOCI")) { QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + " (id int, t_s64bit int, t_u64bit int)")); + //} else if (drvName.startsWith("QIBASE")) { + // QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + " (id int, t_s64bit int64, t_u64bit int64)")); } else { QSKIP("no 64 bit integer support", SkipAll); } @@ -1401,10 +1406,15 @@ void tst_QSqlDatabase::bigIntField() } QVERIFY(q.exec("select * from " + qTableName("qtest_bigint") + " order by id")); QVERIFY(q.next()); + QCOMPARE(q.value(1).toDouble(), (double)ll); QCOMPARE(q.value(1).toLongLong(), ll); + if(drvName.startsWith("QOCI")) + QEXPECT_FAIL("", "Oracle driver lacks support for unsigned int64 types", Continue); QCOMPARE(q.value(2).toULongLong(), ull); QVERIFY(q.next()); QCOMPARE(q.value(1).toLongLong(), -ll); + if(drvName.startsWith("QOCI")) + QEXPECT_FAIL("", "Oracle driver lacks support for unsigned int64 types", Continue); QCOMPARE(q.value(2).toULongLong(), ull); } -- cgit v0.12 From 18055b3c3fe50337ee1af819839694674bdfb3ff Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 2 Jul 2009 15:00:03 +1000 Subject: Tinyint is unsigned, force it to such. Tinyint only supports 0-255, so mark it as unsigned despite sign flag, which have the time is inverted/wrong. --- src/sql/drivers/odbc/qsql_odbc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index e18a9eb..4f358ec 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -252,9 +252,11 @@ static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, const T* p, bool isSi case SQL_SMALLINT: case SQL_INTEGER: case SQL_BIT: - case SQL_TINYINT: type = isSigned ? QVariant::Int : QVariant::UInt; break; + case SQL_TINYINT: + type = QVariant::UInt; + break; case SQL_BIGINT: type = isSigned ? QVariant::LongLong : QVariant::ULongLong; break; -- cgit v0.12 From cdfb2ed5096053314c0e23482609a1a491636ac1 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 2 Jul 2009 10:16:20 +1000 Subject: Improve cetest error reporting. Reviewed-by: Michael Goddard --- .../qtestlib/wince/cetest/activesyncconnection.cpp | 6 ++-- tools/qtestlib/wince/cetest/remoteconnection.cpp | 32 ++++++++++++++++++++++ tools/qtestlib/wince/cetest/remoteconnection.h | 2 ++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp index e8ca8f2..76e4a41 100644 --- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp +++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp @@ -113,6 +113,8 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS CeCloseHandle(deviceHandle); return true; } + } else { + qWarning("Could not open %s: %s", qPrintable(localSource), qPrintable(file.errorString())); } return false; } @@ -120,7 +122,7 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS deleteFile(deviceDest); HANDLE deviceHandle = CeCreateFile(deviceDest.utf16(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (deviceHandle == INVALID_HANDLE_VALUE) { - debugOutput(QString::fromLatin1(" Could not create target file"), 2); + qWarning("Could not create %s: %s", qPrintable(deviceDest), strwinerror(CeGetLastError()).constData()); return false; } @@ -144,7 +146,7 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS if (toWrite == 0) break; if (!CeWriteFile(deviceHandle, data.data() , toWrite, &written, NULL)) { - debugOutput(QString::fromLatin1(" Could not write File"), 2); + qWarning("Could not write to %s: %s", qPrintable(deviceDest), strwinerror(CeGetLastError()).constData()); return false; } currentPos += written; diff --git a/tools/qtestlib/wince/cetest/remoteconnection.cpp b/tools/qtestlib/wince/cetest/remoteconnection.cpp index 547b211..75788e2 100644 --- a/tools/qtestlib/wince/cetest/remoteconnection.cpp +++ b/tools/qtestlib/wince/cetest/remoteconnection.cpp @@ -41,6 +41,38 @@ #include "remoteconnection.h" +QByteArray strwinerror(DWORD errorcode) +{ + QByteArray out(512, 0); + + DWORD ok = FormatMessageA( + FORMAT_MESSAGE_FROM_SYSTEM, + 0, + errorcode, + 0, + out.data(), + out.size(), + 0 + ); + + if (!ok) { + qsnprintf(out.data(), out.size(), + "(error %d; additionally, error %d while looking up error string)", + (int)errorcode, (int)GetLastError()); + } + else { + out.resize(qstrlen(out.constData())); + if (out.endsWith("\r\n")) + out.chop(2); + + /* Append error number to error message for good measure */ + out.append(" ("); + out.append(QByteArray::number((int)errorcode)); + out.append(")"); + } + return out; +} + AbstractRemoteConnection::AbstractRemoteConnection() { } diff --git a/tools/qtestlib/wince/cetest/remoteconnection.h b/tools/qtestlib/wince/cetest/remoteconnection.h index 9c3e63d..f517009 100644 --- a/tools/qtestlib/wince/cetest/remoteconnection.h +++ b/tools/qtestlib/wince/cetest/remoteconnection.h @@ -79,4 +79,6 @@ public: virtual bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL) = 0; }; +QByteArray strwinerror(DWORD); + #endif -- cgit v0.12 From fb1fa68ae8555deeaeaf6f193c678269c85ffc4d Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 2 Jul 2009 11:42:25 +1000 Subject: Let QtRemote report the error code to cetest when creating the test process fails. This gives some hint to the user in the case of problems like missing DLLs, as opposed to silent failure. Reviewed-by: Michael Goddard --- tools/qtestlib/wince/cetest/activesyncconnection.cpp | 14 ++++++++++++-- tools/qtestlib/wince/remotelib/commands.cpp | 10 ++++++++-- tools/qtestlib/wince/remotelib/commands.h | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp index 76e4a41..99fac2c 100644 --- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp +++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp @@ -382,6 +382,7 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo BYTE* output; IRAPIStream *stream; int returned = 0; + DWORD error = 0; HRESULT res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0); if (S_OK != res) { if (S_OK != CeGetLastError()) @@ -416,9 +417,18 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo if (S_OK != stream->Read(&returned, sizeof(returned), &written)) { qWarning(" Could not access return value of process"); } - result = true; - } + if (S_OK != stream->Read(&error, sizeof(error), &written)) { + qWarning(" Could not access error code"); + } + if (error) { + qWarning() << "Error on target:" << strwinerror(error); + result = false; + } + else { + result = true; + } + } if (returnValue) *returnValue = returned; diff --git a/tools/qtestlib/wince/remotelib/commands.cpp b/tools/qtestlib/wince/remotelib/commands.cpp index 3aed2d6..f2176dd 100644 --- a/tools/qtestlib/wince/remotelib/commands.cpp +++ b/tools/qtestlib/wince/remotelib/commands.cpp @@ -56,6 +56,7 @@ int qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream) wchar_t* arguments = 0; int timeout = -1; int returnValue = -2; + DWORD error = 0; if (S_OK != stream->Read(&appLength, sizeof(appLength), &bytesRead)) CLEAN_FAIL(-2); @@ -74,11 +75,13 @@ int qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream) if (S_OK != stream->Read(&timeout, sizeof(timeout), &bytesRead)) CLEAN_FAIL(-2); - bool result = qRemoteExecute(appName, arguments, &returnValue, timeout); + bool result = qRemoteExecute(appName, arguments, &returnValue, &error, timeout); if (timeout != 0) { if (S_OK != stream->Write(&returnValue, sizeof(returnValue), &bytesRead)) CLEAN_FAIL(-4); + if (S_OK != stream->Write(&error, sizeof(error), &bytesRead)) + CLEAN_FAIL(-5); } delete appName; delete arguments; @@ -90,13 +93,16 @@ int qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream) } -bool qRemoteExecute(const wchar_t* program, const wchar_t* arguments, int *returnValue, int timeout) +bool qRemoteExecute(const wchar_t* program, const wchar_t* arguments, int *returnValue, DWORD* error, int timeout) { + *error = 0; + if (!program) return false; PROCESS_INFORMATION pid; if (!CreateProcess(program, arguments, NULL, NULL, false, 0, NULL, NULL, NULL, &pid)) { + *error = GetLastError(); wprintf(L"Could not launch: %s\n", program); return false; } diff --git a/tools/qtestlib/wince/remotelib/commands.h b/tools/qtestlib/wince/remotelib/commands.h index 9f0b2e3..5275f2c 100644 --- a/tools/qtestlib/wince/remotelib/commands.h +++ b/tools/qtestlib/wince/remotelib/commands.h @@ -45,7 +45,7 @@ extern "C" { int __declspec(dllexport) qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream*); - bool __declspec(dllexport) qRemoteExecute(const wchar_t* program, const wchar_t* arguments = NULL, int *returnValue = NULL , int timeout = -1); + bool __declspec(dllexport) qRemoteExecute(const wchar_t* program, const wchar_t* arguments = NULL, int *returnValue = NULL , DWORD* error = NULL, int timeout = -1); } #endif -- cgit v0.12 From f126b8cc5733d2cd37dd2aad9119e482b0d4a0e6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 2 Jul 2009 08:39:57 +0200 Subject: doc: Corrected several qdoc warnings. --- src/gui/graphicsview/qgraphicssceneevent.cpp | 35 ++++++++++++++-------------- src/gui/itemviews/qheaderview.h | 2 +- src/gui/kernel/qapplication.cpp | 2 +- src/qt3support/widgets/q3datetimeedit.cpp | 7 +++--- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index 7906fb8..338f12a 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -1875,12 +1875,12 @@ void QGraphicsSceneGestureEvent::setGestures(const QSet &gestures) } /*! - Sets the accept flag of the all gestures inside the event object, - the equivalent of calling \l{QEvent::accept()}{accept()} or - \l{QEvent::setAccepted()}{setAccepted(true)}. + Sets the accept flag of the all gestures for the event object. + This is the equivalent of calling \l{QEvent::accept()} {accept()} + or \l{QEvent::setAccepted()}{setAccepted(true)}. - Setting the accept parameter indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent + Setting the accept flag indicates that the event receiver wants + the gesture. Unwanted gestures might be propagated to the parent widget. */ void QGraphicsSceneGestureEvent::acceptAll() @@ -1893,13 +1893,14 @@ void QGraphicsSceneGestureEvent::acceptAll() } /*! - Sets the accept flag of the specified gesture inside the event - object, the equivalent of calling - \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()} - Setting the accept parameter indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent - widget. + Sets the accept flag of the gesture specified by \a type. This is + equivalent to calling \l{QGestureEvent::gesture()} {gesture(type)}-> + \l{QGesture::accept()}{accept()} + + Setting the accept flag indicates that the event receiver + wants the gesture. Unwanted gestures might be propagated to the parent + widget. */ void QGraphicsSceneGestureEvent::accept(Qt::GestureType type) { @@ -1908,13 +1909,13 @@ void QGraphicsSceneGestureEvent::accept(Qt::GestureType type) } /*! - Sets the accept flag of the specified gesture inside the event - object, the equivalent of calling - \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()} - Setting the accept parameter indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent - widget. + Sets the accept flag of the gesture specified by \a type. This is + equivalent to calling \l{QGestureEvent::gesture()} {gesture(type)}-> + \l{QGesture::accept()}{accept()} + + Setting the accept flag indicates that the event receiver wants the + gesture. Unwanted gestures might be propagated to the parent widget. */ void QGraphicsSceneGestureEvent::accept(const QString &type) { diff --git a/src/gui/itemviews/qheaderview.h b/src/gui/itemviews/qheaderview.h index f752ae2..bf92667 100644 --- a/src/gui/itemviews/qheaderview.h +++ b/src/gui/itemviews/qheaderview.h @@ -221,7 +221,7 @@ protected: bool isIndexHidden(const QModelIndex &index) const; QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers); - void setSelection(const QRect&, QItemSelectionModel::SelectionFlags); + void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags); QRegion visualRegionForSelection(const QItemSelection &selection) const; void initStyleOption(QStyleOptionHeader *option) const; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 15ddce8..60c69cc 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5096,7 +5096,7 @@ void QApplication::removeGestureRecognizer(QGestureRecognizer *recognizer) The delay allows to postpone widget's input event handling until gestures framework can successfully recognize a gesture. - \sa QWidget::grabGesture + \sa QWidget::grabGesture() */ void QApplication::setEventDeliveryDelayForGestures(int delay) { diff --git a/src/qt3support/widgets/q3datetimeedit.cpp b/src/qt3support/widgets/q3datetimeedit.cpp index 4872642..9c2f289 100644 --- a/src/qt3support/widgets/q3datetimeedit.cpp +++ b/src/qt3support/widgets/q3datetimeedit.cpp @@ -2648,13 +2648,12 @@ Q3DateTimeEdit::~Q3DateTimeEdit() } -/*! +/*! \fn void Q3DateTimeEdit::resizeEvent(QResizeEvent *event) \reimp - Intercepts and handles resize events which have special meaning - for the Q3DateTimeEdit. + Intercepts and handles the resize \a event, which hase a + special meaning for the Q3DateTimeEdit. */ - void Q3DateTimeEdit::resizeEvent(QResizeEvent *) { int dw = de->sizeHint().width(); -- cgit v0.12 From 058c4f1cfd0536779ec99f3d89bdd90bf52ae20e Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 2 Jul 2009 12:58:51 +1000 Subject: Let cetest deploy libraries other than for Qt to make it usable for running unit tests for projects outside of Qt. Let cetest look in the paths given with `-L' in LIBS, and to deploy libraries whose names don't start with `Qt'. This also fixes deployment of Qt autotests which link against phonon (the only Qt library whose name doesn't start with `Qt'). Reviewed-by: mauricek --- tools/qtestlib/wince/cetest/deployment.cpp | 34 +++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/tools/qtestlib/wince/cetest/deployment.cpp b/tools/qtestlib/wince/cetest/deployment.cpp index fec2735..68f0197 100644 --- a/tools/qtestlib/wince/cetest/deployment.cpp +++ b/tools/qtestlib/wince/cetest/deployment.cpp @@ -125,13 +125,37 @@ void DeploymentHandler::initQtDeploy(QMakeProject *project, DeploymentList &depl if (!project->values("QMAKE_QT_DLL").isEmpty() && !project->values("QMAKE_LIBDIR").isEmpty()) { QStringList libs = project->values("LIBS"); QStringList qtLibs; + QStringList libPaths; foreach (QString item, libs) { - if (item.startsWith("-lQt")) { - qtLibs += project->values("QMAKE_LIBDIR").at(0) + QDir::separator() + item.mid(2) + QLatin1String("4.dll"); + + if (item.startsWith("-L")) { + // -L -> a directory containing DLLs + libPaths << item.mid(2); + continue; + } + + QStringList libCandidates; + + if (item.startsWith("-l")) { + // -l -> a library located within one of the standard library paths + QString lib = item.mid(2); + + // Check if it's a Qt library first, then check in all paths given with -L. + // Note Qt libraries get a `4' appended to them, others don't. + libCandidates << project->values("QMAKE_LIBDIR").at(0) + QDir::separator() + lib + QLatin1String("4.dll"); + foreach (QString const& libPath, libPaths) { + libCandidates << libPath + QDir::separator() + lib + QLatin1String(".dll"); + } } else { - QFileInfo info(item); - if (info.exists() && info.isAbsolute() && info.fileName().startsWith(QLatin1String("Qt"))) - qtLibs += info.dir().absoluteFilePath(info.fileName().replace(QLatin1String(".lib"), QLatin1String(".dll"))); + libCandidates << item.replace(".lib",".dll"); + } + + foreach (QString const& file, libCandidates) { + QFileInfo info(file); + if (info.exists()) { + qtLibs += info.dir().absoluteFilePath(info.fileName()); + break; + } } } for (QStringList::ConstIterator it = qtLibs.constBegin(); it != qtLibs.constEnd(); ++it) { -- cgit v0.12 From b4028f5a2195a432059ff26c288d772af47bc14d Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 2 Jul 2009 17:03:31 +1000 Subject: Fixed cetest compile. --- tools/qtestlib/wince/cetest/activesyncconnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp index 99fac2c..0f98619 100644 --- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp +++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp @@ -422,7 +422,7 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo } if (error) { - qWarning() << "Error on target:" << strwinerror(error); + qWarning("Error on target: %s", strwinerror(error).constData()); result = false; } else { -- cgit v0.12 From 5fc3fe2e3f04475ac8c0e3287af6042bd8b67c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 2 Jul 2009 09:56:13 +0200 Subject: Dont include untransformable graphics items twice. This revertes d39a62720ba67a0fa6e4e37519d22f14c7b7404e (we had to do it with the old implementation, but the new one have untransformable items included in the indexed list. The only difference is that untransformable items are also in the untransformable list; otherwise in the bsp tree). Auto-test included. --- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 1 - .../tst_qgraphicssceneindex.cpp | 39 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index ff9a3da..c8d755e 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -606,7 +606,6 @@ QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order) co itemList << item; } } - itemList += d->untransformableItems; if (order != -1) { //We sort descending order d->sortItems(&itemList, order, d->sortCacheEnabled); diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 9d0675d..3ce5b16 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -65,6 +65,7 @@ private slots: void movingItems_data(); void movingItems(); void connectedToSceneRectChanged(); + void items(); private: void common_data(); @@ -228,5 +229,43 @@ void tst_QGraphicsSceneIndex::connectedToSceneRectChanged() QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1); } +void tst_QGraphicsSceneIndex::items() +{ + QGraphicsScene scene; + QGraphicsItem *item1 = scene.addRect(0, 0, 10, 10); + QGraphicsItem *item2 = scene.addRect(10, 10, 10, 10); + QCOMPARE(scene.items().size(), 2); + + // Move from unindexed items into bsp tree. + QTest::qWait(50); + QCOMPARE(scene.items().size(), 2); + + // Add untransformable item. + QGraphicsItem *item3 = new QGraphicsRectItem(QRectF(20, 20, 10, 10)); + item3->setFlag(QGraphicsItem::ItemIgnoresTransformations); + scene.addItem(item3); + QCOMPARE(scene.items().size(), 3); + + // Move from unindexed items into untransformable items. + QTest::qWait(50); + QCOMPARE(scene.items().size(), 3); + + // Move from untransformable items into unindexed items. + item3->setFlag(QGraphicsItem::ItemIgnoresTransformations, false); + QCOMPARE(scene.items().size(), 3); + QTest::qWait(50); + QCOMPARE(scene.items().size(), 3); + + // Make all items untransformable. + item1->setFlag(QGraphicsItem::ItemIgnoresTransformations); + item2->setParentItem(item1); + item3->setParentItem(item2); + QCOMPARE(scene.items().size(), 3); + + // Move from unindexed items into untransformable items. + QTest::qWait(50); + QCOMPARE(scene.items().size(), 3); +} + QTEST_MAIN(tst_QGraphicsSceneIndex) #include "tst_qgraphicssceneindex.moc" -- cgit v0.12 From 69083610b09aaabbff5e8a177fac713a6a6d46ba Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 2 Jul 2009 10:38:08 +0200 Subject: doc: Corrected several qdoc warnings. --- src/gui/graphicsview/qgraphicssceneevent.cpp | 5 ++++- src/gui/kernel/qevent.cpp | 4 ++++ src/gui/kernel/qgesturerecognizer.cpp | 7 ++++--- src/qt3support/sql/q3datatable.cpp | 2 -- tools/qdoc3/test/qt-cpp-ignore.qdocconf | 3 ++- tools/qdoc3/test/qt-inc.qdocconf | 3 ++- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index 338f12a..27a2d7e 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -1892,8 +1892,11 @@ void QGraphicsSceneGestureEvent::acceptAll() setAccepted(true); } -/*! +/*! \fn void QGraphicsSceneGestureEvent::accept() + Calls QEvent::accept(). +*/ +/*! Sets the accept flag of the gesture specified by \a type. This is equivalent to calling \l{QGestureEvent::gesture()} {gesture(type)}-> \l{QGesture::accept()}{accept()} diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index e40ad9d..a7a7f2d 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3628,6 +3628,10 @@ QSet QGestureEvent::cancelledGestures() const return m_cancelledGestures; } +/*! \fn void QGestureEvent::accept() + Calls QEvent::accept(). +*/ + /*! Sets the accept flag of the all gestures inside the event object, the equivalent of calling \l{QEvent::accept()}{accept()} or diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index c330663..30889d7 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -97,8 +97,8 @@ QString qt_getStandardGestureTypeName(Qt::GestureType gestureType); This is a pure virtual function that needs to be implemented in subclasses. - Parses input \a event and returns the result, which specifies if - the event sequence is a gesture or not. + Parses input \a event and returns the result, which specifies + whether the event sequence is a gesture or not. */ /*! \fn QGesture* QGestureRecognizer::getGesture() @@ -123,7 +123,8 @@ QString qt_getStandardGestureTypeName(Qt::GestureType gestureType); The gesture recognizer might emit the stateChanged() signal when the gesture state changes asynchronously, i.e. without any event - being filtered through filterEvent(). + being filtered through filterEvent(). \a result specifies whether + the event sequence is a gesture or not. */ QGestureRecognizerPrivate::QGestureRecognizerPrivate() diff --git a/src/qt3support/sql/q3datatable.cpp b/src/qt3support/sql/q3datatable.cpp index 638aff8..d8d3c2b 100644 --- a/src/qt3support/sql/q3datatable.cpp +++ b/src/qt3support/sql/q3datatable.cpp @@ -1726,8 +1726,6 @@ void Q3DataTable::repaintCell( int row, int col ) the content coordinate system. If \a selected is true the cell has been selected and would normally be rendered differently than an unselected cell. - - \sa QSql::isNull() */ void Q3DataTable::paintCell( QPainter * p, int row, int col, const QRect & cr, diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index 9a18abe..709e336 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -68,7 +68,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ QT_END_NAMESPACE \ QT_END_INCLUDE_NAMESPACE \ PHONON_EXPORT \ - Q_GADGET + Q_GADGET \ + QWEBKIT_EXPORT Cpp.ignoredirectives = Q_DECLARE_HANDLE \ Q_DECLARE_INTERFACE \ Q_DECLARE_METATYPE \ diff --git a/tools/qdoc3/test/qt-inc.qdocconf b/tools/qdoc3/test/qt-inc.qdocconf index 01b07b3..542c7ca 100644 --- a/tools/qdoc3/test/qt-inc.qdocconf +++ b/tools/qdoc3/test/qt-inc.qdocconf @@ -100,7 +100,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ Q_TYPENAME \ Q_XML_EXPORT \ QDBUS_EXPORT \ - Q_GADGET + Q_GADGET \ + QWEBKIT_EXPORT Cpp.ignoredirectives = Q_DECLARE_HANDLE \ Q_DECLARE_INTERFACE \ Q_DECLARE_METATYPE \ -- cgit v0.12 From 6d71de4283c05b1b42ef26fe4c23334ad34c8a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 2 Jul 2009 10:46:37 +0200 Subject: Kill dead BSP tree code in graphics view. --- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 41 ----------------------------- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 3 --- 2 files changed, 44 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index 5858eab..7d30749 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -154,17 +154,6 @@ QList QGraphicsSceneBspTree::items(const QRectF &rect) const return tmp; } -QList QGraphicsSceneBspTree::items(const QPointF &pos) const -{ - QList tmp; - findVisitor->foundItems = &tmp; - climbTree(findVisitor, pos); - // Reset discovery bits. - for (int i = 0; i < tmp.size(); ++i) - tmp.at(i)->d_ptr->itemDiscovered = 0; - return tmp; -} - int QGraphicsSceneBspTree::leafCount() const { return leafCnt; @@ -241,36 +230,6 @@ void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth, int index) } } -void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index) const -{ - if (nodes.isEmpty()) - return; - - const Node &node = nodes.at(index); - const int childIndex = firstChildIndex(index); - - switch (node.type) { - case Node::Leaf: { - visitor->visit(const_cast*>(&leaves[node.leafIndex])); - break; - } - case Node::Vertical: - if (pos.x() < node.offset) { - climbTree(visitor, pos, childIndex); - } else { - climbTree(visitor, pos, childIndex + 1); - } - break; - case Node::Horizontal: - if (pos.y() < node.offset) { - climbTree(visitor, pos, childIndex); - } else { - climbTree(visitor, pos, childIndex + 1); - } - break; - } -} - void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index) const { if (nodes.isEmpty()) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index 323cf04..24b926c 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -93,7 +93,6 @@ public: void removeItems(const QSet &items); QList items(const QRectF &rect) const; - QList items(const QPointF &pos) const; int leafCount() const; inline int firstChildIndex(int index) const @@ -106,11 +105,9 @@ public: private: void initialize(const QRectF &rect, int depth, int index); - void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index = 0) const; void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0) const; void findItems(QList *foundItems, const QRectF &rect, int index); - void findItems(QList *foundItems, const QPointF &pos, int index); QRectF rectForIndex(int index) const; QVector nodes; -- cgit v0.12 From ad84039a4cb0d0057d2fc260e90f20cdd9761f46 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 2 Jul 2009 10:54:44 +0200 Subject: Doc: adding details to qmake docs Added documentation about the create_prl and link_prl to the CONFIG variable in the qmake manual Task-number: 165165 Rev-by: Geir Vattekar Rev-by: Volker Hilsheimer --- doc/src/qmake-manual.qdoc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index d840c71..afd881f 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -1019,6 +1019,25 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 24 + When linking a library, \c qmake relies on the underlying platform to know + what other libraries this library links against. However, if linking + statically, \c qmake will not get this information unless we use the following + \c CONFIG options: + + \table 95% + \header \o Option \o Description + \row \o create_prl \o This option enables \c qmake to track these + dependencies. When this option is enabled, \c qmake will create a file + ending in \c .prl which will save meta-information about the library + (see \l{LibDepend}{Library Dependencies} for more info). + \row \o link_prl \o When this is enabled, \c qmake will process all + libraries linked to by the application and find their meta-information + (see \l{LibDepend}{Library Dependencies} for more info). + \endtable + + Please note that \c create_prl is required when \i {building} a static library, + while \c link_prl is required when \i {using} a static library. + On Windows (or if Qt is configured with \c{-debug_and_release}, adding the \c build_all option to the \c CONFIG variable makes this rule the default when building the project, and installation targets will be created for -- cgit v0.12 From 353dacb5e4c45e860ae8be228df9647c5a71093e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 2 Jul 2009 10:54:09 +0200 Subject: add license headers --- tests/auto/linguist/lconvert/tst_lconvert.cpp | 41 +++++++++++++++++++++++++++ tests/auto/linguist/lrelease/tst_lrelease.cpp | 41 +++++++++++++++++++++++++++ tests/auto/linguist/lupdate/testlupdate.cpp | 41 +++++++++++++++++++++++++++ tests/auto/linguist/lupdate/testlupdate.h | 41 +++++++++++++++++++++++++++ tests/auto/linguist/lupdate/tst_lupdate.cpp | 41 +++++++++++++++++++++++++++ 5 files changed, 205 insertions(+) diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 3df2a19..40be55a 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 6f65dbc..512987d 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include #include diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp index c80dd54..8abc2b0 100644 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ b/tests/auto/linguist/lupdate/testlupdate.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "testlupdate.h" #include #include diff --git a/tests/auto/linguist/lupdate/testlupdate.h b/tests/auto/linguist/lupdate/testlupdate.h index 3fd7dcb..efe9d85 100644 --- a/tests/auto/linguist/lupdate/testlupdate.h +++ b/tests/auto/linguist/lupdate/testlupdate.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef TESTLUPDATE_H #define TESTLUPDATE_H diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 1beae73..fcf8582 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "testlupdate.h" #if CHECK_SIMTEXTH #include "../shared/simtexth.h" -- cgit v0.12 From ad637177fa62f6ac92b653735bc2f743d7af2851 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 2 Jul 2009 11:10:36 +0200 Subject: add a few QObject binding tests --- tests/auto/qscriptqobject/tst_qscriptqobject.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp index 14d3283..ee914ab 100644 --- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp +++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp @@ -605,6 +605,12 @@ void tst_QScriptExtQObject::getSetStaticProperty() QVERIFY(!(mobj.propertyFlags("mySlot") & QScriptValue::Undeletable)); QVERIFY(!(mobj.propertyFlags("mySlot") & QScriptValue::SkipInEnumeration)); QVERIFY(mobj.propertyFlags("mySlot") & QScriptValue::QObjectMember); + + // signature-based property + QVERIFY(!(mobj.propertyFlags("mySlot()") & QScriptValue::ReadOnly)); + QVERIFY(!(mobj.propertyFlags("mySlot()") & QScriptValue::Undeletable)); + QVERIFY(!(mobj.propertyFlags("mySlot()") & QScriptValue::SkipInEnumeration)); + QVERIFY(mobj.propertyFlags("mySlot()") & QScriptValue::QObjectMember); } // property change in C++ should be reflected in script @@ -847,6 +853,9 @@ void tst_QScriptExtQObject::getSetStaticProperty() QVERIFY(slot.isFunction()); QScriptValue sameSlot = m_engine->evaluate("myObject.mySlot"); QVERIFY(sameSlot.strictlyEquals(slot)); + sameSlot = m_engine->evaluate("myObject['mySlot()']"); + QEXPECT_FAIL("", "Signature-based method lookup creates new function wrapper object", Continue); + QVERIFY(sameSlot.strictlyEquals(slot)); } } @@ -897,6 +906,20 @@ void tst_QScriptExtQObject::getSetChildren() QCOMPARE(m_engine->evaluate("myObject.hasOwnProperty('child')") .strictlyEquals(QScriptValue(m_engine, true)), true); + QScriptValue mobj = m_engine->evaluate("myObject"); + QVERIFY(mobj.propertyFlags("child") & QScriptValue::ReadOnly); + QVERIFY(mobj.propertyFlags("child") & QScriptValue::Undeletable); + QVERIFY(mobj.propertyFlags("child") & QScriptValue::SkipInEnumeration); + QVERIFY(!(mobj.propertyFlags("child") & QScriptValue::QObjectMember)); + + { + QScriptValue scriptChild = m_engine->evaluate("myObject.child"); + QVERIFY(scriptChild.isQObject()); + QCOMPARE(scriptChild.toQObject(), (QObject*)child); + QScriptValue sameChild = m_engine->evaluate("myObject.child"); + QVERIFY(sameChild.strictlyEquals(scriptChild)); + } + // add a grandchild MyQObject *grandChild = new MyQObject(child); grandChild->setObjectName("grandChild"); -- cgit v0.12 From cd4901b1e3a545d025628e881a143b8f240d2690 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 2 Jul 2009 11:37:53 +0200 Subject: doc: Corrected several qdoc warnings. --- doc/src/qnamespace.qdoc | 3 +++ src/gui/kernel/qapplication.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index 805855a..e77cc7e 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -1208,6 +1208,9 @@ handle touch events. Without this attribute set, events from a touch device will be sent as mouse events. + \value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single + touch events to be sent to the widget. + \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 60c69cc..a7b7a0a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5064,7 +5064,7 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy) Qt takes ownership of the provided \a recognizer. - \sa Qt::AA_EnableGestures, QGestureEvent + \sa QGestureEvent */ void QApplication::addGestureRecognizer(QGestureRecognizer *recognizer) { @@ -5076,7 +5076,7 @@ void QApplication::addGestureRecognizer(QGestureRecognizer *recognizer) Removes custom gesture \a recognizer object. - \sa Qt::AA_EnableGestures, QGestureEvent + \sa QGestureEvent */ void QApplication::removeGestureRecognizer(QGestureRecognizer *recognizer) { -- cgit v0.12 From 11ef1b9bae383c46f7893db0d26c99d354642609 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 20:50:32 +0200 Subject: Add a function to check if an interface is implemented by an object. Also reorganise a bit, moving the function to create the interface name from an object's class name to qdbusmisc.cpp too. Reviewed-By: Trust Me --- src/dbus/qdbusconnection_p.h | 5 ++--- src/dbus/qdbusintegrator.cpp | 8 ++----- src/dbus/qdbusmisc.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++ src/dbus/qdbusxmlgenerator.cpp | 37 --------------------------------- 4 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 5c37509..a156a71 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -300,6 +300,8 @@ public: extern int qDBusParametersForMethod(const QMetaMethod &mm, QList& metaTypes); extern int qDBusNameToTypeId(const char *name); extern bool qDBusCheckAsyncTag(const char *tag); +extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name); +extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo); // in qdbusinternalfilters.cpp extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node); @@ -310,9 +312,6 @@ extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNod extern QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg); -// in qdbusxmlgenerator.cpp -extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo); - QT_END_NAMESPACE #endif diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 0578bf1..76179c9 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1359,12 +1359,8 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes // try the object itself: if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots)) { bool interfaceFound = true; - if (!msg.interface().isEmpty()) { - // check if the interface name matches anything in the class hierarchy - const QMetaObject *mo = node.obj->metaObject(); - for ( ; !interfaceFound && mo != &QObject::staticMetaObject; mo = mo->superClass()) - interfaceFound = msg.interface() == qDBusInterfaceFromMetaObject(mo); - } + if (!msg.interface().isEmpty()) + interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface()); if (interfaceFound) { if (!activateCall(node.obj, node.flags, msg)) diff --git a/src/dbus/qdbusmisc.cpp b/src/dbus/qdbusmisc.cpp index e5c1da6..1b77a9b 100644 --- a/src/dbus/qdbusmisc.cpp +++ b/src/dbus/qdbusmisc.cpp @@ -41,12 +41,14 @@ #include +#include #include #include #include "qdbusutil_p.h" #include "qdbusconnection_p.h" #include "qdbusmetatype_p.h" +#include "qdbusabstractadaptor_p.h" // for QCLASSINFO_DBUS_* QT_BEGIN_NAMESPACE @@ -73,6 +75,51 @@ int qDBusNameToTypeId(const char *name) return id; } +QString qDBusInterfaceFromMetaObject(const QMetaObject *mo) +{ + QString interface; + + int idx = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE); + if (idx >= mo->classInfoOffset()) { + interface = QLatin1String(mo->classInfo(idx).value()); + } else { + interface = QLatin1String(mo->className()); + interface.replace(QLatin1String("::"), QLatin1String(".")); + + if (interface.startsWith(QLatin1String("QDBus"))) { + interface.prepend(QLatin1String("com.trolltech.QtDBus.")); + } else if (interface.startsWith(QLatin1Char('Q')) && + interface.length() >= 2 && interface.at(1).isUpper()) { + // assume it's Qt + interface.prepend(QLatin1String("com.trolltech.Qt.")); + } else if (!QCoreApplication::instance()|| + QCoreApplication::instance()->applicationName().isEmpty()) { + interface.prepend(QLatin1String("local.")); + } else { + interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName()); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + if (domainName.isEmpty()) + interface.prepend(QLatin1String("local.")); + else + for (int i = 0; i < domainName.count(); ++i) + interface.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + } + } + + return interface; +} + +bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name) +{ + const QMetaObject *mo = obj->metaObject(); + for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass()) + if (interface_name == qDBusInterfaceFromMetaObject(mo)) + return true; + return false; +} + // calculates the metatypes for the method // the slot must have the parameters in the following form: // - zero or more value or const-ref parameters of any kind diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp index 82bd762..b426abd 100644 --- a/src/dbus/qdbusxmlgenerator.cpp +++ b/src/dbus/qdbusxmlgenerator.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include #include #include @@ -232,42 +231,6 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method return retval; } -QString qDBusInterfaceFromMetaObject(const QMetaObject *mo) -{ - QString interface; - - int idx = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE); - if (idx >= mo->classInfoOffset()) { - interface = QLatin1String(mo->classInfo(idx).value()); - } else { - interface = QLatin1String(mo->className()); - interface.replace(QLatin1String("::"), QLatin1String(".")); - - if (interface.startsWith(QLatin1String("QDBus"))) { - interface.prepend(QLatin1String("com.trolltech.QtDBus.")); - } else if (interface.startsWith(QLatin1Char('Q')) && - interface.length() >= 2 && interface.at(1).isUpper()) { - // assume it's Qt - interface.prepend(QLatin1String("com.trolltech.Qt.")); - } else if (!QCoreApplication::instance()|| - QCoreApplication::instance()->applicationName().isEmpty()) { - interface.prepend(QLatin1String("local.")); - } else { - interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName()); - QStringList domainName = - QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), - QString::SkipEmptyParts); - if (domainName.isEmpty()) - interface.prepend(QLatin1String("local.")); - else - for (int i = 0; i < domainName.count(); ++i) - interface.prepend(QLatin1Char('.')).prepend(domainName.at(i)); - } - } - - return interface; - } - QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, const QMetaObject *base, int flags) { -- cgit v0.12 From 6bd18f891b4bbc265e5ddd18ba57095886b36e38 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jun 2009 15:32:26 +0200 Subject: Add some new error codes for indicating invalid D-Bus parameters. I'm wondering if I should be adding com.trolltech.QtDBus stuff now. But since there's already one there, I don't see why not... Reviewed-By: Harald Fernengel --- src/dbus/qdbuserror.cpp | 11 ++++++++++- src/dbus/qdbuserror.h | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp index 817356d..7509ded 100644 --- a/src/dbus/qdbuserror.cpp +++ b/src/dbus/qdbuserror.cpp @@ -91,6 +91,10 @@ org.freedesktop.DBus.Error.InvalidSignature org.freedesktop.DBus.Error.UnknownInterface com.trolltech.QtDBus.Error.InternalError org.freedesktop.DBus.Error.UnknownObject +com.trolltech.QtDBus.Error.InvalidService +com.trolltech.QtDBus.Error.InvalidObjectPath +com.trolltech.QtDBus.Error.InvalidInterface +com.trolltech.QtDBus.Error.InvalidMember */ // in the same order as KnownErrors! @@ -116,12 +120,17 @@ static const char errorMessages_string[] = "org.freedesktop.DBus.Error.UnknownInterface\0" "com.trolltech.QtDBus.Error.InternalError\0" "org.freedesktop.DBus.Error.UnknownObject\0" + "com.trolltech.QtDBus.Error.InvalidService\0" + "com.trolltech.QtDBus.Error.InvalidObjectPath\0" + "com.trolltech.QtDBus.Error.InvalidInterface\0" + "com.trolltech.QtDBus.Error.InvalidMember\0" "\0"; static const int errorMessages_indices[] = { 0, 6, 40, 76, 118, 153, 191, 231, 273, 313, 349, 384, 421, 461, 501, 540, - 581, 617, 661, 705, 746, 0 + 581, 617, 661, 705, 746, 787, 829, 874, + 918, 0 }; static const int errorMessages_count = sizeof errorMessages_indices / diff --git a/src/dbus/qdbuserror.h b/src/dbus/qdbuserror.h index 7b77fd5..4e348dd 100644 --- a/src/dbus/qdbuserror.h +++ b/src/dbus/qdbuserror.h @@ -81,10 +81,14 @@ public: UnknownInterface, InternalError, UnknownObject, + InvalidService, + InvalidObjectPath, + InvalidInterface, + InvalidMember, #ifndef Q_QDOC // don't use this one! - LastErrorType = UnknownObject + LastErrorType = InvalidMember #endif }; -- cgit v0.12 From 96152ee50dfca7adf47b81b14015355260564a22 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jun 2009 17:52:33 +0200 Subject: Add central validation code to QDBusUtil. These tests are useful in QDBusMessage and QDBusAbstractInterface. It avoids having the same messages all over the place. Reviewed-By: Harald Fernengel --- src/dbus/qdbusutil_p.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h index 13031fd..5c1e4cd 100644 --- a/src/dbus/qdbusutil_p.h +++ b/src/dbus/qdbusutil_p.h @@ -57,6 +57,7 @@ #include #include +#include QT_BEGIN_HEADER @@ -83,6 +84,73 @@ namespace QDBusUtil QDBUS_EXPORT bool isValidSingleSignature(const QString &signature); QDBUS_EXPORT QString argumentToString(const QVariant &variant); + + enum AllowEmptyFlag { + EmptyAllowed, + EmptyNotAllowed + }; + + inline bool checkInterfaceName(const QString &name, AllowEmptyFlag empty, QDBusError *error) + { + if (name.isEmpty()) { + if (empty == EmptyAllowed) return true; + *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Interface name cannot be empty")); + return false; + } + if (isValidInterfaceName(name)) return true; + *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid interface class: %1").arg(name)); + return false; + } + + inline bool checkBusName(const QString &name, AllowEmptyFlag empty, QDBusError *error) + { + if (name.isEmpty()) { + if (empty == EmptyAllowed) return true; + *error = QDBusError(QDBusError::InvalidService, QLatin1String("Service name cannot be empty")); + return false; + } + if (isValidBusName(name)) return true; + *error = QDBusError(QDBusError::InvalidService, QString::fromLatin1("Invalid service name: %1").arg(name)); + return false; + } + + inline bool checkObjectPath(const QString &path, AllowEmptyFlag empty, QDBusError *error) + { + if (path.isEmpty()) { + if (empty == EmptyAllowed) return true; + *error = QDBusError(QDBusError::InvalidObjectPath, QLatin1String("Object path cannot be empty")); + return false; + } + if (isValidObjectPath(path)) return true; + *error = QDBusError(QDBusError::InvalidObjectPath, QString::fromLatin1("Invalid object path: %1").arg(path)); + return false; + } + + inline bool checkMemberName(const QString &name, AllowEmptyFlag empty, QDBusError *error, const char *nameType = 0) + { + if (!nameType) nameType = "member"; + if (name.isEmpty()) { + if (empty == EmptyAllowed) return true; + *error = QDBusError(QDBusError::InvalidMember, QLatin1String(nameType) + QLatin1String(" name cannot be empty")); + return false; + } + if (isValidMemberName(name)) return true; + *error = QDBusError(QDBusError::InvalidMember, QString::fromLatin1("Invalid %1 name: %2") + .arg(QString::fromLatin1(nameType), name)); + return false; + } + + inline bool checkErrorName(const QString &name, AllowEmptyFlag empty, QDBusError *error) + { + if (name.isEmpty()) { + if (empty == EmptyAllowed) return true; + *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Error name cannot be empty")); + return false; + } + if (isValidErrorName(name)) return true; + *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid error name: %1").arg(name)); + return false; + } } QT_END_NAMESPACE -- cgit v0.12 From bda9c20a556aa6ab6ccba978f7fc1ffe02c50813 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jun 2009 16:31:09 +0200 Subject: Add support for error messages in the D-Bus marshaller. Reviewed-By: Harald Fernengel --- src/dbus/qdbusargument_p.h | 3 ++- src/dbus/qdbusmarshaller.cpp | 35 ++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/dbus/qdbusargument_p.h b/src/dbus/qdbusargument_p.h index b49a517..78bc683 100644 --- a/src/dbus/qdbusargument_p.h +++ b/src/dbus/qdbusargument_p.h @@ -130,7 +130,7 @@ public: QDBusMarshaller *endCommon(); void open(QDBusMarshaller &sub, int code, const char *signature); void close(); - void error(); + void error(const QString &message); bool appendVariantInternal(const QVariant &arg); bool appendRegisteredType(const QVariant &arg); @@ -140,6 +140,7 @@ public: DBusMessageIter iterator; QDBusMarshaller *parent; QByteArray *ba; + QString errorString; char closeCode; bool ok; diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp index 7ada1ed..bb7fa6b 100644 --- a/src/dbus/qdbusmarshaller.cpp +++ b/src/dbus/qdbusmarshaller.cpp @@ -121,7 +121,7 @@ inline void QDBusMarshaller::append(const QDBusObjectPath &arg) { QByteArray data = arg.path().toUtf8(); if (!ba && data.isEmpty()) - error(); + error(QLatin1String("Invalid object path passed in arguments")); const char *cdata = data.constData(); qIterAppend(&iterator, ba, DBUS_TYPE_OBJECT_PATH, &cdata); } @@ -130,7 +130,7 @@ inline void QDBusMarshaller::append(const QDBusSignature &arg) { QByteArray data = arg.signature().toUtf8(); if (!ba && data.isEmpty()) - error(); + error(QLatin1String("Invalid signature passed in arguments")); const char *cdata = data.constData(); qIterAppend(&iterator, ba, DBUS_TYPE_SIGNATURE, &cdata); } @@ -161,7 +161,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg) QVariant::Type id = QVariant::Type(value.userType()); if (id == QVariant::Invalid) { qWarning("QDBusMarshaller: cannot add a null QDBusVariant"); - error(); + error(QLatin1String("Variant containing QVariant::Invalid passed in arguments")); return false; } @@ -180,7 +180,8 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg) qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. " "Use qDBusRegisterMetaType to register it", QVariant::typeToName( id ), id); - error(); + error(QString::fromLatin1("Unregistered type %1 passed in arguments") + .arg(QLatin1String(QVariant::typeToName(id)))); return false; } @@ -220,7 +221,8 @@ inline QDBusMarshaller *QDBusMarshaller::beginArray(int id) qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. " "Use qDBusRegisterMetaType to register it", QVariant::typeToName( QVariant::Type(id) ), id); - error(); + error(QString::fromLatin1("Unregistered type %1 passed in arguments") + .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id))))); return this; } @@ -234,22 +236,26 @@ inline QDBusMarshaller *QDBusMarshaller::beginMap(int kid, int vid) qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. " "Use qDBusRegisterMetaType to register it", QVariant::typeToName( QVariant::Type(kid) ), kid); - error(); + error(QString::fromLatin1("Unregistered type %1 passed in arguments") + .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid))))); return this; } if (ksignature[1] != 0 || !q_dbus_type_is_basic(*ksignature)) { qWarning("QDBusMarshaller: type '%s' (%d) cannot be used as the key type in a D-BUS map.", QVariant::typeToName( QVariant::Type(kid) ), kid); - error(); + error(QString::fromLatin1("Type %1 passed in arguments cannot be used as a key in a map") + .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid))))); return this; } const char *vsignature = QDBusMetaType::typeToSignature( QVariant::Type(vid) ); if (!vsignature) { + const char *typeName = QVariant::typeToName(QVariant::Type(vid)); qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. " "Use qDBusRegisterMetaType to register it", - QVariant::typeToName( QVariant::Type(vid) ), vid); - error(); + typeName, vid); + error(QString::fromLatin1("Unregistered type %1 passed in arguments") + .arg(QLatin1String(typeName))); return this; } @@ -328,11 +334,13 @@ void QDBusMarshaller::close() } } -void QDBusMarshaller::error() +void QDBusMarshaller::error(const QString &msg) { ok = false; if (parent) - parent->error(); + parent->error(msg); + else + errorString = msg; } bool QDBusMarshaller::appendVariantInternal(const QVariant &arg) @@ -340,7 +348,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg) int id = arg.userType(); if (id == QVariant::Invalid) { qWarning("QDBusMarshaller: cannot add an invalid QVariant"); - error(); + error(QLatin1String("Variant containing QVariant::Invalid passed in arguments")); return false; } @@ -371,7 +379,8 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg) qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. " "Use qDBusRegisterMetaType to register it", QVariant::typeToName( QVariant::Type(id) ), id); - error(); + error(QString::fromLatin1("Unregistered type %1 passed in arguments") + .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id))))); return false; } -- cgit v0.12 From 6b0b1a3eefe60dbeed3f56770fb58d487852e45b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 11:47:46 +0200 Subject: Adapt the message-sending code to return error messages from the marshalling code. Reviewed-By: Harald Fernengel --- src/dbus/qdbusintegrator.cpp | 89 +++++++++++++++----------- src/dbus/qdbusmessage.cpp | 48 ++++++++++---- src/dbus/qdbusmessage_p.h | 2 +- tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp | 16 ++++- 4 files changed, 104 insertions(+), 51 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 76179c9..704d2e3 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1144,9 +1144,12 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface, QLatin1String(memberName)); message.setArguments(args); - DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); + QDBusError error; + DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error); if (!msg) { - qWarning("QDBusConnection: Could not emit signal %s.%s", qPrintable(interface), memberName.constData()); + qWarning("QDBusConnection: Could not emit signal %s.%s: %s", qPrintable(interface), memberName.constData(), + qPrintable(error.message())); + lastError = error; return; } @@ -1698,21 +1701,26 @@ int QDBusConnectionPrivate::send(const QDBusMessage& message) return -1; // don't send; the reply will be retrieved by the caller // through the d_ptr->localReply link - DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); + QDBusError error; + DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error); if (!msg) { if (message.type() == QDBusMessage::MethodCallMessage) - qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"", + qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", qPrintable(message.service()), qPrintable(message.path()), - qPrintable(message.interface()), qPrintable(message.member())); + qPrintable(message.interface()), qPrintable(message.member()), + qPrintable(error.message())); else if (message.type() == QDBusMessage::SignalMessage) - qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\"", + qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\": %s", qPrintable(message.path()), qPrintable(message.interface()), - qPrintable(message.member())); + qPrintable(message.member()), + qPrintable(error.message())); else - qWarning("QDBusConnection: error: could not send %s message to service \"%s\"", + qWarning("QDBusConnection: error: could not send %s message to service \"%s\": %s", message.type() == QDBusMessage::ReplyMessage ? "reply" : message.type() == QDBusMessage::ErrorMessage ? "error" : - "invalid", qPrintable(message.service())); + "invalid", qPrintable(message.service()), + qPrintable(error.message())); + lastError = error; return 0; } @@ -1739,12 +1747,15 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, return sendWithReplyLocal(message); if (!QCoreApplication::instance() || sendMode == QDBus::Block) { - DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); + QDBusError err; + DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &err); if (!msg) { - qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"", + qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", qPrintable(message.service()), qPrintable(message.path()), - qPrintable(message.interface()), qPrintable(message.member())); - return QDBusMessage(); + qPrintable(message.interface()), qPrintable(message.member()), + qPrintable(err.message())); + lastError = err; + return QDBusMessage::createError(err); } qDBusDebug() << QThread::currentThread() << "sending message (blocking):" << message; @@ -1754,9 +1765,8 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, q_dbus_message_unref(msg); if (!!error) { - QDBusError qe = error; - lastError = qe; - return QDBusMessage::createError(qe); + lastError = err = error; + return QDBusMessage::createError(err); } QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(reply); @@ -1766,16 +1776,17 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, return amsg; } else { // use the event loop QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); - if (!pcall) - return QDBusMessage(); + Q_ASSERT(pcall); - pcall->watcherHelper = new QDBusPendingCallWatcherHelper; - QEventLoop loop; - loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit())); - loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit())); + if (pcall->replyMessage.type() != QDBusMessage::InvalidMessage) { + pcall->watcherHelper = new QDBusPendingCallWatcherHelper; + QEventLoop loop; + loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit())); + loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit())); - // enter the event loop and wait for a reply - loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); + // enter the event loop and wait for a reply + loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); + } QDBusMessage reply = pcall->replyMessage; lastError = reply; // set or clear error @@ -1831,20 +1842,25 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM return pcall; } - DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); + checkThread(); + QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate; + pcall->sentMessage = message; + pcall->ref = 0; + + QDBusError error; + DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error); if (!msg) { - qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"", + qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\": %s", qPrintable(message.service()), qPrintable(message.path()), - qPrintable(message.interface()), qPrintable(message.member())); - return 0; + qPrintable(message.interface()), qPrintable(message.member()), + qPrintable(error.message())); + pcall->replyMessage = QDBusMessage::createError(error); + lastError = error; + return pcall; } - checkThread(); qDBusDebug() << QThread::currentThread() << "sending message (async):" << message; DBusPendingCall *pending = 0; - QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate; - pcall->sentMessage = message; - pcall->ref = 0; QDBusDispatchLocker locker(SendWithReplyAsyncAction, this); if (q_dbus_connection_send_with_reply(connection, msg, &pending, timeout)) { @@ -1858,14 +1874,14 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM return pcall; } else { // we're probably disconnected at this point - lastError = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server")); + lastError = error = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server")); } } else { - lastError = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory")); + lastError = error = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory")); } q_dbus_message_unref(msg); - pcall->replyMessage = QDBusMessage::createError(lastError); + pcall->replyMessage = QDBusMessage::createError(error); return pcall; } @@ -1874,8 +1890,7 @@ int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObj int timeout) { QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout); - if (!pcall) - return 0; + Q_ASSERT(pcall); // has it already finished (dispatched locally)? if (pcall->replyMessage.type() == QDBusMessage::ReplyMessage) { diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 9150295..eb09de9 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -94,11 +94,17 @@ QString QDBusMessage::errorMessage() const \internal Constructs a DBusMessage object from this object. The returned value must be de-referenced with q_dbus_message_unref. + + The \a error object is set to indicate the error if anything went wrong with the + marshalling. Usually, this error message will be placed in the reply, as if the call failed. + The \a error pointer must not be null. */ -DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) +DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDBusError *error) { - if (!qdbus_loadLibDBus()) + if (!qdbus_loadLibDBus()) { + *error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library")); return 0; + } DBusMessage *msg = 0; const QDBusMessagePrivate *d_ptr = message.d_ptr; @@ -108,10 +114,17 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) //qDebug() << "QDBusMessagePrivate::toDBusMessage" << "message is invalid"; break; case DBUS_MESSAGE_TYPE_METHOD_CALL: - // only interface can be empty - if (d_ptr->service.isEmpty() || d_ptr->path.isEmpty() || d_ptr->name.isEmpty()) - break; - msg = q_dbus_message_new_method_call(d_ptr->service.toUtf8(), d_ptr->path.toUtf8(), + // only service and interface can be empty -> path and name must not be empty + if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) + return 0; + if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) + return 0; + if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) + return 0; + if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) + return 0; + + msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(), data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8()); break; case DBUS_MESSAGE_TYPE_METHOD_RETURN: @@ -123,8 +136,9 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) break; case DBUS_MESSAGE_TYPE_ERROR: // error name can't be empty - if (d_ptr->name.isEmpty()) - break; + if (!QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error)) + return 0; + msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR); q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8()); if (!d_ptr->localMessage) { @@ -134,8 +148,13 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) break; case DBUS_MESSAGE_TYPE_SIGNAL: // nothing can be empty here - if (d_ptr->path.isEmpty() || d_ptr->interface.isEmpty() || d_ptr->name.isEmpty()) - break; + if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) + return 0; + if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) + return 0; + if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) + return 0; + msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(), d_ptr->name.toUtf8()); break; @@ -170,6 +189,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message) // not ok; q_dbus_message_unref(msg); + *error = QDBusError(QDBusError::Failed, QLatin1String("Marshalling failed: ") + marshaller.errorString); return 0; } @@ -247,7 +267,13 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn, // yes, we are // we must marshall and demarshall again so as to create QDBusArgument // entries for the complex types - DBusMessage *message = toDBusMessage(asSent); + QDBusError error; + DBusMessage *message = toDBusMessage(asSent, &error); + if (!message) { + // failed to marshall, so it's a call error + return QDBusMessage::createError(error); + } + q_dbus_message_set_sender(message, conn.baseService.toUtf8()); QDBusMessage retval = fromDBusMessage(message); diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h index 12a9500..a0a681f 100644 --- a/src/dbus/qdbusmessage_p.h +++ b/src/dbus/qdbusmessage_p.h @@ -80,7 +80,7 @@ public: mutable uint delayedReply : 1; uint localMessage : 1; - static DBusMessage *toDBusMessage(const QDBusMessage &message); + static DBusMessage *toDBusMessage(const QDBusMessage &message, QDBusError *error); static QDBusMessage fromDBusMessage(DBusMessage *dmsg); static bool isLocal(const QDBusMessage &msg); diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp index e5b2ebb..3ba789a 100644 --- a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp @@ -793,7 +793,7 @@ void tst_QDBusMarshall::sendErrors() "signalName"); msg << qVariantFromValue(QDBusObjectPath()); - QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\""); + QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\": Marshalling failed: Invalid object path passed in arguments"); QVERIFY(!con.send(msg)); msg.setArguments(QVariantList()); @@ -803,7 +803,19 @@ void tst_QDBusMarshall::sendErrors() path.setPath("abc"); msg << qVariantFromValue(path); - QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\""); + QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\": Marshalling failed: Invalid object path passed in arguments"); + QVERIFY(!con.send(msg)); + + QDBusSignature sig; + msg.setArguments(QVariantList() << qVariantFromValue(sig)); + QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\": Marshalling failed: Invalid signature passed in arguments"); + QVERIFY(!con.send(msg)); + + QTest::ignoreMessage(QtWarningMsg, "QDBusSignature: invalid signature \"a\""); + sig.setSignature("a"); + msg.setArguments(QVariantList()); + msg << qVariantFromValue(sig); + QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\": Marshalling failed: Invalid signature passed in arguments"); QVERIFY(!con.send(msg)); } -- cgit v0.12 From 8d4657764b0c4362dc25aa79a6e2853b8c98f0ad Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jun 2009 15:20:33 +0200 Subject: Keep creation failure errors for QDBusAbstractInterface. In case the object creation fails, set isValid to false. This will prevent any outgoing calls to be made with invalid information. In that case, lastError will never change either. This required adding a method to QDBusPendingCall, to be able to create one such object from an existing QDBusError. Reviewed-By: Marius Bugge Monsen --- src/dbus/qdbusabstractinterface.cpp | 140 ++++++++++++++++++------------------ src/dbus/qdbusabstractinterface_p.h | 4 ++ src/dbus/qdbuspendingcall.cpp | 36 ++++++++++ src/dbus/qdbuspendingcall.h | 3 + src/dbus/qdbuspendingcall_p.h | 3 + 5 files changed, 116 insertions(+), 70 deletions(-) diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 85c3274..a4097c6 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -52,82 +52,66 @@ QT_BEGIN_NAMESPACE +static QDBusError checkIfValid(const QString &service, const QString &path, + const QString &interface, bool isDynamic) +{ + // We should be throwing exceptions here... oh well + QDBusError error; + + // dynamic interfaces (QDBusInterface) can have empty interfaces, but not service and object paths + // non-dynamic is the opposite: service and object paths can be empty, but not the interface + if (!isDynamic) { + // use assertion here because this should never happen, at all + Q_ASSERT_X(!interface.isEmpty(), "QDBusAbstractInterface", "Interface name cannot be empty"); + } + if (!QDBusUtil::checkBusName(service, isDynamic ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error)) + return error; + if (!QDBusUtil::checkObjectPath(path, isDynamic ? QDBusUtil::EmptyNotAllowed : QDBusUtil::EmptyAllowed, &error)) + return error; + if (!QDBusUtil::checkInterfaceName(interface, QDBusUtil::EmptyAllowed, &error)) + return error; + + // no error + return QDBusError(); +} + QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv, const QString &p, const QString &iface, const QDBusConnection& con, bool isDynamic) - : connection(con), service(serv), path(p), interface(iface), isValid(true) + : connection(con), service(serv), path(p), interface(iface), + lastError(checkIfValid(serv, p, iface, isDynamic)), + isValid(!lastError.isValid()) { - if (isDynamic) { - // QDBusInterface: service and object path can't be empty, but interface can -#if 0 - Q_ASSERT_X(QDBusUtil::isValidBusName(service), - "QDBusInterface::QDBusInterface", "Invalid service name"); - Q_ASSERT_X(QDBusUtil::isValidObjectPath(path), - "QDBusInterface::QDBusInterface", "Invalid object path given"); - Q_ASSERT_X(interface.isEmpty() || QDBusUtil::isValidInterfaceName(interface), - "QDBusInterface::QDBusInterface", "Invalid interface name"); -#else - if (!QDBusUtil::isValidBusName(service)) { - lastError = QDBusError(QDBusError::Disconnected, - QLatin1String("Invalid service name")); - isValid = false; - } else if (!QDBusUtil::isValidObjectPath(path)) { - lastError = QDBusError(QDBusError::Disconnected, - QLatin1String("Invalid object name given")); - isValid = false; - } else if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) { - lastError = QDBusError(QDBusError::Disconnected, - QLatin1String("Invalid interface name")); - isValid = false; - } -#endif - } else { - // all others: service and path can be empty here, but interface can't -#if 0 - Q_ASSERT_X(service.isEmpty() || QDBusUtil::isValidBusName(service), - "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid service name"); - Q_ASSERT_X(path.isEmpty() || QDBusUtil::isValidObjectPath(path), - "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid object path given"); - Q_ASSERT_X(QDBusUtil::isValidInterfaceName(interface), - "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid interface class!"); -#else - if (!service.isEmpty() && !QDBusUtil::isValidBusName(service)) { - lastError = QDBusError(QDBusError::Disconnected, - QLatin1String("Invalid service name")); - isValid = false; - } else if (!path.isEmpty() && !QDBusUtil::isValidObjectPath(path)) { - lastError = QDBusError(QDBusError::Disconnected, - QLatin1String("Invalid object path given")); - isValid = false; - } else if (!QDBusUtil::isValidInterfaceName(interface)) { - lastError = QDBusError(QDBusError::Disconnected, - QLatin1String("Invalid interface class")); - isValid = false; - } -#endif - } - if (!isValid) return; if (!connection.isConnected()) { lastError = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to D-Bus server")); - isValid = false; } else if (!service.isEmpty()) { currentOwner = connectionPrivate()->getNameOwner(service); // verify the name owner if (currentOwner.isEmpty()) { - isValid = false; lastError = connectionPrivate()->lastError; } } } +bool QDBusAbstractInterfacePrivate::canMakeCalls() const +{ + // recheck only if we have a wildcard (i.e. empty) service or path + // if any are empty, set the error message according to QDBusUtil + if (service.isEmpty()) + return QDBusUtil::checkBusName(service, QDBusUtil::EmptyNotAllowed, &lastError); + if (path.isEmpty()) + return QDBusUtil::checkObjectPath(path, QDBusUtil::EmptyNotAllowed, &lastError); + return true; +} + QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const { - if (!connection.isConnected()) // not connected + if (!isValid || !canMakeCalls()) // can't make calls return QVariant(); // is this metatype registered? @@ -144,6 +128,9 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const qWarning("QDBusAbstractInterface: type %s must be registered with QtDBus before it can be " "used to read property %s.%s", mp.typeName(), qPrintable(interface), mp.name()); + lastError = QDBusError(QDBusError::Failed, + QString::fromLatin1("Unregistered type %1 cannot be handled") + .arg(QLatin1String(mp.typeName()))); return QVariant(); } } @@ -208,7 +195,7 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const void QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value) { - if (!connection.isConnected()) // not connected + if (!isValid || !canMakeCalls()) // can't make calls return; // send the value @@ -230,7 +217,6 @@ void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name, //qDebug() << "QDBusAbstractInterfacePrivate serviceOwnerChanged" << name << oldOwner << newOwner; if (name == service) { currentOwner = newOwner; - isValid = !newOwner.isEmpty(); } } @@ -261,7 +247,7 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, : QObject(d, parent) { // keep track of the service owner - if (d_func()->isValid) + if (!d_func()->currentOwner.isEmpty()) QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } @@ -300,7 +286,7 @@ QDBusAbstractInterface::~QDBusAbstractInterface() */ bool QDBusAbstractInterface::isValid() const { - return d_func()->isValid; + return !d_func()->currentOwner.isEmpty(); } /*! @@ -367,6 +353,9 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode, { Q_D(QDBusAbstractInterface); + if (!d->isValid || !d->canMakeCalls()) + return QDBusMessage::createError(d->lastError); + QString m = method; // split out the signature from the method int pos = method.indexOf(QLatin1Char('.')); @@ -425,6 +414,9 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString { Q_D(QDBusAbstractInterface); + if (!d->isValid || !d->canMakeCalls()) + return QDBusPendingCall::fromError(d->lastError); + QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method); msg.setArguments(args); return d->connection.asyncCall(msg); @@ -440,7 +432,8 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString This function returns true if the queueing succeeds. It does not indicate that the executed call succeeded. If it fails, - the \a errorMethod is called. + the \a errorMethod is called. If the queueing failed, this + function returns false and no slot will be called. The \a returnMethod must have as its parameters the types returned by the function call. Optionally, it may have a QDBusMessage @@ -453,22 +446,25 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString bool QDBusAbstractInterface::callWithCallback(const QString &method, const QList &args, QObject *receiver, - const char *returnMethod, + const char *returnMethod, const char *errorMethod) { Q_D(QDBusAbstractInterface); + if (!d->isValid || !d->canMakeCalls()) + return false; + QDBusMessage msg = QDBusMessage::createMethodCall(service(), - path(), - interface(), - method); + path(), + interface(), + method); msg.setArguments(args); d->lastError = 0; return d->connection.callWithCallback(msg, - receiver, - returnMethod, - errorMethod); + receiver, + returnMethod, + errorMethod); } /*! @@ -492,7 +488,7 @@ bool QDBusAbstractInterface::callWithCallback(const QString &method, bool QDBusAbstractInterface::callWithCallback(const QString &method, const QList &args, QObject *receiver, - const char *slot) + const char *slot) { return callWithCallback(method, args, receiver, slot, 0); } @@ -503,13 +499,15 @@ bool QDBusAbstractInterface::callWithCallback(const QString &method, */ void QDBusAbstractInterface::connectNotify(const char *signal) { + // someone connecting to one of our signals + Q_D(QDBusAbstractInterface); + if (!d->isValid) + return; + // we end up recursing here, so optimise away if (qstrcmp(signal + 1, "destroyed(QObject*)") == 0) return; - // someone connecting to one of our signals - Q_D(QDBusAbstractInterface); - QDBusConnectionPrivate *conn = d->connectionPrivate(); if (conn) conn->connectRelay(d->service, d->currentOwner, d->path, d->interface, @@ -524,6 +522,8 @@ void QDBusAbstractInterface::disconnectNotify(const char *signal) { // someone disconnecting from one of our signals Q_D(QDBusAbstractInterface); + if (!d->isValid) + return; QDBusConnectionPrivate *conn = d->connectionPrivate(); if (conn) diff --git a/src/dbus/qdbusabstractinterface_p.h b/src/dbus/qdbusabstractinterface_p.h index e2ea058..e5822b3 100644 --- a/src/dbus/qdbusabstractinterface_p.h +++ b/src/dbus/qdbusabstractinterface_p.h @@ -75,11 +75,15 @@ public: QString path; QString interface; mutable QDBusError lastError; + + // this is set during creation and never changed + // it can't be const because QDBusInterfacePrivate has one more check bool isValid; QDBusAbstractInterfacePrivate(const QString &serv, const QString &p, const QString &iface, const QDBusConnection& con, bool dynamic); virtual ~QDBusAbstractInterfacePrivate() { } + bool canMakeCalls() const; // these functions do not check if the property is valid QVariant property(const QMetaProperty &mp) const; diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp index 1797ed0..7807543 100644 --- a/src/dbus/qdbuspendingcall.cpp +++ b/src/dbus/qdbuspendingcall.cpp @@ -409,6 +409,42 @@ bool QDBusPendingCall::setReplyCallback(QObject *target, const char *member) } #endif +/*! + Creates a QDBusPendingCall object based on the error condition + \a error. The resulting pending call object will be in the + "finished" state and QDBusPendingReply::isError() will return true. + + \sa fromCompletedCall() +*/ +QDBusPendingCall QDBusPendingCall::fromError(const QDBusError &error) +{ + return fromCompletedCall(QDBusMessage::createError(error)); +} + +/*! + Creates a QDBusPendingCall object based on the message \a msg. + The message must be of type QDBusMessage::ErrorMessage or + QDBusMessage::ReplyMessage (that is, a message that is typical + of a completed call). + + This function is useful for code that requires simulating a pending + call, but that has already finished. + + \sa fromError() +*/ +QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg) +{ + QDBusPendingCallPrivate *d = 0; + if (msg.type() == QDBusMessage::ErrorMessage || + msg.type() == QDBusMessage::ReplyMessage) { + d = new QDBusPendingCallPrivate; + d->replyMessage = msg; + d->connection = 0; + } + + return QDBusPendingCall(d); +} + class QDBusPendingCallWatcherPrivate: public QObjectPrivate { diff --git a/src/dbus/qdbuspendingcall.h b/src/dbus/qdbuspendingcall.h index 8881920..8dbbb3c 100644 --- a/src/dbus/qdbuspendingcall.h +++ b/src/dbus/qdbuspendingcall.h @@ -78,6 +78,9 @@ public: QDBusMessage reply() const; #endif + static QDBusPendingCall fromError(const QDBusError &error); + static QDBusPendingCall fromCompletedCall(const QDBusMessage &message); + protected: QExplicitlySharedDataPointer d; friend class QDBusPendingCallPrivate; diff --git a/src/dbus/qdbuspendingcall_p.h b/src/dbus/qdbuspendingcall_p.h index 7136f67..5577451 100644 --- a/src/dbus/qdbuspendingcall_p.h +++ b/src/dbus/qdbuspendingcall_p.h @@ -63,6 +63,7 @@ QT_BEGIN_NAMESPACE +class QDBusPendingCall; class QDBusPendingCallWatcher; class QDBusPendingCallWatcherHelper; class QDBusConnectionPrivate; @@ -94,6 +95,8 @@ public: void waitForFinished(); void setMetaTypes(int count, const int *types); void checkReceivedSignature(); + + static QDBusPendingCall fromMessage(const QDBusMessage &msg); }; class QDBusPendingCallWatcherHelper: public QObject -- cgit v0.12 From e7ca74ed8a41eb4c05f436007417d160b6cf94f7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 11:13:47 +0200 Subject: Avoid revalidating message parameters. This is a small performance improvement when making a call: we don't need to validate what we already know to be valid because we either designed it to be so or because we've already validated. The D-Bus library unfortunately validates again and there's nothing we can do about it. But we can avoid doing it twice in our own code. Reviewed-By: Marius Bugge Monsen --- src/dbus/qdbusabstractinterface.cpp | 6 ++++ src/dbus/qdbusintegrator.cpp | 3 ++ src/dbus/qdbusinternalfilters.cpp | 2 +- src/dbus/qdbusmessage.cpp | 60 +++++++++++++++++++++---------------- src/dbus/qdbusmessage.h | 6 ++-- src/dbus/qdbusmessage_p.h | 9 ++++++ 6 files changed, 55 insertions(+), 31 deletions(-) diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index a4097c6..08da997 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -44,6 +44,7 @@ #include "qdbusargument.h" #include "qdbuspendingcall.h" +#include "qdbusmessage_p.h" #include "qdbusmetaobject_p.h" #include "qdbusmetatype_p.h" #include "qdbusutil_p.h" @@ -139,6 +140,7 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const QDBusMessage msg = QDBusMessage::createMethodCall(service, path, QLatin1String(DBUS_INTERFACE_PROPERTIES), QLatin1String("Get")); + QDBusMessagePrivate::setParametersValidated(msg, true); msg << interface << QString::fromUtf8(mp.name()); QDBusMessage reply = connection.call(msg, QDBus::Block); @@ -202,6 +204,7 @@ void QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const Q QDBusMessage msg = QDBusMessage::createMethodCall(service, path, QLatin1String(DBUS_INTERFACE_PROPERTIES), QLatin1String("Set")); + QDBusMessagePrivate::setParametersValidated(msg, true); msg << interface << QString::fromUtf8(mp.name()) << qVariantFromValue(QDBusVariant(value)); QDBusMessage reply = connection.call(msg, QDBus::Block); @@ -386,6 +389,7 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode, // qDebug() << "QDBusAbstractInterface" << "Service" << service() << "Path:" << path(); QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), m); + QDBusMessagePrivate::setParametersValidated(msg, true); msg.setArguments(args); QDBusMessage reply = d->connection.call(msg, mode); @@ -418,6 +422,7 @@ QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString return QDBusPendingCall::fromError(d->lastError); QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method); + QDBusMessagePrivate::setParametersValidated(msg, true); msg.setArguments(args); return d->connection.asyncCall(msg); } @@ -458,6 +463,7 @@ bool QDBusAbstractInterface::callWithCallback(const QString &method, path(), interface(), method); + QDBusMessagePrivate::setParametersValidated(msg, true); msg.setArguments(args); d->lastError = 0; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 704d2e3..a0903ed 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1143,6 +1143,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in QDBusReadLocker locker(RelaySignalAction, this); QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface, QLatin1String(memberName)); + QDBusMessagePrivate::setParametersValidated(message, true); message.setArguments(args); QDBusError error; DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error); @@ -2092,6 +2093,7 @@ QString QDBusConnectionPrivate::getNameOwner(const QString& serviceName) QDBusMessage msg = QDBusMessage::createMethodCall(QLatin1String(DBUS_SERVICE_DBUS), QLatin1String(DBUS_PATH_DBUS), QLatin1String(DBUS_INTERFACE_DBUS), QLatin1String("GetNameOwner")); + QDBusMessagePrivate::setParametersValidated(msg, true); msg << serviceName; QDBusMessage reply = sendWithReply(msg, QDBus::Block); if (reply.type() == QDBusMessage::ReplyMessage) @@ -2115,6 +2117,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa QDBusMessage msg = QDBusMessage::createMethodCall(service, path, QLatin1String(DBUS_INTERFACE_INTROSPECTABLE), QLatin1String("Introspect")); + QDBusMessagePrivate::setParametersValidated(msg, true); QDBusMessage reply = sendWithReply(msg, QDBus::Block); diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp index 416144d..762a49b 100644 --- a/src/dbus/qdbusinternalfilters.cpp +++ b/src/dbus/qdbusinternalfilters.cpp @@ -179,7 +179,7 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node static QDBusMessage qDBusPropertyError(const QDBusMessage &msg, const QString &interface_name) { - return msg.createErrorReply(QLatin1String(DBUS_ERROR_INVALID_ARGS), + return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path())); diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index eb09de9..78de6d9 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -62,7 +62,8 @@ static inline const char *data(const QByteArray &arr) QDBusMessagePrivate::QDBusMessagePrivate() : msg(0), reply(0), type(DBUS_MESSAGE_TYPE_INVALID), - timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false) + timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false), + parametersValidated(false) { } @@ -115,14 +116,16 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB break; case DBUS_MESSAGE_TYPE_METHOD_CALL: // only service and interface can be empty -> path and name must not be empty - if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) - return 0; - if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) - return 0; - if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) - return 0; - if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) - return 0; + if (!d_ptr->parametersValidated) { + if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)) + return 0; + if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) + return 0; + if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) + return 0; + if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) + return 0; + } msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(), data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8()); @@ -136,7 +139,8 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB break; case DBUS_MESSAGE_TYPE_ERROR: // error name can't be empty - if (!QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error)) + if (!d_ptr->parametersValidated + && !QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error)) return 0; msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR); @@ -148,12 +152,14 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB break; case DBUS_MESSAGE_TYPE_SIGNAL: // nothing can be empty here - if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) - return 0; - if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) - return 0; - if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) - return 0; + if (!d_ptr->parametersValidated) { + if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)) + return 0; + if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)) + return 0; + if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")) + return 0; + } msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(), d_ptr->name.toUtf8()); @@ -162,16 +168,11 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB Q_ASSERT(false); break; } -#if 0 - DBusError err; - q_dbus_error_init(&err); - if (q_dbus_error_is_set(&err)) { - QDBusError qe(&err); - qDebug() << "QDBusMessagePrivate::toDBusMessage" << qe; - } -#endif - if (!msg) - return 0; + + // if we got here, the parameters validated + // and since the message parameters cannot be changed once the message is created + // we can record this fact + d_ptr->parametersValidated = true; QDBusMarshaller marshaller; QVariantList::ConstIterator it = d_ptr->arguments.constBegin(); @@ -492,6 +493,13 @@ QDBusMessage QDBusMessage::createErrorReply(const QString name, const QString &m Constructs a new DBus reply message for the error type \a type using the message \a msg. Returns the DBus message. */ +QDBusMessage QDBusMessage::createErrorReply(QDBusError::ErrorType atype, const QString &amsg) const +{ + QDBusMessage msg = createErrorReply(QDBusError::errorString(atype), amsg); + msg.d_ptr->parametersValidated = true; + return msg; +} + /*! Constructs an empty, invalid QDBusMessage object. diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h index 55f388a..34b1635 100644 --- a/src/dbus/qdbusmessage.h +++ b/src/dbus/qdbusmessage.h @@ -87,8 +87,9 @@ public: QDBusMessage createErrorReply(const QString name, const QString &msg) const; inline QDBusMessage createErrorReply(const QDBusError &err) const { return createErrorReply(err.name(), err.message()); } - inline QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const; + QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const; + // there are no setters; if this changes, see qdbusmessage_p.h QString service() const; QString path() const; QString interface() const; @@ -113,9 +114,6 @@ private: QDBusMessagePrivate *d_ptr; }; -inline QDBusMessage QDBusMessage::createErrorReply(QDBusError::ErrorType atype, const QString &amsg) const -{ return createErrorReply(QDBusError::errorString(atype), amsg); } - #ifndef QT_NO_DEBUG_STREAM QDBUS_EXPORT QDebug operator<<(QDebug, const QDBusMessage &); #endif diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h index a0a681f..b8f23dc 100644 --- a/src/dbus/qdbusmessage_p.h +++ b/src/dbus/qdbusmessage_p.h @@ -55,6 +55,7 @@ #include #include +#include struct DBusMessage; @@ -69,7 +70,11 @@ public: ~QDBusMessagePrivate(); QList arguments; + + // the following parameters are "const": they are not changed after the constructors + // the parametersValidated member below controls whether they've been validated already QString service, path, interface, name, message, signature; + DBusMessage *msg; DBusMessage *reply; int type; @@ -79,6 +84,10 @@ public: mutable uint delayedReply : 1; uint localMessage : 1; + mutable uint parametersValidated : 1; + + static void setParametersValidated(QDBusMessage &msg, bool enable) + { msg.d_ptr->parametersValidated = enable; } static DBusMessage *toDBusMessage(const QDBusMessage &message, QDBusError *error); static QDBusMessage fromDBusMessage(DBusMessage *dmsg); -- cgit v0.12 From 485b2afb790444a0c6c2b32fbac65421e652dbe4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 18:27:11 +0200 Subject: Use an "int status" extra parameter in property reading/writing. When calling qt_metacall with the ReadProperty or WriteProperty, the data is on argv[0] like it was before, but now the QVariant itself is on argv[1] and there's an extra parameter in argv[2] which the meta code can use to indicate result. This allows QtDBus to process properties much more easily. In the case of property reading, we need to be able to modify the variant itself, because copying types when we don't have the data isn't very easy. As for setting, we need to be able to tell setProperty to return true or false depending on whether we succeeded in setting the property or not. Reviewed-By: Kent Hansen Reviewed-By: Marius Bugge Monsen --- src/corelib/kernel/qmetaobject.cpp | 23 ++++++++++++++++----- src/dbus/qdbusabstractinterface.cpp | 40 ++++++++++++++++++++++++++++++++----- src/dbus/qdbusabstractinterface.h | 18 ++++++++++++++++- src/dbus/qdbusabstractinterface_p.h | 2 +- src/dbus/qdbusinterface.cpp | 20 ------------------- 5 files changed, 71 insertions(+), 32 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 71dd5ff..34f580b 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2131,8 +2131,15 @@ QVariant QMetaProperty::read(const QObject *object) const return QVariant(); } } + + // the status variable is changed by qt_metacall to indicate what it did + // this feature is currently only used by QtDBus and should not be depended + // upon. Don't change it without looking into QDBusAbstractInterface first + // -1 (unchanged): normal qt_metacall, result stored in argv[0] + // changed: result stored directly in value + int status = -1; QVariant value; - void *argv[2] = { 0, &value }; + void *argv[] = { 0, &value, &status }; if (t == QVariant::LastType) { argv[0] = &value; } else { @@ -2142,8 +2149,8 @@ QVariant QMetaProperty::read(const QObject *object) const const_cast(object)->qt_metacall(QMetaObject::ReadProperty, idx + mobj->propertyOffset(), argv); - if (argv[1] == 0) - // "value" was changed + + if (status != -1) return value; if (t != QVariant::LastType && argv[0] != value.data()) // pointer or reference @@ -2201,13 +2208,19 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const return false; } - void *argv[2] = { 0, &v }; + // the status variable is changed by qt_metacall to indicate what it did + // this feature is currently only used by QtDBus and should not be depended + // upon. Don't change it without looking into QDBusAbstractInterface first + // -1 (unchanged): normal qt_metacall, result stored in argv[0] + // changed: result stored directly in value, return the value of status + int status = -1; + void *argv[] = { 0, &v, &status }; if (t == QVariant::LastType) argv[0] = &v; else argv[0] = v.data(); object->qt_metacall(QMetaObject::WriteProperty, idx + mobj->propertyOffset(), argv); - return true; + return status; } /*! diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 08da997..9bef2dd 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -195,10 +195,10 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const return QVariant(); } -void QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value) +bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value) { if (!isValid || !canMakeCalls()) // can't make calls - return; + return false; // send the value QDBusMessage msg = QDBusMessage::createMethodCall(service, path, @@ -208,8 +208,11 @@ void QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const Q msg << interface << QString::fromUtf8(mp.name()) << qVariantFromValue(QDBusVariant(value)); QDBusMessage reply = connection.call(msg, QDBus::Block); - if (reply.type() != QDBusMessage::ReplyMessage) + if (reply.type() != QDBusMessage::ReplyMessage) { lastError = reply; + return false; + } + return true; } void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name, @@ -223,6 +226,33 @@ void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name, } } +QDBusAbstractInterfaceBase::QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &d, QObject *parent) + : QObject(d, parent) +{ +} + +int QDBusAbstractInterfaceBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + int saved_id = _id; + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + + if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty) { + QMetaProperty mp = metaObject()->property(saved_id); + int &status = *reinterpret_cast(_a[2]); + QVariant &variant = *reinterpret_cast(_a[1]); + + if (_c == QMetaObject::WriteProperty) { + status = d_func()->setProperty(mp, variant) ? 1 : 0; + } else { + variant = d_func()->property(mp); + status = variant.isValid() ? 1 : 0; + } + _id = -1; + } + return _id; +} /*! \class QDBusAbstractInterface @@ -247,7 +277,7 @@ void QDBusAbstractInterfacePrivate::_q_serviceOwnerChanged(const QString &name, This is the constructor called from QDBusInterface::QDBusInterface. */ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, QObject *parent) - : QObject(d, parent) + : QDBusAbstractInterfaceBase(d, parent) { // keep track of the service owner if (!d_func()->currentOwner.isEmpty()) @@ -263,7 +293,7 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QString &path, const char *interface, const QDBusConnection &con, QObject *parent) - : QObject(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface), + : QDBusAbstractInterfaceBase(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface), con, false), parent) { // keep track of the service owner diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h index 6400b26..e525f77 100644 --- a/src/dbus/qdbusabstractinterface.h +++ b/src/dbus/qdbusabstractinterface.h @@ -61,7 +61,23 @@ class QDBusError; class QDBusPendingCall; class QDBusAbstractInterfacePrivate; -class QDBUS_EXPORT QDBusAbstractInterface: public QObject + +class QDBUS_EXPORT QDBusAbstractInterfaceBase: public QObject +{ +public: + int qt_metacall(QMetaObject::Call, int, void**); +protected: + QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent); +private: + Q_DECLARE_PRIVATE(QDBusAbstractInterface) +}; + +class QDBUS_EXPORT QDBusAbstractInterface: +#ifdef Q_QDOC + public QObject +#else + public QDBusAbstractInterfaceBase +#endif { Q_OBJECT diff --git a/src/dbus/qdbusabstractinterface_p.h b/src/dbus/qdbusabstractinterface_p.h index e5822b3..e577898 100644 --- a/src/dbus/qdbusabstractinterface_p.h +++ b/src/dbus/qdbusabstractinterface_p.h @@ -87,7 +87,7 @@ public: // these functions do not check if the property is valid QVariant property(const QMetaProperty &mp) const; - void setProperty(const QMetaProperty &mp, const QVariant &value); + bool setProperty(const QMetaProperty &mp, const QVariant &value); // return conn's d pointer inline QDBusConnectionPrivate *connectionPrivate() const diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp index 211b717..6f61847 100644 --- a/src/dbus/qdbusinterface.cpp +++ b/src/dbus/qdbusinterface.cpp @@ -205,26 +205,6 @@ int QDBusInterfacePrivate::metacall(QMetaObject::Call c, int id, void **argv) // done return -1; } - } else if (c == QMetaObject::ReadProperty) { - // Qt doesn't support non-readable properties - // we have to re-check - QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset()); - if (!mp.isReadable()) - return -1; // don't read - - QVariant *value = reinterpret_cast(argv[1]); - argv[1] = 0; - *value = property(mp); - - return -1; // handled, error or not - } else if (c == QMetaObject::WriteProperty) { - // QMetaProperty::write has already checked that we're writable - // it has also checked that the type is right - QVariant *value = reinterpret_cast(argv[1]); - QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset()); - - setProperty(mp, *value); - return -1; } return id; } -- cgit v0.12 From c4fa498f447bd569ee91e16f07bdb7954b5adc76 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 20:52:35 +0200 Subject: Fix setting of complex/custom properties and error messages. Complex properties require demarshalling before passing on to QMetaProperty::write(). We can't pass on a QVariant containing an un-demarshalled QDBusArgument. So add a new function that does the decoding properly, as well as error checking. Also take the opportunity to properly check the interface name in the case of setting a property exported from the object itself (not an adaptor). Task-number: 240608 Reviewed-by: Marius Bugge Monsen --- src/dbus/qdbusinternalfilters.cpp | 167 +++++++++++++++++++++++++++++++------- 1 file changed, 136 insertions(+), 31 deletions(-) diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp index 762a49b..45cbbb0 100644 --- a/src/dbus/qdbusinternalfilters.cpp +++ b/src/dbus/qdbusinternalfilters.cpp @@ -53,6 +53,7 @@ #include "qdbusextratypes.h" #include "qdbusmessage.h" #include "qdbusmetatype.h" +#include "qdbusmetatype_p.h" #include "qdbusmessage_p.h" #include "qdbusutil_p.h" @@ -177,14 +178,25 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node // implement the D-Bus interface org.freedesktop.DBus.Properties -static QDBusMessage qDBusPropertyError(const QDBusMessage &msg, const QString &interface_name) +static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name) { - return msg.createErrorReply(QDBusError::InvalidArgs, + return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path())); } +static inline QDBusMessage +propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name) +{ + return msg.createErrorReply(QDBusError::InvalidArgs, + QString::fromLatin1("Property %1%2%3 was not found in object %4") + .arg(interface_name, + QString::fromLatin1(interface_name.isEmpty() ? "" : "."), + QString::fromLatin1(property_name), + msg.path())); +} + QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg) { @@ -198,6 +210,7 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node QDBusAdaptorConnector *connector; QVariant value; + bool interfaceFound = false; if (node.flags & QDBusConnection::ExportAdaptors && (connector = qDBusFindAdaptorConnector(node.obj))) { @@ -217,31 +230,122 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node QDBusAdaptorConnector::AdaptorMap::ConstIterator it; it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), interface_name); - if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) + if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { + interfaceFound = true; value = it->adaptor->property(property_name); + } } } - if (!value.isValid() && node.flags & (QDBusConnection::ExportAllProperties | - QDBusConnection::ExportNonScriptableProperties)) { + if (!interfaceFound && !value.isValid() + && node.flags & (QDBusConnection::ExportAllProperties | + QDBusConnection::ExportNonScriptableProperties)) { // try the object itself - int pidx = node.obj->metaObject()->indexOfProperty(property_name); - if (pidx != -1) { - QMetaProperty mp = node.obj->metaObject()->property(pidx); - if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || - (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) - value = mp.read(node.obj); + if (!interface_name.isEmpty()) + interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); + + if (interfaceFound) { + int pidx = node.obj->metaObject()->indexOfProperty(property_name); + if (pidx != -1) { + QMetaProperty mp = node.obj->metaObject()->property(pidx); + if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || + (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) + value = mp.read(node.obj); + } } } if (!value.isValid()) { // the property was not found - return qDBusPropertyError(msg, interface_name); + if (!interfaceFound) + return interfaceNotFoundError(msg, interface_name); + return propertyNotFoundError(msg, interface_name, property_name); } return msg.createReply(qVariantFromValue(QDBusVariant(value))); } +enum PropertyWriteResult { + PropertyWriteSuccess = 0, + PropertyNotFound, + PropertyTypeMismatch, + PropertyWriteFailed +}; + +static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name, + const QByteArray &property_name, int status) +{ + switch (status) { + case PropertyNotFound: + return propertyNotFoundError(msg, interface_name, property_name); + case PropertyTypeMismatch: + return msg.createErrorReply(QDBusError::InvalidArgs, + QString::fromLatin1("Invalid arguments for writing to property %1%2%3") + .arg(interface_name, + QString::fromLatin1(interface_name.isEmpty() ? "" : "."), + QString::fromLatin1(property_name))); + case PropertyWriteFailed: + return msg.createErrorReply(QDBusError::InternalError, + QString::fromLatin1("Internal error")); + + case PropertyWriteSuccess: + return msg.createReply(); + } + Q_ASSERT_X(false, "", "Should not be reached"); + return QDBusMessage(); +} + +static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value, + int propFlags = QDBusConnection::ExportAllProperties) +{ + const QMetaObject *mo = obj->metaObject(); + int pidx = mo->indexOfProperty(property_name); + if (pidx == -1) { + // this object has no property by that name + return PropertyNotFound; + } + + QMetaProperty mp = mo->property(pidx); + + // check if this property is exported + bool isScriptable = mp.isScriptable(); + if (!(propFlags & QDBusConnection::ExportScriptableProperties) && isScriptable) + return PropertyNotFound; + if (!(propFlags & QDBusConnection::ExportNonScriptableProperties) && !isScriptable) + return PropertyNotFound; + + // we found our property + // do we have the right type? + int id = mp.type(); + if (id == QVariant::UserType) { + // dynamic type + id = qDBusNameToTypeId(mp.typeName()); + if (id == -1) { + // type not registered? + qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'", + mp.typeName(), mo->className(), property_name.constData()); + return PropertyWriteFailed; + } + } + + if (id != 0xff && value.userType() == QDBusMetaTypeId::argument) { + // we have to demarshall before writing + void *null = 0; + QVariant other(id, null); + if (!QDBusMetaType::demarshall(qVariantValue(value), id, other.data())) { + qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " + "Use qDBusRegisterMetaType to register it", + mp.typeName(), id); + return PropertyWriteFailed; + } + + value = other; + } + + // the property type here should match + return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed; +} + QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg) { @@ -263,38 +367,39 @@ QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node if (interface_name.isEmpty()) { for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), end = connector->adaptors.constEnd(); it != end; ++it) { - const QMetaObject *mo = it->adaptor->metaObject(); - int pidx = mo->indexOfProperty(property_name); - if (pidx != -1) { - mo->property(pidx).write(it->adaptor, value); - return msg.createReply(); - } + int status = writeProperty(it->adaptor, property_name, value); + if (status == PropertyNotFound) + continue; + return propertyWriteReply(msg, interface_name, property_name, status); } } else { QDBusAdaptorConnector::AdaptorMap::ConstIterator it; it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), interface_name); - if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) - if (it->adaptor->setProperty(property_name, value)) - return msg.createReply(); + if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) { + return propertyWriteReply(msg, interface_name, property_name, + writeProperty(it->adaptor, property_name, value)); + } } } if (node.flags & (QDBusConnection::ExportScriptableProperties | QDBusConnection::ExportNonScriptableProperties)) { // try the object itself - int pidx = node.obj->metaObject()->indexOfProperty(property_name); - if (pidx != -1) { - QMetaProperty mp = node.obj->metaObject()->property(pidx); - if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || - (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) - if (mp.write(node.obj, value)) - return msg.createReply(); + bool interfaceFound = true; + if (!interface_name.isEmpty()) + interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); + + if (interfaceFound) { + return propertyWriteReply(msg, interface_name, property_name, + writeProperty(node.obj, property_name, value, node.flags)); } } - // the property was not found or not written to - return qDBusPropertyError(msg, interface_name); + // the property was not found + if (!interface_name.isEmpty()) + return interfaceNotFoundError(msg, interface_name); + return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); } // unite two QVariantMaps, but don't generate duplicate keys @@ -385,7 +490,7 @@ QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &n if (!interfaceFound && !interface_name.isEmpty()) { // the interface was not found - return qDBusPropertyError(msg, interface_name); + return interfaceNotFoundError(msg, interface_name); } return msg.createReply(qVariantFromValue(result)); -- cgit v0.12 From a80d8f015f68cb2b6d5f4cc8b2893543122c5d2b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jun 2009 16:16:57 +0200 Subject: Autotest: make sure we create the QDBusInterface after the object exists. The current code allows making calls to QDBusInterface objects that failed to introspect. It's technically a valid condition. You won't be able to connect to signals, get or set properties, but making calls was possible. I don't know if I want to keep this change in behaviour. --- .../tst_qdbusabstractadaptor.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp index c70c619..5d08c63 100644 --- a/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp +++ b/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp @@ -609,19 +609,22 @@ void tst_QDBusAbstractAdaptor::methodCalls() QVERIFY(con.isConnected()); //QDBusInterface emptycon.baseService(), "/", QString()); - QDBusInterface if1(con.baseService(), "/", "local.Interface1", con); - QDBusInterface if2(con.baseService(), "/", "local.Interface2", con); - QDBusInterface if3(con.baseService(), "/", "local.Interface3", con); - QDBusInterface if4(con.baseService(), "/", "local.Interface4", con); - // must fail: no object - //QCOMPARE(empty->call("method").type(), QDBusMessage::ErrorMessage); - QCOMPARE(if1.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ErrorMessage); + { + // must fail: no object + QDBusInterface if1(con.baseService(), "/", "local.Interface1", con); + QCOMPARE(if1.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ErrorMessage); + } QFETCH(int, nInterfaces); MyObject obj(nInterfaces); con.registerObject("/", &obj); + QDBusInterface if1(con.baseService(), "/", "local.Interface1", con); + QDBusInterface if2(con.baseService(), "/", "local.Interface2", con); + QDBusInterface if3(con.baseService(), "/", "local.Interface3", con); + QDBusInterface if4(con.baseService(), "/", "local.Interface4", con); + // must fail: no such method QCOMPARE(if1.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ErrorMessage); if (!nInterfaces--) @@ -670,11 +673,11 @@ void tst_QDBusAbstractAdaptor::methodCallScriptable() QDBusConnection con = QDBusConnection::sessionBus(); QVERIFY(con.isConnected()); - QDBusInterface if2(con.baseService(), "/", "local.Interface2", con); - MyObject obj(2); con.registerObject("/", &obj); + QDBusInterface if2(con.baseService(), "/", "local.Interface2", con); + QCOMPARE(if2.call(QDBus::BlockWithGui,"scriptableMethod").type(), QDBusMessage::ReplyMessage); QCOMPARE(slotSpy, "void Interface2::scriptableMethod()"); } -- cgit v0.12 From d675a1f752f6acb57c66082b9b25e1b8aa337f8a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 11:15:22 +0200 Subject: Autotest: add tests for method call errors --- tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp | 105 ++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp index 3ba789a..e304712 100644 --- a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp @@ -84,12 +84,17 @@ private slots: void sendArgument_data(); void sendArgument(); - void sendErrors(); + void sendSignalErrors(); + void sendCallErrors_data(); + void sendCallErrors(); private: QProcess proc; }; +struct UnregisteredType { }; +Q_DECLARE_METATYPE(UnregisteredType) + class WaitForQPong: public QObject { Q_OBJECT @@ -784,7 +789,7 @@ void tst_QDBusMarshall::sendArgument() QCOMPARE(extracted, value); } -void tst_QDBusMarshall::sendErrors() +void tst_QDBusMarshall::sendSignalErrors() { QDBusConnection con = QDBusConnection::sessionBus(); @@ -819,5 +824,101 @@ void tst_QDBusMarshall::sendErrors() QVERIFY(!con.send(msg)); } +void tst_QDBusMarshall::sendCallErrors_data() +{ + QTest::addColumn("service"); + QTest::addColumn("path"); + QTest::addColumn("interface"); + QTest::addColumn("method"); + QTest::addColumn("arguments"); + QTest::addColumn("errorName"); + QTest::addColumn("errorMsg"); + QTest::addColumn("ignoreMsg"); + + // this error comes from the bus server + QTest::newRow("empty-service") << "" << objectPath << interfaceName << "ping" << QVariantList() + << "org.freedesktop.DBus.Error.UnknownMethod" + << "Method \"ping\" with signature \"\" on interface \"com.trolltech.autotests.qpong\" doesn't exist\n" << (const char*)0; + + QTest::newRow("invalid-service") << "this isn't valid" << objectPath << interfaceName << "ping" << QVariantList() + << "com.trolltech.QtDBus.Error.InvalidService" + << "Invalid service name: this isn't valid" << ""; + + QTest::newRow("empty-path") << serviceName << "" << interfaceName << "ping" << QVariantList() + << "com.trolltech.QtDBus.Error.InvalidObjectPath" + << "Object path cannot be empty" << ""; + QTest::newRow("invalid-path") << serviceName << "//" << interfaceName << "ping" << QVariantList() + << "com.trolltech.QtDBus.Error.InvalidObjectPath" + << "Invalid object path: //" << ""; + + // empty interfaces are valid + QTest::newRow("invalid-interface") << serviceName << objectPath << "this isn't valid" << "ping" << QVariantList() + << "com.trolltech.QtDBus.Error.InvalidInterface" + << "Invalid interface class: this isn't valid" << ""; + + QTest::newRow("empty-method") << serviceName << objectPath << interfaceName << "" << QVariantList() + << "com.trolltech.QtDBus.Error.InvalidMember" + << "method name cannot be empty" << ""; + QTest::newRow("invalid-method") << serviceName << objectPath << interfaceName << "this isn't valid" << QVariantList() + << "com.trolltech.QtDBus.Error.InvalidMember" + << "Invalid method name: this isn't valid" << ""; + + QTest::newRow("invalid-variant1") << serviceName << objectPath << interfaceName << "ping" + << (QVariantList() << QVariant()) + << "org.freedesktop.DBus.Error.Failed" + << "Marshalling failed: Variant containing QVariant::Invalid passed in arguments" + << "QDBusMarshaller: cannot add an invalid QVariant"; + QTest::newRow("invalid-variant1") << serviceName << objectPath << interfaceName << "ping" + << (QVariantList() << qVariantFromValue(QDBusVariant())) + << "org.freedesktop.DBus.Error.Failed" + << "Marshalling failed: Variant containing QVariant::Invalid passed in arguments" + << "QDBusMarshaller: cannot add a null QDBusVariant"; + + QTest::newRow("builtin-unregistered") << serviceName << objectPath << interfaceName << "ping" + << (QVariantList() << QLocale::c()) + << "org.freedesktop.DBus.Error.Failed" + << "Marshalling failed: Unregistered type QLocale passed in arguments" + << "QDBusMarshaller: type `QLocale' (18) is not registered with D-BUS. Use qDBusRegisterMetaType to register it"; + + // this type is known to the meta type system, but not registered with D-Bus + qRegisterMetaType(); + QTest::newRow("extra-unregistered") << serviceName << objectPath << interfaceName << "ping" + << (QVariantList() << qVariantFromValue(UnregisteredType())) + << "org.freedesktop.DBus.Error.Failed" + << "Marshalling failed: Unregistered type UnregisteredType passed in arguments" + << QString("QDBusMarshaller: type `UnregisteredType' (%1) is not registered with D-BUS. Use qDBusRegisterMetaType to register it") + .arg(qMetaTypeId()); +} + +void tst_QDBusMarshall::sendCallErrors() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + QFETCH(QString, service); + QFETCH(QString, path); + QFETCH(QString, interface); + QFETCH(QString, method); + QFETCH(QVariantList, arguments); + QFETCH(QString, errorMsg); + + QFETCH(QString, ignoreMsg); + if (!ignoreMsg.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, ignoreMsg.toLatin1()); + if (!ignoreMsg.isNull()) + QTest::ignoreMessage(QtWarningMsg, + QString("QDBusConnection: error: could not send message to service \"%1\" path \"%2\" interface \"%3\" member \"%4\": %5") + .arg(service, path, interface, method, errorMsg) + .toLatin1()); + + QDBusMessage msg = QDBusMessage::createMethodCall(service, path, interface, method); + msg.setArguments(arguments); + + QDBusMessage reply = con.call(msg, QDBus::Block); + QCOMPARE(reply.type(), QDBusMessage::ErrorMessage); + QTEST(reply.errorName(), "errorName"); + QCOMPARE(reply.errorMessage(), errorMsg); +} + QTEST_MAIN(tst_QDBusMarshall) #include "tst_qdbusmarshall.moc" -- cgit v0.12 From 202167643206bbfb50cce605fdfbd4cfef843bad Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 16:21:44 +0200 Subject: Autotest: Add testing of QDBusAbstractInterface --- tests/auto/auto.pro | 1 + .../com.trolltech.QtDBus.Pinger.xml | 29 ++ tests/auto/qdbusabstractinterface/interface.cpp | 48 ++ tests/auto/qdbusabstractinterface/interface.h | 109 +++++ tests/auto/qdbusabstractinterface/pinger.cpp | 67 +++ tests/auto/qdbusabstractinterface/pinger.h | 139 ++++++ .../qdbusabstractinterface.pro | 15 + .../tst_qdbusabstractinterface.cpp | 529 +++++++++++++++++++++ 8 files changed, 937 insertions(+) create mode 100644 tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml create mode 100644 tests/auto/qdbusabstractinterface/interface.cpp create mode 100644 tests/auto/qdbusabstractinterface/interface.h create mode 100644 tests/auto/qdbusabstractinterface/pinger.cpp create mode 100644 tests/auto/qdbusabstractinterface/pinger.h create mode 100644 tests/auto/qdbusabstractinterface/qdbusabstractinterface.pro create mode 100644 tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index fd887fd..8bc2ed9 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -419,6 +419,7 @@ xmlpatternsxslts.depends = xmlpatternsxqts unix:!embedded:contains(QT_CONFIG, dbus):SUBDIRS += \ qdbusabstractadaptor \ + qdbusabstractinterface \ qdbusconnection \ qdbusinterface \ qdbuslocalcalls \ diff --git a/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml b/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml new file mode 100644 index 0000000..8909675 --- /dev/null +++ b/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/qdbusabstractinterface/interface.cpp b/tests/auto/qdbusabstractinterface/interface.cpp new file mode 100644 index 0000000..1c391ce --- /dev/null +++ b/tests/auto/qdbusabstractinterface/interface.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "interface.h" + +Interface::Interface() +{ +} + +#include "moc_interface.cpp" diff --git a/tests/auto/qdbusabstractinterface/interface.h b/tests/auto/qdbusabstractinterface/interface.h new file mode 100644 index 0000000..86e0dc4 --- /dev/null +++ b/tests/auto/qdbusabstractinterface/interface.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef INTERFACE_H +#define INTERFACE_H + +#include +#include + +struct RegisteredType +{ + inline RegisteredType(const QString &str = QString()) : s(str) {} + inline bool operator==(const RegisteredType &other) const { return s == other.s; } + QString s; +}; +Q_DECLARE_METATYPE(RegisteredType) + +inline QDBusArgument &operator<<(QDBusArgument &s, const RegisteredType &data) +{ + s.beginStructure(); + s << data.s; + s.endStructure(); + return s; +} + +inline const QDBusArgument &operator>>(const QDBusArgument &s, RegisteredType &data) +{ + s.beginStructure(); + s >> data.s; + s.endStructure(); + return s; +} + +struct UnregisteredType +{ + QString s; +}; +Q_DECLARE_METATYPE(UnregisteredType) + +class Interface: public QObject +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.trolltech.QtDBus.Pinger") + Q_PROPERTY(QString stringProp READ stringProp WRITE setStringProp SCRIPTABLE true) + Q_PROPERTY(RegisteredType complexProp READ complexProp WRITE setComplexProp SCRIPTABLE true) + + friend class tst_QDBusAbstractInterface; + QString m_stringProp; + RegisteredType m_complexProp; + +public: + Interface(); + + QString stringProp() const { return m_stringProp; } + void setStringProp(const QString &s) { m_stringProp = s; } + RegisteredType complexProp() const { return m_complexProp; } + void setComplexProp(const RegisteredType &r) { m_complexProp = r; } + +public slots: + Q_SCRIPTABLE void voidMethod() {} + Q_SCRIPTABLE QString stringMethod() { return "Hello, world"; } + Q_SCRIPTABLE RegisteredType complexMethod() { return RegisteredType("Hello, world"); } + Q_SCRIPTABLE QString multiOutMethod(int &value) { value = 42; return "Hello, world"; } + +signals: + Q_SCRIPTABLE void voidSignal(); + Q_SCRIPTABLE void stringSignal(const QString &); + Q_SCRIPTABLE void complexSignal(RegisteredType); +}; + +#endif // INTERFACE_H diff --git a/tests/auto/qdbusabstractinterface/pinger.cpp b/tests/auto/qdbusabstractinterface/pinger.cpp new file mode 100644 index 0000000..4fcb89a --- /dev/null +++ b/tests/auto/qdbusabstractinterface/pinger.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -i interface.h -p pinger com.trolltech.QtDBus.Pinger.xml + * + * qdbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#include "pinger.h" + +/* + * Implementation of interface class ComTrolltechQtDBusPingerInterface + */ + +ComTrolltechQtDBusPingerInterface::ComTrolltechQtDBusPingerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +{ +} + +ComTrolltechQtDBusPingerInterface::~ComTrolltechQtDBusPingerInterface() +{ +} + diff --git a/tests/auto/qdbusabstractinterface/pinger.h b/tests/auto/qdbusabstractinterface/pinger.h new file mode 100644 index 0000000..3ff218c --- /dev/null +++ b/tests/auto/qdbusabstractinterface/pinger.h @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -i interface.h -p pinger com.trolltech.QtDBus.Pinger.xml + * + * qdbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#ifndef PINGER_H_1246371899 +#define PINGER_H_1246371899 + +#include +#include +#include +#include +#include +#include +#include +#include +#include "interface.h" + +/* + * Proxy class for interface com.trolltech.QtDBus.Pinger + */ +class ComTrolltechQtDBusPingerInterface: public QDBusAbstractInterface +{ + Q_OBJECT +public: + static inline const char *staticInterfaceName() + { return "com.trolltech.QtDBus.Pinger"; } + +public: + ComTrolltechQtDBusPingerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + + ~ComTrolltechQtDBusPingerInterface(); + + Q_PROPERTY(RegisteredType complexProp READ complexProp WRITE setComplexProp) + inline RegisteredType complexProp() const + { return qvariant_cast< RegisteredType >(internalPropGet("complexProp")); } + inline void setComplexProp(RegisteredType value) + { internalPropSet("complexProp", qVariantFromValue(value)); } + + Q_PROPERTY(QString stringProp READ stringProp WRITE setStringProp) + inline QString stringProp() const + { return qvariant_cast< QString >(internalPropGet("stringProp")); } + inline void setStringProp(const QString &value) + { internalPropSet("stringProp", qVariantFromValue(value)); } + +public Q_SLOTS: // METHODS + inline QDBusPendingReply complexMethod() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("complexMethod"), argumentList); + } + + inline QDBusPendingReply multiOutMethod() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("multiOutMethod"), argumentList); + } + inline QDBusReply multiOutMethod(int &out1) + { + QList argumentList; + QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("multiOutMethod"), argumentList); + if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) { + out1 = qdbus_cast(reply.arguments().at(1)); + } + return reply; + } + + inline QDBusPendingReply stringMethod() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("stringMethod"), argumentList); + } + + inline QDBusPendingReply<> voidMethod() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("voidMethod"), argumentList); + } + +Q_SIGNALS: // SIGNALS + void complexSignal(RegisteredType in0); + void stringSignal(const QString &in0); + void voidSignal(); +}; + +namespace com { + namespace trolltech { + namespace QtDBus { + typedef ::ComTrolltechQtDBusPingerInterface Pinger; + } + } +} +#endif diff --git a/tests/auto/qdbusabstractinterface/qdbusabstractinterface.pro b/tests/auto/qdbusabstractinterface/qdbusabstractinterface.pro new file mode 100644 index 0000000..a4853b8 --- /dev/null +++ b/tests/auto/qdbusabstractinterface/qdbusabstractinterface.pro @@ -0,0 +1,15 @@ +load(qttest_p4) +QT = core +contains(QT_CONFIG,dbus): { + SOURCES += tst_qdbusabstractinterface.cpp interface.cpp + HEADERS += interface.h + QT += dbus + + # These are generated sources + # To regenerate, see the command-line at the top of the files + SOURCES += pinger.cpp + HEADERS += pinger.h +} +else:SOURCES += ../qdbusmarshall/dummy.cpp + +OTHER_FILES += com.trolltech.QtDBus.Pinger.xml diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp new file mode 100644 index 0000000..4aee089 --- /dev/null +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -0,0 +1,529 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +#include + +#include + +#include "interface.h" +#include "pinger.h" + +typedef QSharedPointer Pinger; + +class tst_QDBusAbstractInterface: public QObject +{ + Q_OBJECT + Interface targetObj; + + Pinger getPinger(QString service = "", const QString &path = "/") + { + QDBusConnection con = QDBusConnection::sessionBus(); + if (!con.isConnected()) + return Pinger(); + if (service.isEmpty() && !service.isNull()) + service = con.baseService(); + return Pinger(new com::trolltech::QtDBus::Pinger(service, path, con)); + } + +public: + tst_QDBusAbstractInterface(); + +private slots: + void initTestCase(); + + void makeVoidCall(); + void makeStringCall(); + void makeComplexCall(); + void makeMultiOutCall(); + + void makeAsyncVoidCall(); + void makeAsyncStringCall(); + void makeAsyncComplexCall(); + void makeAsyncMultiOutCall(); + + void stringPropRead(); + void stringPropWrite(); + void complexPropRead(); + void complexPropWrite(); + + void stringPropDirectRead(); + void stringPropDirectWrite(); + void complexPropDirectRead(); + void complexPropDirectWrite(); + + void getVoidSignal_data(); + void getVoidSignal(); + void getStringSignal_data(); + void getStringSignal(); + void getComplexSignal_data(); + void getComplexSignal(); + + void createErrors_data(); + void createErrors(); + + void callErrors_data(); + void callErrors(); + void asyncCallErrors_data(); + void asyncCallErrors(); + + void propertyReadErrors_data(); + void propertyReadErrors(); + void propertyWriteErrors_data(); + void propertyWriteErrors(); + void directPropertyReadErrors_data(); + void directPropertyReadErrors(); + void directPropertyWriteErrors_data(); + void directPropertyWriteErrors(); +}; + +tst_QDBusAbstractInterface::tst_QDBusAbstractInterface() +{ + // register the meta types + qDBusRegisterMetaType(); + qRegisterMetaType(); +} + +void tst_QDBusAbstractInterface::initTestCase() +{ + // register the object + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + con.registerObject("/", &targetObj, QDBusConnection::ExportScriptableContents); +} + +void tst_QDBusAbstractInterface::makeVoidCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusReply r = p->voidMethod(); + QVERIFY(r.isValid()); +} + +void tst_QDBusAbstractInterface::makeStringCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusReply r = p->stringMethod(); + QVERIFY(r.isValid()); + QCOMPARE(r.value(), targetObj.stringMethod()); +} + +void tst_QDBusAbstractInterface::makeComplexCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusReply r = p->complexMethod(); + QVERIFY(r.isValid()); + QCOMPARE(r.value(), targetObj.complexMethod()); +} + +void tst_QDBusAbstractInterface::makeMultiOutCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + int value; + QDBusReply r = p->multiOutMethod(value); + QVERIFY(r.isValid()); + + int expectedValue; + QCOMPARE(r.value(), targetObj.multiOutMethod(expectedValue)); + QCOMPARE(value, expectedValue); +} + +void tst_QDBusAbstractInterface::makeAsyncVoidCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusPendingReply r = p->voidMethod(); + r.waitForFinished(); + QVERIFY(r.isValid()); +} + +void tst_QDBusAbstractInterface::makeAsyncStringCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusPendingReply r = p->stringMethod(); + r.waitForFinished(); + QVERIFY(r.isValid()); + QCOMPARE(r.value(), targetObj.stringMethod()); +} + +void tst_QDBusAbstractInterface::makeAsyncComplexCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusPendingReply r = p->complexMethod(); + r.waitForFinished(); + QVERIFY(r.isValid()); + QCOMPARE(r.value(), targetObj.complexMethod()); +} + +void tst_QDBusAbstractInterface::makeAsyncMultiOutCall() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusPendingReply r = p->multiOutMethod(); + r.waitForFinished(); + QVERIFY(r.isValid()); + + int expectedValue; + QCOMPARE(r.value(), targetObj.multiOutMethod(expectedValue)); + QCOMPARE(r.argumentAt<1>(), expectedValue); +} + +void tst_QDBusAbstractInterface::stringPropRead() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QString expectedValue = targetObj.m_stringProp = "This is a test"; + QVariant v = p->property("stringProp"); + QVERIFY(v.isValid()); + QCOMPARE(v.toString(), expectedValue); +} + +void tst_QDBusAbstractInterface::stringPropWrite() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QString expectedValue = "This is a value"; + QVERIFY(p->setProperty("stringProp", expectedValue)); + QCOMPARE(targetObj.m_stringProp, expectedValue); +} + +void tst_QDBusAbstractInterface::complexPropRead() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + RegisteredType expectedValue = targetObj.m_complexProp = RegisteredType("This is a test"); + QVariant v = p->property("complexProp"); + QVERIFY(v.userType() == qMetaTypeId()); + QCOMPARE(v.value(), targetObj.m_complexProp); +} + +void tst_QDBusAbstractInterface::complexPropWrite() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + RegisteredType expectedValue = RegisteredType("This is a value"); + QVERIFY(p->setProperty("complexProp", qVariantFromValue(expectedValue))); + QCOMPARE(targetObj.m_complexProp, expectedValue); +} + +void tst_QDBusAbstractInterface::stringPropDirectRead() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QString expectedValue = targetObj.m_stringProp = "This is a test"; + QCOMPARE(p->stringProp(), expectedValue); +} + +void tst_QDBusAbstractInterface::stringPropDirectWrite() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QString expectedValue = "This is a value"; + p->setStringProp(expectedValue); + QCOMPARE(targetObj.m_stringProp, expectedValue); +} + +void tst_QDBusAbstractInterface::complexPropDirectRead() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + RegisteredType expectedValue = targetObj.m_complexProp = RegisteredType("This is a test"); + QCOMPARE(p->complexProp(), targetObj.m_complexProp); +} + +void tst_QDBusAbstractInterface::complexPropDirectWrite() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + RegisteredType expectedValue = RegisteredType("This is a value"); + p->setComplexProp(expectedValue); + QCOMPARE(targetObj.m_complexProp, expectedValue); +} + +void tst_QDBusAbstractInterface::getVoidSignal_data() +{ + QTest::addColumn("service"); + QTest::addColumn("path"); + + QTest::newRow("specific") << QDBusConnection::sessionBus().baseService() << "/"; + QTest::newRow("service-wildcard") << QString() << "/"; + QTest::newRow("path-wildcard") << QDBusConnection::sessionBus().baseService() << QString(); + QTest::newRow("full-wildcard") << QString() << QString(); +} + +void tst_QDBusAbstractInterface::getVoidSignal() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we need to connect the signal somewhere in order for D-Bus to enable the rules + QTestEventLoop::instance().connect(p.data(), SIGNAL(voidSignal()), SLOT(exitLoop())); + QSignalSpy s(p.data(), SIGNAL(voidSignal())); + + emit targetObj.voidSignal(); + QTestEventLoop::instance().enterLoop(2); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(s.size() == 1); + QVERIFY(s.at(0).size() == 0); +} + +void tst_QDBusAbstractInterface::getStringSignal_data() +{ + getVoidSignal_data(); +} + +void tst_QDBusAbstractInterface::getStringSignal() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we need to connect the signal somewhere in order for D-Bus to enable the rules + QTestEventLoop::instance().connect(p.data(), SIGNAL(stringSignal(QString)), SLOT(exitLoop())); + QSignalSpy s(p.data(), SIGNAL(stringSignal(QString))); + + QString expectedValue = "Good morning"; + emit targetObj.stringSignal(expectedValue); + QTestEventLoop::instance().enterLoop(2); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(s.size() == 1); + QVERIFY(s[0].size() == 1); + QCOMPARE(s[0][0].userType(), int(QVariant::String)); + QCOMPARE(s[0][0].toString(), expectedValue); +} + +void tst_QDBusAbstractInterface::getComplexSignal_data() +{ + getVoidSignal_data(); +} + +void tst_QDBusAbstractInterface::getComplexSignal() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we need to connect the signal somewhere in order for D-Bus to enable the rules + QTestEventLoop::instance().connect(p.data(), SIGNAL(complexSignal(RegisteredType)), SLOT(exitLoop())); + QSignalSpy s(p.data(), SIGNAL(complexSignal(RegisteredType))); + + RegisteredType expectedValue("Good evening"); + emit targetObj.complexSignal(expectedValue); + QTestEventLoop::instance().enterLoop(2); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(s.size() == 1); + QVERIFY(s[0].size() == 1); + QCOMPARE(s[0][0].userType(), qMetaTypeId()); + QCOMPARE(s[0][0].value(), expectedValue); +} + +void tst_QDBusAbstractInterface::createErrors_data() +{ + QTest::addColumn("service"); + QTest::addColumn("path"); + QTest::addColumn("errorName"); + + QTest::newRow("invalid-service") << "this isn't valid" << "/" << "com.trolltech.QtDBus.Error.InvalidService"; + QTest::newRow("invalid-path") << QDBusConnection::sessionBus().baseService() << "this isn't valid" + << "com.trolltech.QtDBus.Error.InvalidObjectPath"; +} + +void tst_QDBusAbstractInterface::createErrors() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + QVERIFY(!p->isValid()); + QTEST(p->lastError().name(), "errorName"); +} + +void tst_QDBusAbstractInterface::callErrors_data() +{ + createErrors_data(); + QTest::newRow("service-wildcard") << QString() << "/" << "com.trolltech.QtDBus.Error.InvalidService"; + QTest::newRow("path-wildcard") << QDBusConnection::sessionBus().baseService() << QString() + << "com.trolltech.QtDBus.Error.InvalidObjectPath"; + QTest::newRow("full-wildcard") << QString() << QString() << "com.trolltech.QtDBus.Error.InvalidService"; +} + +void tst_QDBusAbstractInterface::callErrors() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we shouldn't be able to make this call: + QDBusReply r = p->stringMethod(); + QVERIFY(!r.isValid()); + QTEST(r.error().name(), "errorName"); + QCOMPARE(p->lastError().name(), r.error().name()); +} + +void tst_QDBusAbstractInterface::asyncCallErrors_data() +{ + callErrors_data(); +} + +void tst_QDBusAbstractInterface::asyncCallErrors() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we shouldn't be able to make this call: + QDBusPendingReply r = p->stringMethod(); + QVERIFY(r.isError()); + QTEST(r.error().name(), "errorName"); + QCOMPARE(p->lastError().name(), r.error().name()); +} + +void tst_QDBusAbstractInterface::propertyReadErrors_data() +{ + callErrors_data(); +} + +void tst_QDBusAbstractInterface::propertyReadErrors() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we shouldn't be able to get this value: + QVariant v = p->property("stringProp"); + QVERIFY(v.isNull()); + QVERIFY(!v.isValid()); + QTEST(p->lastError().name(), "errorName"); +} + +void tst_QDBusAbstractInterface::propertyWriteErrors_data() +{ + callErrors_data(); +} + +void tst_QDBusAbstractInterface::propertyWriteErrors() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we shouldn't be able to get this value: + if (p->isValid()) + QCOMPARE(int(p->lastError().type()), int(QDBusError::NoError)); + QVERIFY(!p->setProperty("stringProp", "")); + QTEST(p->lastError().name(), "errorName"); +} + +void tst_QDBusAbstractInterface::directPropertyReadErrors_data() +{ + callErrors_data(); +} + +void tst_QDBusAbstractInterface::directPropertyReadErrors() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we shouldn't be able to get this value: + QString v = p->stringProp(); + QVERIFY(v.isNull()); + QTEST(p->lastError().name(), "errorName"); +} + +void tst_QDBusAbstractInterface::directPropertyWriteErrors_data() +{ + callErrors_data(); +} + +void tst_QDBusAbstractInterface::directPropertyWriteErrors() +{ + QFETCH(QString, service); + QFETCH(QString, path); + Pinger p = getPinger(service, path); + QVERIFY2(p, "Not connected to D-Bus"); + + // we shouldn't be able to get this value: + // but there's no direct way of verifying that the setting failed + if (p->isValid()) + QCOMPARE(int(p->lastError().type()), int(QDBusError::NoError)); + p->setStringProp(""); + QTEST(p->lastError().name(), "errorName"); +} + +QTEST_MAIN(tst_QDBusAbstractInterface) +#include "tst_qdbusabstractinterface.moc" -- cgit v0.12 From 826c03c1c010a9d612007aa85ce3a5188edb0cb8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2009 19:27:16 +0200 Subject: Autotest: Add property-setting and getting tests to QDBusInterface --- tests/auto/qdbusinterface/tst_qdbusinterface.cpp | 102 ++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp index c4d4b08..718ba18 100644 --- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp @@ -60,6 +60,9 @@ class MyObject: public QObject Q_CLASSINFO("D-Bus Introspection", "" " \n" " \n" +" \n" +" \n" +" \n" " \n" " \n" " \n" @@ -75,6 +78,9 @@ class MyObject: public QObject " \n" " \n" "") + Q_PROPERTY(int prop1 READ prop1 WRITE setProp1) + Q_PROPERTY(QList complexProp READ complexProp WRITE setComplexProp) + public: static int callCount; static QVariantList callArgs; @@ -84,6 +90,30 @@ public: subObject->setObjectName("subObject"); } + int m_prop1; + int prop1() const + { + ++callCount; + return m_prop1; + } + void setProp1(int value) + { + ++callCount; + m_prop1 = value; + } + + QList m_complexProp; + QList complexProp() const + { + ++callCount; + return m_complexProp; + } + void setComplexProp(const QList &value) + { + ++callCount; + m_complexProp = value; + } + public slots: void ping(QDBusMessage msg) @@ -146,6 +176,11 @@ private slots: void invokeMethod(); void signal(); + + void propertyRead(); + void propertyWrite(); + void complexPropertyRead(); + void complexPropertyWrite(); }; void tst_QDBusInterface::initTestCase() @@ -154,7 +189,7 @@ void tst_QDBusInterface::initTestCase() QVERIFY(con.isConnected()); QTest::qWait(500); - con.registerObject("/", &obj, QDBusConnection::ExportAdaptors + con.registerObject("/", &obj, QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSlots | QDBusConnection::ExportChildObjects); } @@ -231,8 +266,9 @@ void tst_QDBusInterface::introspect() QCOMPARE(mo->methodCount() - mo->methodOffset(), 3); QVERIFY(mo->indexOfSignal(TEST_SIGNAL_NAME "(QString)") != -1); - QCOMPARE(mo->propertyCount() - mo->propertyOffset(), 1); + QCOMPARE(mo->propertyCount() - mo->propertyOffset(), 2); QVERIFY(mo->indexOfProperty("prop1") != -1); + QVERIFY(mo->indexOfProperty("complexProp") != -1); } void tst_QDBusInterface::callMethod() @@ -322,6 +358,68 @@ void tst_QDBusInterface::signal() } } +void tst_QDBusInterface::propertyRead() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), + TEST_INTERFACE_NAME); + + int arg = obj.m_prop1 = 42; + MyObject::callCount = 0; + + QVariant v = iface.property("prop1"); + QVERIFY(v.isValid()); + QCOMPARE(v.userType(), int(QVariant::Int)); + QCOMPARE(v.toInt(), arg); + QCOMPARE(MyObject::callCount, 1); +} + +void tst_QDBusInterface::propertyWrite() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), + TEST_INTERFACE_NAME); + + int arg = 42; + obj.m_prop1 = 0; + MyObject::callCount = 0; + + QVERIFY(iface.setProperty("prop1", arg)); + QCOMPARE(MyObject::callCount, 1); + QCOMPARE(obj.m_prop1, arg); +} + +void tst_QDBusInterface::complexPropertyRead() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), + TEST_INTERFACE_NAME); + + QList arg = obj.m_complexProp = QList() << 42 << -47; + MyObject::callCount = 0; + + QVariant v = iface.property("complexProp"); + QVERIFY(v.isValid()); + QCOMPARE(v.userType(), qMetaTypeId >()); + QCOMPARE(v.value >(), arg); + QCOMPARE(MyObject::callCount, 1); +} + +void tst_QDBusInterface::complexPropertyWrite() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), + TEST_INTERFACE_NAME); + + QList arg = QList() << -47 << 42; + obj.m_complexProp.clear(); + MyObject::callCount = 0; + + QVERIFY(iface.setProperty("complexProp", qVariantFromValue(arg))); + QCOMPARE(MyObject::callCount, 1); + QCOMPARE(obj.m_complexProp, arg); +} + QTEST_MAIN(tst_QDBusInterface) #include "tst_qdbusinterface.moc" -- cgit v0.12 From 962b7fde5194a08a83609b9b4367425e52f76614 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 1 Jul 2009 17:44:56 +0200 Subject: Improve the code a bit more by using the variant that QMetaProperty creates. This works for the case of complex types that have to be demarshalled. We don't need to instantiate a new type because QMetaProperty has already done that for us. Also, fix the handling of properties of type variant. I have verified as well that the sending of those properties on the wire use a double-variant encoding (i.e., a variant containing a variant containing some data, the same that Qt 4.5 uses). It's a bit pedantic and it's hard to use when reading stuff, because you get a QVariant containing a QDBusVariant which contains data, but I can't change this anymore. Reviewed-By: Marius Bugge Monsen --- src/dbus/qdbusabstractinterface.cpp | 70 +++++++++++++++---------------------- src/dbus/qdbusabstractinterface_p.h | 2 +- 2 files changed, 29 insertions(+), 43 deletions(-) diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 9bef2dd..7c520df 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -110,21 +110,17 @@ bool QDBusAbstractInterfacePrivate::canMakeCalls() const return true; } -QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const +void QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, QVariant &where) const { - if (!isValid || !canMakeCalls()) // can't make calls - return QVariant(); + if (!isValid || !canMakeCalls()) { // can't make calls + where.clear(); + return; + } // is this metatype registered? - int mid; - const char *expectedSignature; - if (mp.type() == QVariant::LastType) { - // We're asking to read a QVariant - mid = qMetaTypeId(); - expectedSignature = "v"; - } else { - mid = QMetaType::type(mp.typeName()); - expectedSignature = QDBusMetaType::typeToSignature(mid); + const char *expectedSignature = ""; + if (mp.type() != 0xff) { + expectedSignature = QDBusMetaType::typeToSignature(where.userType()); if (expectedSignature == 0) { qWarning("QDBusAbstractInterface: type %s must be registered with QtDBus before it can be " "used to read property %s.%s", @@ -132,7 +128,8 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const lastError = QDBusError(QDBusError::Failed, QString::fromLatin1("Unregistered type %1 cannot be handled") .arg(QLatin1String(mp.typeName()))); - return QVariant(); + where.clear(); + return; } } @@ -146,21 +143,27 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const if (reply.type() != QDBusMessage::ReplyMessage) { lastError = reply; - return QVariant(); + where.clear(); + return; } if (reply.signature() != QLatin1String("v")) { QString errmsg = QLatin1String("Invalid signature `%1' in return from call to " DBUS_INTERFACE_PROPERTIES); lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature())); - return QVariant(); + where.clear(); + return; } QByteArray foundSignature; const char *foundType = 0; QVariant value = qvariant_cast(reply.arguments().at(0)).variant(); - if (value.userType() == mid) - return value; // simple match + if (value.userType() == where.userType() || mp.type() == 0xff + || (expectedSignature[0] == 'v' && expectedSignature[1] == '\0')) { + // simple match + where = value; + return; + } if (value.userType() == qMetaTypeId()) { QDBusArgument arg = qvariant_cast(value); @@ -168,14 +171,9 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const foundType = "user type"; foundSignature = arg.currentSignature().toLatin1(); if (foundSignature == expectedSignature) { - void *null = 0; - QVariant result(mid, null); - QDBusMetaType::demarshall(arg, mid, result.data()); - - if (mp.type() == QVariant::LastType) - // special case: QVariant - return qvariant_cast(result).variant(); - return result; + // signatures match, we can demarshall + QDBusMetaType::demarshall(arg, where.userType(), where.data()); + return; } } else { foundType = value.typeName(); @@ -192,7 +190,8 @@ QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const QString::fromUtf8(mp.name()), QString::fromLatin1(mp.typeName()), QString::fromLatin1(expectedSignature))); - return QVariant(); + where.clear(); + return; } bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value) @@ -246,7 +245,7 @@ int QDBusAbstractInterfaceBase::qt_metacall(QMetaObject::Call _c, int _id, void if (_c == QMetaObject::WriteProperty) { status = d_func()->setProperty(mp, variant) ? 1 : 0; } else { - variant = d_func()->property(mp); + d_func()->property(mp, variant); status = variant.isValid() ? 1 : 0; } _id = -1; @@ -576,11 +575,7 @@ QVariant QDBusAbstractInterface::internalPropGet(const char *propname) const // assume this property exists and is readable // we're only called from generated code anyways - int idx = metaObject()->indexOfProperty(propname); - if (idx != -1) - return d_func()->property(metaObject()->property(idx)); - qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname); - return QVariant(); // error + return property(propname); } /*! @@ -589,16 +584,7 @@ QVariant QDBusAbstractInterface::internalPropGet(const char *propname) const */ void QDBusAbstractInterface::internalPropSet(const char *propname, const QVariant &value) { - Q_D(QDBusAbstractInterface); - - // assume this property exists and is writeable - // we're only called from generated code anyways - - int idx = metaObject()->indexOfProperty(propname); - if (idx != -1) - d->setProperty(metaObject()->property(idx), value); - else - qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname); + setProperty(propname, value); } /*! diff --git a/src/dbus/qdbusabstractinterface_p.h b/src/dbus/qdbusabstractinterface_p.h index e577898..65df902 100644 --- a/src/dbus/qdbusabstractinterface_p.h +++ b/src/dbus/qdbusabstractinterface_p.h @@ -86,7 +86,7 @@ public: bool canMakeCalls() const; // these functions do not check if the property is valid - QVariant property(const QMetaProperty &mp) const; + void property(const QMetaProperty &mp, QVariant &where) const; bool setProperty(const QMetaProperty &mp, const QVariant &value); // return conn's d pointer -- cgit v0.12 From 43a760280edd49382d01eb1e23ae2a08933b6bf7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 1 Jul 2009 17:45:17 +0200 Subject: Autotest: add tests for checking variant properties --- .../com.trolltech.QtDBus.Pinger.xml | 1 + tests/auto/qdbusabstractinterface/interface.h | 4 ++ tests/auto/qdbusabstractinterface/pinger.h | 10 ++++- .../tst_qdbusabstractinterface.cpp | 47 ++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml b/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml index 8909675..fb2aab8 100644 --- a/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml +++ b/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml @@ -2,6 +2,7 @@ + diff --git a/tests/auto/qdbusabstractinterface/interface.h b/tests/auto/qdbusabstractinterface/interface.h index 86e0dc4..f6d34a7 100644 --- a/tests/auto/qdbusabstractinterface/interface.h +++ b/tests/auto/qdbusabstractinterface/interface.h @@ -80,10 +80,12 @@ class Interface: public QObject Q_OBJECT Q_CLASSINFO("D-Bus Interface", "com.trolltech.QtDBus.Pinger") Q_PROPERTY(QString stringProp READ stringProp WRITE setStringProp SCRIPTABLE true) + Q_PROPERTY(QDBusVariant variantProp READ variantProp WRITE setVariantProp SCRIPTABLE true) Q_PROPERTY(RegisteredType complexProp READ complexProp WRITE setComplexProp SCRIPTABLE true) friend class tst_QDBusAbstractInterface; QString m_stringProp; + QDBusVariant m_variantProp; RegisteredType m_complexProp; public: @@ -91,6 +93,8 @@ public: QString stringProp() const { return m_stringProp; } void setStringProp(const QString &s) { m_stringProp = s; } + QDBusVariant variantProp() const { return m_variantProp; } + void setVariantProp(const QDBusVariant &v) { m_variantProp = v; } RegisteredType complexProp() const { return m_complexProp; } void setComplexProp(const RegisteredType &r) { m_complexProp = r; } diff --git a/tests/auto/qdbusabstractinterface/pinger.h b/tests/auto/qdbusabstractinterface/pinger.h index 3ff218c..6e92e65 100644 --- a/tests/auto/qdbusabstractinterface/pinger.h +++ b/tests/auto/qdbusabstractinterface/pinger.h @@ -49,8 +49,8 @@ * Do not edit! All changes made to it will be lost. */ -#ifndef PINGER_H_1246371899 -#define PINGER_H_1246371899 +#ifndef PINGER_H_1246460303 +#define PINGER_H_1246460303 #include #include @@ -89,6 +89,12 @@ public: inline void setStringProp(const QString &value) { internalPropSet("stringProp", qVariantFromValue(value)); } + Q_PROPERTY(QDBusVariant variantProp READ variantProp WRITE setVariantProp) + inline QDBusVariant variantProp() const + { return qvariant_cast< QDBusVariant >(internalPropGet("variantProp")); } + inline void setVariantProp(const QDBusVariant &value) + { internalPropSet("variantProp", qVariantFromValue(value)); } + public Q_SLOTS: // METHODS inline QDBusPendingReply complexMethod() { diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 4aee089..fa5e332 100644 --- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -84,11 +84,15 @@ private slots: void stringPropRead(); void stringPropWrite(); + void variantPropRead(); + void variantPropWrite(); void complexPropRead(); void complexPropWrite(); void stringPropDirectRead(); void stringPropDirectWrite(); + void variantPropDirectRead(); + void variantPropDirectWrite(); void complexPropDirectRead(); void complexPropDirectWrite(); @@ -242,6 +246,29 @@ void tst_QDBusAbstractInterface::stringPropWrite() QCOMPARE(targetObj.m_stringProp, expectedValue); } +void tst_QDBusAbstractInterface::variantPropRead() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusVariant expectedValue = targetObj.m_variantProp = QDBusVariant(QVariant(42)); + QVariant v = p->property("variantProp"); + QVERIFY(v.isValid()); + QDBusVariant value = v.value(); + QCOMPARE(value.variant().userType(), expectedValue.variant().userType()); + QCOMPARE(value.variant(), expectedValue.variant()); +} + +void tst_QDBusAbstractInterface::variantPropWrite() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusVariant expectedValue = QDBusVariant(Q_INT64_C(-47)); + QVERIFY(p->setProperty("variantProp", qVariantFromValue(expectedValue))); + QCOMPARE(targetObj.m_variantProp.variant(), expectedValue.variant()); +} + void tst_QDBusAbstractInterface::complexPropRead() { Pinger p = getPinger(); @@ -282,6 +309,26 @@ void tst_QDBusAbstractInterface::stringPropDirectWrite() QCOMPARE(targetObj.m_stringProp, expectedValue); } +void tst_QDBusAbstractInterface::variantPropDirectRead() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusVariant expectedValue = targetObj.m_variantProp = QDBusVariant(42); + QCOMPARE(p->variantProp().variant(), expectedValue.variant()); +} + +void tst_QDBusAbstractInterface::variantPropDirectWrite() +{ + Pinger p = getPinger(); + QVERIFY2(p, "Not connected to D-Bus"); + + QDBusVariant expectedValue = QDBusVariant(Q_INT64_C(-47)); + p->setVariantProp(expectedValue); + QCOMPARE(targetObj.m_variantProp.variant().userType(), expectedValue.variant().userType()); + QCOMPARE(targetObj.m_variantProp.variant(), expectedValue.variant()); +} + void tst_QDBusAbstractInterface::complexPropDirectRead() { Pinger p = getPinger(); -- cgit v0.12 From 232f7af78d152518ccdcaaf1f42f89abb048ae5f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 1 Jul 2009 17:52:48 +0200 Subject: Replace internalPropGet and internalPropSet with the QObject versions in QDBusAbstractInterface. They're now good enough and as fast. Reviewed-By: Marius Bugge Monsen --- tests/auto/qdbusabstractinterface/pinger.h | 16 ++++++++-------- tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp | 11 ++++------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/tests/auto/qdbusabstractinterface/pinger.h b/tests/auto/qdbusabstractinterface/pinger.h index 6e92e65..fb8adda 100644 --- a/tests/auto/qdbusabstractinterface/pinger.h +++ b/tests/auto/qdbusabstractinterface/pinger.h @@ -49,8 +49,8 @@ * Do not edit! All changes made to it will be lost. */ -#ifndef PINGER_H_1246460303 -#define PINGER_H_1246460303 +#ifndef PINGER_H_1246463415 +#define PINGER_H_1246463415 #include #include @@ -79,21 +79,21 @@ public: Q_PROPERTY(RegisteredType complexProp READ complexProp WRITE setComplexProp) inline RegisteredType complexProp() const - { return qvariant_cast< RegisteredType >(internalPropGet("complexProp")); } + { return qvariant_cast< RegisteredType >(property("complexProp")); } inline void setComplexProp(RegisteredType value) - { internalPropSet("complexProp", qVariantFromValue(value)); } + { setProperty("complexProp", qVariantFromValue(value)); } Q_PROPERTY(QString stringProp READ stringProp WRITE setStringProp) inline QString stringProp() const - { return qvariant_cast< QString >(internalPropGet("stringProp")); } + { return qvariant_cast< QString >(property("stringProp")); } inline void setStringProp(const QString &value) - { internalPropSet("stringProp", qVariantFromValue(value)); } + { setProperty("stringProp", qVariantFromValue(value)); } Q_PROPERTY(QDBusVariant variantProp READ variantProp WRITE setVariantProp) inline QDBusVariant variantProp() const - { return qvariant_cast< QDBusVariant >(internalPropGet("variantProp")); } + { return qvariant_cast< QDBusVariant >(property("variantProp")); } inline void setVariantProp(const QDBusVariant &value) - { internalPropSet("variantProp", qVariantFromValue(value)); } + { setProperty("variantProp", qVariantFromValue(value)); } public Q_SLOTS: // METHODS inline QDBusPendingReply complexMethod() diff --git a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp index 5d1ac32..b8b9338 100644 --- a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -613,18 +613,15 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf // getter: if (property.access != QDBusIntrospection::Property::Write) { - hs << " inline " << type << " " << getter << "() const" << endl; - if (type != "QVariant") - hs << " { return qvariant_cast< " << type << " >(internalPropGet(\"" - << property.name << "\")); }" << endl; - else - hs << " { return internalPropGet(\"" << property.name << "\"); }" << endl; + hs << " inline " << type << " " << getter << "() const" << endl + << " { return qvariant_cast< " << type << " >(property(\"" + << property.name << "\")); }" << endl; } // setter: if (property.access != QDBusIntrospection::Property::Read) { hs << " inline void " << setter << "(" << constRefArg(type) << "value)" << endl - << " { internalPropSet(\"" << property.name + << " { setProperty(\"" << property.name << "\", qVariantFromValue(value)); }" << endl; } -- cgit v0.12 From 200286b8e83918e785b61e4695443a3b77ebeaea Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 1 Jul 2009 18:24:56 +0200 Subject: Implement a support for getting return arguments out of invokeMethod with QDBusInterface. The problem was that I didn't know how to implement the operator= for all types. But it turns out that this was possible all along: the only types I have to implement the operator= for are the basic types, which are already demarshalled. The complex types are left in QDBusArgument semi-demarshalling, but we have QDBusMetaType::demarshall, which takes a void* to an already-constructed type and demarshalls into it. That's exactly what the doctor ordered. Task-number: 206765 Reviewed-By: Marius Bugge Monsen --- src/dbus/qdbusinterface.cpp | 126 +++++++++++++++++++++-- tests/auto/qdbusinterface/tst_qdbusinterface.cpp | 92 ++++++++++++++++- 2 files changed, 209 insertions(+), 9 deletions(-) diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp index 6f61847..5f6df0a 100644 --- a/src/dbus/qdbusinterface.cpp +++ b/src/dbus/qdbusinterface.cpp @@ -51,6 +51,102 @@ QT_BEGIN_NAMESPACE +static void copyArgument(void *to, int id, const QVariant &arg) +{ + if (id == arg.userType()) { + switch (id) { + case QVariant::Bool: + *reinterpret_cast(to) = arg.toBool(); + return; + + case QMetaType::UChar: + *reinterpret_cast(to) = arg.value(); + return; + + case QMetaType::Short: + *reinterpret_cast(to) = arg.value(); + return; + + case QMetaType::UShort: + *reinterpret_cast(to) = arg.value(); + return; + + case QVariant::Int: + *reinterpret_cast(to) = arg.toInt(); + return; + + case QVariant::UInt: + *reinterpret_cast(to) = arg.toUInt(); + return; + + case QVariant::LongLong: + *reinterpret_cast(to) = arg.toLongLong(); + return; + + case QVariant::ULongLong: + *reinterpret_cast(to) = arg.toULongLong(); + return; + + case QVariant::Double: + *reinterpret_cast(to) = arg.toDouble(); + return; + + case QVariant::String: + *reinterpret_cast(to) = arg.toString(); + return; + + case QVariant::ByteArray: + *reinterpret_cast(to) = arg.toByteArray(); + return; + + case QVariant::StringList: + *reinterpret_cast(to) = arg.toStringList(); + return; + } + + if (id == QDBusMetaTypeId::variant) { + *reinterpret_cast(to) = arg.value(); + return; + } else if (id == QDBusMetaTypeId::objectpath) { + *reinterpret_cast(to) = arg.value(); + return; + } else if (id == QDBusMetaTypeId::signature) { + *reinterpret_cast(to) = arg.value(); + return; + } + + // those above are the only types possible + // the demarshaller code doesn't demarshall anything else + qFatal("Found a decoded basic type in a D-Bus reply that shouldn't be there"); + } + + // if we got here, it's either an un-dermarshalled type or a mismatch + if (arg.userType() != QDBusMetaTypeId::argument) { + // it's a mismatch + //qWarning? + return; + } + + // is this type registered? + const char *userSignature = QDBusMetaType::typeToSignature(id); + if (!userSignature || !*userSignature) { + // type not registered + //qWarning? + return; + } + + // is it the same signature? + QDBusArgument dbarg = arg.value(); + if (dbarg.currentSignature() != QLatin1String(userSignature)) { + // not the same signature, another mismatch + //qWarning? + return; + } + + // we can demarshall + QDBusMetaType::demarshall(dbarg, id, to); +} + QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p, const QString &iface, const QDBusConnection &con) : QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(0) @@ -186,23 +282,37 @@ int QDBusInterfacePrivate::metacall(QMetaObject::Call c, int id, void **argv) // we will assume that the input arguments were passed correctly QVariantList args; - for (int i = 1; i <= inputTypesCount; ++i) + int i = 1; + for ( ; i <= inputTypesCount; ++i) args << QVariant(inputTypes[i], argv[i]); // make the call - QPointer qq = q; QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args); - args.clear(); - // we ignore return values + if (reply.type() == QDBusMessage::ReplyMessage) { + // attempt to demarshall the return values + args = reply.arguments(); + QVariantList::ConstIterator it = args.constBegin(); + const int *outputTypes = metaObject->outputTypesForMethod(id); + int outputTypesCount = *outputTypes++; + + if (*mm.typeName()) { + // this method has a return type + if (argv[0] && it != args.constEnd()) + copyArgument(argv[0], *outputTypes++, *it); - // access to "this" or to "q" below this point must check for "qq" - // we may have been deleted! + // skip this argument even if we didn't copy it + --outputTypesCount; + ++it; + } - if (!qq.isNull()) - lastError = reply; + for (int j = 0; j < outputTypesCount && it != args.constEnd(); ++i, ++j, ++it) { + copyArgument(argv[i], outputTypes[j], *it); + } + } // done + lastError = reply; return -1; } } diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp index 718ba18..60afe4e 100644 --- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp @@ -76,6 +76,12 @@ class MyObject: public QObject " \n" " \n" " \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" " \n" "") Q_PROPERTY(int prop1 READ prop1 WRITE setProp1) @@ -174,6 +180,9 @@ private slots: void introspect(); void callMethod(); void invokeMethod(); + void invokeMethodWithReturn(); + void invokeMethodWithMultiReturn(); + void invokeMethodWithComplexReturn(); void signal(); @@ -263,7 +272,7 @@ void tst_QDBusInterface::introspect() const QMetaObject *mo = iface.metaObject(); - QCOMPARE(mo->methodCount() - mo->methodOffset(), 3); + QCOMPARE(mo->methodCount() - mo->methodOffset(), 4); QVERIFY(mo->indexOfSignal(TEST_SIGNAL_NAME "(QString)") != -1); QCOMPARE(mo->propertyCount() - mo->propertyOffset(), 2); @@ -317,6 +326,87 @@ void tst_QDBusInterface::invokeMethod() QCOMPARE(dv.variant().toString(), QString("foo")); } +void tst_QDBusInterface::invokeMethodWithReturn() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), + TEST_INTERFACE_NAME); + + // make the call without a return type + MyObject::callCount = 0; + QDBusVariant arg("foo"); + QDBusVariant retArg; + QVERIFY(QMetaObject::invokeMethod(&iface, "ping", Q_RETURN_ARG(QDBusVariant, retArg), Q_ARG(QDBusVariant, arg))); + QCOMPARE(MyObject::callCount, 1); + + // verify what the callee received + QCOMPARE(MyObject::callArgs.count(), 1); + QVariant v = MyObject::callArgs.at(0); + QDBusVariant dv = qdbus_cast(v); + QCOMPARE(dv.variant().type(), QVariant::String); + QCOMPARE(dv.variant().toString(), arg.variant().toString()); + + // verify that we got the reply as expected + QCOMPARE(retArg.variant(), arg.variant()); +} + +void tst_QDBusInterface::invokeMethodWithMultiReturn() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), + TEST_INTERFACE_NAME); + + // make the call without a return type + MyObject::callCount = 0; + QDBusVariant arg("foo"), arg2("bar"); + QDBusVariant retArg, retArg2; + QVERIFY(QMetaObject::invokeMethod(&iface, "ping", + Q_RETURN_ARG(QDBusVariant, retArg), + Q_ARG(QDBusVariant, arg), + Q_ARG(QDBusVariant, arg2), + Q_ARG(QDBusVariant&, retArg2))); + QCOMPARE(MyObject::callCount, 1); + + // verify what the callee received + QCOMPARE(MyObject::callArgs.count(), 2); + QVariant v = MyObject::callArgs.at(0); + QDBusVariant dv = qdbus_cast(v); + QCOMPARE(dv.variant().type(), QVariant::String); + QCOMPARE(dv.variant().toString(), arg.variant().toString()); + + v = MyObject::callArgs.at(1); + dv = qdbus_cast(v); + QCOMPARE(dv.variant().type(), QVariant::String); + QCOMPARE(dv.variant().toString(), arg2.variant().toString()); + + // verify that we got the replies as expected + QCOMPARE(retArg.variant(), arg.variant()); + QCOMPARE(retArg2.variant(), arg2.variant()); +} + +void tst_QDBusInterface::invokeMethodWithComplexReturn() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/"), + TEST_INTERFACE_NAME); + + // make the call without a return type + MyObject::callCount = 0; + QList arg = QList() << 42 << -47; + QList retArg; + QVERIFY(QMetaObject::invokeMethod(&iface, "ping", Q_RETURN_ARG(QList, retArg), Q_ARG(QList, arg))); + QCOMPARE(MyObject::callCount, 1); + + // verify what the callee received + QCOMPARE(MyObject::callArgs.count(), 1); + QVariant v = MyObject::callArgs.at(0); + QCOMPARE(v.userType(), qMetaTypeId()); + QCOMPARE(qdbus_cast >(v), arg); + + // verify that we got the reply as expected + QCOMPARE(retArg, arg); +} + void tst_QDBusInterface::signal() { QDBusConnection con = QDBusConnection::sessionBus(); -- cgit v0.12 From 9a90dab23bd1bd37bd4a7aace588896d2ae7e9d9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jul 2009 10:53:23 +0200 Subject: add support for attaching meta data to translatable messages Requirement: QT-457 --- .../snippets/code/src_corelib_kernel_qobject.cpp | 9 ++++++ src/corelib/kernel/qobject.cpp | 28 +++++++++++++++++ .../lupdate/testdata/good/parsecpp/main.cpp | 19 ++++++++++++ .../testdata/good/parsecpp/project.ts.result | 21 +++++++++++++ tools/linguist/lupdate/cpp.cpp | 35 ++++++++++++++++++---- 5 files changed, 107 insertions(+), 5 deletions(-) diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp index 5a7c5a7..5c0f80c 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp @@ -376,6 +376,15 @@ hostNameLabel->setText(tr("Name:")); QString example = tr("Example"); //! [40] +//! [meta data] +//: This is a comment for the translator. +//= qtn_foo_bar +//~ loc-layout_id foo_dialog +//~ loc-blank False +//~ magic-stuff This might mean something magic. +QString text = MyMagicClass::tr("Sim sala bim."); +//! [meta data] + //! [explicit tr context] QString text = QScrollBar::tr("Page up"); //! [explicit tr context] diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 9dc25c7..9e87b3b 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2086,6 +2086,34 @@ void QObject::deleteLater() \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 17 + \section1 Meta Data + + Additional data can be attached to each translatable message. + The syntax: + + \tt{//= } + + can be used to give the message a unique identifier to support tools + which need it. + The syntax: + + \tt{//~ } + + can be used to attach meta data to the message. The field name should consist + of a domain prefix (possibly the conventional file extension of the file format + the field is inspired by), a hyphen and the actual field name in + underscore-delimited notation. For storage in TS files, the field name together + with the prefix "extra-" will form an XML element name. The field contents will + be XML-escaped, but otherwise appear verbatim as the element's contents. + Any number of unique fields can be added to each message. + + Example: + + \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp meta data + + Meta data appearing right in front of a magic TRANSLATOR comment applies to the + whole TS file. + \section1 Character Encodings You can set the encoding for \a sourceText by calling QTextCodec::setCodecForTr(). diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index df75baf..9fb43fe 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -156,3 +156,22 @@ QT_TRANSLATE_NOOP3_UTF8("scope", "string", "comment") // 4.4 doesn't see this QT_TRANSLATE_NOOP("scope", "string " // this is an interleaved comment "continuation on next line") + + +class TestingTake17 : QObject { + Q_OBJECT + + int function(void) + { + //: random comment + //= this_is_an_id + //~ loc-layout_id fooish_bar + //~ po-ignore_me totally foo-barred nonsense + tr("something cool"); + + tr("less cool"); + + //= another_id + tr("even more cool"); + } +}; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 9386c19..5bd7525 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -239,6 +239,27 @@ + TestingTake17 + + + something cool + random comment + + totally foo-barred nonsense + fooish_bar + + + + less cool + + + + + even more cool + + + + scope diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 09148e7..b1d2d01 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -180,7 +180,8 @@ private: QString transcode(const QString &str, bool utf8); void recordMessage( int line, const QString &context, const QString &text, const QString &comment, - const QString &extracomment, bool utf8, bool plural); + const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, + bool utf8, bool plural); void processInclude(const QString &file, ConversionData &cd, QSet &inclusions); @@ -1299,13 +1300,16 @@ QString CppParser::transcode(const QString &str, bool utf8) void CppParser::recordMessage( int line, const QString &context, const QString &text, const QString &comment, - const QString &extracomment, bool utf8, bool plural) + const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, + bool utf8, bool plural) { TranslatorMessage msg( transcode(context, utf8), transcode(text, utf8), transcode(comment, utf8), QString(), yyFileName, line, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(transcode(extracomment.simplified(), utf8)); + msg.setId(msgid); + msg.setExtras(extra); if ((utf8 || yyForceUtf8) && !yyCodecIsUtf8 && msg.needs8Bit()) msg.setUtf8(true); results->tor->append(msg); @@ -1332,6 +1336,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) QString text; QString comment; QString extracomment; + QString msgid; + TranslatorMessage::ExtraData extra; QString prefix; #ifdef DIAGNOSE_RETRANSLATABILITY QString functionName; @@ -1604,9 +1610,11 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) prefix.clear(); } - recordMessage(line, context, text, comment, extracomment, utf8, plural); + recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural); } extracomment.clear(); + msgid.clear(); + extra.clear(); break; case Tok_translateUtf8: case Tok_translate: @@ -1655,9 +1663,11 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) break; } } - recordMessage(line, context, text, comment, extracomment, utf8, plural); + recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural); } extracomment.clear(); + msgid.clear(); + extra.clear(); break; case Tok_Q_DECLARE_TR_FUNCTIONS: case Tok_Q_OBJECT: @@ -1679,6 +1689,15 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) if (yyComment.startsWith(QLatin1Char(':'))) { yyComment.remove(0, 1); extracomment.append(yyComment); + } else if (yyComment.startsWith(QLatin1Char('='))) { + yyComment.remove(0, 1); + msgid = yyComment.simplified(); + } else if (yyComment.startsWith(QLatin1Char('~'))) { + yyComment.remove(0, 1); + yyComment = yyComment.trimmed(); + int k = yyComment.indexOf(QLatin1Char(' ')); + if (k > -1) + extra.insert(yyComment.left(k), yyComment.mid(k + 1).trimmed()); } else { comment = yyComment.simplified(); if (comment.startsWith(QLatin1String(MagicComment))) { @@ -1689,7 +1708,11 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) } else { context = comment.left(k); comment.remove(0, k + 1); - recordMessage(yyLineNo, context, QString(), comment, extracomment, false, false); + recordMessage(yyLineNo, context, QString(), comment, extracomment, + QString(), TranslatorMessage::ExtraData(), false, false); + extracomment.clear(); + results->tor->setExtras(extra); + extra.clear(); } } } @@ -1739,6 +1762,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) prospectiveContext.clear(); prefix.clear(); extracomment.clear(); + msgid.clear(); + extra.clear(); yyTokColonSeen = false; yyTok = getToken(); break; -- cgit v0.12 From ebfdbff7712e230c19fc2a990632038e3fc79ef2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 13:27:21 +0200 Subject: Doc: indicate that these methods are added in 4.6 --- src/dbus/qdbuspendingcall.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp index 7807543..0ec1a26 100644 --- a/src/dbus/qdbuspendingcall.cpp +++ b/src/dbus/qdbuspendingcall.cpp @@ -410,6 +410,7 @@ bool QDBusPendingCall::setReplyCallback(QObject *target, const char *member) #endif /*! + \since 4.6 Creates a QDBusPendingCall object based on the error condition \a error. The resulting pending call object will be in the "finished" state and QDBusPendingReply::isError() will return true. @@ -422,6 +423,7 @@ QDBusPendingCall QDBusPendingCall::fromError(const QDBusError &error) } /*! + \since 4.6 Creates a QDBusPendingCall object based on the message \a msg. The message must be of type QDBusMessage::ErrorMessage or QDBusMessage::ReplyMessage (that is, a message that is typical -- cgit v0.12 From bd3c9e428af5a804fd4631c941fb642c99f6430b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 13:28:17 +0200 Subject: Add a note about this method not being safe in multithreaded contexts --- src/dbus/qdbusconnection.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 6777aa5..14cadd9 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -973,8 +973,15 @@ QDBusConnection QDBusConnection::systemBus() } /*! + \nonreentrant + Returns the connection that sent the signal, if called in a slot activated by QDBus; otherwise it returns 0. + + \note Please avoid this function. This function is not thread-safe, so if + there's any other thread delivering a D-Bus call, this function may return + the wrong connection. In new code, please use QDBusContext::connection() + (see that class for a description on how to use it). */ QDBusConnection QDBusConnection::sender() { -- cgit v0.12 From c5f83fbd89d6bb950fb012c285879f6c88b5bdf3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Apr 2009 16:47:12 +0200 Subject: Add qcore_unix_p.h containing mostly safe versions of Unix functions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most of these functions are from unistd.h and need to have a loop around the actual call because the calls can be interrupted by a signal delivery. Some special calls (open, dup2, pipe) require an extra flag to support thread-safe execution: the file descriptor must be created from the operating system with the FD_CLOEXEC flag already set. The O_CLOEXEC flag is specified in POSIX.1-2008, but the rest is Linux-specific. Reviewed-By: João Abecasis --- src/corelib/kernel/kernel.pri | 1 + src/corelib/kernel/qcore_unix_p.h | 246 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 247 insertions(+) create mode 100644 src/corelib/kernel/qcore_unix_p.h diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index ecef555..6f28029 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -92,6 +92,7 @@ unix { kernel/qsharedmemory_unix.cpp \ kernel/qsystemsemaphore_unix.cpp HEADERS += \ + kernel/qcore_unix_p.h \ kernel/qcrashhandler_p.h contains(QT_CONFIG, glib) { diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h new file mode 100644 index 0000000..4e3158a --- /dev/null +++ b/src/corelib/kernel/qcore_unix_p.h @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCORE_UNIX_P_H +#define QCORE_UNIX_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt code on Unix. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qplatformdefs.h" + +#ifndef Q_OS_UNIX +# error "qcore_unix_p.h included on a non-Unix system" +#endif + +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0209 +# define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 1 +#else +# define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 0 +#endif + +#define EINTR_LOOP(var, cmd) \ + do { \ + var = cmd; \ + } while (var == -1 && errno == EINTR) + + +// don't call QT_OPEN or ::open +// call qt_safe_open +static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 0777) +{ +#ifdef O_CLOEXEC + flags |= O_CLOEXEC; +#endif + register int fd; + EINTR_LOOP(fd, QT_OPEN(pathname, flags, mode)); + + // unknown flags are ignored, so we have no way of verifying if + // O_CLOEXEC was accepted + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + return fd; +} +#undef QT_OPEN +#define QT_OPEN qt_safe_open + +// don't call ::pipe +// call qt_safe_pipe +static inline int qt_safe_pipe(int pipefd[2], int flags = 0) +{ +#ifdef O_CLOEXEC + Q_ASSERT((flags & ~(O_CLOEXEC | O_NONBLOCK)) == 0); +#else + Q_ASSERT((flags & ~O_NONBLOCK) == 0); +#endif + + register int ret; +#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC + // use pipe2 + flags |= O_CLOEXEC; + ret = ::pipe2(pipefd, flags); // pipe2 is Linux-specific and is documented not to return EINTR + if (ret == 0 || errno != ENOSYS) + return ret; +#endif + + ret = ::pipe(pipefd); + if (ret == -1) + return -1; + + ::fcntl(pipefd[0], F_SETFD, FD_CLOEXEC); + ::fcntl(pipefd[1], F_SETFD, FD_CLOEXEC); + + // set non-block too? + if (flags & O_NONBLOCK) { + ::fcntl(pipefd[0], F_SETFL, ::fcntl(pipefd[0], F_GETFL) | O_NONBLOCK); + ::fcntl(pipefd[1], F_SETFL, ::fcntl(pipefd[1], F_GETFL) | O_NONBLOCK); + } + + return 0; +} + +// don't call dup or fcntl(F_DUPFD) +static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC) +{ + Q_ASSERT(flags == FD_CLOEXEC || flags == 0); + + register int ret; +#ifdef F_DUPFD_CLOEXEC + // use this fcntl + if (flags & FD_CLOEXEC) { + ret = ::fcntl(oldfd, F_DUPFD_CLOEXEC, atleast); + if (ret != -1 || errno != EINVAL) + return ret; + } +#endif + + // use F_DUPFD + ret = ::fcntl(oldfd, F_DUPFD, atleast); + + if (flags && ret != -1) + ::fcntl(ret, F_SETFD, flags); + return ret; +} + +// don't call dup2 +// call qt_safe_dup2 +static inline int qt_safe_dup2(int oldfd, int newfd, int flags = FD_CLOEXEC) +{ + Q_ASSERT(flags == FD_CLOEXEC || flags == 0); + + register int ret; +#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC + // use dup3 + if (flags & FD_CLOEXEC) { + EINTR_LOOP(ret, ::dup3(oldfd, newfd, O_CLOEXEC)); + if (ret == 0 || errno != ENOSYS) + return ret; + } +#endif + EINTR_LOOP(ret, ::dup2(oldfd, newfd)); + if (ret == -1) + return -1; + + if (flags) + ::fcntl(newfd, F_SETFD, flags); + return 0; +} + +static inline qint64 qt_safe_read(int fd, char *data, qint64 maxlen) +{ + qint64 ret = 0; + EINTR_LOOP(ret, QT_READ(fd, data, maxlen)); + return ret; +} +#undef QT_READ +#define QT_READ qt_safe_read + +static inline qint64 qt_safe_write(int fd, const char *data, qint64 len) +{ + qint64 ret = 0; + EINTR_LOOP(ret, QT_WRITE(fd, data, len)); + return ret; +} +#undef QT_WRITE +#define QT_WRITE qt_safe_write + +static inline int qt_safe_close(int fd) +{ + register int ret; + EINTR_LOOP(ret, QT_CLOSE(fd)); + return ret; +} +#undef QT_CLOSE +#define QT_CLOSE qt_safe_close + +static inline int qt_safe_execve(const char *filename, char *const argv[], + char *const envp[]) +{ + register int ret; + EINTR_LOOP(ret, ::execve(filename, argv, envp)); + return ret; +} + +static inline int qt_safe_execv(const char *path, char *const argv[]) +{ + register int ret; + EINTR_LOOP(ret, ::execv(path, argv)); + return ret; +} + +static inline int qt_safe_execvp(const char *file, char *const argv[]) +{ + register int ret; + EINTR_LOOP(ret, ::execvp(file, argv)); + return ret; +} + +static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) +{ + register int ret; + EINTR_LOOP(ret, ::waitpid(pid, status, options)); + return ret; +} + +Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, + const struct timeval *tv); + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 29302d2429ed81f4396155383b602e7bde4edd3b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Apr 2009 17:30:51 +0200 Subject: Port most uses of ::open and QT_OPEN to the safe version. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures that we're calling the open64 version of this function as well as handling the O_CLOEXEC flag and EINTR errors. Reviewed-By: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 5 +++-- src/corelib/io/qfsfileengine_unix.cpp | 18 +++++++----------- src/corelib/io/qresource.cpp | 4 ++++ src/corelib/io/qtemporaryfile.cpp | 17 ++++++----------- src/corelib/kernel/qsharedmemory_unix.cpp | 4 +++- src/corelib/kernel/qtranslator.cpp | 1 + 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index ed42c34..721f52c 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -43,6 +43,7 @@ #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_kqueue_p.h" +#include "qcore_unix_p.h" #include #include @@ -124,9 +125,9 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths, QString path = it.next(); int fd; #if defined(O_EVTONLY) - fd = ::open(QFile::encodeName(path), O_EVTONLY); + fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY); #else - fd = ::open(QFile::encodeName(path), O_RDONLY); + fd = qt_safe_open(QFile::encodeName(path), O_RDONLY); #endif if (fd == -1) { perror("QKqueueFileSystemWatcherEngine::addPaths: open"); diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 4743a47..5708e9f 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -42,6 +42,7 @@ #include "qplatformdefs.h" #include "qabstractfileengine.h" #include "private/qfsfileengine_p.h" +#include "private/qcore_unix_p.h" #ifndef QT_NO_FSFILEENGINE @@ -90,6 +91,12 @@ static QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QString & if (flags & QIODevice::ReadOnly) mode += '+'; } + +#if defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0207 + // must be glibc >= 2.7 + mode += 'e'; +#endif + return mode; } @@ -118,12 +125,6 @@ static int openModeToOpenFlags(QIODevice::OpenMode mode) oflags |= QT_OPEN_TRUNC; } -#ifdef O_CLOEXEC - // supported on Linux >= 2.6.23; avoids one extra system call - // and avoids a race condition: if another thread forks, we could - // end up leaking a file descriptor... - oflags |= O_CLOEXEC; -#endif return oflags; } @@ -177,11 +178,6 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) } } -#ifndef O_CLOEXEC - // not needed on Linux >= 2.6.23 - setCloseOnExec(fd); // ignore failure -#endif - // Seek to the end when in Append mode. if (flags & QFile::Append) { int ret; diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index fe8764d..a70b92f 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -56,6 +56,10 @@ #include #include "private/qabstractfileengine_p.h" +#ifdef Q_OS_UNIX +# include "private/qcore_unix_p.h" +#endif + //#define DEBUG_RESOURCE_MATCH QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 62ab0c4..2ae4611 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -60,6 +60,10 @@ #include #include +#if defined(Q_OS_UNIX) +# include "private/qcore_unix_p.h" +#endif + #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) # include # if defined(_MSC_VER) && _MSC_VER >= 1400 @@ -72,7 +76,6 @@ # include "qfunctions_wince.h" #endif - QT_BEGIN_NAMESPACE /* @@ -208,8 +211,9 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen) if ((*doopen = QT_OPEN(targetPath.toLocal8Bit(), O_CREAT|O_EXCL|O_RDWR # else // CE + // this is Unix if ((*doopen = - open(path, QT_OPEN_CREAT|O_EXCL|QT_OPEN_RDWR + qt_safe_open(path, QT_OPEN_CREAT|O_EXCL|QT_OPEN_RDWR # endif # ifdef QT_LARGEFILE_SUPPORT |QT_OPEN_LARGEFILE @@ -219,18 +223,9 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen) # elif defined(Q_OS_WIN) |O_BINARY # endif -# ifdef O_CLOEXEC - // supported on Linux >= 2.6.23; avoids one extra system call - // and avoids a race condition: if another thread forks, we could - // end up leaking a file descriptor... - |O_CLOEXEC -# endif , 0600)) >= 0) #endif // WIN && !CE { -#if defined(Q_OS_UNIX) && !defined(O_CLOEXEC) - fcntl(*doopen, F_SETFD, FD_CLOEXEC); -#endif return 1; } if (errno != EEXIST) diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 5299972..04739ff 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -59,6 +59,8 @@ #include #include +#include "private/qcore_unix_p.h" + QT_BEGIN_NAMESPACE QSharedMemoryPrivate::QSharedMemoryPrivate() @@ -153,7 +155,7 @@ int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName) if (QFile::exists(fileName)) return 0; - int fd = open(QFile::encodeName(fileName).constData(), + int fd = qt_safe_open(QFile::encodeName(fileName).constData(), O_EXCL | O_CREAT | O_RDWR, 0640); if (-1 == fd) { if (errno == EEXIST) diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 64cf16e..4aed2b2 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -58,6 +58,7 @@ #if defined(Q_OS_UNIX) #define QT_USE_MMAP +#include "private/qcore_unix_p.h" #endif // most of the headers below are already included in qplatformdefs.h -- cgit v0.12 From 557258e8f944f0003e9b71e5fe11fcb458db71d8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Apr 2009 18:01:05 +0200 Subject: Make the inotify_init call also use FD_CLOEXEC-safe version of the system call Reviewed-By: ossi --- src/corelib/io/qfilesystemwatcher_inotify.cpp | 40 +++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 401e545..9d08228 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -44,6 +44,8 @@ #ifndef QT_NO_FILESYSTEMWATCHER +#include "private/qcore_unix_p.h" + #include #include #include @@ -62,62 +64,80 @@ # define __NR_inotify_init 291 # define __NR_inotify_add_watch 292 # define __NR_inotify_rm_watch 293 +# define __NR_inotify_init1 332 #elif defined(__x86_64__) # define __NR_inotify_init 253 # define __NR_inotify_add_watch 254 # define __NR_inotify_rm_watch 255 +# define __NR_inotify_init1 294 #elif defined(__powerpc__) || defined(__powerpc64__) # define __NR_inotify_init 275 # define __NR_inotify_add_watch 276 # define __NR_inotify_rm_watch 277 +# define __NR_inotify_init1 318 #elif defined (__ia64__) # define __NR_inotify_init 1277 # define __NR_inotify_add_watch 1278 # define __NR_inotify_rm_watch 1279 +# define __NR_inotify_init1 1318 #elif defined (__s390__) || defined (__s390x__) # define __NR_inotify_init 284 # define __NR_inotify_add_watch 285 # define __NR_inotify_rm_watch 286 +# define __NR_inotify_init1 324 #elif defined (__alpha__) # define __NR_inotify_init 444 # define __NR_inotify_add_watch 445 # define __NR_inotify_rm_watch 446 +// no inotify_init1 for the Alpha #elif defined (__sparc__) || defined (__sparc64__) # define __NR_inotify_init 151 # define __NR_inotify_add_watch 152 # define __NR_inotify_rm_watch 156 +# define __NR_inotify_init1 322 #elif defined (__arm__) # define __NR_inotify_init 316 # define __NR_inotify_add_watch 317 # define __NR_inotify_rm_watch 318 +# define __NR_inotify_init1 360 #elif defined (__sh__) # define __NR_inotify_init 290 # define __NR_inotify_add_watch 291 # define __NR_inotify_rm_watch 292 +# define __NR_inotify_init1 332 #elif defined (__sh64__) # define __NR_inotify_init 318 # define __NR_inotify_add_watch 319 # define __NR_inotify_rm_watch 320 +# define __NR_inotify_init1 360 #elif defined (__mips__) # define __NR_inotify_init 284 # define __NR_inotify_add_watch 285 # define __NR_inotify_rm_watch 286 +# define __NR_inotify_init1 329 #elif defined (__hppa__) # define __NR_inotify_init 269 # define __NR_inotify_add_watch 270 # define __NR_inotify_rm_watch 271 +# define __NR_inotify_init1 314 #elif defined (__avr32__) # define __NR_inotify_init 240 # define __NR_inotify_add_watch 241 # define __NR_inotify_rm_watch 242 +// no inotify_init1 for AVR32 #elif defined (__mc68000__) # define __NR_inotify_init 284 # define __NR_inotify_add_watch 285 # define __NR_inotify_rm_watch 286 +# define __NR_inotify_init1 328 #else # error "This architecture is not supported. Please talk to qt-bugs@trolltech.com" #endif +#if !defined(IN_CLOEXEC) && defined(O_CLOEXEC) && defined(__NR_inotify_init1) +# define IN_CLOEXEC O_CLOEXEC +#endif + QT_BEGIN_NAMESPACE #ifdef QT_LINUXBASE @@ -140,6 +160,13 @@ static inline int inotify_rm_watch(int fd, __u32 wd) return syscall(__NR_inotify_rm_watch, fd, wd); } +#ifdef IN_CLOEXEC +static inline int inotify_init1(int flags) +{ + return syscall(__NR_inotify_init1, flags); +} +#endif + // the following struct and values are documented in linux/inotify.h extern "C" { @@ -185,9 +212,16 @@ QT_BEGIN_NAMESPACE QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create() { - int fd = inotify_init(); - if (fd <= 0) - return 0; + register int fd = -1; +#ifdef IN_CLOEXEC + fd = inotify_init1(IN_CLOEXEC); +#endif + if (fd == -1) { + fd = inotify_init(); + if (fd == -1) + return 0; + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } return new QInotifyFileSystemWatcherEngine(fd); } -- cgit v0.12 From 1d965e189dfd5c9977565ca0c20224806aa7473d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Apr 2009 19:02:32 +0200 Subject: Use the safe versions in these system calls I've just introduced. Reviewed-By: ossi --- src/corelib/io/qfilesystemwatcher_dnotify.cpp | 20 ++++++++++---------- src/corelib/io/qfsfileengine.cpp | 3 +++ src/corelib/io/qfsfileengine_unix.cpp | 2 +- src/corelib/kernel/qeventdispatcher_unix.cpp | 12 +++++++----- src/gui/painting/qpdf.cpp | 20 ++++++++++++-------- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index c68af85..6df3746 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -59,6 +59,8 @@ #include #include +#include "private/qcore_unix_p.h" + #ifdef QT_LINUXBASE /* LSB doesn't standardize these */ @@ -80,7 +82,7 @@ static void (*qfswd_old_sigio_handler)(int) = 0; static void (*qfswd_old_sigio_action)(int, siginfo_t *, void *) = 0; static void qfswd_sigio_monitor(int signum, siginfo_t *i, void *v) { - ::write(qfswd_fileChanged_pipe[1], &i->si_fd, sizeof(int)); + qt_safe_write(qfswd_fileChanged_pipe[1], reinterpret_cast(&i->si_fd), sizeof(int)); if (qfswd_old_sigio_handler && qfswd_old_sigio_handler != SIG_IGN) qfswd_old_sigio_handler(signum); @@ -121,9 +123,7 @@ QDnotifySignalThread::QDnotifySignalThread() { moveToThread(this); - ::pipe(qfswd_fileChanged_pipe); - ::fcntl(qfswd_fileChanged_pipe[0], F_SETFL, - ::fcntl(qfswd_fileChanged_pipe[0], F_GETFL) | O_NONBLOCK); + qt_safe_pipe(qfswd_fileChanged_pipe, O_NONBLOCK); struct sigaction oldAction; struct sigaction action; @@ -181,7 +181,7 @@ void QDnotifySignalThread::run() void QDnotifySignalThread::readFromDnotify() { int fd; - int readrv = ::read(qfswd_fileChanged_pipe[0], &fd,sizeof(int)); + int readrv = qt_safe_read(qfswd_fileChanged_pipe[0], reinterpret_cast(&fd), sizeof(int)); // Only expect EAGAIN or EINTR. Other errors are assumed to be impossible. if(readrv != -1) { Q_ASSERT(readrv == sizeof(int)); @@ -207,9 +207,9 @@ QDnotifyFileSystemWatcherEngine::~QDnotifyFileSystemWatcherEngine() for(QHash::ConstIterator iter = fdToDirectory.constBegin(); iter != fdToDirectory.constEnd(); ++iter) { - ::close(iter->fd); + qt_safe_close(iter->fd); if(iter->parentFd) - ::close(iter->parentFd); + qt_safe_close(iter->parentFd); } } @@ -353,7 +353,7 @@ QStringList QDnotifyFileSystemWatcherEngine::removePaths(const QStringList &path if(!directory.isMonitored && directory.files.isEmpty()) { // No longer needed - ::close(directory.fd); + qt_safe_close(directory.fd); pathToFD.remove(directory.path); fdToDirectory.remove(fd); } @@ -419,9 +419,9 @@ void QDnotifyFileSystemWatcherEngine::refresh(int fd) } if(!directory.isMonitored && directory.files.isEmpty()) { - ::close(directory.fd); + qt_safe_close(directory.fd); if(directory.parentFd) { - ::close(directory.parentFd); + qt_safe_close(directory.parentFd); parentToFD.remove(directory.parentFd); } fdToDirectory.erase(iter); diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index e32b818..beafe72 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -50,6 +50,9 @@ #if !defined(Q_OS_WINCE) #include #endif +#if defined(Q_OS_UNIX) +#include "private/qcore_unix_p.h" +#endif #include QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 5708e9f..47e3db0 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -458,7 +458,7 @@ bool QFSFileEngine::caseSensitive() const bool QFSFileEngine::setCurrentPath(const QString &path) { int r; - r = ::chdir(QFile::encodeName(path)); + r = QT_CHDIR(QFile::encodeName(path)); return r >= 0; } diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 161398e..0eeea04 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -49,6 +49,7 @@ #include "qeventdispatcher_unix_p.h" #include #include +#include #include #include @@ -76,6 +77,7 @@ static void signalHandler(int sig) } +#ifdef Q_OS_INTEGRITY static void initThreadPipeFD(int fd) { int ret = fcntl(fd, F_SETFD, FD_CLOEXEC); @@ -90,7 +92,7 @@ static void initThreadPipeFD(int fd) if (ret == -1) perror("QEventDispatcherUNIXPrivate: Unable to set flags on thread pipe"); } - +#endif QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() { @@ -102,13 +104,13 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() // INTEGRITY doesn't like a "select" on pipes, so use socketpair instead if (socketpair(AF_INET, SOCK_STREAM, PF_INET, thread_pipe) == -1) perror("QEventDispatcherUNIXPrivate(): Unable to create socket pair"); -#else - if (pipe(thread_pipe) == -1) - perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe"); -#endif initThreadPipeFD(thread_pipe[0]); initThreadPipeFD(thread_pipe[1]); +#else + if (qt_safe_pipe(thread_pipe, O_NONBLOCK) == -1) + perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe"); +#endif sn_highest = -1; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index a6ecd4e..178d519 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -48,6 +48,10 @@ #include "qprinterinfo.h" #include +#ifdef Q_OS_UNIX +#include "private/qcore_unix_p.h" // overrides QT_OPEN +#endif + QT_BEGIN_NAMESPACE extern int qt_defaultDpi(); @@ -1647,7 +1651,7 @@ static void closeAllOpenFds() #endif // leave stdin/out/err untouched while(--i > 2) - ::close(i); + QT_CLOSE(i); } #endif @@ -1681,7 +1685,7 @@ bool QPdfBaseEnginePrivate::openPrintDevice() if (!printerName.isEmpty()) pr = printerName; int fds[2]; - if (pipe(fds) != 0) { + if (qt_safe_pipe(fds) != 0) { qWarning("QPdfPrinter: Could not open pipe to print"); return false; } @@ -1700,9 +1704,9 @@ bool QPdfBaseEnginePrivate::openPrintDevice() (void)execlp("true", "true", (char *)0); (void)execl("/bin/true", "true", (char *)0); (void)execl("/usr/bin/true", "true", (char *)0); - ::exit(0); + ::_exit(0); } - dup2(fds[0], 0); + qt_safe_dup2(fds[0], 0, 0); closeAllOpenFds(); @@ -1769,14 +1773,14 @@ bool QPdfBaseEnginePrivate::openPrintDevice() // wait for a second so the parent process (the // child of the GUI process) has exited. then // exit. - ::close(0); + QT_CLOSE(0); (void)::sleep(1); - ::exit(0); + ::_exit(0); } // parent process - ::close(fds[0]); + QT_CLOSE(fds[0]); fd = fds[1]; - (void)::waitpid(pid, 0, 0); + (void)qt_safe_waitpid(pid, 0, 0); if (fd < 0) return false; -- cgit v0.12 From de05f9a40e41deb79daf5c4935b2645d70d7f322 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Apr 2009 19:04:32 +0200 Subject: Port QProcess to use the EINTR-safe and thread-safe functions Reviewed-By: ossi --- src/corelib/io/qprocess_unix.cpp | 213 ++++++++++++--------------------------- 1 file changed, 65 insertions(+), 148 deletions(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 49869a4..c81da44 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -84,6 +84,7 @@ QT_END_NAMESPACE #include "qprocess.h" #include "qprocess_p.h" +#include "private/qcore_unix_p.h" #ifdef Q_OS_MAC #include @@ -114,78 +115,11 @@ static inline char *strdup(const char *data) } #endif -static qint64 qt_native_read(int fd, char *data, qint64 maxlen) -{ - qint64 ret = 0; - do { - ret = ::read(fd, data, maxlen); - } while (ret == -1 && errno == EINTR); - return ret; -} - -static qint64 qt_native_write(int fd, const char *data, qint64 len) -{ - qint64 ret = 0; - do { - ret = ::write(fd, data, len); - } while (ret == -1 && errno == EINTR); - return ret; -} - -static void qt_native_close(int fd) -{ - int ret; - do { - ret = ::close(fd); - } while (ret == -1 && errno == EINTR); -} - -static void qt_native_dup2(int oldfd, int newfd) -{ - int ret; - do { - ret = ::dup2(oldfd, newfd); - } while (ret == -1 && errno == EINTR); -} - -static void qt_native_chdir(const char *path) -{ - int ret; - do { - ret = ::chdir(path); - } while (ret == -1 && errno == EINTR); -} - -static void qt_native_execve(const char *filename, char *const argv[], - char *const envp[]) -{ - int ret; - do { - ret = ::execve(filename, argv, envp); - } while (ret == -1 && errno == EINTR); -} - -static void qt_native_execv(const char *path, char *const argv[]) -{ - int ret; - do { - ret = ::execv(path, argv); - } while (ret == -1 && errno == EINTR); -} - -static void qt_native_execvp(const char *file, char *const argv[]) -{ - int ret; - do { - ret = ::execvp(file, argv); - } while (ret == -1 && errno == EINTR); -} - static int qt_qprocess_deadChild_pipe[2]; static void (*qt_sa_old_sigchld_handler)(int) = 0; static void qt_sa_sigchld_handler(int signum) { - qt_native_write(qt_qprocess_deadChild_pipe[1], "", 1); + qt_safe_write(qt_qprocess_deadChild_pipe[1], "", 1); #if defined (QPROCESS_DEBUG) fprintf(stderr, "*** SIGCHLD\n"); #endif @@ -231,13 +165,7 @@ QProcessManager::QProcessManager() // initialize the dead child pipe and make it non-blocking. in the // extremely unlikely event that the pipe fills up, we do not under any // circumstances want to block. - ::pipe(qt_qprocess_deadChild_pipe); - ::fcntl(qt_qprocess_deadChild_pipe[0], F_SETFD, FD_CLOEXEC); - ::fcntl(qt_qprocess_deadChild_pipe[1], F_SETFD, FD_CLOEXEC); - ::fcntl(qt_qprocess_deadChild_pipe[0], F_SETFL, - ::fcntl(qt_qprocess_deadChild_pipe[0], F_GETFL) | O_NONBLOCK); - ::fcntl(qt_qprocess_deadChild_pipe[1], F_SETFL, - ::fcntl(qt_qprocess_deadChild_pipe[1], F_GETFL) | O_NONBLOCK); + qt_safe_pipe(qt_qprocess_deadChild_pipe, O_NONBLOCK); // set up the SIGCHLD handler, which writes a single byte to the dead // child pipe every time a child dies. @@ -254,13 +182,13 @@ QProcessManager::QProcessManager() QProcessManager::~QProcessManager() { // notify the thread that we're shutting down. - qt_native_write(qt_qprocess_deadChild_pipe[1], "@", 1); - qt_native_close(qt_qprocess_deadChild_pipe[1]); + qt_safe_write(qt_qprocess_deadChild_pipe[1], "@", 1); + qt_safe_close(qt_qprocess_deadChild_pipe[1]); wait(); // on certain unixes, closing the reading end of the pipe will cause // select in run() to block forever, rather than return with EBADF. - qt_native_close(qt_qprocess_deadChild_pipe[0]); + qt_safe_close(qt_qprocess_deadChild_pipe[0]); qt_qprocess_deadChild_pipe[0] = -1; qt_qprocess_deadChild_pipe[1] = -1; @@ -304,7 +232,7 @@ void QProcessManager::run() // signals may have been delivered in the meantime, to avoid race // conditions. char c; - if (qt_native_read(qt_qprocess_deadChild_pipe[0], &c, 1) < 0 || c == '@') + if (qt_safe_read(qt_qprocess_deadChild_pipe[0], &c, 1) < 0 || c == '@') break; // catch any and all children that we can. @@ -323,7 +251,7 @@ void QProcessManager::catchDeadChildren() // notify all children that they may have died. they need to run // waitpid() in their own thread. QProcessInfo *info = it.value(); - qt_native_write(info->deathPipe, "", 1); + qt_safe_write(info->deathPipe, "", 1); #if defined (QPROCESS_DEBUG) qDebug() << "QProcessManager::run() sending death notice to" << info->process; @@ -382,25 +310,23 @@ void QProcessManager::unlock() static void qt_create_pipe(int *pipe) { if (pipe[0] != -1) - qt_native_close(pipe[0]); + qt_safe_close(pipe[0]); if (pipe[1] != -1) - qt_native_close(pipe[1]); - if (::pipe(pipe) != 0) { + qt_safe_close(pipe[1]); + if (qt_safe_pipe(pipe) != 0) { qWarning("QProcessPrivate::createPipe: Cannot create pipe %p: %s", pipe, qPrintable(qt_error_string(errno))); } - ::fcntl(pipe[0], F_SETFD, FD_CLOEXEC); - ::fcntl(pipe[1], F_SETFD, FD_CLOEXEC); } void QProcessPrivate::destroyPipe(int *pipe) { if (pipe[1] != -1) { - qt_native_close(pipe[1]); + qt_safe_close(pipe[1]); pipe[1] = -1; } if (pipe[0] != -1) { - qt_native_close(pipe[0]); + qt_safe_close(pipe[0]); pipe[0] = -1; } } @@ -453,7 +379,7 @@ bool QProcessPrivate::createChannel(Channel &channel) if (&channel == &stdinChannel) { // try to open in read-only mode channel.pipe[1] = -1; - if ( (channel.pipe[0] = QT_OPEN(fname, O_RDONLY)) != -1) + if ( (channel.pipe[0] = qt_safe_open(fname, O_RDONLY)) != -1) return true; // success q->setErrorString(QProcess::tr("Could not open input redirection for reading")); @@ -465,7 +391,7 @@ bool QProcessPrivate::createChannel(Channel &channel) mode |= O_TRUNC; channel.pipe[0] = -1; - if ( (channel.pipe[1] = QT_OPEN(fname, mode, 0666)) != -1) + if ( (channel.pipe[1] = qt_safe_open(fname, mode, 0666)) != -1) return true; // success q->setErrorString(QProcess::tr("Could not open output redirection for writing")); @@ -586,8 +512,6 @@ void QProcessPrivate::startProcess() return; qt_create_pipe(childStartedPipe); qt_create_pipe(deathPipe); - ::fcntl(deathPipe[0], F_SETFD, FD_CLOEXEC); - ::fcntl(deathPipe[1], F_SETFD, FD_CLOEXEC); if (threadData->eventDispatcher) { startupSocketNotifier = new QSocketNotifier(childStartedPipe[0], @@ -728,11 +652,11 @@ void QProcessPrivate::startProcess() // parent // close the ends we don't use and make all pipes non-blocking ::fcntl(deathPipe[0], F_SETFL, ::fcntl(deathPipe[0], F_GETFL) | O_NONBLOCK); - qt_native_close(childStartedPipe[1]); + qt_safe_close(childStartedPipe[1]); childStartedPipe[1] = -1; if (stdinChannel.pipe[0] != -1) { - qt_native_close(stdinChannel.pipe[0]); + qt_safe_close(stdinChannel.pipe[0]); stdinChannel.pipe[0] = -1; } @@ -740,7 +664,7 @@ void QProcessPrivate::startProcess() ::fcntl(stdinChannel.pipe[1], F_SETFL, ::fcntl(stdinChannel.pipe[1], F_GETFL) | O_NONBLOCK); if (stdoutChannel.pipe[1] != -1) { - qt_native_close(stdoutChannel.pipe[1]); + qt_safe_close(stdoutChannel.pipe[1]); stdoutChannel.pipe[1] = -1; } @@ -748,7 +672,7 @@ void QProcessPrivate::startProcess() ::fcntl(stdoutChannel.pipe[0], F_SETFL, ::fcntl(stdoutChannel.pipe[0], F_GETFL) | O_NONBLOCK); if (stderrChannel.pipe[1] != -1) { - qt_native_close(stderrChannel.pipe[1]); + qt_safe_close(stderrChannel.pipe[1]); stderrChannel.pipe[1] = -1; } if (stderrChannel.pipe[0] != -1) @@ -761,35 +685,34 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv Q_Q(QProcess); - // copy the stdin socket - qt_native_dup2(stdinChannel.pipe[0], fileno(stdin)); + // copy the stdin socket (without closing on exec) + qt_safe_dup2(stdinChannel.pipe[0], fileno(stdin), 0); // copy the stdout and stderr if asked to if (processChannelMode != QProcess::ForwardedChannels) { - qt_native_dup2(stdoutChannel.pipe[1], fileno(stdout)); + qt_safe_dup2(stdoutChannel.pipe[1], fileno(stdout), 0); // merge stdout and stderr if asked to if (processChannelMode == QProcess::MergedChannels) { - qt_native_dup2(fileno(stdout), fileno(stderr)); + qt_safe_dup2(fileno(stdout), fileno(stderr), 0); } else { - qt_native_dup2(stderrChannel.pipe[1], fileno(stderr)); + qt_safe_dup2(stderrChannel.pipe[1], fileno(stderr), 0); } } // make sure this fd is closed if execvp() succeeds - qt_native_close(childStartedPipe[0]); - ::fcntl(childStartedPipe[1], F_SETFD, FD_CLOEXEC); + qt_safe_close(childStartedPipe[0]); // enter the working directory if (workingDir) - qt_native_chdir(workingDir); + QT_CHDIR(workingDir); // this is a virtual call, and it base behavior is to do nothing. q->setupChildProcess(); // execute the process if (!envp) { - qt_native_execvp(argv[0], argv); + qt_safe_execvp(argv[0], argv); } else { if (path) { char **arg = path; @@ -798,14 +721,14 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv #if defined (QPROCESS_DEBUG) fprintf(stderr, "QProcessPrivate::execChild() searching / starting %s\n", argv[0]); #endif - qt_native_execve(argv[0], argv, envp); + qt_safe_execve(argv[0], argv, envp); ++arg; } } else { #if defined (QPROCESS_DEBUG) fprintf(stderr, "QProcessPrivate::execChild() starting %s\n", argv[0]); #endif - qt_native_execve(argv[0], argv, envp); + qt_safe_execve(argv[0], argv, envp); } } @@ -813,21 +736,21 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv #if defined (QPROCESS_DEBUG) fprintf(stderr, "QProcessPrivate::execChild() failed, notifying parent process\n"); #endif - qt_native_write(childStartedPipe[1], "", 1); - qt_native_close(childStartedPipe[1]); + qt_safe_write(childStartedPipe[1], "", 1); + qt_safe_close(childStartedPipe[1]); childStartedPipe[1] = -1; } bool QProcessPrivate::processStarted() { char c; - int i = qt_native_read(childStartedPipe[0], &c, 1); + int i = qt_safe_read(childStartedPipe[0], &c, 1); if (startupSocketNotifier) { startupSocketNotifier->setEnabled(false); startupSocketNotifier->deleteLater(); startupSocketNotifier = 0; } - qt_native_close(childStartedPipe[0]); + qt_safe_close(childStartedPipe[0]); childStartedPipe[0] = -1; #if defined (QPROCESS_DEBUG) @@ -862,7 +785,7 @@ qint64 QProcessPrivate::bytesAvailableFromStderr() const qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen) { - qint64 bytesRead = qt_native_read(stdoutChannel.pipe[0], data, maxlen); + qint64 bytesRead = qt_safe_read(stdoutChannel.pipe[0], data, maxlen); #if defined QPROCESS_DEBUG qDebug("QProcessPrivate::readFromStdout(%p \"%s\", %lld) == %lld", data, qt_prettyDebug(data, bytesRead, 16).constData(), maxlen, bytesRead); @@ -872,7 +795,7 @@ qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen) qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen) { - qint64 bytesRead = qt_native_read(stderrChannel.pipe[0], data, maxlen); + qint64 bytesRead = qt_safe_read(stderrChannel.pipe[0], data, maxlen); #if defined QPROCESS_DEBUG qDebug("QProcessPrivate::readFromStderr(%p \"%s\", %lld) == %lld", data, qt_prettyDebug(data, bytesRead, 16).constData(), maxlen, bytesRead); @@ -896,7 +819,7 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen) { qt_ignore_sigpipe(); - qint64 written = qt_native_write(stdinChannel.pipe[1], data, maxlen); + qint64 written = qt_safe_write(stdinChannel.pipe[1], data, maxlen); #if defined QPROCESS_DEBUG qDebug("QProcessPrivate::writeToStdin(%p \"%s\", %lld) == %lld", data, qt_prettyDebug(data, maxlen, 16).constData(), maxlen, written); @@ -922,7 +845,7 @@ void QProcessPrivate::killProcess() ::kill(pid_t(pid), SIGKILL); } -static int qt_native_select(fd_set *fdread, fd_set *fdwrite, int timeout) +static int qt_safe_select(fd_set *fdread, fd_set *fdwrite, int timeout) { struct timeval tv; tv.tv_sec = timeout / 1000; @@ -962,7 +885,7 @@ bool QProcessPrivate::waitForStarted(int msecs) FD_SET(childStartedPipe[0], &fds); int ret; do { - ret = qt_native_select(&fds, 0, msecs); + ret = qt_safe_select(&fds, 0, msecs); } while (ret < 0 && errno == EINTR); if (ret == 0) { processError = QProcess::Timedout; @@ -1011,7 +934,7 @@ bool QProcessPrivate::waitForReadyRead(int msecs) FD_SET(stdinChannel.pipe[1], &fdwrite); int timeout = qt_timeout_value(msecs, stopWatch.elapsed()); - int ret = qt_native_select(&fdread, &fdwrite, timeout); + int ret = qt_safe_select(&fdread, &fdwrite, timeout); if (ret < 0) { if (errno == EINTR) continue; @@ -1084,7 +1007,7 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) FD_SET(stdinChannel.pipe[1], &fdwrite); int timeout = qt_timeout_value(msecs, stopWatch.elapsed()); - int ret = qt_native_select(&fdread, &fdwrite, timeout); + int ret = qt_safe_select(&fdread, &fdwrite, timeout); if (ret < 0) { if (errno == EINTR) continue; @@ -1152,7 +1075,7 @@ bool QProcessPrivate::waitForFinished(int msecs) FD_SET(stdinChannel.pipe[1], &fdwrite); int timeout = qt_timeout_value(msecs, stopWatch.elapsed()); - int ret = qt_native_select(&fdread, &fdwrite, timeout); + int ret = qt_safe_select(&fdread, &fdwrite, timeout); if (ret < 0) { if (errno == EINTR) continue; @@ -1193,7 +1116,7 @@ bool QProcessPrivate::waitForWrite(int msecs) int ret; do { - ret = qt_native_select(0, &fdwrite, msecs < 0 ? 0 : msecs) == 1; + ret = qt_safe_select(0, &fdwrite, msecs < 0 ? 0 : msecs) == 1; } while (ret < 0 && errno == EINTR); return ret == 1; } @@ -1210,15 +1133,11 @@ bool QProcessPrivate::waitForDeadChild() // read a byte from the death pipe char c; - qt_native_read(deathPipe[0], &c, 1); + qt_safe_read(deathPipe[0], &c, 1); // check if our process is dead int exitStatus; - pid_t waitResult = 0; - do { - waitResult = waitpid(pid_t(pid), &exitStatus, WNOHANG); - } while ((waitResult == -1 && errno == EINTR)); - if (waitResult > 0) { + if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) { processManager()->remove(q); crashed = !WIFEXITED(exitStatus); exitCode = WEXITSTATUS(exitStatus); @@ -1262,16 +1181,15 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a ::setsid(); - qt_native_close(startedPipe[0]); - qt_native_close(pidPipe[0]); + qt_safe_close(startedPipe[0]); + qt_safe_close(pidPipe[0]); pid_t doubleForkPid = qt_fork(); if (doubleForkPid == 0) { - ::fcntl(startedPipe[1], F_SETFD, FD_CLOEXEC); - qt_native_close(pidPipe[1]); + qt_safe_close(pidPipe[1]); if (!encodedWorkingDirectory.isEmpty()) - qt_native_chdir(encodedWorkingDirectory.constData()); + QT_CHDIR(encodedWorkingDirectory.constData()); char **argv = new char *[arguments.size() + 2]; for (int i = 0; i < arguments.size(); ++i) { @@ -1292,13 +1210,13 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a if (!tmp.endsWith('/')) tmp += '/'; tmp += QFile::encodeName(program); argv[0] = tmp.data(); - qt_native_execv(argv[0], argv); + qt_safe_execv(argv[0], argv); } } } else { QByteArray tmp = QFile::encodeName(program); argv[0] = tmp.data(); - qt_native_execv(argv[0], argv); + qt_safe_execv(argv[0], argv); } struct sigaction noaction; @@ -1308,8 +1226,8 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a // '\1' means execv failed char c = '\1'; - qt_native_write(startedPipe[1], &c, 1); - qt_native_close(startedPipe[1]); + qt_safe_write(startedPipe[1], &c, 1); + qt_safe_close(startedPipe[1]); ::_exit(1); } else if (doubleForkPid == -1) { struct sigaction noaction; @@ -1319,40 +1237,39 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a // '\2' means internal error char c = '\2'; - qt_native_write(startedPipe[1], &c, 1); + qt_safe_write(startedPipe[1], &c, 1); } - qt_native_close(startedPipe[1]); - qt_native_write(pidPipe[1], (const char *)&doubleForkPid, sizeof(pid_t)); - qt_native_chdir("/"); + qt_safe_close(startedPipe[1]); + qt_safe_write(pidPipe[1], (const char *)&doubleForkPid, sizeof(pid_t)); + QT_CHDIR("/"); ::_exit(1); } - qt_native_close(startedPipe[1]); - qt_native_close(pidPipe[1]); + qt_safe_close(startedPipe[1]); + qt_safe_close(pidPipe[1]); if (childPid == -1) { - qt_native_close(startedPipe[0]); - qt_native_close(pidPipe[0]); + qt_safe_close(startedPipe[0]); + qt_safe_close(pidPipe[0]); return false; } char reply = '\0'; - int startResult = qt_native_read(startedPipe[0], &reply, 1); + int startResult = qt_safe_read(startedPipe[0], &reply, 1); int result; - qt_native_close(startedPipe[0]); - while (::waitpid(childPid, &result, 0) == -1 && errno == EINTR) - { } + qt_safe_close(startedPipe[0]); + qt_safe_waitpid(childPid, &result, 0); bool success = (startResult != -1 && reply == '\0'); if (success && pid) { pid_t actualPid = 0; - if (qt_native_read(pidPipe[0], (char *)&actualPid, sizeof(pid_t)) == sizeof(pid_t)) { + if (qt_safe_read(pidPipe[0], (char *)&actualPid, sizeof(pid_t)) == sizeof(pid_t)) { *pid = actualPid; } else { *pid = 0; } } - qt_native_close(pidPipe[0]); + qt_safe_close(pidPipe[0]); return success; } -- cgit v0.12 From 27fc6ef5dfb7d58af778de162298fdc4da34459f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Apr 2009 20:54:17 +0200 Subject: Add a properly-safe version of select(2). Do the timeout handling the right and cross-platform way. The code that was in QProcess worked only on Linux, where the kernel sets the remainder in the returned timeval structure. Reviewed-By: ossi --- src/corelib/io/qprocess_unix.cpp | 80 ++++++++-------- src/corelib/kernel/kernel.pri | 1 + src/corelib/kernel/qcore_unix.cpp | 121 ++++++++++++++++++++++++ src/network/socket/qnativesocketengine_unix.cpp | 53 ++--------- 4 files changed, 165 insertions(+), 90 deletions(-) create mode 100644 src/corelib/kernel/qcore_unix.cpp diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index c81da44..fafce07 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -128,6 +128,13 @@ static void qt_sa_sigchld_handler(int signum) qt_sa_old_sigchld_handler(signum); } +static inline void add_fd(int &nfds, int fd, fd_set *fdset) +{ + FD_SET(fd, fdset); + if ((fd) > nfds) + nfds = fd; +} + struct QProcessInfo { QProcess *process; int deathPipe; @@ -845,17 +852,15 @@ void QProcessPrivate::killProcess() ::kill(pid_t(pid), SIGKILL); } -static int qt_safe_select(fd_set *fdread, fd_set *fdwrite, int timeout) +static int select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout) { + if (timeout < 0) + return qt_safe_select(nfds, fdread, fdwrite, 0, 0); + struct timeval tv; tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; - - int ret; - do { - ret = select(FD_SETSIZE, fdread, fdwrite, 0, timeout < 0 ? 0 : &tv); - } while (ret < 0 && (errno == EINTR)); - return ret; + return qt_safe_select(nfds, fdread, fdwrite, 0, &tv); } /* @@ -883,11 +888,7 @@ bool QProcessPrivate::waitForStarted(int msecs) fd_set fds; FD_ZERO(&fds); FD_SET(childStartedPipe[0], &fds); - int ret; - do { - ret = qt_safe_select(&fds, 0, msecs); - } while (ret < 0 && errno == EINTR); - if (ret == 0) { + if (select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) { processError = QProcess::Timedout; q->setErrorString(QProcess::tr("Process operation timed out")); #if defined (QPROCESS_DEBUG) @@ -920,24 +921,23 @@ bool QProcessPrivate::waitForReadyRead(int msecs) FD_ZERO(&fdread); FD_ZERO(&fdwrite); + int nfds = deathPipe[0]; + FD_SET(deathPipe[0], &fdread); + if (processState == QProcess::Starting) - FD_SET(childStartedPipe[0], &fdread); + add_fd(nfds, childStartedPipe[0], &fdread); if (stdoutChannel.pipe[0] != -1) - FD_SET(stdoutChannel.pipe[0], &fdread); + add_fd(nfds, stdoutChannel.pipe[0], &fdread); if (stderrChannel.pipe[0] != -1) - FD_SET(stderrChannel.pipe[0], &fdread); - - FD_SET(deathPipe[0], &fdread); + add_fd(nfds, stderrChannel.pipe[0], &fdread); if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1) - FD_SET(stdinChannel.pipe[1], &fdwrite); + add_fd(nfds, stdinChannel.pipe[1], &fdwrite); int timeout = qt_timeout_value(msecs, stopWatch.elapsed()); - int ret = qt_safe_select(&fdread, &fdwrite, timeout); + int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout); if (ret < 0) { - if (errno == EINTR) - continue; break; } if (ret == 0) { @@ -993,24 +993,24 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) FD_ZERO(&fdread); FD_ZERO(&fdwrite); + int nfds = deathPipe[0]; + FD_SET(deathPipe[0], &fdread); + if (processState == QProcess::Starting) - FD_SET(childStartedPipe[0], &fdread); + add_fd(nfds, childStartedPipe[0], &fdread); if (stdoutChannel.pipe[0] != -1) - FD_SET(stdoutChannel.pipe[0], &fdread); + add_fd(nfds, stdoutChannel.pipe[0], &fdread); if (stderrChannel.pipe[0] != -1) - FD_SET(stderrChannel.pipe[0], &fdread); + add_fd(nfds, stderrChannel.pipe[0], &fdread); - FD_SET(deathPipe[0], &fdread); if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1) - FD_SET(stdinChannel.pipe[1], &fdwrite); + add_fd(nfds, stdinChannel.pipe[1], &fdwrite); int timeout = qt_timeout_value(msecs, stopWatch.elapsed()); - int ret = qt_safe_select(&fdread, &fdwrite, timeout); + int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout); if (ret < 0) { - if (errno == EINTR) - continue; break; } @@ -1056,29 +1056,28 @@ bool QProcessPrivate::waitForFinished(int msecs) forever { fd_set fdread; fd_set fdwrite; + int nfds = -1; FD_ZERO(&fdread); FD_ZERO(&fdwrite); if (processState == QProcess::Starting) - FD_SET(childStartedPipe[0], &fdread); + add_fd(nfds, childStartedPipe[0], &fdread); if (stdoutChannel.pipe[0] != -1) - FD_SET(stdoutChannel.pipe[0], &fdread); + add_fd(nfds, stdoutChannel.pipe[0], &fdread); if (stderrChannel.pipe[0] != -1) - FD_SET(stderrChannel.pipe[0], &fdread); + add_fd(nfds, stderrChannel.pipe[0], &fdread); if (processState == QProcess::Running) - FD_SET(deathPipe[0], &fdread); + add_fd(nfds, deathPipe[0], &fdread); if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1) - FD_SET(stdinChannel.pipe[1], &fdwrite); + add_fd(nfds, stdinChannel.pipe[1], &fdwrite); int timeout = qt_timeout_value(msecs, stopWatch.elapsed()); - int ret = qt_safe_select(&fdread, &fdwrite, timeout); + int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout); if (ret < 0) { - if (errno == EINTR) - continue; break; } if (ret == 0) { @@ -1113,12 +1112,7 @@ bool QProcessPrivate::waitForWrite(int msecs) fd_set fdwrite; FD_ZERO(&fdwrite); FD_SET(stdinChannel.pipe[1], &fdwrite); - - int ret; - do { - ret = qt_safe_select(0, &fdwrite, msecs < 0 ? 0 : msecs) == 1; - } while (ret < 0 && errno == EINTR); - return ret == 1; + return select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1; } void QProcessPrivate::findExitCode() diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 6f28029..8759578 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -88,6 +88,7 @@ mac { unix { SOURCES += \ + kernel/qcore_unix.cpp \ kernel/qcrashhandler.cpp \ kernel/qsharedmemory_unix.cpp \ kernel/qsystemsemaphore_unix.cpp diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp new file mode 100644 index 0000000..ffaf958 --- /dev/null +++ b/src/corelib/kernel/qcore_unix.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcore_unix_p.h" + +#include +#include +#include + +#include "qeventdispatcher_unix_p.h" // for the timeval operators + +#if !defined(QT_NO_CLOCK_MONOTONIC) +# if defined(QT_BOOTSTRAPPED) +# define QT_NO_CLOCK_MONOTONIC +# endif +#endif + +QT_BEGIN_NAMESPACE + +static inline timeval gettime() +{ + timeval tv; +#ifndef QT_NO_CLOCK_MONOTONIC + // use the monotonic clock + static volatile bool monotonicClockDisabled = false; + struct timespec ts; + if (!monotonicClockDisabled) { + if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) { + monotonicClockDisabled = true; + } else { + tv.tv_sec = ts.tv_sec; + tv.tv_usec = ts.tv_nsec / 1000; + return tv; + } + } +#endif + // use gettimeofday + ::gettimeofday(&tv, 0); + return tv; +} + +static inline bool time_update(struct timeval *tv, const struct timeval &start, + const struct timeval &timeout) +{ + struct timeval now = gettime(); + if (now < start) { + // clock reset, give up + return false; + } + + *tv = timeout + start - now; + return true; +} + +int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, + const struct timeval *orig_timeout) +{ + if (!orig_timeout) { + // no timeout -> block forever + register int ret; + EINTR_LOOP(ret, select(nfds, fdread, fdwrite, fdexcept, 0)); + return ret; + } + + timeval start = gettime(); + timeval timeout = *orig_timeout; + + // loop and recalculate the timeout as needed + int ret; + forever { + ret = ::select(nfds, fdread, fdwrite, fdexcept, &timeout); + if (ret != -1 || errno != EINTR) + return ret; + + // recalculate the timeout + if (!time_update(&timeout, start, *orig_timeout)) { + // clock reset, fake timeout error + return 0; + } + } +} + +QT_END_NAMESPACE diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index b130a9b..6eafe05 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -42,6 +42,7 @@ //#define QNATIVESOCKETENGINE_DEBUG #include "qnativesocketengine_p.h" +#include "private/qcore_unix_p.h" #include "qiodevice.h" #include "qhostaddress.h" #include "qvarlengtharray.h" @@ -833,33 +834,11 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; - QTime timer; - timer.start(); - int retval; - do { - if (selectForRead) - retval = select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); - else - retval = select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); - - if (retval != -1 || errno != EINTR) - break; - - if (timeout > 0) { - // recalculate the timeout - int t = timeout - timer.elapsed(); - if (t < 0) { - // oops, timeout turned negative? - retval = -1; - break; - } - - tv.tv_sec = t / 1000; - tv.tv_usec = (t % 1000) * 1000; - } - } while (true); - + if (selectForRead) + retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); + else + retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); return retval; } @@ -880,28 +859,8 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; - QTime timer; - timer.start(); - int ret; - do { - ret = select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); - if (ret != -1 || errno != EINTR) - break; - - if (timeout > 0) { - // recalculate the timeout - int t = timeout - timer.elapsed(); - if (t < 0) { - // oops, timeout turned negative? - ret = -1; - break; - } - - tv.tv_sec = t / 1000; - tv.tv_usec = (t % 1000) * 1000; - } - } while (true); + ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); if (ret <= 0) return ret; -- cgit v0.12 From cad1bf4c902899ec1a8277d46272afa23fc2b34b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 23 Apr 2009 11:55:02 +0200 Subject: Port gui/embedded to the EINTR-safe functions. I think I found two file descriptor that aren't closed. One seems like a genuine leak, the other seems intentional. Reviewed-By: ossi --- src/gui/embedded/qkbdlinuxinput_qws.cpp | 1 + src/gui/embedded/qkbdsl5000_qws.cpp | 6 +++-- src/gui/embedded/qkbdtty_qws.cpp | 4 ++++ src/gui/embedded/qkbdvfb_qws.cpp | 9 ++++---- src/gui/embedded/qkbdvr41xx_qws.cpp | 7 +++--- src/gui/embedded/qkbdyopy_qws.cpp | 10 +++++---- src/gui/embedded/qlock.cpp | 6 +++-- src/gui/embedded/qmousebus_qws.cpp | 11 +++++----- src/gui/embedded/qmouselinuxtp_qws.cpp | 7 +++--- src/gui/embedded/qmousepc_qws.cpp | 39 +++++++++++++++++---------------- src/gui/embedded/qmousevfb_qws.cpp | 9 ++++---- src/gui/embedded/qmousevr41xx_qws.cpp | 11 +++++----- src/gui/embedded/qmouseyopy_qws.cpp | 7 +++--- src/gui/embedded/qscreenlinuxfb_qws.cpp | 20 ++++++++++------- src/gui/embedded/qsoundqss_qws.cpp | 9 ++++---- src/gui/embedded/qtransportauth_qws.cpp | 7 +++--- src/gui/embedded/qunixsocket.cpp | 18 ++++++++++----- src/gui/text/qfontdatabase_qws.cpp | 5 +++-- src/gui/text/qfontengine_qpf.cpp | 11 +++++----- src/gui/text/qfontengine_qws.cpp | 5 +++-- 20 files changed, 118 insertions(+), 84 deletions(-) diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp index d5720f7..e552731 100644 --- a/src/gui/embedded/qkbdlinuxinput_qws.cpp +++ b/src/gui/embedded/qkbdlinuxinput_qws.cpp @@ -47,6 +47,7 @@ #include #include +#include // overrides QT_OPEN #include #include diff --git a/src/gui/embedded/qkbdsl5000_qws.cpp b/src/gui/embedded/qkbdsl5000_qws.cpp index 36cb903..cf82c10 100644 --- a/src/gui/embedded/qkbdsl5000_qws.cpp +++ b/src/gui/embedded/qkbdsl5000_qws.cpp @@ -51,6 +51,8 @@ #include "qnamespace.h" #include "qtimer.h" +#include // overrides QT_OPEN + #include #include #include @@ -207,14 +209,14 @@ QWSSL5000KeyboardHandler::QWSSL5000KeyboardHandler(const QString &device) numLock = false; sharp_kbdctl_modifstat st; - int dev = ::open(device.isEmpty()?"/dev/sharp_kbdctl":device.toLocal8Bit().constData(), O_RDWR); + int dev = QT_OPEN(device.isEmpty()?"/dev/sharp_kbdctl":device.toLocal8Bit().constData(), O_RDWR); if (dev >= 0) { memset(&st, 0, sizeof(st)); st.which = 3; int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); if(!ret) numLock = (bool)st.stat; - ::close(dev); + QT_CLOSE(dev); } } diff --git a/src/gui/embedded/qkbdtty_qws.cpp b/src/gui/embedded/qkbdtty_qws.cpp index 33777eb..8c1e79b 100644 --- a/src/gui/embedded/qkbdtty_qws.cpp +++ b/src/gui/embedded/qkbdtty_qws.cpp @@ -47,6 +47,7 @@ #include #include +#include // overrides QT_OPEN #include #include @@ -213,6 +214,9 @@ QWSTtyKbPrivate::~QWSTtyKbPrivate() ::ioctl(m_tty_fd, KDSKBMODE, m_originalKbdMode); #endif tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr); + + // we're leaking m_tty_fd here? + //QT_CLOSE(m_tty_fd); } } diff --git a/src/gui/embedded/qkbdvfb_qws.cpp b/src/gui/embedded/qkbdvfb_qws.cpp index 082aac1..a44183b 100644 --- a/src/gui/embedded/qkbdvfb_qws.cpp +++ b/src/gui/embedded/qkbdvfb_qws.cpp @@ -55,6 +55,7 @@ #include #include #include +#include // overrides QT_OPEN QT_BEGIN_NAMESPACE @@ -69,13 +70,13 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device) kbdBufferLen = sizeof(QVFbKeyData) * 5; kbdBuffer = new unsigned char [kbdBufferLen]; - if ((kbdFD = open(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { + if ((kbdFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { qWarning("Cannot open %s (%s)", terminalName.toLatin1().constData(), strerror(errno)); } else { // Clear pending input char buf[2]; - while (read(kbdFD, buf, 1) > 0) { } + while (QT_READ(kbdFD, buf, 1) > 0) { } notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); @@ -85,7 +86,7 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device) QVFbKeyboardHandler::~QVFbKeyboardHandler() { if (kbdFD >= 0) - close(kbdFD); + QT_CLOSE(kbdFD); delete [] kbdBuffer; } @@ -94,7 +95,7 @@ void QVFbKeyboardHandler::readKeyboardData() { int n; do { - n = read(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); + n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); if (n > 0) kbdIdx += n; } while (n > 0); diff --git a/src/gui/embedded/qkbdvr41xx_qws.cpp b/src/gui/embedded/qkbdvr41xx_qws.cpp index 03c2a67..6d8299b 100644 --- a/src/gui/embedded/qkbdvr41xx_qws.cpp +++ b/src/gui/embedded/qkbdvr41xx_qws.cpp @@ -52,6 +52,7 @@ #include #include +#include // overrides QT_OPEN QT_BEGIN_NAMESPACE @@ -95,7 +96,7 @@ QWSVr41xxKbPrivate::QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QStrin buttonFD = -1; notifier = 0; - buttonFD = open(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);; + buttonFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);; if (buttonFD < 0) { qWarning("Cannot open %s\n", qPrintable(terminalName)); return; @@ -115,7 +116,7 @@ QWSVr41xxKbPrivate::QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QStrin QWSVr41xxKbPrivate::~QWSVr41xxKbPrivate() { if (buttonFD > 0) { - ::close(buttonFD); + QT_CLOSE(buttonFD); buttonFD = -1; } delete notifier; @@ -127,7 +128,7 @@ void QWSVr41xxKbPrivate::readKeyboardData() { int n = 0; do { - n = read(buttonFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); + n = QT_READ(buttonFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); if (n > 0) kbdIdx += n; } while (n > 0); diff --git a/src/gui/embedded/qkbdyopy_qws.cpp b/src/gui/embedded/qkbdyopy_qws.cpp index 5c9d28d..edb732c 100644 --- a/src/gui/embedded/qkbdyopy_qws.cpp +++ b/src/gui/embedded/qkbdyopy_qws.cpp @@ -60,6 +60,8 @@ #include #include +#include // overrides QT_OPEN + extern "C" { int getpgid(int); } @@ -105,7 +107,7 @@ QWSYopyKbPrivate::QWSYopyKbPrivate(QWSYopyKeyboardHandler *h, const QString &dev buttonFD = -1; notifier = 0; - buttonFD = ::open(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0); + buttonFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0); if (buttonFD < 0) { qWarning("Cannot open %s\n", qPrintable(terminalName)); return; @@ -177,10 +179,10 @@ void QWSYopyKbPrivate::readKeyboardData() case 40: k=Qt::Key_Up; break; // prev case 45: k=Qt::Key_Down; break; // next case 35: if(!press) { - fd = open("/proc/sys/pm/sleep",O_RDWR,0); + fd = QT_OPEN("/proc/sys/pm/sleep",O_RDWR,0); if(fd >= 0) { - write(fd,&c,sizeof(c)); - close(fd); + QT_WRITE(fd,&c,sizeof(c)); + QT_CLOSE(fd); // // Updates all widgets. // diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index c23608f..305832c 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -73,6 +73,8 @@ union semun { #endif // QT_NO_QWS_MULTIPROCESS +#include // overrides QT_OPEN + #define MAX_LOCKS 200 // maximum simultaneous read locks QT_BEGIN_NAMESPACE @@ -134,7 +136,7 @@ QLock::QLock(const QString &filename, char id, bool create) #ifdef Q_NO_SEMAPHORE data->file = QString(filename+id).toLocal8Bit().constData(); for(int x = 0; x < 2; x++) { - data->id = open(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU); + data->id = QT_OPEN(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU); if(data->id != -1 || !create) { data->owned = x; break; @@ -177,7 +179,7 @@ QLock::~QLock() unlock(); #ifdef Q_NO_SEMAPHORE if(isValid()) { - close(data->id); + QT_CLOSE(data->id); if(data->owned) unlink(data->file); } diff --git a/src/gui/embedded/qmousebus_qws.cpp b/src/gui/embedded/qmousebus_qws.cpp index a88ca5b..0b674b6 100644 --- a/src/gui/embedded/qmousebus_qws.cpp +++ b/src/gui/embedded/qmousebus_qws.cpp @@ -47,6 +47,7 @@ #include "qsocketnotifier.h" #include "qapplication.h" +#include // overrides QT_OPEN #include #include @@ -119,9 +120,9 @@ QWSBusMouseHandlerPrivate::QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h, mouseDev = QLatin1String("/dev/mouse"); obstate = -1; mouseFD = -1; - mouseFD = open(mouseDev.toLocal8Bit(), O_RDWR | O_NDELAY); + mouseFD = QT_OPEN(mouseDev.toLocal8Bit(), O_RDWR | O_NDELAY); if (mouseFD < 0) - mouseFD = open(mouseDev.toLocal8Bit(), O_RDONLY | O_NDELAY); + mouseFD = QT_OPEN(mouseDev.toLocal8Bit(), O_RDONLY | O_NDELAY); if (mouseFD < 0) qDebug("Cannot open %s (%s)", qPrintable(mouseDev), strerror(errno)); @@ -130,7 +131,7 @@ QWSBusMouseHandlerPrivate::QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h, usleep(50000); char buf[100]; // busmouse driver will not read if bufsize < 3, YYD - while (read(mouseFD, buf, 100) > 0) { } // eat unwanted replies + while (QT_READ(mouseFD, buf, 100) > 0) { } // eat unwanted replies mouseIdx = 0; @@ -142,7 +143,7 @@ QWSBusMouseHandlerPrivate::~QWSBusMouseHandlerPrivate() { if (mouseFD >= 0) { tcflush(mouseFD,TCIFLUSH); // yyd. - close(mouseFD); + QT_CLOSE(mouseFD); } } @@ -167,7 +168,7 @@ void QWSBusMouseHandlerPrivate::readMouseData() for (;;) { if (mouseBufSize - mouseIdx < 3) break; - n = read(mouseFD, mouseBuf+mouseIdx, 3); + n = QT_READ(mouseFD, mouseBuf+mouseIdx, 3); if (n != 3) break; mouseIdx += 3; diff --git a/src/gui/embedded/qmouselinuxtp_qws.cpp b/src/gui/embedded/qmouselinuxtp_qws.cpp index 1b4d96e..e64407e 100644 --- a/src/gui/embedded/qmouselinuxtp_qws.cpp +++ b/src/gui/embedded/qmouselinuxtp_qws.cpp @@ -47,6 +47,7 @@ #include "qtimer.h" #include "qapplication.h" #include "qscreen_qws.h" +#include // overrides QT_OPEN #include #include @@ -190,7 +191,7 @@ QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHand } else { mousedev = device; } - if ((mouseFD = open(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { + if ((mouseFD = QT_OPEN(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { qWarning("Cannot open %s (%s)", qPrintable(mousedev), strerror(errno)); return; } @@ -205,7 +206,7 @@ QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHand QWSLinuxTPMouseHandlerPrivate::~QWSLinuxTPMouseHandlerPrivate() { if (mouseFD >= 0) - close(mouseFD); + QT_CLOSE(mouseFD); } void QWSLinuxTPMouseHandlerPrivate::suspend() @@ -233,7 +234,7 @@ void QWSLinuxTPMouseHandlerPrivate::readMouseData() int n; do { - n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); + n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); if (n > 0) mouseIdx += n; } while (n > 0 && mouseIdx < mouseBufSize); diff --git a/src/gui/embedded/qmousepc_qws.cpp b/src/gui/embedded/qmousepc_qws.cpp index a9f2bc8..317bb8a 100644 --- a/src/gui/embedded/qmousepc_qws.cpp +++ b/src/gui/embedded/qmousepc_qws.cpp @@ -55,6 +55,7 @@ #include "qfile.h" #include "qtextstream.h" #include "qstringlist.h" +#include // overrides QT_OPEN #include #include @@ -107,7 +108,7 @@ public: { if (fd != f) { f = fd; - close(fd); + QT_CLOSE(fd); } } @@ -170,7 +171,7 @@ public: } static const uchar initseq[] = { 243, 200, 243, 100, 243, 80 }; static const uchar query[] = { 0xf2 }; - if (write(fd, initseq, sizeof(initseq))!=sizeof(initseq)) { + if (QT_WRITE(fd, initseq, sizeof(initseq))!=sizeof(initseq)) { badness = 100; return; } @@ -180,12 +181,12 @@ public: perror("QWSPcMouseSubHandler_intellimouse: post-init tcflush"); #endif } - if (write(fd, query, sizeof(query))!=sizeof(query)) { + if (QT_WRITE(fd, query, sizeof(query))!=sizeof(query)) { badness = 100; return; } usleep(10000); - n = read(fd, reply, 20); + n = QT_READ(fd, reply, 20); if (n > 0) { goodness = 10; switch (reply[n-1]) { @@ -256,13 +257,13 @@ public: perror("QWSPcMouseSubHandler_mouseman: initial tcflush"); #endif } - write(fd,"",1); + QT_WRITE(fd,"",1); usleep(50000); - write(fd,"@EeI!",5); + QT_WRITE(fd,"@EeI!",5); usleep(10000); static const char ibuf[] = { 246, 244 }; - write(fd,ibuf,1); - write(fd,ibuf+1,1); + QT_WRITE(fd,ibuf,1); + QT_WRITE(fd,ibuf+1,1); if (tcflush(fd,TCIOFLUSH) == -1) { #ifdef QWS_MOUSE_DEBUG perror("QWSPcMouseSubHandler_mouseman: tcflush"); @@ -271,7 +272,7 @@ public: usleep(10000); char buf[100]; - while (read(fd, buf, 100) > 0) { } // eat unwanted replies + while (QT_READ(fd, buf, 100) > 0) { } // eat unwanted replies } int tryData() @@ -350,7 +351,7 @@ private: for (int n = 0; n < 4; n++) { setflags(CSTOPB | speed[n]); - write(fd, "*q", 2); + QT_WRITE(fd, "*q", 2); usleep(10000); } } @@ -369,7 +370,7 @@ public: { setflags(B1200|CS8|CSTOPB); // 60Hz - if (write(fd, "R", 1)!=1) { + if (QT_WRITE(fd, "R", 1)!=1) { badness = 100; return; } @@ -418,7 +419,7 @@ public: { setflags(B1200|CS7); // 60Hz - if (write(fd, "R", 1)!=1) { + if (QT_WRITE(fd, "R", 1)!=1) { badness = 100; return; } @@ -648,25 +649,25 @@ void QWSPcMouseHandlerPrivate::openDevices() if (drv == QLatin1String("intellimouse")) { if (dev.isEmpty()) dev = "/dev/psaux"; - fd = open(dev, O_RDWR | O_NDELAY); + fd = QT_OPEN(dev, O_RDWR | O_NDELAY); if (fd >= 0) sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); } else if (drv == QLatin1String("microsoft")) { if (dev.isEmpty()) dev = "/dev/ttyS0"; - fd = open(dev, O_RDWR | O_NDELAY); + fd = QT_OPEN(dev, O_RDWR | O_NDELAY); if (fd >= 0) sub[nsub++] = new QWSPcMouseSubHandler_ms(fd); } else if (drv == QLatin1String("mousesystems")) { if (dev.isEmpty()) dev = "/dev/ttyS0"; - fd = open(dev, O_RDWR | O_NDELAY); + fd = QT_OPEN(dev, O_RDWR | O_NDELAY); if (fd >= 0) sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd); } else if (drv == QLatin1String("mouseman")) { if (dev.isEmpty()) dev = "/dev/psaux"; - fd = open(dev, O_RDWR | O_NDELAY); + fd = QT_OPEN(dev, O_RDWR | O_NDELAY); if (fd >= 0) sub[nsub++] = new QWSPcMouseSubHandler_mouseman(fd); } @@ -677,12 +678,12 @@ void QWSPcMouseHandlerPrivate::openDevices() dev.constData(), strerror(errno)); } else { // Try automatically - fd = open("/dev/psaux", O_RDWR | O_NDELAY); + fd = QT_OPEN("/dev/psaux", O_RDWR | O_NDELAY); if (fd >= 0) { sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); notify(fd); } - fd = open("/dev/input/mice", O_RDWR | O_NDELAY); + fd = QT_OPEN("/dev/input/mice", O_RDWR | O_NDELAY); if (fd >= 0) { sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); notify(fd); @@ -694,7 +695,7 @@ void QWSPcMouseHandlerPrivate::openDevices() #if 0 const char fn[4][11] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3" }; for (int ch = 0; ch < 4; ++ch) { - fd = open(fn[ch], O_RDWR | O_NDELAY); + fd = QT_OPEN(fn[ch], O_RDWR | O_NDELAY); if (fd >= 0) { //sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd); diff --git a/src/gui/embedded/qmousevfb_qws.cpp b/src/gui/embedded/qmousevfb_qws.cpp index 17d051f..dd553bc 100644 --- a/src/gui/embedded/qmousevfb_qws.cpp +++ b/src/gui/embedded/qmousevfb_qws.cpp @@ -54,6 +54,7 @@ #include #include #include +#include // overrides QT_OPEN QT_BEGIN_NAMESPACE @@ -64,7 +65,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device) if (device.isEmpty()) mouseDev = QLatin1String("/dev/vmouse"); - mouseFD = open(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); + mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); if (mouseFD == -1) { perror("QVFbMouseHandler::QVFbMouseHandler"); qWarning("QVFbMouseHander: Unable to open device %s", @@ -74,7 +75,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device) // Clear pending input char buf[2]; - while (read(mouseFD, buf, 1) > 0) { } + while (QT_READ(mouseFD, buf, 1) > 0) { } mouseIdx = 0; @@ -85,7 +86,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device) QVFbMouseHandler::~QVFbMouseHandler() { if (mouseFD >= 0) - close(mouseFD); + QT_CLOSE(mouseFD); } void QVFbMouseHandler::resume() @@ -102,7 +103,7 @@ void QVFbMouseHandler::readMouseData() { int n; do { - n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); + n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); if (n > 0) mouseIdx += n; } while (n > 0); diff --git a/src/gui/embedded/qmousevr41xx_qws.cpp b/src/gui/embedded/qmousevr41xx_qws.cpp index 8748055..b7491d9 100644 --- a/src/gui/embedded/qmousevr41xx_qws.cpp +++ b/src/gui/embedded/qmousevr41xx_qws.cpp @@ -49,6 +49,7 @@ #include "qscreen_qws.h" #include #include +#include // overrides QT_OPEN #include #include @@ -144,7 +145,7 @@ QWSVr41xxMouseHandlerPrivate::QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler else dev = options.first(); - if ((mouseFD = open(dev.toLocal8Bit().constData(), O_RDONLY)) < 0) { + if ((mouseFD = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY)) < 0) { qWarning("Cannot open %s (%s)", qPrintable(dev), strerror(errno)); return; } @@ -167,7 +168,7 @@ QWSVr41xxMouseHandlerPrivate::QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler QWSVr41xxMouseHandlerPrivate::~QWSVr41xxMouseHandlerPrivate() { if (mouseFD >= 0) - close(mouseFD); + QT_CLOSE(mouseFD); } void QWSVr41xxMouseHandlerPrivate::suspend() @@ -190,9 +191,9 @@ void QWSVr41xxMouseHandlerPrivate::sendRelease() bool QWSVr41xxMouseHandlerPrivate::getSample() { - const int n = read(mouseFD, - reinterpret_cast(currSample) + currLength, - sizeof(currSample) - currLength); + const int n = QT_READ(mouseFD, + reinterpret_cast(currSample) + currLength, + sizeof(currSample) - currLength); if (n > 0) currLength += n; diff --git a/src/gui/embedded/qmouseyopy_qws.cpp b/src/gui/embedded/qmouseyopy_qws.cpp index 7b1141a..3a541d3 100644 --- a/src/gui/embedded/qmouseyopy_qws.cpp +++ b/src/gui/embedded/qmouseyopy_qws.cpp @@ -46,6 +46,7 @@ #include "qsocketnotifier.h" #include "qapplication.h" #include "qscreen_qws.h" +#include // overrides QT_OPEN #include #include @@ -103,7 +104,7 @@ void QWSYopyMouseHandler::suspend() QWSYopyMouseHandlerPrivate::QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h) : handler(h) { - if ((mouseFD = open("/dev/ts", O_RDONLY)) < 0) { + if ((mouseFD = QT_OPEN("/dev/ts", O_RDONLY)) < 0) { qWarning("Cannot open /dev/ts (%s)", strerror(errno)); return; } else { @@ -118,7 +119,7 @@ QWSYopyMouseHandlerPrivate::QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h) QWSYopyMouseHandlerPrivate::~QWSYopyMouseHandlerPrivate() { if (mouseFD >= 0) - close(mouseFD); + QT_CLOSE(mouseFD); } #define YOPY_XPOS(d) (d[1]&0x3FF) @@ -156,7 +157,7 @@ void QWSYopyMouseHandlerPrivate::readMouseData() int ret; - ret=read(mouseFD,&yopDat,sizeof(yopDat)); + ret=QT_READ(mouseFD,&yopDat,sizeof(yopDat)); if(ret) { data.status= (YOPY_PRES(yopDat)) ? 1 : 0; diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp index 42c4fcd..2845842 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp @@ -46,6 +46,7 @@ #include "qwsdisplay_qws.h" #include "qpixmap.h" #include +#include // overrides QT_OPEN #include #include @@ -122,12 +123,12 @@ void QLinuxFbScreenPrivate::openTty() if (ttyDevice.isEmpty()) { for (const char * const *dev = devs; *dev; ++dev) { - ttyfd = ::open(*dev, O_RDWR); + ttyfd = QT_OPEN(*dev, O_RDWR); if (ttyfd != -1) break; } } else { - ttyfd = ::open(ttyDevice.toAscii().constData(), O_RDWR); + ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR); } if (ttyfd == -1) @@ -144,7 +145,7 @@ void QLinuxFbScreenPrivate::openTty() // No blankin' screen, no blinkin' cursor!, no cursor! const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c"; - ::write(ttyfd, termctl, sizeof(termctl)); + QT_WRITE(ttyfd, termctl, sizeof(termctl)); } void QLinuxFbScreenPrivate::closeTty() @@ -157,9 +158,9 @@ void QLinuxFbScreenPrivate::closeTty() // Blankin' screen, blinkin' cursor! const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c"; - ::write(ttyfd, termctl, sizeof(termctl)); + QT_WRITE(ttyfd, termctl, sizeof(termctl)); - ::close(ttyfd); + QT_CLOSE(ttyfd); ttyfd = -1; } @@ -281,7 +282,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) dev = QLatin1String("/dev/fb0"); if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0) - d_ptr->fd = open(dev.toLatin1().constData(), O_RDWR); + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR); if (d_ptr->fd == -1) { if (QApplication::type() == QApplication::GuiServer) { perror("QScreenLinuxFb::connect"); @@ -289,7 +290,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) return false; } if (access(dev.toLatin1().constData(), R_OK) == 0) - d_ptr->fd = open(dev.toLatin1().constData(), O_RDONLY); + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); } fb_fix_screeninfo finfo; @@ -681,7 +682,7 @@ bool QLinuxFbScreen::initDevice() #ifdef __i386__ // Now init mtrr if(!::getenv("QWS_NOMTRR")) { - int mfd=open("/proc/mtrr",O_WRONLY,0); + int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0); // MTRR entry goes away when file is closed - i.e. // hopefully when QWS is killed if(mfd != -1) { @@ -702,6 +703,9 @@ bool QLinuxFbScreen::initDevice() //sentry.base,sentry.size,strerror(errno)); } } + + // Should we close mfd here? + //QT_CLOSE(mfd); } #endif if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR)) diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp index ac0ac9d..a45d0fe 100644 --- a/src/gui/embedded/qsoundqss_qws.cpp +++ b/src/gui/embedded/qsoundqss_qws.cpp @@ -53,6 +53,7 @@ #include #include #include +#include // overrides QT_OPEN #include #include @@ -1137,7 +1138,7 @@ void QWSSoundServerPrivate::sendCompletedSignals() int QWSSoundServerPrivate::openFile(int wid, int sid, const QString& filename) { stopFile(wid, sid); // close and re-open. - int f = ::open(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK); + int f = QT_OPEN(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK); if (f == -1) { // XXX check ferror, check reason. qDebug("Failed opening \"%s\"",filename.toLatin1().data()); @@ -1157,7 +1158,7 @@ bool QWSSoundServerPrivate::openDevice() { if (fd < 0) { if( silent ) { - fd = ::open( "/dev/null", O_WRONLY ); + fd = QT_OPEN( "/dev/null", O_WRONLY ); // Emulate write to audio device int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit))/sound_speed/2; timerId = startTimer(delay); @@ -1168,7 +1169,7 @@ bool QWSSoundServerPrivate::openDevice() // Don't block open right away. // bool openOkay = false; - if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) { + if ((fd = QT_OPEN("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) { int flags = fcntl(fd, F_GETFL); flags &= ~O_NONBLOCK; openOkay = (fcntl(fd, F_SETFL, flags) == 0); @@ -1222,7 +1223,7 @@ bool QWSSoundServerPrivate::openDevice() // // Check system volume // - int mixerHandle = ::open( "/dev/mixer", O_RDWR|O_NONBLOCK ); + int mixerHandle = QT_OPEN( "/dev/mixer", O_RDWR|O_NONBLOCK ); if ( mixerHandle >= 0 ) { int volume; ioctl( mixerHandle, MIXER_READ(0), &volume ); diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp index 05dce11..8523e27 100644 --- a/src/gui/embedded/qtransportauth_qws.cpp +++ b/src/gui/embedded/qtransportauth_qws.cpp @@ -56,6 +56,7 @@ #include "qlibraryinfo.h" #include "qfile.h" #include "qdebug.h" +#include // overrides QT_OPEN #include #include @@ -572,7 +573,7 @@ bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &r //get cmdline from proc/pid/cmdline snprintf( cmdlinePath, BUF_SIZE, "/proc/%d/cmdline", d.processId ); - int cmdlineFd = open( cmdlinePath, O_RDONLY ); + int cmdlineFd = QT_OPEN( cmdlinePath, O_RDONLY ); if ( cmdlineFd == -1 ) { qWarning( "SXE:- Error encountered in opening /proc/%u/cmdline: %s", @@ -581,13 +582,13 @@ bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &r } else { - if ( -1 == ::read(cmdlineFd, cmdline, BUF_SIZE - 1 ) ) + if ( -1 == QT_READ(cmdlineFd, cmdline, BUF_SIZE - 1 ) ) { qWarning( "SXE:- Error encountered in reading /proc/%u/cmdline : %s", d.processId, strerror(errno) ); snprintf( cmdline, BUF_SIZE, "%s", "Unknown" ); } - close( cmdlineFd ); + QT_CLOSE( cmdlineFd ); } syslog( LOG_ERR | LOG_LOCAL6, "%s // PID:%u // ProgId:%u // Exe:%s // Request:%s // Cmdline:%s", diff --git a/src/gui/embedded/qunixsocket.cpp b/src/gui/embedded/qunixsocket.cpp index 070d3cf..57a4a11 100644 --- a/src/gui/embedded/qunixsocket.cpp +++ b/src/gui/embedded/qunixsocket.cpp @@ -46,6 +46,7 @@ #include #include #include +#include "private/qcore_unix_p.h" // overrides QT_OPEN #ifdef QUNIXSOCKET_DEBUG #include @@ -131,7 +132,7 @@ struct QUnixSocketRightsPrivate : public QSharedData #ifdef QUNIXSOCKET_DEBUG int closerv = #endif - ::close(fd); + QT_CLOSE(fd); #ifdef QUNIXSOCKET_DEBUG if(0 != closerv) { qDebug() << "QUnixSocketRightsPrivate: Unable to close managed" @@ -162,7 +163,7 @@ QUnixSocketRights::QUnixSocketRights(int fd) if(-1 == fd) { d->fd = -1; } else { - d->fd = ::dup(fd); + d->fd = qt_safe_dup(fd); #ifdef QUNIXSOCKET_DEBUG if(-1 == d->fd) { qDebug() << "QUnixSocketRights: Unable to duplicate fd " @@ -232,7 +233,7 @@ int QUnixSocketRights::dupFd() const { if(-1 == d->fd) return -1; - int rv = ::dup(d->fd); + int rv = qt_safe_dup(d->fd); #ifdef QUNIXSOCKET_DEBUG if(-1 == rv) @@ -825,7 +826,7 @@ public: int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int); for(int ii = 0; ii < numFds; ++ii) - ::close(fds[ii]); + QT_CLOSE(fds[ii]); } h = (::cmsghdr *)CMSG_NXTHDR(&(message), h); @@ -1017,7 +1018,7 @@ connect_error: // Cleanup failed connection #ifdef QUNIXSOCKET_DEBUG int closerv = #endif - ::close(d->fd); + QT_CLOSE(d->fd); #ifdef QUNIXSOCKET_DEBUG if(0 != closerv) { qDebug() << "QUnixSocket: Unable to close file descriptor after " @@ -1762,7 +1763,12 @@ void QUnixSocketPrivate::readActivated() message.msg_controllen = ancillaryBufferCapacity(); message.msg_control = ancillaryBuffer; - int recvrv = ::recvmsg(fd, &message, 0); + int flags = 0; +#ifdef MSG_CMSG_CLOEXEC + flags = MSG_CMSG_CLOEXEC; +#endif + + int recvrv = ::recvmsg(fd, &message, flags); #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Received message (" << recvrv << ')'; #endif diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index 2c359ba..d348e1b 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -55,6 +55,7 @@ #endif #include "qfontengine_qpf_p.h" #include "private/qfactoryloader_p.h" +#include "private/qcore_unix_p.h" // overrides QT_OPEN #include "qabstractfontengine_qws.h" #include "qabstractfontengine_p.h" #include @@ -128,7 +129,7 @@ void QFontDatabasePrivate::addQPF2File(const QByteArray &file) struct stat st; if (stat(file.constData(), &st)) return; - int f = ::open(file, O_RDONLY, 0); + int f = QT_OPEN(file, O_RDONLY, 0); if (f < 0) return; const uchar *data = (const uchar *)mmap(0, st.st_size, PROT_READ, MAP_SHARED, f, 0); @@ -176,7 +177,7 @@ void QFontDatabasePrivate::addQPF2File(const QByteArray &file) #endif } #ifndef QT_FONTS_ARE_RESOURCES - ::close(f); + QT_CLOSE(f); #endif } #endif diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 2df4095..b255694 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -51,6 +51,7 @@ #if !defined(QT_NO_FREETYPE) #include "private/qfontengine_ft_p.h" #endif +#include "private/qcore_unix_p.h" // overrides QT_OPEN // for mmap #include @@ -252,7 +253,7 @@ QList QFontEngineQPF::cleanUpAfterClientCrash(const QList &cras for (int i = 0; i < int(dir.count()); ++i) { const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i])); - int fd = ::open(fileName.constData(), O_RDONLY, 0); + int fd = QT_OPEN(fileName.constData(), O_RDONLY, 0); if (fd >= 0) { void *header = ::mmap(0, sizeof(QFontEngineQPF::Header), PROT_READ, MAP_SHARED, fd, 0); if (header && header != MAP_FAILED) { @@ -265,7 +266,7 @@ QList QFontEngineQPF::cleanUpAfterClientCrash(const QList &cras ::munmap(header, sizeof(QFontEngineQPF::Header)); } - ::close(fd); + QT_CLOSE(fd); } } if (!removedFonts.isEmpty()) @@ -331,15 +332,15 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng qDebug() << "found existing qpf:" << fileName; #endif if (::access(encodedName, W_OK | R_OK) == 0) - fd = ::open(encodedName, O_RDWR, 0); + fd = QT_OPEN(encodedName, O_RDWR, 0); else if (::access(encodedName, R_OK) == 0) - fd = ::open(encodedName, O_RDONLY, 0); + fd = QT_OPEN(encodedName, O_RDONLY, 0); } else { #if defined(DEBUG_FONTENGINE) qDebug() << "creating qpf on the fly:" << fileName; #endif if (::access(QFile::encodeName(qws_fontCacheDir()), W_OK) == 0) { - fd = ::open(encodedName, O_RDWR | O_EXCL | O_CREAT, 0644); + fd = QT_OPEN(encodedName, O_RDWR | O_EXCL | O_CREAT, 0644); QBuffer buffer; buffer.open(QIODevice::ReadWrite); diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 6fb4f15..70ce8f9 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -47,6 +47,7 @@ #include #include #include "qtextengine_p.h" +#include "private/qcore_unix_p.h" // overrides QT_OPEN #include @@ -387,7 +388,7 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) { cache_cost = 1; - int f = ::open( QFile::encodeName(fn), O_RDONLY, 0); + int f = QT_OPEN( QFile::encodeName(fn), O_RDONLY, 0); Q_ASSERT(f>=0); QT_STATBUF st; if ( QT_FSTAT( f, &st ) ) @@ -406,7 +407,7 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) #endif if ( !data || data == (uchar*)MAP_FAILED ) qFatal("Failed to mmap %s",QFile::encodeName(fn).data()); - ::close(f); + QT_CLOSE(f); d = new QFontEngineQPF1Data; memcpy(reinterpret_cast(&d->fm),data,sizeof(d->fm)); -- cgit v0.12 From d7d0d20469d447933c827d169651c3751c7069ad Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 23 Apr 2009 20:07:34 +0200 Subject: Add the support for the EINTR- and CLOEXEC-safe network calls too. The SOCK_NONBLOCK, SOCK_CLOEXEC and accept4(2) calls are Linux-specific. Other platforms get the same behaviour through emulation. Reviewed-By: ossi --- src/network/socket/qnet_unix_p.h | 153 +++++++++++++++++++++++++++++++++++++++ src/network/socket/socket.pri | 3 +- 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 src/network/socket/qnet_unix_p.h diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h new file mode 100644 index 0000000..5256131 --- /dev/null +++ b/src/network/socket/qnet_unix_p.h @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNET_UNIX_P_H +#define QNET_UNIX_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt code on Unix. This header file may change from version to +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qcore_unix_p.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +// Almost always the same. If not, specify in qplatformdefs.h. +#if !defined(QT_SOCKOPTLEN_T) +# define QT_SOCKOPTLEN_T QT_SOCKLEN_T +#endif + +// UnixWare 7 redefines socket -> _socket +static inline int qt_safe_socket(int domain, int type, int protocol, int flags = 0) +{ + Q_ASSERT((flags & ~O_NONBLOCK) == 0); + + register int fd; +#ifdef SOCK_CLOEXEC + int newtype = type | SOCK_CLOEXEC; + if (flags & O_NONBLOCK) + newtype |= SOCK_NONBLOCK; + fd = ::socket(domain, newtype, protocol); + if (fd != -1 || errno != EINVAL) + return fd; +#endif + + fd = ::socket(domain, type, protocol); + if (fd == -1) + return -1; + + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + + // set non-block too? + if (flags & O_NONBLOCK) + ::fcntl(fd, F_SETFL, ::fcntl(fd, F_GETFL) | O_NONBLOCK); + + return fd; +} + +// Tru64 redefines accept -> _accept with _XOPEN_SOURCE_EXTENDED +static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *addrlen, int flags = 0) +{ + Q_ASSERT((flags & ~O_NONBLOCK) == 0); + + register int fd; +#if 0 // no released version of glibc contains accept4 yet + // use accept4 + int sockflags = SOCK_CLOEXEC; + if (flags & O_NONBLOCK) + sockflags |= SOCK_NONBLOCK; + fd = ::accept4(s, addr, static_cast(addrlen), sockflags); + if (fd != -1 || !(errno == ENOSYS || errno == EINVAL)) + return fd; +#endif + + fd = ::accept(s, addr, static_cast(addrlen)); + if (fd == -1) + return -1; + + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + + // set non-block too? + if (flags & O_NONBLOCK) + ::fcntl(fd, F_SETFL, ::fcntl(fd, F_GETFL) | O_NONBLOCK); + + return fd; +} + +// UnixWare 7 redefines listen -> _listen +static inline int qt_safe_listen(int s, int backlog) +{ + return ::listen(s, backlog); +} + +static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SOCKLEN_T addrlen) +{ + register int ret; + EINTR_LOOP(ret, QT_SOCKET_CONNECT(sockfd, addr, addrlen)); + return ret; +} +#undef QT_SOCKET_CONNECT +#define QT_SOCKET_CONNECT qt_safe_connect + +#if defined(socket) +# undef socket +#endif +#if defined(accept) +# undef accept +#endif +#if defined(listen) +# undef listen +#endif + +QT_END_NAMESPACE + +#endif // QNET_UNIX_P_H diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index b1fe64a..17e49d2 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -28,7 +28,8 @@ SOURCES += socket/qabstractsocketengine.cpp \ unix:SOURCES += socket/qnativesocketengine_unix.cpp \ socket/qlocalsocket_unix.cpp \ socket/qlocalserver_unix.cpp - +unix:HEADERS += \ + socket/qnet_unix_p.h win32:SOURCES += socket/qnativesocketengine_win.cpp \ socket/qlocalsocket_win.cpp \ -- cgit v0.12 From 0b757d0c1b6f64d17086621ec692369d37fd62fc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 23 Apr 2009 20:07:47 +0200 Subject: Use the safe versions of the network system calls I have just added. Reviewed-By: ossi --- src/corelib/kernel/qcore_unix.cpp | 63 +++++++++++++++++++++++++ src/corelib/kernel/qcore_unix_p.h | 13 ++++- src/network/socket/qlocalserver_unix.cpp | 9 ++-- src/network/socket/qlocalsocket_p.h | 37 --------------- src/network/socket/qlocalsocket_unix.cpp | 5 +- src/network/socket/qnativesocketengine_unix.cpp | 8 ++-- src/network/socket/qnet_unix_p.h | 2 +- 7 files changed, 88 insertions(+), 49 deletions(-) diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index ffaf958..2549f77 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -119,3 +119,66 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, } QT_END_NAMESPACE + +#ifdef Q_OS_LINUX +// Don't wait for libc to supply the calls we need +// Make syscalls directly + +# if defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204 +// glibc 2.4 has syscall(...) +# include +# include +# else +// no syscall(...) +static inline int syscall(...) { errno = ENOSYS; return -1;} +# endif + +# ifndef __NR_dup3 +# if defined(__i386__) +# define __NR_dup3 330 +# define __NR_pipe2 331 +# elif defined(__x86_64__) +# define __NR_accept4 288 +# define __NR_dup3 292 +# define __NR_pipe2 293 +# elif defined(__ia64__) +# define __NR_accept4 -1 +# define __NR_dup3 1316 +# define __NR_pipe2 1317 +# else +// set the syscalls to absurd numbers so that they'll cause ENOSYS errors +# warning "Please port the pipe2/dup3/accept4 code to this platform" +# define __NR_accept4 -1 +# define __NR_dup3 -1 +# define __NR_pipe2 -1 +# endif +# endif + +QT_BEGIN_NAMESPACE +namespace QtLibcSupplement { + int pipe2(int pipes[], int flags) + { + return syscall(__NR_pipe2, pipes, flags); + } + + int dup3(int oldfd, int newfd, int flags) + { + return syscall(__NR_dup3, oldfd, newfd, flags); + } + + int accept4(int s, sockaddr *addr, QT_SOCKLEN_T *addrlen, int flags) + { +# if defined(__NR_socketcall) + // This platform uses socketcall() instead of raw syscalls + // the SYS_ACCEPT4 number is cross-platform: 18 + return syscall(__NR_socketcall, 18, &s); +# else + return syscall(__NR_accept4, s, addr, addrlen, flags); +# endif + + Q_UNUSED(addr); Q_UNUSED(addrlen); Q_UNUSED(flags); // they're actually used + } +} +QT_END_NAMESPACE +#endif // Q_OS_LINUX + diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 4e3158a..6ae4ff0 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -67,10 +67,21 @@ #include #include +struct sockaddr; + QT_BEGIN_NAMESPACE -#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0209 +#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204 +// Linux supports thread-safe FD_CLOEXEC # define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 1 + +namespace QtLibcSupplement { + Q_CORE_EXPORT int accept4(int, sockaddr *, QT_SOCKLEN_T *, int flags); + Q_CORE_EXPORT int dup3(int oldfd, int newfd, int flags); + Q_CORE_EXPORT int pipe2(int pipes[], int flags); +} + +using namespace QtLibcSupplement; #else # define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 0 #endif diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 1cb804a..c2e05cd 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -43,6 +43,7 @@ #include "qlocalserver_p.h" #include "qlocalsocket.h" #include "qlocalsocket_p.h" +#include "qnet_unix_p.h" #ifndef QT_NO_LOCALSERVER @@ -88,7 +89,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) serverName = requestedServerName; // create the unix socket - listenSocket = qSocket(PF_UNIX, SOCK_STREAM, 0); + listenSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0); if (-1 == listenSocket) { setError(QLatin1String("QLocalServer::listen")); closeServer(); @@ -107,7 +108,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) fullServerName.toLatin1().size() + 1); // bind - if(-1 == qBind(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) { + if(-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) { setError(QLatin1String("QLocalServer::listen")); // if address is in use already, just close the socket, but do not delete the file if(errno == EADDRINUSE) @@ -120,7 +121,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) } // listen for connections - if (-1 == qListen(listenSocket, 50)) { + if (-1 == qt_safe_listen(listenSocket, 50)) { setError(QLatin1String("QLocalServer::listen")); closeServer(); listenSocket = -1; @@ -172,7 +173,7 @@ void QLocalServerPrivate::_q_onNewConnection() ::sockaddr_un addr; QT_SOCKLEN_T length = sizeof(sockaddr_un); - int connectedSocket = qAccept(listenSocket, (sockaddr *)&addr, &length); + int connectedSocket = qt_safe_accept(listenSocket, (sockaddr *)&addr, &length); if(-1 == connectedSocket) { setError(QLatin1String("QLocalSocket::activated")); closeServer(); diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h index 24b5dd6..bdbba42 100644 --- a/src/network/socket/qlocalsocket_p.h +++ b/src/network/socket/qlocalsocket_p.h @@ -74,43 +74,6 @@ QT_BEGIN_NAMESPACE -#if !defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP) -static inline int qSocket(int af, int socketype, int proto) -{ - int ret; - while((ret = qt_socket_socket(af, socketype, proto)) == -1 && errno == EINTR){} - return ret; -} - -static inline int qBind(int fd, const sockaddr *sa, int len) -{ - int ret; - while((ret = QT_SOCKET_BIND(fd, (sockaddr*)sa, len)) == -1 && errno == EINTR){} - return ret; -} - -static inline int qConnect(int fd, const sockaddr *sa, int len) -{ - int ret; - while((ret = QT_SOCKET_CONNECT(fd, (sockaddr*)sa, len)) == -1 && errno == EINTR){} - return ret; -} - -static inline int qListen(int fd, int backlog) -{ - int ret; - while((ret = qt_socket_listen(fd, backlog)) == -1 && errno == EINTR){} - return ret; -} - -static inline int qAccept(int fd, struct sockaddr *addr, QT_SOCKLEN_T *addrlen) -{ - int ret; - while((ret = qt_socket_accept(fd, addr, addrlen)) == -1 && errno == EINTR){} - return ret; -} -#endif //#if !defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP) - #if !defined(Q_OS_WIN) || defined(QT_LOCALSOCKET_TCP) class QLocalUnixSocket : public QTcpSocket { diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 41dac3c..d038794 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -41,6 +41,7 @@ #include "qlocalsocket.h" #include "qlocalsocket_p.h" +#include "qnet_unix_p.h" #ifndef QT_NO_LOCALSOCKET @@ -232,7 +233,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) } // create the socket - if (-1 == (d->connectingSocket = qSocket(PF_UNIX, SOCK_STREAM, 0))) { + if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0))) { d->errorOccurred(UnsupportedSocketOperationError, QLatin1String("QLocalSocket::connectToServer")); return; @@ -282,7 +283,7 @@ void QLocalSocketPrivate::_q_connectToSocket() } ::memcpy(name.sun_path, connectingPathName.toLatin1().data(), connectingPathName.toLatin1().size() + 1); - if (-1 == qConnect(connectingSocket, (struct sockaddr *)&name, sizeof(name))) { + if (-1 == qt_safe_connect(connectingSocket, (struct sockaddr *)&name, sizeof(name))) { QString function = QLatin1String("QLocalSocket::connectToServer"); switch (errno) { diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 6eafe05..0c1fa19 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -42,7 +42,7 @@ //#define QNATIVESOCKETENGINE_DEBUG #include "qnativesocketengine_p.h" -#include "private/qcore_unix_p.h" +#include "private/qnet_unix_p.h" #include "qiodevice.h" #include "qhostaddress.h" #include "qvarlengtharray.h" @@ -162,7 +162,7 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc int protocol = AF_INET; #endif int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM; - int socket = qt_socket_socket(protocol, type, 0); + int socket = qt_safe_socket(protocol, type, 0); if (socket <= 0) { switch (errno) { @@ -467,7 +467,7 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 bool QNativeSocketEnginePrivate::nativeListen(int backlog) { - if (qt_socket_listen(socketDescriptor, backlog) < 0) { + if (qt_safe_listen(socketDescriptor, backlog) < 0) { switch (errno) { case EADDRINUSE: setError(QAbstractSocket::AddressInUseError, @@ -494,7 +494,7 @@ bool QNativeSocketEnginePrivate::nativeListen(int backlog) int QNativeSocketEnginePrivate::nativeAccept() { - int acceptedDescriptor = qt_socket_accept(socketDescriptor, 0, 0); + int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0); #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeAccept() == %i", acceptedDescriptor); #endif diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 5256131..80a4c58 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -100,7 +100,7 @@ static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *add Q_ASSERT((flags & ~O_NONBLOCK) == 0); register int fd; -#if 0 // no released version of glibc contains accept4 yet +#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC // use accept4 int sockflags = SOCK_CLOEXEC; if (flags & O_NONBLOCK) -- cgit v0.12 From a32019f4c2f56a84172bde739d7ea174be0db381 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 Jun 2009 17:22:53 +0200 Subject: Add qobject_cast for QSharedPointer. This obviously only works for classes that derive from QObject. And you must remember that QSharedPointer controls the QObject's lifetime, not the QObject parent-child relationship. Reviewed-by: dt Reviewed-by: Bradley T. Hughes --- src/corelib/tools/qsharedpointer.cpp | 56 +++++++++++ src/corelib/tools/qsharedpointer.h | 3 + src/corelib/tools/qsharedpointer_impl.h | 51 ++++++++++ tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 123 +++++++++++++++++++++++ 4 files changed, 233 insertions(+) diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index ba62ce1..71bf318 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -340,6 +340,23 @@ */ /*! + \fn QSharedPointer QSharedPointer::objectCast() const + + Performs a \ref qobject_cast from this pointer's type to \tt X and + returns a QSharedPointer that shares the reference. If this + function is used to up-cast, then QSharedPointer will perform a \tt + qobject_cast, which means that if the object being pointed by this + QSharedPointer is not of type \tt X, the returned object will be + null. + + Note: the template type \c X must have the same const and volatile + qualifiers as the template of this object, or the cast will + fail. Use constCast() if you need to drop those qualifiers. + + \sa qSharedPointerObjectCast() +*/ + +/*! \fn QWeakPointer QSharedPointer::toWeakRef() const Returns a weak reference object that shares the pointer referenced @@ -718,6 +735,45 @@ */ /*! + \fn QSharedPointer qSharedPointerObjectCast(const QSharedPointer &other) + \relates QSharedPointer + + Returns a shared pointer to the pointer held by \a other, using a + \ref qobject_cast to type \tt X to obtain an internal pointer of the + appropriate type. If the \tt qobject_cast fails, the object + returned will be null. + + Note that \tt X must have the same cv-qualifiers (\tt const and + \tt volatile) that \tt T has, or the code will fail to + compile. Use qSharedPointerConstCast to cast away the constness. + + \sa QSharedPointer::objectCast(), qSharedPointerCast(), qSharedPointerConstCast() +*/ + +/*! + \fn QSharedPointer qSharedPointerObjectCast(const QWeakPointer &other) + \relates QSharedPointer + \relates QWeakPointer + + Returns a shared pointer to the pointer held by \a other, using a + \ref qobject_cast to type \tt X to obtain an internal pointer of the + appropriate type. If the \tt qobject_cast fails, the object + returned will be null. + + The \a other object is converted first to a strong reference. If + that conversion fails (because the object it's pointing to has + already been deleted), this function also returns a null + QSharedPointer. + + Note that \tt X must have the same cv-qualifiers (\tt const and + \tt volatile) that \tt T has, or the code will fail to + compile. Use qSharedPointerConstCast to cast away the constness. + + \sa QWeakPointer::toStrongRef(), qSharedPointerCast(), qSharedPointerConstCast() +*/ + + +/*! \fn QWeakPointer qWeakPointerCast(const QWeakPointer &other) \relates QWeakPointer diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h index cd6bc62..abd83ad 100644 --- a/src/corelib/tools/qsharedpointer.h +++ b/src/corelib/tools/qsharedpointer.h @@ -93,6 +93,7 @@ public: template QSharedPointer staticCast() const; template QSharedPointer dynamicCast() const; template QSharedPointer constCast() const; + template QSharedPointer objectCast() const; }; template @@ -136,6 +137,8 @@ template QSharedPointer qSharedPointerDynamicCast(const QS template QSharedPointer qSharedPointerDynamicCast(const QWeakPointer &src); template QSharedPointer qSharedPointerConstCast(const QSharedPointer &src); template QSharedPointer qSharedPointerConstCast(const QWeakPointer &src); +template QSharedPointer qSharedPointerObjectCast(const QSharedPointer &src); +template QSharedPointer qSharedPointerObjectCast(const QWeakPointer &src); template QWeakPointer qWeakPointerCast(const QWeakPointer &src); diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 2797622..df31fec 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -49,6 +49,7 @@ #endif #include +#include // for qobject_cast QT_BEGIN_HEADER @@ -83,6 +84,11 @@ QSharedPointer qSharedPointerDynamicCast(const QSharedPointer &ptr); template QSharedPointer qSharedPointerConstCast(const QSharedPointer &ptr); +#ifndef QT_NO_QOBJECT +template +QSharedPointer qSharedPointerObjectCast(const QSharedPointer &ptr); +#endif + namespace QtSharedPointer { template class InternalRefCount; template class ExternalRefCount; @@ -330,6 +336,14 @@ public: return qSharedPointerConstCast(*this); } +#ifndef QT_NO_QOBJECT + template + QSharedPointer objectCast() const + { + return qSharedPointerObjectCast(*this); + } +#endif + inline void clear() { *this = QSharedPointer(); } QWeakPointer toWeakRef() const; @@ -545,6 +559,43 @@ QWeakPointer qWeakPointerCast(const QSharedPointer &src) return qSharedPointerCast(src).toWeakRef(); } +#ifndef QT_NO_QOBJECT +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerObjectCast(const QSharedPointer &src) +{ + register X *ptr = qobject_cast(src.data()); + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerObjectCast(const QWeakPointer &src) +{ + return qSharedPointerObjectCast(src.toStrongRef()); +} + +# ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +namespace QtSharedPointer { + template struct RemovePointer; + template struct RemovePointer { typedef T Type; }; + template struct RemovePointer > { typedef T Type; }; + template struct RemovePointer > { typedef T Type; }; +} + +template +inline QSharedPointer::Type> +qobject_cast(const QSharedPointer &src) +{ + return qSharedPointerObjectCast::Type, T>(src); +} +template +inline QSharedPointer::Type> +qobject_cast(const QWeakPointer &src) +{ + return qSharedPointerObjectCast::Type, T>(src); +} +# endif + +#endif + QT_END_NAMESPACE QT_END_HEADER diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index db93fc9..57ebdce 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -56,6 +56,7 @@ private slots: void memoryManagement(); void downCast(); void upCast(); + void objectCast(); void differentPointers(); void virtualBaseDifferentPointers(); #ifndef QTEST_NO_RTTI @@ -424,6 +425,109 @@ void tst_QSharedPointer::upCast() QCOMPARE(int(baseptr.d->strongref), 1); } +class OtherObject: public QObject +{ + Q_OBJECT +}; + +void tst_QSharedPointer::objectCast() +{ + { + OtherObject *data = new OtherObject; + QSharedPointer baseptr = QSharedPointer(data); + QVERIFY(baseptr == data); + QVERIFY(data == baseptr); + + // perform object cast + QSharedPointer ptr = qSharedPointerObjectCast(baseptr); + QVERIFY(!ptr.isNull()); + QCOMPARE(ptr.data(), data); + QVERIFY(ptr == data); + + // again: + ptr = baseptr.objectCast(); + QVERIFY(ptr == data); + +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + // again: + ptr = qobject_cast(baseptr); + QVERIFY(ptr == data); + + // again: + ptr = qobject_cast >(baseptr); + QVERIFY(ptr == data); +#endif + } + + { + const OtherObject *data = new OtherObject; + QSharedPointer baseptr = QSharedPointer(data); + QVERIFY(baseptr == data); + QVERIFY(data == baseptr); + + // perform object cast + QSharedPointer ptr = qSharedPointerObjectCast(baseptr); + QVERIFY(!ptr.isNull()); + QCOMPARE(ptr.data(), data); + QVERIFY(ptr == data); + + // again: + ptr = baseptr.objectCast(); + QVERIFY(ptr == data); + +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + // again: + ptr = qobject_cast(baseptr); + QVERIFY(ptr == data); + + // again: + ptr = qobject_cast >(baseptr); + QVERIFY(ptr == data); +#endif + } + + { + OtherObject *data = new OtherObject; + QPointer qptr = data; + QSharedPointer ptr = QSharedPointer(data); + QWeakPointer weakptr = ptr; + + { + // perform object cast + QSharedPointer otherptr = qSharedPointerObjectCast(weakptr); + QVERIFY(otherptr == ptr); + + // again: + otherptr = qobject_cast(weakptr); + QVERIFY(otherptr == ptr); + + // again: + otherptr = qobject_cast >(weakptr); + QVERIFY(otherptr == ptr); + } + + // drop the reference: + ptr.clear(); + QVERIFY(ptr.isNull()); + QVERIFY(qptr.isNull()); + QVERIFY(weakptr.toStrongRef().isNull()); + + // verify that the object casts fail without crash + QSharedPointer otherptr = qSharedPointerObjectCast(weakptr); + QVERIFY(otherptr.isNull()); + +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + // again: + otherptr = qobject_cast(weakptr); + QVERIFY(otherptr.isNull()); + + // again: + otherptr = qobject_cast >(weakptr); + QVERIFY(otherptr.isNull()); +#endif + } +} + void tst_QSharedPointer::differentPointers() { { @@ -939,6 +1043,20 @@ void tst_QSharedPointer::invalidConstructs_data() << "QSharedPointer baseptr = QSharedPointer(new Data);\n" "QSharedPointer ptr;" "ptr = baseptr;"; + QTest::newRow("const-dropping-static-cast") + << &QTest::QExternalTest::tryCompileFail + << "QSharedPointer baseptr = QSharedPointer(new Data);\n" + "qSharedPointerCast(baseptr);"; +#ifndef QTEST_NO_RTTI + QTest::newRow("const-dropping-dynamic-cast") + << &QTest::QExternalTest::tryCompileFail + << "QSharedPointer baseptr = QSharedPointer(new Data);\n" + "qSharedPointerDynamicCast(baseptr);"; +#endif + QTest::newRow("const-dropping-object-cast") + << &QTest::QExternalTest::tryCompileFail + << "QSharedPointer baseptr = QSharedPointer(new QObject);\n" + "qSharedPointerObjectCast(baseptr);"; // arithmethics through automatic cast operators QTest::newRow("arithmethic1") @@ -982,6 +1100,10 @@ void tst_QSharedPointer::invalidConstructs_data() << &QTest::QExternalTest::tryCompileFail << "QSharedPointer ptr1;\n" "QSharedPointer ptr2 = qSharedPointerConstCast(ptr1);"; + QTest::newRow("invalid-cast4") + << &QTest::QExternalTest::tryCompileFail + << "QSharedPointer ptr1;\n" + "QSharedPointer ptr2 = qSharedPointerObjectCast(ptr1);"; } void tst_QSharedPointer::invalidConstructs() @@ -999,6 +1121,7 @@ void tst_QSharedPointer::invalidConstructs() test.setProgramHeader( "#define QT_SHAREDPOINTER_TRACK_POINTERS\n" "#include \n" + "#include \n" "\n" "struct Data { int i; };\n" "struct DerivedData: public Data { int j; };\n" -- cgit v0.12 From fb51a10ee0451274a430227566ae26efb2ac4474 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 Jun 2009 20:52:36 +0200 Subject: Add support for creating the object alongside the Data structure in one go. This avoids one memory allocation. Currently, we only support calling the default constructors. I will *NOT* implement argument passing for C++03. I will implement it with rvalue references for C++0x-capable compilers. --- src/corelib/tools/qsharedpointer_impl.h | 47 +++++++++++ tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 102 ++++++++++++++++++++++- 2 files changed, 147 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index df31fec..cb78f29 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -48,6 +48,7 @@ #pragma qt_sync_stop_processing #endif +#include #include #include // for qobject_cast @@ -190,6 +191,34 @@ namespace QtSharedPointer { }; template + struct ExternalRefCountWithContiguousData: public ExternalRefCountData + { +#ifdef Q_DECL_ALIGN +# ifdef Q_ALIGNOF +# define QSP_ALIGNOF(T) Q_ALIGNOF(T) +# else +# define QSP_ALIGNOF(T) (sizeof(T) >= 16 ? 16 : sizeof(T) >= 8 ? 8 : sizeof(T) >= 4 ? 4 : sizeof(T) >= 2 ? 2 : 1) +# endif + + char data[sizeof(T)] Q_DECL_ALIGN(QSP_ALIGNOF(T)); + inline T *pointer() { return reinterpret_cast(data); } + +# undef QSP_ALIGNOF +#else + union { + char data[sizeof(T) + 16]; + double dummy1; +# ifndef Q_OS_DARWIN + long double dummy2; +# endif + }; + inline T *pointer() { return reinterpret_cast(data + 16 - (quintptr(data) & 0xf)); } +#endif + + inline bool destroy() { this->pointer()->~T(); return true; } + }; + + template class ExternalRefCount: public Basic { typedef ExternalRefCountData Data; @@ -220,6 +249,16 @@ namespace QtSharedPointer { d = new ExternalRefCountWithSpecializedDeleter(ptr, deleter); } + inline void internalCreate() + { + ExternalRefCountWithContiguousData *dd = new ExternalRefCountWithContiguousData; + T *ptr = dd->pointer(); + new (ptr) T(); // create + + Basic::internalConstruct(ptr); + d = dd; + } + inline ExternalRefCount() : d(0) { } inline ~ExternalRefCount() { if (d && !deref()) delete d; } inline ExternalRefCount(const ExternalRefCount &other) : Basic(other), d(other.d) @@ -347,6 +386,14 @@ public: inline void clear() { *this = QSharedPointer(); } QWeakPointer toWeakRef() const; + +public: + static QSharedPointer create() + { + QSharedPointer result; + result.internalCreate(); + return result; + } }; template diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 57ebdce..d6321c7 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -65,8 +65,9 @@ private slots: void dynamicCastVirtualBase(); void dynamicCastFailure(); #endif - void customDeleter(); void constCorrectness(); + void customDeleter(); + void creating(); void validConstructs(); void invalidConstructs_data(); void invalidConstructs(); @@ -104,6 +105,8 @@ public: { delete this; } + + virtual int classLevel() { return 1; } }; int Data::generationCounter = 0; int Data::destructorCounter = 0; @@ -311,6 +314,8 @@ public: { delete this; } + + virtual int classLevel() { return 2; } }; int DerivedData::derivedDestructorCounter = 0; @@ -318,15 +323,23 @@ class Stuffing { public: char buffer[16]; + Stuffing() { for (uint i = 0; i < sizeof buffer; ++i) buffer[i] = 16 - i; } virtual ~Stuffing() { } }; class DiffPtrDerivedData: public Stuffing, public Data { +public: + virtual int classLevel() { return 3; } }; class VirtualDerived: virtual public Data { +public: + int moreData; + + VirtualDerived() : moreData(0xc0ffee) { } + virtual int classLevel() { return 4; } }; void tst_QSharedPointer::downCast() @@ -972,6 +985,82 @@ void tst_QSharedPointer::customDeleter() QCOMPARE(derivedDataDeleter.callCount, 1); } +void tst_QSharedPointer::creating() +{ + Data::generationCounter = Data::destructorCounter = 0; + { + QSharedPointer ptr = QSharedPointer::create(); + QVERIFY(ptr.data()); + QCOMPARE(Data::generationCounter, 1); + QCOMPARE(ptr->generation, 1); + QCOMPARE(Data::destructorCounter, 0); + + QCOMPARE(ptr->classLevel(), 1); + + ptr.clear(); + QCOMPARE(Data::destructorCounter, 1); + } + + Data::generationCounter = Data::destructorCounter = 0; + { + QSharedPointer ptr = QSharedPointer::create(); + QWeakPointer weakptr = ptr; + QtSharedPointer::ExternalRefCountData *d = ptr.d; + + ptr.clear(); + QVERIFY(ptr.isNull()); + QCOMPARE(Data::destructorCounter, 1); + + // valgrind will complain here if something happened to the pointer + QVERIFY(d->weakref == 1); + QVERIFY(d->strongref == 0); + } + + Data::generationCounter = Data::destructorCounter = 0; + DerivedData::derivedDestructorCounter = 0; + { + QSharedPointer ptr = QSharedPointer::create(); + QCOMPARE(ptr->classLevel(), 2); + QCOMPARE(ptr.staticCast()->moreData, 0); + ptr.clear(); + + QCOMPARE(Data::destructorCounter, 1); + QCOMPARE(DerivedData::derivedDestructorCounter, 1); + } + + { + QSharedPointer ptr = QSharedPointer::create(); + QCOMPARE(ptr->classLevel(), 3); + QCOMPARE(ptr.staticCast()->buffer[7]+0, 16-7); + QCOMPARE(ptr.staticCast()->buffer[3]+0, 16-3); + QCOMPARE(ptr.staticCast()->buffer[0]+0, 16); + } + + { + QSharedPointer ptr = QSharedPointer::create(); + QCOMPARE(ptr->classLevel(), 4); + QCOMPARE(ptr->moreData, 0xc0ffee); + + QSharedPointer baseptr = ptr; + QCOMPARE(baseptr->classLevel(), 4); + } + + { + QSharedPointer ptr = QSharedPointer::create(); + QCOMPARE(ptr->metaObject(), &QObject::staticMetaObject); + + QPointer qptr = ptr.data(); + ptr.clear(); + + QVERIFY(qptr.isNull()); + } + + { + QSharedPointer ptr = QSharedPointer::create(); + QCOMPARE(ptr->metaObject(), &OtherObject::staticMetaObject); + } +} + void tst_QSharedPointer::validConstructs() { { @@ -1021,6 +1110,9 @@ void tst_QSharedPointer::invalidConstructs_data() QTest::newRow("forward-declaration") << &QTest::QExternalTest::tryCompileFail << "QSharedPointer ptr;"; + QTest::newRow("creating-forward-declaration") + << &QTest::QExternalTest::tryCompileFail + << "QSharedPointer::create();"; // upcast without cast operator: QTest::newRow("upcast1") @@ -1053,10 +1145,16 @@ void tst_QSharedPointer::invalidConstructs_data() << "QSharedPointer baseptr = QSharedPointer(new Data);\n" "qSharedPointerDynamicCast(baseptr);"; #endif - QTest::newRow("const-dropping-object-cast") + QTest::newRow("const-dropping-object-cast1") << &QTest::QExternalTest::tryCompileFail << "QSharedPointer baseptr = QSharedPointer(new QObject);\n" "qSharedPointerObjectCast(baseptr);"; +#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION + QTest::newRow("const-dropping-object-cast2") + << &QTest::QExternalTest::tryCompileFail + << "QSharedPointer baseptr = QSharedPointer(new QObject);\n" + "qobject_cast(baseptr);"; +#endif // arithmethics through automatic cast operators QTest::newRow("arithmethic1") -- cgit v0.12 From 6f673e2cf55755a97aeb8971994ab9fc62fb794e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 Jun 2009 21:01:24 +0200 Subject: Experimental: allow QSharedPointer to be used with forward declarations that are declared in this file. The one-definition rule allows the forward declaration appearing below to apply to code that was earlier. Therefore, if the compiler finds out how to delete the object, we can allow a QSharedPointer of a forward- declared-type. This means the actual problem is just a warning with g++. To catch the error, we need a separate .cpp file and I'd rather run this as an external test. --- src/corelib/tools/qsharedpointer_impl.h | 2 +- tests/auto/qsharedpointer/externaltests.cpp | 20 ++++++++- tests/auto/qsharedpointer/externaltests.h | 4 ++ tests/auto/qsharedpointer/externaltests.pri | 1 + tests/auto/qsharedpointer/forwarddeclaration.cpp | 52 +++++++++++++++++++++++ tests/auto/qsharedpointer/forwarddeclared.cpp | 53 +++++++++++++++++++++++ tests/auto/qsharedpointer/forwarddeclared.h | 54 ++++++++++++++++++++++++ tests/auto/qsharedpointer/qsharedpointer.pro | 9 ++-- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 42 +++++++++++++++--- 9 files changed, 224 insertions(+), 13 deletions(-) create mode 100644 tests/auto/qsharedpointer/forwarddeclaration.cpp create mode 100644 tests/auto/qsharedpointer/forwarddeclared.cpp create mode 100644 tests/auto/qsharedpointer/forwarddeclared.h diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index cb78f29..2fa9eb2 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -129,7 +129,7 @@ namespace QtSharedPointer { inline T *operator->() const { return data(); } protected: - inline Basic() : value(0 * sizeof(T)) { } + inline Basic() : value(0) { } // ~Basic(); inline void verifyReconstruction(const T *ptr) diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp index 75ac5f1..8077b84 100644 --- a/tests/auto/qsharedpointer/externaltests.cpp +++ b/tests/auto/qsharedpointer/externaltests.cpp @@ -59,7 +59,7 @@ static QString makespec() { static const char default_makespec[] = DEFAULT_MAKESPEC; const char *p; - for (p = default_makespec + sizeof(default_makespec); p >= default_makespec; --p) + for (p = default_makespec + sizeof(default_makespec) - 1; p >= default_makespec; --p) if (*p == '/' || *p == '\\') break; @@ -122,6 +122,7 @@ namespace QTest { enum Target { Compile, Link, Run }; QList qmakeLines; + QStringList extraProgramSources; QByteArray programHeader; QExternalTest::QtModules qtModules; QExternalTest::ApplicationType appType; @@ -199,6 +200,16 @@ namespace QTest { d->appType = type; } + QStringList QExternalTest::extraProgramSources() const + { + return d->extraProgramSources; + } + + void QExternalTest::setExtraProgramSources(const QStringList &extra) + { + d->extraProgramSources = extra; + } + QByteArray QExternalTest::programHeader() const { return d->programHeader; @@ -483,6 +494,13 @@ namespace QTest { else projectFile.write("\nCONFIG += release\n"); + QByteArray extraSources = QFile::encodeName(extraProgramSources.join(" ")); + if (!extraSources.isEmpty()) { + projectFile.write("SOURCES += "); + projectFile.write(extraSources); + projectFile.putChar('\n'); + } + // Add Qt modules if (qtModules & QExternalTest::QtCore) projectFile.write("QT += core\n"); diff --git a/tests/auto/qsharedpointer/externaltests.h b/tests/auto/qsharedpointer/externaltests.h index 24a3236..ecc107e 100644 --- a/tests/auto/qsharedpointer/externaltests.h +++ b/tests/auto/qsharedpointer/externaltests.h @@ -45,6 +45,7 @@ #include #include +#include QT_BEGIN_NAMESPACE namespace QTest { @@ -102,6 +103,9 @@ namespace QTest { ApplicationType applicationType() const; void setApplicationType(ApplicationType type); + QStringList extraProgramSources() const; + void setExtraProgramSources(const QStringList &list); + QByteArray programHeader() const; void setProgramHeader(const QByteArray &header); diff --git a/tests/auto/qsharedpointer/externaltests.pri b/tests/auto/qsharedpointer/externaltests.pri index 717acac..1fdcf65 100644 --- a/tests/auto/qsharedpointer/externaltests.pri +++ b/tests/auto/qsharedpointer/externaltests.pri @@ -1,4 +1,5 @@ SOURCES += $$PWD/externaltests.cpp +HEADERS += $$PWD/externaltests.h cleanedQMAKESPEC = $$replace(QMAKESPEC, \\\\, /) DEFINES += DEFAULT_MAKESPEC=\\\"$$cleanedQMAKESPEC\\\" diff --git a/tests/auto/qsharedpointer/forwarddeclaration.cpp b/tests/auto/qsharedpointer/forwarddeclaration.cpp new file mode 100644 index 0000000..1dbbeec --- /dev/null +++ b/tests/auto/qsharedpointer/forwarddeclaration.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define QT_SHAREDPOINTER_TRACK_POINTERS +#include "qsharedpointer.h" + +class ForwardDeclared; +ForwardDeclared *forwardPointer(); + +void externalForwardDeclaration() +{ + struct Wrapper { QSharedPointer pointer; }; +} + diff --git a/tests/auto/qsharedpointer/forwarddeclared.cpp b/tests/auto/qsharedpointer/forwarddeclared.cpp new file mode 100644 index 0000000..4ab467a --- /dev/null +++ b/tests/auto/qsharedpointer/forwarddeclared.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "forwarddeclared.h" + +ForwardDeclared *forwardPointer() +{ + return new ForwardDeclared; +} + +int forwardDeclaredDestructorRunCount; +ForwardDeclared::~ForwardDeclared() +{ + ++forwardDeclaredDestructorRunCount; +} diff --git a/tests/auto/qsharedpointer/forwarddeclared.h b/tests/auto/qsharedpointer/forwarddeclared.h new file mode 100644 index 0000000..a4cc2b4 --- /dev/null +++ b/tests/auto/qsharedpointer/forwarddeclared.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FORWARDDECLARED_H +#define FORWARDDECLARED_H + +extern int forwardDeclaredDestructorRunCount; +class ForwardDeclared +{ +public: + ~ForwardDeclared(); +}; + +ForwardDeclared *forwardPointer(); + +#endif // FORWARDDECLARED_H diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/qsharedpointer/qsharedpointer.pro index e329803..30c81cb 100644 --- a/tests/auto/qsharedpointer/qsharedpointer.pro +++ b/tests/auto/qsharedpointer/qsharedpointer.pro @@ -1,7 +1,8 @@ load(qttest_p4) - -SOURCES += tst_qsharedpointer.cpp +SOURCES += tst_qsharedpointer.cpp \ + forwarddeclaration.cpp \ + forwarddeclared.cpp QT = core -DEFINES += SRCDIR=\\\"$$PWD\\\" - +DEFINES += SRCDIR=\\\"$$PWD/\\\" include(externaltests.pri) +HEADERS += forwarddeclared.h diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index d6321c7..dd53e3c 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -225,16 +225,37 @@ void tst_QSharedPointer::basics() } class ForwardDeclared; +ForwardDeclared *forwardPointer(); +void externalForwardDeclaration(); +extern int forwardDeclaredDestructorRunCount; + void tst_QSharedPointer::forwardDeclaration1() { - class Wrapper { QSharedPointer pointer; }; + externalForwardDeclaration(); + + struct Wrapper { QSharedPointer pointer; }; + + forwardDeclaredDestructorRunCount = 0; + { + Wrapper w; + w.pointer = QSharedPointer(forwardPointer()); + QVERIFY(!w.pointer.isNull()); + } + QCOMPARE(forwardDeclaredDestructorRunCount, 1); } -class ForwardDeclared { }; +#include "forwarddeclared.h" + void tst_QSharedPointer::forwardDeclaration2() { - class Wrapper { QSharedPointer pointer; }; - Wrapper w; + forwardDeclaredDestructorRunCount = 0; + { + struct Wrapper { QSharedPointer pointer; }; + Wrapper w1, w2; + w1.pointer = QSharedPointer(forwardPointer()); + QVERIFY(!w1.pointer.isNull()); + } + QCOMPARE(forwardDeclaredDestructorRunCount, 1); } void tst_QSharedPointer::memoryManagement() @@ -1108,8 +1129,10 @@ void tst_QSharedPointer::invalidConstructs_data() // use of forward-declared class QTest::newRow("forward-declaration") - << &QTest::QExternalTest::tryCompileFail - << "QSharedPointer ptr;"; + << &QTest::QExternalTest::tryRun + << "forwardDeclaredDestructorRunCount = 0;\n" + "{ QSharedPointer ptr = QSharedPointer(forwardPointer()); }\n" + "exit(forwardDeclaredDestructorRunCount);"; QTest::newRow("creating-forward-declaration") << &QTest::QExternalTest::tryCompileFail << "QSharedPointer::create();"; @@ -1216,6 +1239,7 @@ void tst_QSharedPointer::invalidConstructs() QTest::QExternalTest test; test.setDebugMode(true); test.setQtModules(QTest::QExternalTest::QtCore); + test.setExtraProgramSources(QStringList() << SRCDIR "forwarddeclared.cpp"); test.setProgramHeader( "#define QT_SHAREDPOINTER_TRACK_POINTERS\n" "#include \n" @@ -1223,7 +1247,11 @@ void tst_QSharedPointer::invalidConstructs() "\n" "struct Data { int i; };\n" "struct DerivedData: public Data { int j; };\n" - "struct ForwardDeclared;"); + "\n" + "extern int forwardDeclaredDestructorRunCount;\n" + "struct ForwardDeclared;\n" + "ForwardDeclared *forwardPointer();\n" + ); QFETCH(QString, code); static bool sane = true; -- cgit v0.12 From b3a0229d70ac87d2ae1fd70a7489e3caf66a2f6f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 14:06:04 +0200 Subject: Fix oops in strcmp in QBuffer. Reported via qt-bugs. Reviewed-By: Peter Hartmann --- src/corelib/io/qbuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp index aed5b82..3883d30 100644 --- a/src/corelib/io/qbuffer.cpp +++ b/src/corelib/io/qbuffer.cpp @@ -452,7 +452,7 @@ qint64 QBuffer::writeData(const char *data, qint64 len) */ void QBuffer::connectNotify(const char *signal) { - if (strcmp(signal + 1, "readyRead()") == 0 || strcmp(signal + 1, "bytesWritten(qint64)")) + if (strcmp(signal + 1, "readyRead()") == 0 || strcmp(signal + 1, "bytesWritten(qint64)") == 0) d_func()->signalConnectionCount++; } -- cgit v0.12 From d70839d4fd855d6d5f6bf8d982b677402f71e5ba Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 14:14:51 +0200 Subject: These files don't have to have CRLF line-termination. The other files here don't, so I see no reason why these should --- examples/tools/codecs/encodedfiles/.gitattributes | 2 -- examples/tools/codecs/encodedfiles/iso-8859-1.txt | 12 ++++++------ examples/tools/codecs/encodedfiles/iso-8859-15.txt | 16 ++++++++-------- 3 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 examples/tools/codecs/encodedfiles/.gitattributes diff --git a/examples/tools/codecs/encodedfiles/.gitattributes b/examples/tools/codecs/encodedfiles/.gitattributes deleted file mode 100644 index 996aab2..0000000 --- a/examples/tools/codecs/encodedfiles/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -iso-8859-15.txt -crlf -iso-8859-1.txt -crlf diff --git a/examples/tools/codecs/encodedfiles/iso-8859-1.txt b/examples/tools/codecs/encodedfiles/iso-8859-1.txt index 4a7ebe3..d7fcaca 100644 --- a/examples/tools/codecs/encodedfiles/iso-8859-1.txt +++ b/examples/tools/codecs/encodedfiles/iso-8859-1.txt @@ -1,6 +1,6 @@ -Paulo Coelho: O Gênio e as Rosas -Anna Hallström, Urban Östberg: Svår svenska -Darrell Huff: How to Lie with Statistics -Franz Kafka: Das Schloß -Walter Moers: Die 13½ Leben des Käpt'n Blaubär -Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige +Paulo Coelho: O Gênio e as Rosas +Anna Hallström, Urban Östberg: Svår svenska +Darrell Huff: How to Lie with Statistics +Franz Kafka: Das Schloß +Walter Moers: Die 13½ Leben des Käpt'n Blaubär +Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige diff --git a/examples/tools/codecs/encodedfiles/iso-8859-15.txt b/examples/tools/codecs/encodedfiles/iso-8859-15.txt index cd43ea3..be2d83c 100644 --- a/examples/tools/codecs/encodedfiles/iso-8859-15.txt +++ b/examples/tools/codecs/encodedfiles/iso-8859-15.txt @@ -1,8 +1,8 @@ -Paulo Coelho: O Gênio e as Rosas -Jean-Pierre Coffe: À table en famille avec 15 ¤ par jour -Anna Hallström, Urban Östberg: Svår svenska -Darrell Huff: How to Lie with Statistics -Franz Kafka: Das Schloß -Helena Lehecková: T¨ekkiä suomalaisille -Arthur Rimbaud: ¼uvres complètes -Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige +Paulo Coelho: O Gênio e as Rosas +Jean-Pierre Coffe: À table en famille avec 15 ¤ par jour +Anna Hallström, Urban Östberg: Svår svenska +Darrell Huff: How to Lie with Statistics +Franz Kafka: Das Schloß +Helena Lehecková: T¨ekkiä suomalaisille +Arthur Rimbaud: ¼uvres complètes +Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige -- cgit v0.12 From 349997b5c4167b07d0bdc55beff175b39f3abe75 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 14:18:47 +0200 Subject: Minor: fix spelling in configure.exe -help output. Reported via qt-bugs --- tools/configure/configureapp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 9ee5eef..1e501c5 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1531,7 +1531,7 @@ bool Configure::displayHelp() desc( "-graphicssystem ", "Specify which graphicssystem should be used.\n" "Available values for :"); desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' '); - desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL accelleration, experimental!", ' '); + desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' '); desc( "-help, -h, -?", "Display this information.\n"); -- cgit v0.12 From 3473453dda9f40bf94733bc971b0cc1658e7c3c8 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Thu, 2 Jul 2009 14:28:46 +0200 Subject: Fix a regression where dynamic tooltips wouldn't show up in Cocoa. Tracking of mouse events was only enabled when enableMouseTracking or Hover or a tooltip had been set explictly on the item, but this meant that the dynamic QEvent::Tooltips would never get dispatched. So, in order to help out people that might use this feature, all QCocoaViews must pay the mouse move event tax *sigh*. I added comments in the proper places so that we DO the right thing for a release where we can force the change in behavior. Task-number: 257320 Reviewed-by: Denis --- src/gui/kernel/qapplication.cpp | 7 +++++++ src/gui/kernel/qcocoaview_mac.mm | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 40795d1..c6af728 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -3724,6 +3724,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } } + // ### Qt 5 These dynamic tool tips should be an OPT-IN feature. Some platforms + // like Mac OS X (probably others too), can optimize their views by not + // dispatching mouse move events. We have attributes to control hover, + // and mouse tracking, but as long as we are deciding to implement this + // feature without choice of opting-in or out, you ALWAYS have to have + // tracking enabled. Therefore, the other properties give a false sense of + // performance enhancement. if (e->type() == QEvent::MouseMove && mouse->buttons() == 0) { d->toolTipWidget = w; d->toolTipPos = relpos; diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index ae3265b..17e3313 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -564,11 +564,15 @@ extern "C" { [self removeTrackingArea:t]; } } + + // Ideally, we shouldn't have NSTrackingMouseMoved events included below, it should + // only be turned on if mouseTracking, hover is on or a tool tip is set. + // Unfortunately, Qt will send "tooltip" events on mouse moves, so we need to + // turn it on in ALL case. That means EVERY QCocoaView gets to pay the cost of + // mouse moves delivered to it (Apple recommends keeping it OFF because there + // is a performance hit). So it goes. NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp - | NSTrackingInVisibleRect; - if (qwidget->hasMouseTracking() || !qwidgetprivate->toolTip.isEmpty() - || qwidget->testAttribute(Qt::WA_Hover)) - trackingOptions |= NSTrackingMouseMoved; + | NSTrackingInVisibleRect | NSTrackingMouseMoved; NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:NSMakeRect(0, 0, qwidget->width(), qwidget->height()) -- cgit v0.12 From c4ae87721e011fe44f301c4039f0651a05394162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 2 Jul 2009 14:59:51 +0200 Subject: Speedup item-lookup in Graphics View. We don't have to do a stable sort anymore because the lessThan operator now accounts for the insertion order. This also means we don't have to sort all top-level items to preserve the insertion order in QGraphicsScenePrivate::topLevelItemsInStackingOrder. Reviewed-by: Andreas --- src/gui/graphicsview/qgraphicsitem.cpp | 5 +++ src/gui/graphicsview/qgraphicsitem_p.h | 17 +++++++ src/gui/graphicsview/qgraphicsscene.cpp | 52 ++++++++++------------ src/gui/graphicsview/qgraphicsscene_p.h | 8 ++++ .../graphicsview/qgraphicsscenebsptreeindex.cpp | 12 ++--- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 18 +++----- src/gui/graphicsview/qgraphicssceneindex.cpp | 5 +-- 7 files changed, 65 insertions(+), 52 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 002eab9..9a27ef5 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -4310,6 +4310,7 @@ void QGraphicsItemPrivate::resolveDepth(int parentDepth) void QGraphicsItemPrivate::addChild(QGraphicsItem *child) { needSortChildren = 1; + child->d_ptr->siblingIndex = children.size(); children.append(child); } @@ -4319,6 +4320,10 @@ void QGraphicsItemPrivate::addChild(QGraphicsItem *child) void QGraphicsItemPrivate::removeChild(QGraphicsItem *child) { children.removeOne(child); + // NB! Do not use children.removeAt(child->d_ptr->siblingIndex) because + // the child is not guaranteed to be at the index after the list is sorted. + // (see ensureSortedChildren()). + child->d_ptr->siblingIndex = -1; } /*! diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index a4b2c25..99865b0 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -126,6 +126,7 @@ public: parent(0), transformData(0), index(-1), + siblingIndex(-1), depth(0), acceptedMouseButtons(0x1f), visible(1), @@ -386,6 +387,7 @@ public: } inline QTransform transformToParent() const; + inline void ensureSortedChildren(); QPainterPath cachedClipPath; QRectF childrenBoundingRect; @@ -401,6 +403,7 @@ public: TransformData *transformData; QTransform sceneTransform; int index; + int siblingIndex; int depth; inline QGestureExtraData* extraGestures() const @@ -517,6 +520,12 @@ struct QGraphicsItemPrivate::TransformData { } }; +/*! + \internal +*/ +static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ return qt_closestLeaf(item2, item1); } + /* return the full transform of the item to the parent. This include the position and all the transform data */ @@ -527,6 +536,14 @@ inline QTransform QGraphicsItemPrivate::transformToParent() const return matrix; } +inline void QGraphicsItemPrivate::ensureSortedChildren() +{ + if (needSortChildren) { + qSort(children.begin(), children.end(), qt_notclosestLeaf); + needSortChildren = 0; + } +} + QT_END_NAMESPACE #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 8a032f4..3b1c8ad 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -375,6 +375,7 @@ void QGraphicsScenePrivate::_q_emitUpdated() void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item) { needSortTopLevelItems = true; + item->d_ptr->siblingIndex = topLevelItems.size(); topLevelItems.append(item); } @@ -384,6 +385,10 @@ void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item) void QGraphicsScenePrivate::unregisterTopLevelItem(QGraphicsItem *item) { topLevelItems.removeOne(item); + // NB! Do not use topLevelItems.removeAt(item->d_ptr->siblingIndex) because + // the item is not guaranteed to be at the index after the list is sorted + // (see ensureSortedTopLevelItems()). + item->d_ptr->siblingIndex = -1; } /*! @@ -1084,37 +1089,29 @@ QList QGraphicsScenePrivate::topLevelItemsInStackingOrder(const const QRectF &sceneRect) { if (indexMethod == QGraphicsScene::NoIndex || sceneRect.isNull()) { - if (needSortTopLevelItems) { - needSortTopLevelItems = false; - qStableSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf); - } + ensureSortedTopLevelItems(); return topLevelItems; } - QList tmp = index->estimateItems(sceneRect, Qt::SortOrder(-1), - viewTransform ? *viewTransform : QTransform()); - for (int i = 0; i < tmp.size(); ++i) - tmp.at(i)->topLevelItem()->d_ptr->itemDiscovered = 1; - - // Sort if the toplevel list is unsorted. - if (needSortTopLevelItems) { - needSortTopLevelItems = false; - qStableSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf); - } - + const QList tmp = index->estimateItems(sceneRect, Qt::SortOrder(-1), + viewTransform ? *viewTransform : QTransform()); + // estimateItems returns a list of *all* items, but we are only interested + // in the top-levels (those that are within the rect themselves and those that + // have descendants within the rect). + // ### Look into how we can add this feature to the BSP. QList tli; - for (int i = 0; i < topLevelItems.size(); ++i) { - // ### Investigate smarter ways. Looping through all top level - // items is not optimal. If the BSP tree is to have maximum - // effect, it should be possible to sort the subset of items - // quickly. We must use this approach for now, as it's the only - // current way to keep the stable sorting order (insertion order). - QGraphicsItem *item = topLevelItems.at(i); - if (item->d_ptr->itemDiscovered) { - item->d_ptr->itemDiscovered = 0; - tli << item; + for (int i = 0; i < tmp.size(); ++i) { + QGraphicsItem *topLevelItem = tmp.at(i)->topLevelItem(); + if (!topLevelItem->d_ptr->itemDiscovered) { + tli << topLevelItem; + topLevelItem->d_ptr->itemDiscovered = 1; } } + // Reset discovered bit. + for (int i = 0; i < tli.size(); ++i) + tli.at(i)->d_ptr->itemDiscovered = 0; + + qSort(tli.begin(), tli.end(), qt_notclosestLeaf); return tli; } @@ -4283,10 +4280,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * int i = 0; if (itemHasChildren) { - if (item->d_ptr->needSortChildren) { - item->d_ptr->needSortChildren = 0; - qStableSort(item->d_ptr->children.begin(), item->d_ptr->children.end(), qt_notclosestLeaf); - } + item->d_ptr->ensureSortedChildren(); if (itemClipsChildrenToShape) { painter->save(); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 4842e72..23b0dd5 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -234,6 +234,14 @@ public: item->d_ptr->ignoreOpacity = 0; } + inline void ensureSortedTopLevelItems() + { + if (needSortTopLevelItems) { + qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf); + needSortTopLevelItems = false; + } + } + QStyle *style; QFont font; void setFont_helper(const QFont &font); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index c8d755e..0688cb1 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -242,7 +242,7 @@ void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stac { if (!item->d_ptr->children.isEmpty()) { QList childList = item->d_ptr->children; - qStableSort(childList.begin(), childList.end(), qt_closestLeaf); + qSort(childList.begin(), childList.end(), qt_closestLeaf); for (int i = 0; i < childList.size(); ++i) { QGraphicsItem *item = childList.at(i); if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent)) @@ -281,7 +281,7 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache() topLevels << item; } - qStableSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); + qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf); for (int i = 0; i < topLevels.size(); ++i) climbTree(topLevels.at(i), &stackingOrder); } @@ -446,15 +446,15 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemLi { if (sortCacheEnabled) { if (order == Qt::AscendingOrder) { - qStableSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); + qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); } else if (order == Qt::DescendingOrder) { - qStableSort(itemList->begin(), itemList->end(), closestItemLast_withCache); + qSort(itemList->begin(), itemList->end(), closestItemLast_withCache); } } else { if (order == Qt::AscendingOrder) { - qStableSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); + qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); } else if (order == Qt::DescendingOrder) { - qStableSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); + qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); } } } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 7b431e6..437b17d 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -173,21 +173,13 @@ inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item const QGraphicsItemPrivate *d2 = item2->d_ptr; bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; - if (f1 != f2) return f2; - qreal z1 = d1->z; - qreal z2 = d2->z; - return z1 > z2; + if (f1 != f2) + return f2; + if (d1->z != d2->z) + return d1->z > d2->z; + return d1->siblingIndex > d2->siblingIndex; } -/*! - \internal -*/ -static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - return qt_closestLeaf(item2, item1); -} - - static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) { qreal xp = s.left(); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index b317e8e..d6281e2 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -266,10 +266,7 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe int i = 0; if (itemHasChildren) { // Sort children. - if (item->d_ptr->needSortChildren) { - item->d_ptr->needSortChildren = 0; - qStableSort(item->d_ptr->children.begin(), item->d_ptr->children.end(), qt_notclosestLeaf); - } + item->d_ptr->ensureSortedChildren(); // Clip to shape. if (itemClipsChildrenToShape) -- cgit v0.12 From 501d1395bd3fc6c67e50216345959d31c0db7707 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 15:44:17 +0200 Subject: Revert "Add support for creating the object alongside the Data structure in QSharedPointer" This reverts commit fb51a10ee0451274a430227566ae26efb2ac4474. Sorry, it didn't work. I can fix the MSVC error, but the problem is that older GCC versions (4.2) fail with the following code: template struct Buffer { char buffer[128] __attribute__((aligned(__alignof__(T)))); }; The same works fine in GCC 4.4. --- src/corelib/tools/qsharedpointer_impl.h | 47 ----------- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 102 +---------------------- 2 files changed, 2 insertions(+), 147 deletions(-) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 2fa9eb2..739a949 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -48,7 +48,6 @@ #pragma qt_sync_stop_processing #endif -#include #include #include // for qobject_cast @@ -191,34 +190,6 @@ namespace QtSharedPointer { }; template - struct ExternalRefCountWithContiguousData: public ExternalRefCountData - { -#ifdef Q_DECL_ALIGN -# ifdef Q_ALIGNOF -# define QSP_ALIGNOF(T) Q_ALIGNOF(T) -# else -# define QSP_ALIGNOF(T) (sizeof(T) >= 16 ? 16 : sizeof(T) >= 8 ? 8 : sizeof(T) >= 4 ? 4 : sizeof(T) >= 2 ? 2 : 1) -# endif - - char data[sizeof(T)] Q_DECL_ALIGN(QSP_ALIGNOF(T)); - inline T *pointer() { return reinterpret_cast(data); } - -# undef QSP_ALIGNOF -#else - union { - char data[sizeof(T) + 16]; - double dummy1; -# ifndef Q_OS_DARWIN - long double dummy2; -# endif - }; - inline T *pointer() { return reinterpret_cast(data + 16 - (quintptr(data) & 0xf)); } -#endif - - inline bool destroy() { this->pointer()->~T(); return true; } - }; - - template class ExternalRefCount: public Basic { typedef ExternalRefCountData Data; @@ -249,16 +220,6 @@ namespace QtSharedPointer { d = new ExternalRefCountWithSpecializedDeleter(ptr, deleter); } - inline void internalCreate() - { - ExternalRefCountWithContiguousData *dd = new ExternalRefCountWithContiguousData; - T *ptr = dd->pointer(); - new (ptr) T(); // create - - Basic::internalConstruct(ptr); - d = dd; - } - inline ExternalRefCount() : d(0) { } inline ~ExternalRefCount() { if (d && !deref()) delete d; } inline ExternalRefCount(const ExternalRefCount &other) : Basic(other), d(other.d) @@ -386,14 +347,6 @@ public: inline void clear() { *this = QSharedPointer(); } QWeakPointer toWeakRef() const; - -public: - static QSharedPointer create() - { - QSharedPointer result; - result.internalCreate(); - return result; - } }; template diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index dd53e3c..5cb435a 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -65,9 +65,8 @@ private slots: void dynamicCastVirtualBase(); void dynamicCastFailure(); #endif - void constCorrectness(); void customDeleter(); - void creating(); + void constCorrectness(); void validConstructs(); void invalidConstructs_data(); void invalidConstructs(); @@ -105,8 +104,6 @@ public: { delete this; } - - virtual int classLevel() { return 1; } }; int Data::generationCounter = 0; int Data::destructorCounter = 0; @@ -335,8 +332,6 @@ public: { delete this; } - - virtual int classLevel() { return 2; } }; int DerivedData::derivedDestructorCounter = 0; @@ -344,23 +339,15 @@ class Stuffing { public: char buffer[16]; - Stuffing() { for (uint i = 0; i < sizeof buffer; ++i) buffer[i] = 16 - i; } virtual ~Stuffing() { } }; class DiffPtrDerivedData: public Stuffing, public Data { -public: - virtual int classLevel() { return 3; } }; class VirtualDerived: virtual public Data { -public: - int moreData; - - VirtualDerived() : moreData(0xc0ffee) { } - virtual int classLevel() { return 4; } }; void tst_QSharedPointer::downCast() @@ -1006,82 +993,6 @@ void tst_QSharedPointer::customDeleter() QCOMPARE(derivedDataDeleter.callCount, 1); } -void tst_QSharedPointer::creating() -{ - Data::generationCounter = Data::destructorCounter = 0; - { - QSharedPointer ptr = QSharedPointer::create(); - QVERIFY(ptr.data()); - QCOMPARE(Data::generationCounter, 1); - QCOMPARE(ptr->generation, 1); - QCOMPARE(Data::destructorCounter, 0); - - QCOMPARE(ptr->classLevel(), 1); - - ptr.clear(); - QCOMPARE(Data::destructorCounter, 1); - } - - Data::generationCounter = Data::destructorCounter = 0; - { - QSharedPointer ptr = QSharedPointer::create(); - QWeakPointer weakptr = ptr; - QtSharedPointer::ExternalRefCountData *d = ptr.d; - - ptr.clear(); - QVERIFY(ptr.isNull()); - QCOMPARE(Data::destructorCounter, 1); - - // valgrind will complain here if something happened to the pointer - QVERIFY(d->weakref == 1); - QVERIFY(d->strongref == 0); - } - - Data::generationCounter = Data::destructorCounter = 0; - DerivedData::derivedDestructorCounter = 0; - { - QSharedPointer ptr = QSharedPointer::create(); - QCOMPARE(ptr->classLevel(), 2); - QCOMPARE(ptr.staticCast()->moreData, 0); - ptr.clear(); - - QCOMPARE(Data::destructorCounter, 1); - QCOMPARE(DerivedData::derivedDestructorCounter, 1); - } - - { - QSharedPointer ptr = QSharedPointer::create(); - QCOMPARE(ptr->classLevel(), 3); - QCOMPARE(ptr.staticCast()->buffer[7]+0, 16-7); - QCOMPARE(ptr.staticCast()->buffer[3]+0, 16-3); - QCOMPARE(ptr.staticCast()->buffer[0]+0, 16); - } - - { - QSharedPointer ptr = QSharedPointer::create(); - QCOMPARE(ptr->classLevel(), 4); - QCOMPARE(ptr->moreData, 0xc0ffee); - - QSharedPointer baseptr = ptr; - QCOMPARE(baseptr->classLevel(), 4); - } - - { - QSharedPointer ptr = QSharedPointer::create(); - QCOMPARE(ptr->metaObject(), &QObject::staticMetaObject); - - QPointer qptr = ptr.data(); - ptr.clear(); - - QVERIFY(qptr.isNull()); - } - - { - QSharedPointer ptr = QSharedPointer::create(); - QCOMPARE(ptr->metaObject(), &OtherObject::staticMetaObject); - } -} - void tst_QSharedPointer::validConstructs() { { @@ -1133,9 +1044,6 @@ void tst_QSharedPointer::invalidConstructs_data() << "forwardDeclaredDestructorRunCount = 0;\n" "{ QSharedPointer ptr = QSharedPointer(forwardPointer()); }\n" "exit(forwardDeclaredDestructorRunCount);"; - QTest::newRow("creating-forward-declaration") - << &QTest::QExternalTest::tryCompileFail - << "QSharedPointer::create();"; // upcast without cast operator: QTest::newRow("upcast1") @@ -1168,16 +1076,10 @@ void tst_QSharedPointer::invalidConstructs_data() << "QSharedPointer baseptr = QSharedPointer(new Data);\n" "qSharedPointerDynamicCast(baseptr);"; #endif - QTest::newRow("const-dropping-object-cast1") + QTest::newRow("const-dropping-object-cast") << &QTest::QExternalTest::tryCompileFail << "QSharedPointer baseptr = QSharedPointer(new QObject);\n" "qSharedPointerObjectCast(baseptr);"; -#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION - QTest::newRow("const-dropping-object-cast2") - << &QTest::QExternalTest::tryCompileFail - << "QSharedPointer baseptr = QSharedPointer(new QObject);\n" - "qobject_cast(baseptr);"; -#endif // arithmethics through automatic cast operators QTest::newRow("arithmethic1") -- cgit v0.12 From d9b28812d0065227e6f66817cd9bf917dfadb0f0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 15:49:49 +0200 Subject: Don't compile the FD_CLOEXEC-safe accept4 call if we don't know about SOCK_CLOEXEC --- src/network/socket/qnet_unix_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 80a4c58..ffd5b39 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -100,7 +100,7 @@ static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *add Q_ASSERT((flags & ~O_NONBLOCK) == 0); register int fd; -#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC +#if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK) // use accept4 int sockflags = SOCK_CLOEXEC; if (flags & O_NONBLOCK) -- cgit v0.12 From f30f3e7bdc846baf49ef51721a5b11d31be22cf2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 16:43:40 +0200 Subject: Fix build with MSVC2003: apparently the code path I thought was Unix was also older MSVC --- src/corelib/io/qtemporaryfile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 2ae4611..b520bee 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -61,7 +61,7 @@ #include #if defined(Q_OS_UNIX) -# include "private/qcore_unix_p.h" +# include "private/qcore_unix_p.h" // overrides QT_OPEN #endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) @@ -211,9 +211,9 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen) if ((*doopen = QT_OPEN(targetPath.toLocal8Bit(), O_CREAT|O_EXCL|O_RDWR # else // CE - // this is Unix + // this is Unix or older MSVC if ((*doopen = - qt_safe_open(path, QT_OPEN_CREAT|O_EXCL|QT_OPEN_RDWR + QT_OPEN(path, QT_OPEN_CREAT|O_EXCL|QT_OPEN_RDWR # endif # ifdef QT_LARGEFILE_SUPPORT |QT_OPEN_LARGEFILE -- cgit v0.12 From 8dbdcc129a7bb5f924aeb451799bc4d7495714ba Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 2 Jul 2009 16:41:53 +0200 Subject: QHeaderView: the sizeHint for section now takes the indicator into account for all sections is sorting is enabled. Task-number: 208320 --- src/gui/itemviews/qheaderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index b35c30b..aea288b 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -2540,7 +2540,7 @@ QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const if (opt.icon.isNull()) opt.icon = qvariant_cast(variant); QSize size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this); - if (isSortIndicatorShown() && sortIndicatorSection() == logicalIndex) { + if (isSortIndicatorShown()) { int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this); if (d->orientation == Qt::Horizontal) size.rwidth() += size.height() + margin; -- cgit v0.12 From 097476afe24d69bac65b84b70ed2f93e88875b40 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 1 Jul 2009 14:34:21 +0200 Subject: Implement hitTest Cocoa calls hitTest on our view to determine if the view should get the mouse press. We always said, "yes" and did all the logic ourselves. Turns out that we can say "no" if I'm transparent to mouse events and remove all that code where we do all the work ourselves. Big maintenance win! For the time being I've kept the "transparentViewForEvent" method since it might be useful for others, but no one is using it at the moment and we may just kill it soon. HitTest should handle this situation correctly. --- src/gui/kernel/qcocoaview_mac.mm | 17 ++++++------- src/gui/kernel/qt_cocoa_helpers_mac.mm | 44 ---------------------------------- 2 files changed, 7 insertions(+), 54 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 17e3313..81e06a9 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -554,6 +554,13 @@ extern "C" { return !qwidget->testAttribute(Qt::WA_MacNoClickThrough); } +- (NSView *)hitTest:(NSPoint)aPoint +{ + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) + return nil; // You cannot hit a transparent for mouse event widget. + return [super hitTest:aPoint]; +} + - (void)updateTrackingAreas { QMacCocoaAutoReleasePool pool; @@ -794,16 +801,6 @@ extern "C" { Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]); QWidget *widgetToGetMouse = qwidget; - if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) { - // Simulate passing the event through since Cocoa doesn't do that for us. - // Start by building a tree up. - NSView *candidateView = [self viewUnderTransparentForMouseView:self - widget:widgetToGetMouse - withWindowPoint:windowPoint]; - if (candidateView != nil) { - widgetToGetMouse = QWidget::find(WId(candidateView)); - } - } // Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets // expect the delta to be a multiple of 120. diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 2dd4fdf..241ea44 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -851,50 +851,6 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil]; QPoint qlocalPoint(localPoint.x, localPoint.y); - if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) { - // Simulate passing the event through since Cocoa doesn't do that for us. - // Start by building a tree up. - NSView *candidateView = [theView viewUnderTransparentForMouseView:tmpView - widget:widgetToGetMouse - withWindowPoint:windowPoint]; - if (candidateView != nil) { - // Fast-track our views, since dispatching trough the normal ways - // would just end up going through here anyway. - if ([candidateView isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) { - return qt_mac_handleMouseEvent(candidateView, theEvent, eventType, button); - } else { - switch (eventType) { - default: - qWarning("not handled! %d", eventType); - break; - case QEvent::MouseMove: - [candidateView mouseMoved:theEvent]; - break; - case QEvent::MouseButtonPress: - if (button == Qt::LeftButton) - [candidateView mouseDown:theEvent]; - else if (button == Qt::RightButton) - [candidateView rightMouseDown:theEvent]; - else - [candidateView otherMouseDown:theEvent]; - break; - case QEvent::MouseButtonRelease: - if (button == Qt::LeftButton) - [candidateView mouseUp:theEvent]; - else if (button == Qt::RightButton) - [candidateView rightMouseUp:theEvent]; - else - [candidateView otherMouseUp:theEvent]; - break; - } - return true; // We've done the dispatching, no need go further. - } - } - // Nothing below me return false - return false; - } - - EventRef carbonEvent = static_cast(const_cast([theEvent eventRef])); if (qt_mac_sendMacEventToWidget(widgetToGetMouse, carbonEvent)) return true; -- cgit v0.12 From c6cc00316b2ce95adddc9fdb658d737057b40682 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 2 Jul 2009 16:25:44 +0200 Subject: Drag and drop events are not delivered correctly in Cocoa Drag and drop events should consider the WA_TransparentForMouseEvents attribute like the mouse events. If this attribute is set for a widget, the event has to be passed to right widget under mouse. The widget is identified by calling hitTest. In such cases the leave event has to be delivered to the widget which actually accepted the enter event. Task-number: 252088 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qcocoaview_mac.mm | 49 ++++++++++++++++++++++++++++++++------- src/gui/kernel/qcocoaview_mac_p.h | 2 ++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 81e06a9..4479531 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -288,11 +288,18 @@ extern "C" { { if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false) return NSDragOperationNone; + NSPoint windowPoint = [sender draggingLocation]; + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { + // pass the drag enter event to the view underneath. + NSView *candidateView = [[[self window] contentView] hitTest:windowPoint]; + if (candidateView && candidateView != self) + return [candidateView draggingEntered:sender]; + } + dragEnterSequence = [sender draggingSequenceNumber]; [self addDropData:sender]; QMimeData *mimeData = dropData; if (QDragManager::self()->source()) mimeData = QDragManager::self()->dragPrivate()->data; - NSPoint windowPoint = [sender draggingLocation]; NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; QPoint posDrag(localPoint.x, localPoint.y); @@ -316,6 +323,9 @@ extern "C" { [self removeDropData]; return NSDragOperationNone; } else { + // save the mouse position, used by draggingExited handler. + DnDParams *dndParams = [QCocoaView currentMouseEvent]; + dndParams->activeDragEnterPos = windowPoint; // send a drag move event immediately after a drag enter event (as per documentation). QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers); qDMEvent.setDropAction(qDEEvent.dropAction()); @@ -336,11 +346,22 @@ extern "C" { - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender { - // drag enter event was rejected, so ignore the move event. + NSPoint windowPoint = [sender draggingLocation]; + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { + // pass the drag move event to the view underneath. + NSView *candidateView = [[[self window] contentView] hitTest:windowPoint]; + if (candidateView && candidateView != self) + return [candidateView draggingUpdated:sender]; + } + // in cases like QFocusFrame, the view under the mouse might + // not have received the drag enter. Generate a synthetic + // drag enter event for that view. + if (dragEnterSequence != [sender draggingSequenceNumber]) + [self draggingEntered:sender]; + // drag enter event was rejected, so ignore the move event. if (dropData == 0) return NSDragOperationNone; // return last value, if we are still in the answerRect. - NSPoint windowPoint = [sender draggingLocation]; NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; NSDragOperation nsActions = [sender draggingSourceOperationMask]; @@ -379,21 +400,34 @@ extern "C" { - (void)draggingExited:(id < NSDraggingInfo >)sender { - Q_UNUSED(sender) - // drag enter event was rejected, so ignore the move event. + dragEnterSequence = -1; + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { + // try sending the leave event to the last view which accepted drag enter. + DnDParams *dndParams = [QCocoaView currentMouseEvent]; + NSView *candidateView = [[[self window] contentView] hitTest:dndParams->activeDragEnterPos]; + if (candidateView && candidateView != self) + return [candidateView draggingExited:sender]; + } + // drag enter event was rejected, so ignore the move event. if (dropData) { QDragLeaveEvent de; QApplication::sendEvent(qwidget, &de); [self removeDropData]; } - } - (BOOL)performDragOperation:(id )sender { + NSPoint windowPoint = [sender draggingLocation]; + dragEnterSequence = -1; + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) { + // pass the drop event to the view underneath. + NSView *candidateView = [[[self window] contentView] hitTest:windowPoint]; + if (candidateView && candidateView != self) + return [candidateView performDragOperation:sender]; + } [self addDropData:sender]; - NSPoint windowPoint = [sender draggingLocation]; NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; QPoint posDrop(localPoint.x, localPoint.y); @@ -688,7 +722,6 @@ extern "C" { } if (!lowerView) // Low as we can be at this point. candidateView = viewForDescent; - // Try to go deeper, will also exit out of the loop, if we found the point. viewForDescent = lowerView; lowerView = nil; diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index b4a60b6..7c227cc 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -68,6 +68,7 @@ struct DnDParams NSEvent *theEvent; NSPoint localPoint; NSDragOperation performedAction; + NSPoint activeDragEnterPos; }; QT_END_NAMESPACE @@ -85,6 +86,7 @@ Q_GUI_EXPORT int composingLength; bool sendKeyEvents; QStringList *currentCustomTypes; + NSInteger dragEnterSequence; } - (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; - (void) finishInitWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; -- cgit v0.12 From d2bfae633e99a818c9086846bf330d722afd86f4 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 2 Jul 2009 16:55:38 +0200 Subject: Remove unused function viewUnderTransparentForMouseView in QCocoaView. After we implemented hitTest for QCocoaView, this function is no longer used. Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qcocoaview_mac.mm | 55 --------------------------------------- src/gui/kernel/qcocoaview_mac_p.h | 2 -- 2 files changed, 57 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 4479531..e3ec30a 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -678,61 +678,6 @@ extern "C" { qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); } -- (NSView *)viewUnderTransparentForMouseView:(NSView *)mouseView widget:(QWidget *)widgetToGetMouse - withWindowPoint:(NSPoint)windowPoint -{ - NSMutableArray *viewsToLookAt = [NSMutableArray arrayWithCapacity:5]; - [viewsToLookAt addObject:mouseView]; - QWidget *parentWidget = widgetToGetMouse->parentWidget(); - while (parentWidget) { - [viewsToLookAt addObject:qt_mac_nativeview_for(parentWidget)]; - parentWidget = parentWidget->parentWidget(); - } - - // Now walk through the subviews of each view and determine which subview should - // get the event. We look through all the subviews at a given level with - // the assumption that the last item to be found the candidate has a higher z-order. - // Unfortunately, fast enumeration doesn't go backwards in 10.5, so assume go fast - // forward is quicker than the slow normal way backwards. - NSView *candidateView = nil; - for (NSView *lookView in viewsToLookAt) { - NSPoint tmpPoint = [lookView convertPoint:windowPoint fromView:nil]; - for (NSView *view in [lookView subviews]) { - if (view == mouseView || [view isHidden]) - continue; - NSRect frameRect = [view frame]; - if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) - candidateView = view; - } - if (candidateView) - break; - } - - - if (candidateView != nil) { - // Now that we've got a candidate, we have to dig into it's tree and see where it is. - NSView *lowerView = nil; - NSView *viewForDescent = candidateView; - while (viewForDescent) { - NSPoint tmpPoint = [viewForDescent convertPoint:windowPoint fromView:nil]; - // Apply same rule as above wrt z-order. - for (NSView *view in [viewForDescent subviews]) { - if (![view isHidden] && NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) - lowerView = view; - } - if (!lowerView) // Low as we can be at this point. - candidateView = viewForDescent; - // Try to go deeper, will also exit out of the loop, if we found the point. - viewForDescent = lowerView; - lowerView = nil; - } - } - // I am transparent, so I can't be a candidate. - if (candidateView == mouseView) - candidateView = nil; - return candidateView; -} - - (void)mouseDown:(NSEvent *)theEvent { qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton); diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index 7c227cc..24040ba 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -105,8 +105,6 @@ Q_GUI_EXPORT - (QWidget *)qt_qwidget; - (BOOL)qt_leftButtonIsRightButton; - (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped; -- (NSView *)viewUnderTransparentForMouseView:(NSView *)mouseView widget:(QWidget *)widgetToGetMouse - withWindowPoint:(NSPoint)windowPoint; + (DnDParams*)currentMouseEvent; @end -- cgit v0.12 From 8b8e6a7e12e7f5769b60d827f7c8443aa71c339a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 17:03:59 +0200 Subject: Use void* in the read/write replacements That's what unistd.h uses: void* can receive any pointer, while char* can't --- src/corelib/kernel/qcore_unix_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 6ae4ff0..1f3fe39 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -193,7 +193,7 @@ static inline int qt_safe_dup2(int oldfd, int newfd, int flags = FD_CLOEXEC) return 0; } -static inline qint64 qt_safe_read(int fd, char *data, qint64 maxlen) +static inline qint64 qt_safe_read(int fd, void *data, qint64 maxlen) { qint64 ret = 0; EINTR_LOOP(ret, QT_READ(fd, data, maxlen)); @@ -202,7 +202,7 @@ static inline qint64 qt_safe_read(int fd, char *data, qint64 maxlen) #undef QT_READ #define QT_READ qt_safe_read -static inline qint64 qt_safe_write(int fd, const char *data, qint64 len) +static inline qint64 qt_safe_write(int fd, const void *data, qint64 len) { qint64 ret = 0; EINTR_LOOP(ret, QT_WRITE(fd, data, len)); -- cgit v0.12 From 27360dd89f0ea72610cf2cd725c62f7a7dd2ea91 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Jul 2009 17:09:59 +0200 Subject: Correct #include path for qcore_unix_p.h --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 721f52c..dfed6a4 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -43,7 +43,7 @@ #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_kqueue_p.h" -#include "qcore_unix_p.h" +#include "private/qcore_unix_p.h" #include #include -- cgit v0.12 From 099a32d121cbc80a1a234c3146f4be9b5237e7e8 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 2 Jul 2009 11:46:42 +0200 Subject: Don't insert text into a text widget when a modifier is pressed. For example when an unhandled key sequence (i.e. that has now shortcut assosiated with it) like Alt-L is pressed, we shouldn't insert the 'L' text from the QKeyEvent::text() into the text widget. Reviewed-by: Thomas Zander --- src/gui/text/qtextcontrol.cpp | 3 ++- src/gui/widgets/qlineedit.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index b2ad686..2a590fd 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1245,7 +1245,8 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e) process: { QString text = e->text(); - if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { + if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t')) && + ((e->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) { if (overwriteMode // no need to call deleteChar() if we have a selection, insertText // does it already diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index c7f3e97..d1067a8 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2169,7 +2169,8 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) if (unknown && !d->readOnly) { QString t = event->text(); - if (!t.isEmpty() && t.at(0).isPrint()) { + if (!t.isEmpty() && t.at(0).isPrint() && + ((event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) { insert(t); #ifndef QT_NO_COMPLETER d->complete(event->key()); -- cgit v0.12 From 60e965fd35037f4a27816d2aeccafdff0d6ae9d6 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 15 Jun 2009 16:00:46 +0200 Subject: Refactored gesture api Rewritten the api almost from scratch, making it simplier and more flexible at the same time. The current implementation will not have complex gseturemanager class inside Qt, but the QGesture base class, which represents both a gesture recognizer and a gesture itself with a set of properties. A set of common gestures that can use used in third-party applications (and in Qt itself internally) is supposed to be found in qstandardgestures.h, and a base class for user-defined gestures is in qgesture.h Gesture implementation for Pan on Windows7 has also been added as a reference implementation for platform gestures. --- doc/src/qnamespace.qdoc | 38 +- examples/gestures/browser/Info_mac.plist | 43 - examples/gestures/browser/addbookmarkdialog.ui | 98 -- examples/gestures/browser/autosaver.cpp | 94 -- examples/gestures/browser/autosaver.h | 76 -- examples/gestures/browser/bookmarks.cpp | 987 --------------- examples/gestures/browser/bookmarks.h | 310 ----- examples/gestures/browser/bookmarks.ui | 106 -- examples/gestures/browser/browser.icns | Bin 50218 -> 0 bytes examples/gestures/browser/browser.ico | Bin 15374 -> 0 bytes examples/gestures/browser/browser.pro | 91 -- examples/gestures/browser/browser.rc | 2 - examples/gestures/browser/browserapplication.cpp | 447 ------- examples/gestures/browser/browserapplication.h | 119 -- examples/gestures/browser/browsermainwindow.cpp | 991 --------------- examples/gestures/browser/browsermainwindow.h | 169 --- examples/gestures/browser/chasewidget.cpp | 142 --- examples/gestures/browser/chasewidget.h | 85 -- examples/gestures/browser/cookiejar.cpp | 733 ----------- examples/gestures/browser/cookiejar.h | 204 ---- examples/gestures/browser/cookies.ui | 106 -- examples/gestures/browser/cookiesexceptions.ui | 184 --- examples/gestures/browser/data/addtab.png | Bin 469 -> 0 bytes examples/gestures/browser/data/browser.svg | 411 ------- examples/gestures/browser/data/closetab.png | Bin 516 -> 0 bytes examples/gestures/browser/data/data.qrc | 11 - .../gestures/browser/data/defaultbookmarks.xbel | 40 - examples/gestures/browser/data/defaulticon.png | Bin 1473 -> 0 bytes examples/gestures/browser/data/history.png | Bin 1527 -> 0 bytes examples/gestures/browser/data/loading.gif | Bin 847 -> 0 bytes examples/gestures/browser/downloaditem.ui | 134 -- examples/gestures/browser/downloadmanager.cpp | 579 --------- examples/gestures/browser/downloadmanager.h | 162 --- examples/gestures/browser/downloads.ui | 83 -- examples/gestures/browser/edittableview.cpp | 78 -- examples/gestures/browser/edittableview.h | 61 - examples/gestures/browser/edittreeview.cpp | 77 -- examples/gestures/browser/edittreeview.h | 61 - examples/gestures/browser/history.cpp | 1282 -------------------- examples/gestures/browser/history.h | 350 ------ examples/gestures/browser/history.ui | 106 -- examples/gestures/browser/htmls/htmls.qrc | 5 - examples/gestures/browser/htmls/notfound.html | 63 - examples/gestures/browser/main.cpp | 53 - examples/gestures/browser/modelmenu.cpp | 227 ---- examples/gestures/browser/modelmenu.h | 105 -- examples/gestures/browser/networkaccessmanager.cpp | 171 --- examples/gestures/browser/networkaccessmanager.h | 68 -- examples/gestures/browser/passworddialog.ui | 111 -- examples/gestures/browser/proxy.ui | 104 -- examples/gestures/browser/searchlineedit.cpp | 238 ---- examples/gestures/browser/searchlineedit.h | 103 -- examples/gestures/browser/settings.cpp | 324 ----- examples/gestures/browser/settings.h | 74 -- examples/gestures/browser/settings.ui | 614 ---------- examples/gestures/browser/squeezelabel.cpp | 61 - examples/gestures/browser/squeezelabel.h | 60 - examples/gestures/browser/tabwidget.cpp | 830 ------------- examples/gestures/browser/tabwidget.h | 224 ---- examples/gestures/browser/toolbarsearch.cpp | 161 --- examples/gestures/browser/toolbarsearch.h | 84 -- examples/gestures/browser/urllineedit.cpp | 340 ------ examples/gestures/browser/urllineedit.h | 115 -- examples/gestures/browser/webview.cpp | 363 ------ examples/gestures/browser/webview.h | 124 -- examples/gestures/browser/xbel.cpp | 320 ----- examples/gestures/browser/xbel.h | 113 -- examples/gestures/collidingmice/collidingmice.pro | 18 - .../collidingmice/gesturerecognizerlinjazax.cpp | 213 ---- .../collidingmice/gesturerecognizerlinjazax.h | 106 -- examples/gestures/collidingmice/images/cheese.jpg | Bin 3029 -> 0 bytes examples/gestures/collidingmice/linjazaxgesture.h | 102 -- examples/gestures/collidingmice/main.cpp | 163 --- examples/gestures/collidingmice/mice.qrc | 5 - examples/gestures/collidingmice/mouse.cpp | 200 --- examples/gestures/collidingmice/mouse.h | 72 -- examples/gestures/gestures.pro | 9 +- examples/gestures/graphicsview/graphicsview.pro | 2 - examples/gestures/graphicsview/main.cpp | 150 --- examples/gestures/imageviewer/imagewidget.cpp | 79 +- examples/gestures/imageviewer/imagewidget.h | 14 +- examples/gestures/pannablewebview/main.cpp | 90 -- .../gestures/pannablewebview/pannablewebview.pro | 4 - src/corelib/global/qnamespace.h | 29 - src/corelib/kernel/qcoreevent.cpp | 3 +- src/corelib/kernel/qcoreevent.h | 3 +- src/gui/graphicsview/qgraphicsitem.cpp | 119 -- src/gui/graphicsview/qgraphicsitem.h | 5 - src/gui/graphicsview/qgraphicsitem_p.h | 33 +- src/gui/graphicsview/qgraphicsproxywidget.cpp | 13 - src/gui/graphicsview/qgraphicsscene.cpp | 127 -- src/gui/graphicsview/qgraphicsscene.h | 1 - src/gui/graphicsview/qgraphicsscene_p.h | 8 - src/gui/graphicsview/qgraphicssceneevent.cpp | 249 ---- src/gui/graphicsview/qgraphicssceneevent.h | 43 - src/gui/graphicsview/qgraphicsview.cpp | 14 - src/gui/kernel/kernel.pri | 13 +- src/gui/kernel/qapplication.cpp | 84 +- src/gui/kernel/qapplication.h | 9 - src/gui/kernel/qapplication_p.h | 121 +- src/gui/kernel/qapplication_win.cpp | 89 ++ src/gui/kernel/qdirectionrecognizer.cpp | 182 --- src/gui/kernel/qdirectionrecognizer_p.h | 105 -- src/gui/kernel/qdirectionsimplificator_p.h | 172 --- src/gui/kernel/qevent.cpp | 156 --- src/gui/kernel/qevent.h | 35 - src/gui/kernel/qevent_p.h | 16 + src/gui/kernel/qgesture.cpp | 308 ++--- src/gui/kernel/qgesture.h | 82 +- src/gui/kernel/qgesture_p.h | 35 +- src/gui/kernel/qgesturemanager.cpp | 644 ---------- src/gui/kernel/qgesturemanager_p.h | 126 -- src/gui/kernel/qgesturerecognizer.cpp | 160 --- src/gui/kernel/qgesturerecognizer.h | 87 -- src/gui/kernel/qgesturerecognizer_p.h | 72 -- src/gui/kernel/qgesturestandardrecognizers.cpp | 306 ----- src/gui/kernel/qgesturestandardrecognizers_p.h | 131 -- src/gui/kernel/qstandardgestures.cpp | 254 ++++ src/gui/kernel/qstandardgestures.h | 102 ++ src/gui/kernel/qstandardgestures_p.h | 91 ++ src/gui/kernel/qwidget.cpp | 163 +-- src/gui/kernel/qwidget.h | 7 - src/gui/kernel/qwidget_p.h | 5 - src/gui/widgets/qabstractscrollarea.cpp | 34 +- src/gui/widgets/qabstractscrollarea_p.h | 5 + src/gui/widgets/qplaintextedit.cpp | 32 + src/gui/widgets/qplaintextedit.h | 1 + src/gui/widgets/qplaintextedit_p.h | 5 + src/gui/widgets/qtextedit.cpp | 26 + src/gui/widgets/qtextedit.h | 1 + src/gui/widgets/qtextedit_p.h | 5 +- tests/auto/gestures/tst_gestures.cpp | 29 +- 132 files changed, 1091 insertions(+), 17991 deletions(-) delete mode 100644 examples/gestures/browser/Info_mac.plist delete mode 100644 examples/gestures/browser/addbookmarkdialog.ui delete mode 100644 examples/gestures/browser/autosaver.cpp delete mode 100644 examples/gestures/browser/autosaver.h delete mode 100644 examples/gestures/browser/bookmarks.cpp delete mode 100644 examples/gestures/browser/bookmarks.h delete mode 100644 examples/gestures/browser/bookmarks.ui delete mode 100644 examples/gestures/browser/browser.icns delete mode 100644 examples/gestures/browser/browser.ico delete mode 100644 examples/gestures/browser/browser.pro delete mode 100644 examples/gestures/browser/browser.rc delete mode 100644 examples/gestures/browser/browserapplication.cpp delete mode 100644 examples/gestures/browser/browserapplication.h delete mode 100644 examples/gestures/browser/browsermainwindow.cpp delete mode 100644 examples/gestures/browser/browsermainwindow.h delete mode 100644 examples/gestures/browser/chasewidget.cpp delete mode 100644 examples/gestures/browser/chasewidget.h delete mode 100644 examples/gestures/browser/cookiejar.cpp delete mode 100644 examples/gestures/browser/cookiejar.h delete mode 100644 examples/gestures/browser/cookies.ui delete mode 100644 examples/gestures/browser/cookiesexceptions.ui delete mode 100644 examples/gestures/browser/data/addtab.png delete mode 100644 examples/gestures/browser/data/browser.svg delete mode 100644 examples/gestures/browser/data/closetab.png delete mode 100644 examples/gestures/browser/data/data.qrc delete mode 100644 examples/gestures/browser/data/defaultbookmarks.xbel delete mode 100644 examples/gestures/browser/data/defaulticon.png delete mode 100644 examples/gestures/browser/data/history.png delete mode 100644 examples/gestures/browser/data/loading.gif delete mode 100644 examples/gestures/browser/downloaditem.ui delete mode 100644 examples/gestures/browser/downloadmanager.cpp delete mode 100644 examples/gestures/browser/downloadmanager.h delete mode 100644 examples/gestures/browser/downloads.ui delete mode 100644 examples/gestures/browser/edittableview.cpp delete mode 100644 examples/gestures/browser/edittableview.h delete mode 100644 examples/gestures/browser/edittreeview.cpp delete mode 100644 examples/gestures/browser/edittreeview.h delete mode 100644 examples/gestures/browser/history.cpp delete mode 100644 examples/gestures/browser/history.h delete mode 100644 examples/gestures/browser/history.ui delete mode 100644 examples/gestures/browser/htmls/htmls.qrc delete mode 100644 examples/gestures/browser/htmls/notfound.html delete mode 100644 examples/gestures/browser/main.cpp delete mode 100644 examples/gestures/browser/modelmenu.cpp delete mode 100644 examples/gestures/browser/modelmenu.h delete mode 100644 examples/gestures/browser/networkaccessmanager.cpp delete mode 100644 examples/gestures/browser/networkaccessmanager.h delete mode 100644 examples/gestures/browser/passworddialog.ui delete mode 100644 examples/gestures/browser/proxy.ui delete mode 100644 examples/gestures/browser/searchlineedit.cpp delete mode 100644 examples/gestures/browser/searchlineedit.h delete mode 100644 examples/gestures/browser/settings.cpp delete mode 100644 examples/gestures/browser/settings.h delete mode 100644 examples/gestures/browser/settings.ui delete mode 100644 examples/gestures/browser/squeezelabel.cpp delete mode 100644 examples/gestures/browser/squeezelabel.h delete mode 100644 examples/gestures/browser/tabwidget.cpp delete mode 100644 examples/gestures/browser/tabwidget.h delete mode 100644 examples/gestures/browser/toolbarsearch.cpp delete mode 100644 examples/gestures/browser/toolbarsearch.h delete mode 100644 examples/gestures/browser/urllineedit.cpp delete mode 100644 examples/gestures/browser/urllineedit.h delete mode 100644 examples/gestures/browser/webview.cpp delete mode 100644 examples/gestures/browser/webview.h delete mode 100644 examples/gestures/browser/xbel.cpp delete mode 100644 examples/gestures/browser/xbel.h delete mode 100644 examples/gestures/collidingmice/collidingmice.pro delete mode 100644 examples/gestures/collidingmice/gesturerecognizerlinjazax.cpp delete mode 100644 examples/gestures/collidingmice/gesturerecognizerlinjazax.h delete mode 100644 examples/gestures/collidingmice/images/cheese.jpg delete mode 100644 examples/gestures/collidingmice/linjazaxgesture.h delete mode 100644 examples/gestures/collidingmice/main.cpp delete mode 100644 examples/gestures/collidingmice/mice.qrc delete mode 100644 examples/gestures/collidingmice/mouse.cpp delete mode 100644 examples/gestures/collidingmice/mouse.h delete mode 100644 examples/gestures/graphicsview/graphicsview.pro delete mode 100644 examples/gestures/graphicsview/main.cpp delete mode 100644 examples/gestures/pannablewebview/main.cpp delete mode 100644 examples/gestures/pannablewebview/pannablewebview.pro delete mode 100644 src/gui/kernel/qdirectionrecognizer.cpp delete mode 100644 src/gui/kernel/qdirectionrecognizer_p.h delete mode 100644 src/gui/kernel/qdirectionsimplificator_p.h delete mode 100644 src/gui/kernel/qgesturemanager.cpp delete mode 100644 src/gui/kernel/qgesturemanager_p.h delete mode 100644 src/gui/kernel/qgesturerecognizer.cpp delete mode 100644 src/gui/kernel/qgesturerecognizer.h delete mode 100644 src/gui/kernel/qgesturerecognizer_p.h delete mode 100644 src/gui/kernel/qgesturestandardrecognizers.cpp delete mode 100644 src/gui/kernel/qgesturestandardrecognizers_p.h create mode 100644 src/gui/kernel/qstandardgestures.cpp create mode 100644 src/gui/kernel/qstandardgestures.h create mode 100644 src/gui/kernel/qstandardgestures_p.h diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index e77cc7e..b691ac7 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -2700,20 +2700,6 @@ \internal */ -/*! \enum Qt::GestureType - \since 4.6 - - This enum lists standard gestures. - - \value UnknownGesture An unknown gesture. This enum value shouldn't be used. - \value TapGesture A single tap gesture. - \value DoubleTapGesture A double tap gesture. - \value TrippleTapGesture A tripple tap gesture. - \value TapAndHoldGesture A tap-and-hold (long tap) gesture. - \value PanGesture A pan gesture. - \value PinchGesture A pinch gesture. -*/ - /*! \enum Qt::GestureState \since 4.6 @@ -2722,30 +2708,8 @@ \omitvalue NoGesture \value GestureStarted A continuous gesture has started. - \value GestureUpdated A gesture continiues. + \value GestureUpdated A gesture continues. \value GestureFinished A gesture has finished. \sa QGesture */ - -/*! - \enum Qt::DirectionType - \since 4.6 - - This enum type describes directions. This could be used by the - gesture recognizers. - - \value NoDirection Non-specific direction. - \value LeftDownDirection - \value DownLeftDirection - \value DownDirection - \value RightDownDirection - \value DownRightDirection - \value LeftDirection - \value RightDirection - \value LeftUpDirection - \value UpLeftDirection - \value UpDirection - \value RightUpDirection - \value UpRightDirection -*/ diff --git a/examples/gestures/browser/Info_mac.plist b/examples/gestures/browser/Info_mac.plist deleted file mode 100644 index 5648631..0000000 --- a/examples/gestures/browser/Info_mac.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleIconFile - @ICON@ - CFBundlePackageType - APPL - CFBundleGetInfoString - Created by Qt/QMake - CFBundleIdentifier - com.trolltech.DemoBrowser - CFBundleSignature - ttxt - CFBundleExecutable - @EXECUTABLE@ - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - html - htm - shtml - xht - xhtml - - CFBundleTypeIconFile - @ICON@ - CFBundleTypeName - HTML Document - CFBundleTypeOSTypes - - HTML - - CFBundleTypeRole - Viewer - - - NOTE - DemoBrowser by Nokia Corporation and/or its subsidiary(-ies) - - diff --git a/examples/gestures/browser/addbookmarkdialog.ui b/examples/gestures/browser/addbookmarkdialog.ui deleted file mode 100644 index 3460d7b..0000000 --- a/examples/gestures/browser/addbookmarkdialog.ui +++ /dev/null @@ -1,98 +0,0 @@ - - AddBookmarkDialog - - - - 0 - 0 - 240 - 168 - - - - Add Bookmark - - - - - - Type a name for the bookmark, and choose where to keep it. - - - Qt::PlainText - - - true - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - false - - - - - - - - - buttonBox - accepted() - AddBookmarkDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AddBookmarkDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/examples/gestures/browser/autosaver.cpp b/examples/gestures/browser/autosaver.cpp deleted file mode 100644 index 77888ce..0000000 --- a/examples/gestures/browser/autosaver.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "autosaver.h" - -#include -#include -#include -#include - -#define AUTOSAVE_IN 1000 * 3 // seconds -#define MAXWAIT 1000 * 15 // seconds - -AutoSaver::AutoSaver(QObject *parent) : QObject(parent) -{ - Q_ASSERT(parent); -} - -AutoSaver::~AutoSaver() -{ - if (m_timer.isActive()) - qWarning() << "AutoSaver: still active when destroyed, changes not saved."; -} - -void AutoSaver::changeOccurred() -{ - if (m_firstChange.isNull()) - m_firstChange.start(); - - if (m_firstChange.elapsed() > MAXWAIT) { - saveIfNeccessary(); - } else { - m_timer.start(AUTOSAVE_IN, this); - } -} - -void AutoSaver::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == m_timer.timerId()) { - saveIfNeccessary(); - } else { - QObject::timerEvent(event); - } -} - -void AutoSaver::saveIfNeccessary() -{ - if (!m_timer.isActive()) - return; - m_timer.stop(); - m_firstChange = QTime(); - if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) { - qWarning() << "AutoSaver: error invoking slot save() on parent"; - } -} - diff --git a/examples/gestures/browser/autosaver.h b/examples/gestures/browser/autosaver.h deleted file mode 100644 index e6b44ed..0000000 --- a/examples/gestures/browser/autosaver.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef AUTOSAVER_H -#define AUTOSAVER_H - -#include -#include -#include - -/* - This class will call the save() slot on the parent object when the parent changes. - It will wait several seconds after changed() to combining multiple changes and - prevent continuous writing to disk. - */ -class AutoSaver : public QObject { - -Q_OBJECT - -public: - AutoSaver(QObject *parent); - ~AutoSaver(); - void saveIfNeccessary(); - -public slots: - void changeOccurred(); - -protected: - void timerEvent(QTimerEvent *event); - -private: - QBasicTimer m_timer; - QTime m_firstChange; - -}; - -#endif // AUTOSAVER_H - diff --git a/examples/gestures/browser/bookmarks.cpp b/examples/gestures/browser/bookmarks.cpp deleted file mode 100644 index 125bcbe..0000000 --- a/examples/gestures/browser/bookmarks.cpp +++ /dev/null @@ -1,987 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "bookmarks.h" - -#include "autosaver.h" -#include "browserapplication.h" -#include "history.h" -#include "xbel.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#define BOOKMARKBAR "Bookmarks Bar" -#define BOOKMARKMENU "Bookmarks Menu" - -BookmarksManager::BookmarksManager(QObject *parent) - : QObject(parent) - , m_loaded(false) - , m_saveTimer(new AutoSaver(this)) - , m_bookmarkRootNode(0) - , m_bookmarkModel(0) -{ - connect(this, SIGNAL(entryAdded(BookmarkNode *)), - m_saveTimer, SLOT(changeOccurred())); - connect(this, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)), - m_saveTimer, SLOT(changeOccurred())); - connect(this, SIGNAL(entryChanged(BookmarkNode *)), - m_saveTimer, SLOT(changeOccurred())); -} - -BookmarksManager::~BookmarksManager() -{ - m_saveTimer->saveIfNeccessary(); -} - -void BookmarksManager::changeExpanded() -{ - m_saveTimer->changeOccurred(); -} - -void BookmarksManager::load() -{ - if (m_loaded) - return; - m_loaded = true; - - QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - QString bookmarkFile = dir + QLatin1String("/bookmarks.xbel"); - if (!QFile::exists(bookmarkFile)) - bookmarkFile = QLatin1String(":defaultbookmarks.xbel"); - - XbelReader reader; - m_bookmarkRootNode = reader.read(bookmarkFile); - if (reader.error() != QXmlStreamReader::NoError) { - QMessageBox::warning(0, QLatin1String("Loading Bookmark"), - tr("Error when loading bookmarks on line %1, column %2:\n" - "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); - } - - BookmarkNode *toolbar = 0; - BookmarkNode *menu = 0; - QList others; - for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { - BookmarkNode *node = m_bookmarkRootNode->children().at(i); - if (node->type() == BookmarkNode::Folder) { - // Automatically convert - if (node->title == tr("Toolbar Bookmarks") && !toolbar) { - node->title = tr(BOOKMARKBAR); - } - if (node->title == tr(BOOKMARKBAR) && !toolbar) { - toolbar = node; - } - - // Automatically convert - if (node->title == tr("Menu") && !menu) { - node->title = tr(BOOKMARKMENU); - } - if (node->title == tr(BOOKMARKMENU) && !menu) { - menu = node; - } - } else { - others.append(node); - } - m_bookmarkRootNode->remove(node); - } - Q_ASSERT(m_bookmarkRootNode->children().count() == 0); - if (!toolbar) { - toolbar = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode); - toolbar->title = tr(BOOKMARKBAR); - } else { - m_bookmarkRootNode->add(toolbar); - } - - if (!menu) { - menu = new BookmarkNode(BookmarkNode::Folder, m_bookmarkRootNode); - menu->title = tr(BOOKMARKMENU); - } else { - m_bookmarkRootNode->add(menu); - } - - for (int i = 0; i < others.count(); ++i) - menu->add(others.at(i)); -} - -void BookmarksManager::save() const -{ - if (!m_loaded) - return; - - XbelWriter writer; - QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - QString bookmarkFile = dir + QLatin1String("/bookmarks.xbel"); - if (!writer.write(bookmarkFile, m_bookmarkRootNode)) - qWarning() << "BookmarkManager: error saving to" << bookmarkFile; -} - -void BookmarksManager::addBookmark(BookmarkNode *parent, BookmarkNode *node, int row) -{ - if (!m_loaded) - return; - Q_ASSERT(parent); - InsertBookmarksCommand *command = new InsertBookmarksCommand(this, parent, node, row); - m_commands.push(command); -} - -void BookmarksManager::removeBookmark(BookmarkNode *node) -{ - if (!m_loaded) - return; - - Q_ASSERT(node); - BookmarkNode *parent = node->parent(); - int row = parent->children().indexOf(node); - RemoveBookmarksCommand *command = new RemoveBookmarksCommand(this, parent, row); - m_commands.push(command); -} - -void BookmarksManager::setTitle(BookmarkNode *node, const QString &newTitle) -{ - if (!m_loaded) - return; - - Q_ASSERT(node); - ChangeBookmarkCommand *command = new ChangeBookmarkCommand(this, node, newTitle, true); - m_commands.push(command); -} - -void BookmarksManager::setUrl(BookmarkNode *node, const QString &newUrl) -{ - if (!m_loaded) - return; - - Q_ASSERT(node); - ChangeBookmarkCommand *command = new ChangeBookmarkCommand(this, node, newUrl, false); - m_commands.push(command); -} - -BookmarkNode *BookmarksManager::bookmarks() -{ - if (!m_loaded) - load(); - return m_bookmarkRootNode; -} - -BookmarkNode *BookmarksManager::menu() -{ - if (!m_loaded) - load(); - - for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { - BookmarkNode *node = m_bookmarkRootNode->children().at(i); - if (node->title == tr(BOOKMARKMENU)) - return node; - } - Q_ASSERT(false); - return 0; -} - -BookmarkNode *BookmarksManager::toolbar() -{ - if (!m_loaded) - load(); - - for (int i = m_bookmarkRootNode->children().count() - 1; i >= 0; --i) { - BookmarkNode *node = m_bookmarkRootNode->children().at(i); - if (node->title == tr(BOOKMARKBAR)) - return node; - } - Q_ASSERT(false); - return 0; -} - -BookmarksModel *BookmarksManager::bookmarksModel() -{ - if (!m_bookmarkModel) - m_bookmarkModel = new BookmarksModel(this, this); - return m_bookmarkModel; -} - -void BookmarksManager::importBookmarks() -{ - QString fileName = QFileDialog::getOpenFileName(0, tr("Open File"), - QString(), - tr("XBEL (*.xbel *.xml)")); - if (fileName.isEmpty()) - return; - - XbelReader reader; - BookmarkNode *importRootNode = reader.read(fileName); - if (reader.error() != QXmlStreamReader::NoError) { - QMessageBox::warning(0, QLatin1String("Loading Bookmark"), - tr("Error when loading bookmarks on line %1, column %2:\n" - "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); - } - - importRootNode->setType(BookmarkNode::Folder); - importRootNode->title = (tr("Imported %1").arg(QDate::currentDate().toString(Qt::SystemLocaleShortDate))); - addBookmark(menu(), importRootNode); -} - -void BookmarksManager::exportBookmarks() -{ - QString fileName = QFileDialog::getSaveFileName(0, tr("Save File"), - tr("%1 Bookmarks.xbel").arg(QCoreApplication::applicationName()), - tr("XBEL (*.xbel *.xml)")); - if (fileName.isEmpty()) - return; - - XbelWriter writer; - if (!writer.write(fileName, m_bookmarkRootNode)) - QMessageBox::critical(0, tr("Export error"), tr("error saving bookmarks")); -} - -RemoveBookmarksCommand::RemoveBookmarksCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *parent, int row) - : QUndoCommand(BookmarksManager::tr("Remove Bookmark")) - , m_row(row) - , m_bookmarkManagaer(m_bookmarkManagaer) - , m_node(parent->children().value(row)) - , m_parent(parent) - , m_done(false) -{ -} - -RemoveBookmarksCommand::~RemoveBookmarksCommand() -{ - if (m_done && !m_node->parent()) { - delete m_node; - } -} - -void RemoveBookmarksCommand::undo() -{ - m_parent->add(m_node, m_row); - emit m_bookmarkManagaer->entryAdded(m_node); - m_done = false; -} - -void RemoveBookmarksCommand::redo() -{ - m_parent->remove(m_node); - emit m_bookmarkManagaer->entryRemoved(m_parent, m_row, m_node); - m_done = true; -} - -InsertBookmarksCommand::InsertBookmarksCommand(BookmarksManager *m_bookmarkManagaer, - BookmarkNode *parent, BookmarkNode *node, int row) - : RemoveBookmarksCommand(m_bookmarkManagaer, parent, row) -{ - setText(BookmarksManager::tr("Insert Bookmark")); - m_node = node; -} - -ChangeBookmarkCommand::ChangeBookmarkCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *node, - const QString &newValue, bool title) - : QUndoCommand() - , m_bookmarkManagaer(m_bookmarkManagaer) - , m_title(title) - , m_newValue(newValue) - , m_node(node) -{ - if (m_title) { - m_oldValue = m_node->title; - setText(BookmarksManager::tr("Name Change")); - } else { - m_oldValue = m_node->url; - setText(BookmarksManager::tr("Address Change")); - } -} - -void ChangeBookmarkCommand::undo() -{ - if (m_title) - m_node->title = m_oldValue; - else - m_node->url = m_oldValue; - emit m_bookmarkManagaer->entryChanged(m_node); -} - -void ChangeBookmarkCommand::redo() -{ - if (m_title) - m_node->title = m_newValue; - else - m_node->url = m_newValue; - emit m_bookmarkManagaer->entryChanged(m_node); -} - -BookmarksModel::BookmarksModel(BookmarksManager *bookmarkManager, QObject *parent) - : QAbstractItemModel(parent) - , m_endMacro(false) - , m_bookmarksManager(bookmarkManager) -{ - connect(bookmarkManager, SIGNAL(entryAdded(BookmarkNode *)), - this, SLOT(entryAdded(BookmarkNode *))); - connect(bookmarkManager, SIGNAL(entryRemoved(BookmarkNode *, int, BookmarkNode *)), - this, SLOT(entryRemoved(BookmarkNode *, int, BookmarkNode *))); - connect(bookmarkManager, SIGNAL(entryChanged(BookmarkNode *)), - this, SLOT(entryChanged(BookmarkNode *))); -} - -QModelIndex BookmarksModel::index(BookmarkNode *node) const -{ - BookmarkNode *parent = node->parent(); - if (!parent) - return QModelIndex(); - return createIndex(parent->children().indexOf(node), 0, node); -} - -void BookmarksModel::entryAdded(BookmarkNode *item) -{ - Q_ASSERT(item && item->parent()); - int row = item->parent()->children().indexOf(item); - BookmarkNode *parent = item->parent(); - // item was already added so remove beore beginInsertRows is called - parent->remove(item); - beginInsertRows(index(parent), row, row); - parent->add(item, row); - endInsertRows(); -} - -void BookmarksModel::entryRemoved(BookmarkNode *parent, int row, BookmarkNode *item) -{ - // item was already removed, re-add so beginRemoveRows works - parent->add(item, row); - beginRemoveRows(index(parent), row, row); - parent->remove(item); - endRemoveRows(); -} - -void BookmarksModel::entryChanged(BookmarkNode *item) -{ - QModelIndex idx = index(item); - emit dataChanged(idx, idx); -} - -bool BookmarksModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (row < 0 || count <= 0 || row + count > rowCount(parent)) - return false; - - BookmarkNode *bookmarkNode = node(parent); - for (int i = row + count - 1; i >= row; --i) { - BookmarkNode *node = bookmarkNode->children().at(i); - if (node == m_bookmarksManager->menu() - || node == m_bookmarksManager->toolbar()) - continue; - - m_bookmarksManager->removeBookmark(node); - } - if (m_endMacro) { - m_bookmarksManager->undoRedoStack()->endMacro(); - m_endMacro = false; - } - return true; -} - -QVariant BookmarksModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { - switch (section) { - case 0: return tr("Title"); - case 1: return tr("Address"); - } - } - return QAbstractItemModel::headerData(section, orientation, role); -} - -QVariant BookmarksModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.model() != this) - return QVariant(); - - const BookmarkNode *bookmarkNode = node(index); - switch (role) { - case Qt::EditRole: - case Qt::DisplayRole: - if (bookmarkNode->type() == BookmarkNode::Separator) { - switch (index.column()) { - case 0: return QString(50, 0xB7); - case 1: return QString(); - } - } - - switch (index.column()) { - case 0: return bookmarkNode->title; - case 1: return bookmarkNode->url; - } - break; - case BookmarksModel::UrlRole: - return QUrl(bookmarkNode->url); - break; - case BookmarksModel::UrlStringRole: - return bookmarkNode->url; - break; - case BookmarksModel::TypeRole: - return bookmarkNode->type(); - break; - case BookmarksModel::SeparatorRole: - return (bookmarkNode->type() == BookmarkNode::Separator); - break; - case Qt::DecorationRole: - if (index.column() == 0) { - if (bookmarkNode->type() == BookmarkNode::Folder) - return QApplication::style()->standardIcon(QStyle::SP_DirIcon); - return BrowserApplication::instance()->icon(bookmarkNode->url); - } - } - - return QVariant(); -} - -int BookmarksModel::columnCount(const QModelIndex &parent) const -{ - return (parent.column() > 0) ? 0 : 2; -} - -int BookmarksModel::rowCount(const QModelIndex &parent) const -{ - if (parent.column() > 0) - return 0; - - if (!parent.isValid()) - return m_bookmarksManager->bookmarks()->children().count(); - - const BookmarkNode *item = static_cast(parent.internalPointer()); - return item->children().count(); -} - -QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const -{ - if (row < 0 || column < 0 || row >= rowCount(parent) || column >= columnCount(parent)) - return QModelIndex(); - - // get the parent node - BookmarkNode *parentNode = node(parent); - return createIndex(row, column, parentNode->children().at(row)); -} - -QModelIndex BookmarksModel::parent(const QModelIndex &index) const -{ - if (!index.isValid()) - return QModelIndex(); - - BookmarkNode *itemNode = node(index); - BookmarkNode *parentNode = (itemNode ? itemNode->parent() : 0); - if (!parentNode || parentNode == m_bookmarksManager->bookmarks()) - return QModelIndex(); - - // get the parent's row - BookmarkNode *grandParentNode = parentNode->parent(); - int parentRow = grandParentNode->children().indexOf(parentNode); - Q_ASSERT(parentRow >= 0); - return createIndex(parentRow, 0, parentNode); -} - -bool BookmarksModel::hasChildren(const QModelIndex &parent) const -{ - if (!parent.isValid()) - return true; - const BookmarkNode *parentNode = node(parent); - return (parentNode->type() == BookmarkNode::Folder); -} - -Qt::ItemFlags BookmarksModel::flags(const QModelIndex &index) const -{ - if (!index.isValid()) - return Qt::NoItemFlags; - - Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; - - BookmarkNode *bookmarkNode = node(index); - - if (bookmarkNode != m_bookmarksManager->menu() - && bookmarkNode != m_bookmarksManager->toolbar()) { - flags |= Qt::ItemIsDragEnabled; - if (bookmarkNode->type() != BookmarkNode::Separator) - flags |= Qt::ItemIsEditable; - } - if (hasChildren(index)) - flags |= Qt::ItemIsDropEnabled; - return flags; -} - -Qt::DropActions BookmarksModel::supportedDropActions () const -{ - return Qt::CopyAction | Qt::MoveAction; -} - -#define MIMETYPE QLatin1String("application/bookmarks.xbel") - -QStringList BookmarksModel::mimeTypes() const -{ - QStringList types; - types << MIMETYPE; - return types; -} - -QMimeData *BookmarksModel::mimeData(const QModelIndexList &indexes) const -{ - QMimeData *mimeData = new QMimeData(); - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - foreach (QModelIndex index, indexes) { - if (index.column() != 0 || !index.isValid()) - continue; - QByteArray encodedData; - QBuffer buffer(&encodedData); - buffer.open(QBuffer::ReadWrite); - XbelWriter writer; - const BookmarkNode *parentNode = node(index); - writer.write(&buffer, parentNode); - stream << encodedData; - } - mimeData->setData(MIMETYPE, data); - return mimeData; -} - -bool BookmarksModel::dropMimeData(const QMimeData *data, - Qt::DropAction action, int row, int column, const QModelIndex &parent) -{ - if (action == Qt::IgnoreAction) - return true; - - if (!data->hasFormat(MIMETYPE) - || column > 0) - return false; - - QByteArray ba = data->data(MIMETYPE); - QDataStream stream(&ba, QIODevice::ReadOnly); - if (stream.atEnd()) - return false; - - QUndoStack *undoStack = m_bookmarksManager->undoRedoStack(); - undoStack->beginMacro(QLatin1String("Move Bookmarks")); - - while (!stream.atEnd()) { - QByteArray encodedData; - stream >> encodedData; - QBuffer buffer(&encodedData); - buffer.open(QBuffer::ReadOnly); - - XbelReader reader; - BookmarkNode *rootNode = reader.read(&buffer); - QList children = rootNode->children(); - for (int i = 0; i < children.count(); ++i) { - BookmarkNode *bookmarkNode = children.at(i); - rootNode->remove(bookmarkNode); - row = qMax(0, row); - BookmarkNode *parentNode = node(parent); - m_bookmarksManager->addBookmark(parentNode, bookmarkNode, row); - m_endMacro = true; - } - delete rootNode; - } - return true; -} - -bool BookmarksModel::setData(const QModelIndex &index, const QVariant &value, int role) -{ - if (!index.isValid() || (flags(index) & Qt::ItemIsEditable) == 0) - return false; - - BookmarkNode *item = node(index); - - switch (role) { - case Qt::EditRole: - case Qt::DisplayRole: - if (index.column() == 0) { - m_bookmarksManager->setTitle(item, value.toString()); - break; - } - if (index.column() == 1) { - m_bookmarksManager->setUrl(item, value.toString()); - break; - } - return false; - case BookmarksModel::UrlRole: - m_bookmarksManager->setUrl(item, value.toUrl().toString()); - break; - case BookmarksModel::UrlStringRole: - m_bookmarksManager->setUrl(item, value.toString()); - break; - default: - break; - return false; - } - - return true; -} - -BookmarkNode *BookmarksModel::node(const QModelIndex &index) const -{ - BookmarkNode *itemNode = static_cast(index.internalPointer()); - if (!itemNode) - return m_bookmarksManager->bookmarks(); - return itemNode; -} - - -AddBookmarkProxyModel::AddBookmarkProxyModel(QObject *parent) - : QSortFilterProxyModel(parent) -{ -} - -int AddBookmarkProxyModel::columnCount(const QModelIndex &parent) const -{ - return qMin(1, QSortFilterProxyModel::columnCount(parent)); -} - -bool AddBookmarkProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const -{ - QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); - return sourceModel()->hasChildren(idx); -} - -AddBookmarkDialog::AddBookmarkDialog(const QString &url, const QString &title, QWidget *parent, BookmarksManager *bookmarkManager) - : QDialog(parent) - , m_url(url) - , m_bookmarksManager(bookmarkManager) -{ - setWindowFlags(Qt::Sheet); - if (!m_bookmarksManager) - m_bookmarksManager = BrowserApplication::bookmarksManager(); - setupUi(this); - QTreeView *view = new QTreeView(this); - m_proxyModel = new AddBookmarkProxyModel(this); - BookmarksModel *model = m_bookmarksManager->bookmarksModel(); - m_proxyModel->setSourceModel(model); - view->setModel(m_proxyModel); - view->expandAll(); - view->header()->setStretchLastSection(true); - view->header()->hide(); - view->setItemsExpandable(false); - view->setRootIsDecorated(false); - view->setIndentation(10); - location->setModel(m_proxyModel); - view->show(); - location->setView(view); - BookmarkNode *menu = m_bookmarksManager->menu(); - QModelIndex idx = m_proxyModel->mapFromSource(model->index(menu)); - view->setCurrentIndex(idx); - location->setCurrentIndex(idx.row()); - name->setText(title); -} - -void AddBookmarkDialog::accept() -{ - QModelIndex index = location->view()->currentIndex(); - index = m_proxyModel->mapToSource(index); - if (!index.isValid()) - index = m_bookmarksManager->bookmarksModel()->index(0, 0); - BookmarkNode *parent = m_bookmarksManager->bookmarksModel()->node(index); - BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark); - bookmark->url = m_url; - bookmark->title = name->text(); - m_bookmarksManager->addBookmark(parent, bookmark); - QDialog::accept(); -} - -BookmarksMenu::BookmarksMenu(QWidget *parent) - : ModelMenu(parent) - , m_bookmarksManager(0) -{ - connect(this, SIGNAL(activated(const QModelIndex &)), - this, SLOT(activated(const QModelIndex &))); - setMaxRows(-1); - setHoverRole(BookmarksModel::UrlStringRole); - setSeparatorRole(BookmarksModel::SeparatorRole); -} - -void BookmarksMenu::activated(const QModelIndex &index) -{ - emit openUrl(index.data(BookmarksModel::UrlRole).toUrl()); -} - -bool BookmarksMenu::prePopulated() -{ - m_bookmarksManager = BrowserApplication::bookmarksManager(); - setModel(m_bookmarksManager->bookmarksModel()); - setRootIndex(m_bookmarksManager->bookmarksModel()->index(1, 0)); - // initial actions - for (int i = 0; i < m_initialActions.count(); ++i) - addAction(m_initialActions.at(i)); - if (!m_initialActions.isEmpty()) - addSeparator(); - createMenu(model()->index(0, 0), 1, this); - return true; -} - -void BookmarksMenu::setInitialActions(QList actions) -{ - m_initialActions = actions; - for (int i = 0; i < m_initialActions.count(); ++i) - addAction(m_initialActions.at(i)); -} - -BookmarksDialog::BookmarksDialog(QWidget *parent, BookmarksManager *manager) - : QDialog(parent) -{ - m_bookmarksManager = manager; - if (!m_bookmarksManager) - m_bookmarksManager = BrowserApplication::bookmarksManager(); - setupUi(this); - - tree->setUniformRowHeights(true); - tree->setSelectionBehavior(QAbstractItemView::SelectRows); - tree->setSelectionMode(QAbstractItemView::ContiguousSelection); - tree->setTextElideMode(Qt::ElideMiddle); - m_bookmarksModel = m_bookmarksManager->bookmarksModel(); - m_proxyModel = new TreeProxyModel(this); - connect(search, SIGNAL(textChanged(QString)), - m_proxyModel, SLOT(setFilterFixedString(QString))); - connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne())); - m_proxyModel->setSourceModel(m_bookmarksModel); - tree->setModel(m_proxyModel); - tree->setDragDropMode(QAbstractItemView::InternalMove); - tree->setExpanded(m_proxyModel->index(0, 0), true); - tree->setAlternatingRowColors(true); - QFontMetrics fm(font()); - int header = fm.width(QLatin1Char('m')) * 40; - tree->header()->resizeSection(0, header); - tree->header()->setStretchLastSection(true); - connect(tree, SIGNAL(activated(const QModelIndex&)), - this, SLOT(open())); - tree->setContextMenuPolicy(Qt::CustomContextMenu); - connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(customContextMenuRequested(const QPoint &))); - connect(addFolderButton, SIGNAL(clicked()), - this, SLOT(newFolder())); - expandNodes(m_bookmarksManager->bookmarks()); - setAttribute(Qt::WA_DeleteOnClose); -} - -BookmarksDialog::~BookmarksDialog() -{ - if (saveExpandedNodes(tree->rootIndex())) - m_bookmarksManager->changeExpanded(); -} - -bool BookmarksDialog::saveExpandedNodes(const QModelIndex &parent) -{ - bool changed = false; - for (int i = 0; i < m_proxyModel->rowCount(parent); ++i) { - QModelIndex child = m_proxyModel->index(i, 0, parent); - QModelIndex sourceIndex = m_proxyModel->mapToSource(child); - BookmarkNode *childNode = m_bookmarksModel->node(sourceIndex); - bool wasExpanded = childNode->expanded; - if (tree->isExpanded(child)) { - childNode->expanded = true; - changed |= saveExpandedNodes(child); - } else { - childNode->expanded = false; - } - changed |= (wasExpanded != childNode->expanded); - } - return changed; -} - -void BookmarksDialog::expandNodes(BookmarkNode *node) -{ - for (int i = 0; i < node->children().count(); ++i) { - BookmarkNode *childNode = node->children()[i]; - if (childNode->expanded) { - QModelIndex idx = m_bookmarksModel->index(childNode); - idx = m_proxyModel->mapFromSource(idx); - tree->setExpanded(idx, true); - expandNodes(childNode); - } - } -} - -void BookmarksDialog::customContextMenuRequested(const QPoint &pos) -{ - QMenu menu; - QModelIndex index = tree->indexAt(pos); - index = index.sibling(index.row(), 0); - if (index.isValid() && !tree->model()->hasChildren(index)) { - menu.addAction(tr("Open"), this, SLOT(open())); - menu.addSeparator(); - } - menu.addAction(tr("Delete"), tree, SLOT(removeOne())); - menu.exec(QCursor::pos()); -} - -void BookmarksDialog::open() -{ - QModelIndex index = tree->currentIndex(); - if (!index.parent().isValid()) - return; - emit openUrl(index.sibling(index.row(), 1).data(BookmarksModel::UrlRole).toUrl()); -} - -void BookmarksDialog::newFolder() -{ - QModelIndex currentIndex = tree->currentIndex(); - QModelIndex idx = currentIndex; - if (idx.isValid() && !idx.model()->hasChildren(idx)) - idx = idx.parent(); - if (!idx.isValid()) - idx = tree->rootIndex(); - idx = m_proxyModel->mapToSource(idx); - BookmarkNode *parent = m_bookmarksManager->bookmarksModel()->node(idx); - BookmarkNode *node = new BookmarkNode(BookmarkNode::Folder); - node->title = tr("New Folder"); - m_bookmarksManager->addBookmark(parent, node, currentIndex.row() + 1); -} - -BookmarksToolBar::BookmarksToolBar(BookmarksModel *model, QWidget *parent) - : QToolBar(tr("Bookmark"), parent) - , m_bookmarksModel(model) -{ - connect(this, SIGNAL(actionTriggered(QAction*)), this, SLOT(triggered(QAction*))); - setRootIndex(model->index(0, 0)); - connect(m_bookmarksModel, SIGNAL(modelReset()), this, SLOT(build())); - connect(m_bookmarksModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(build())); - connect(m_bookmarksModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(build())); - connect(m_bookmarksModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(build())); - setAcceptDrops(true); -} - -void BookmarksToolBar::dragEnterEvent(QDragEnterEvent *event) -{ - const QMimeData *mimeData = event->mimeData(); - if (mimeData->hasUrls()) - event->acceptProposedAction(); - QToolBar::dragEnterEvent(event); -} - -void BookmarksToolBar::dropEvent(QDropEvent *event) -{ - const QMimeData *mimeData = event->mimeData(); - if (mimeData->hasUrls() && mimeData->hasText()) { - QList urls = mimeData->urls(); - QAction *action = actionAt(event->pos()); - QString dropText; - if (action) - dropText = action->text(); - int row = -1; - QModelIndex parentIndex = m_root; - for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) { - QModelIndex idx = m_bookmarksModel->index(i, 0, m_root); - QString title = idx.data().toString(); - if (title == dropText) { - row = i; - if (m_bookmarksModel->hasChildren(idx)) { - parentIndex = idx; - row = -1; - } - break; - } - } - BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark); - bookmark->url = urls.at(0).toString(); - bookmark->title = mimeData->text(); - - BookmarkNode *parent = m_bookmarksModel->node(parentIndex); - BookmarksManager *bookmarksManager = m_bookmarksModel->bookmarksManager(); - bookmarksManager->addBookmark(parent, bookmark, row); - event->acceptProposedAction(); - } - QToolBar::dropEvent(event); -} - - -void BookmarksToolBar::setRootIndex(const QModelIndex &index) -{ - m_root = index; - build(); -} - -QModelIndex BookmarksToolBar::rootIndex() const -{ - return m_root; -} - -void BookmarksToolBar::build() -{ - clear(); - for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) { - QModelIndex idx = m_bookmarksModel->index(i, 0, m_root); - if (m_bookmarksModel->hasChildren(idx)) { - QToolButton *button = new QToolButton(this); - button->setPopupMode(QToolButton::InstantPopup); - button->setArrowType(Qt::DownArrow); - button->setText(idx.data().toString()); - ModelMenu *menu = new ModelMenu(this); - connect(menu, SIGNAL(activated(const QModelIndex &)), - this, SLOT(activated(const QModelIndex &))); - menu->setModel(m_bookmarksModel); - menu->setRootIndex(idx); - menu->addAction(new QAction(menu)); - button->setMenu(menu); - button->setToolButtonStyle(Qt::ToolButtonTextOnly); - QAction *a = addWidget(button); - a->setText(idx.data().toString()); - } else { - QAction *action = addAction(idx.data().toString()); - action->setData(idx.data(BookmarksModel::UrlRole)); - } - } -} - -void BookmarksToolBar::triggered(QAction *action) -{ - QVariant v = action->data(); - if (v.canConvert()) { - emit openUrl(v.toUrl()); - } -} - -void BookmarksToolBar::activated(const QModelIndex &index) -{ - emit openUrl(index.data(BookmarksModel::UrlRole).toUrl()); -} - diff --git a/examples/gestures/browser/bookmarks.h b/examples/gestures/browser/bookmarks.h deleted file mode 100644 index 7fcdae1..0000000 --- a/examples/gestures/browser/bookmarks.h +++ /dev/null @@ -1,310 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BOOKMARKS_H -#define BOOKMARKS_H - -#include -#include - -#include - -/*! - Bookmark manager, owner of the bookmarks, loads, saves and basic tasks - */ -class AutoSaver; -class BookmarkNode; -class BookmarksModel; -class BookmarksManager : public QObject -{ - Q_OBJECT - -signals: - void entryAdded(BookmarkNode *item); - void entryRemoved(BookmarkNode *parent, int row, BookmarkNode *item); - void entryChanged(BookmarkNode *item); - -public: - BookmarksManager(QObject *parent = 0); - ~BookmarksManager(); - - void addBookmark(BookmarkNode *parent, BookmarkNode *node, int row = -1); - void removeBookmark(BookmarkNode *node); - void setTitle(BookmarkNode *node, const QString &newTitle); - void setUrl(BookmarkNode *node, const QString &newUrl); - void changeExpanded(); - - BookmarkNode *bookmarks(); - BookmarkNode *menu(); - BookmarkNode *toolbar(); - - BookmarksModel *bookmarksModel(); - QUndoStack *undoRedoStack() { return &m_commands; }; - -public slots: - void importBookmarks(); - void exportBookmarks(); - -private slots: - void save() const; - -private: - void load(); - - bool m_loaded; - AutoSaver *m_saveTimer; - BookmarkNode *m_bookmarkRootNode; - BookmarksModel *m_bookmarkModel; - QUndoStack m_commands; - - friend class RemoveBookmarksCommand; - friend class ChangeBookmarkCommand; -}; - -class RemoveBookmarksCommand : public QUndoCommand -{ - -public: - RemoveBookmarksCommand(BookmarksManager *m_bookmarkManagaer, BookmarkNode *parent, int row); - ~RemoveBookmarksCommand(); - void undo(); - void redo(); - -protected: - int m_row; - BookmarksManager *m_bookmarkManagaer; - BookmarkNode *m_node; - BookmarkNode *m_parent; - bool m_done; -}; - -class InsertBookmarksCommand : public RemoveBookmarksCommand -{ - -public: - InsertBookmarksCommand(BookmarksManager *m_bookmarkManagaer, - BookmarkNode *parent, BookmarkNode *node, int row); - void undo() { RemoveBookmarksCommand::redo(); } - void redo() { RemoveBookmarksCommand::undo(); } - -}; - -class ChangeBookmarkCommand : public QUndoCommand -{ - -public: - ChangeBookmarkCommand(BookmarksManager *m_bookmarkManagaer, - BookmarkNode *node, const QString &newValue, bool title); - void undo(); - void redo(); - -private: - BookmarksManager *m_bookmarkManagaer; - bool m_title; - QString m_oldValue; - QString m_newValue; - BookmarkNode *m_node; -}; - -/*! - BookmarksModel is a QAbstractItemModel wrapper around the BookmarkManager - */ -#include -class BookmarksModel : public QAbstractItemModel -{ - Q_OBJECT - -public slots: - void entryAdded(BookmarkNode *item); - void entryRemoved(BookmarkNode *parent, int row, BookmarkNode *item); - void entryChanged(BookmarkNode *item); - -public: - enum Roles { - TypeRole = Qt::UserRole + 1, - UrlRole = Qt::UserRole + 2, - UrlStringRole = Qt::UserRole + 3, - SeparatorRole = Qt::UserRole + 4 - }; - - BookmarksModel(BookmarksManager *bookmarkManager, QObject *parent = 0); - inline BookmarksManager *bookmarksManager() const { return m_bookmarksManager; } - - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const; - QModelIndex parent(const QModelIndex& index= QModelIndex()) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - Qt::DropActions supportedDropActions () const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - QMimeData *mimeData(const QModelIndexList &indexes) const; - QStringList mimeTypes() const; - bool dropMimeData(const QMimeData *data, - Qt::DropAction action, int row, int column, const QModelIndex &parent); - bool hasChildren(const QModelIndex &parent = QModelIndex()) const; - - BookmarkNode *node(const QModelIndex &index) const; - QModelIndex index(BookmarkNode *node) const; - -private: - - bool m_endMacro; - BookmarksManager *m_bookmarksManager; -}; - -// Menu that is dynamically populated from the bookmarks -#include "modelmenu.h" -class BookmarksMenu : public ModelMenu -{ - Q_OBJECT - -signals: - void openUrl(const QUrl &url); - -public: - BookmarksMenu(QWidget *parent = 0); - void setInitialActions(QList actions); - -protected: - bool prePopulated(); - -private slots: - void activated(const QModelIndex &index); - -private: - BookmarksManager *m_bookmarksManager; - QList m_initialActions; -}; - -/* - Proxy model that filters out the bookmarks so only the folders - are left behind. Used in the add bookmark dialog combobox. - */ -#include -class AddBookmarkProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - AddBookmarkProxyModel(QObject * parent = 0); - int columnCount(const QModelIndex & parent = QModelIndex()) const; - -protected: - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; -}; - -/*! - Add bookmark dialog - */ -#include "ui_addbookmarkdialog.h" -class AddBookmarkDialog : public QDialog, public Ui_AddBookmarkDialog -{ - Q_OBJECT - -public: - AddBookmarkDialog(const QString &url, const QString &title, QWidget *parent = 0, BookmarksManager *bookmarkManager = 0); - -private slots: - void accept(); - -private: - QString m_url; - BookmarksManager *m_bookmarksManager; - AddBookmarkProxyModel *m_proxyModel; -}; - -#include "ui_bookmarks.h" -class TreeProxyModel; -class BookmarksDialog : public QDialog, public Ui_BookmarksDialog -{ - Q_OBJECT - -signals: - void openUrl(const QUrl &url); - -public: - BookmarksDialog(QWidget *parent = 0, BookmarksManager *manager = 0); - ~BookmarksDialog(); - -private slots: - void customContextMenuRequested(const QPoint &pos); - void open(); - void newFolder(); - -private: - void expandNodes(BookmarkNode *node); - bool saveExpandedNodes(const QModelIndex &parent); - - BookmarksManager *m_bookmarksManager; - BookmarksModel *m_bookmarksModel; - TreeProxyModel *m_proxyModel; -}; - -#include -class BookmarksToolBar : public QToolBar -{ - Q_OBJECT - -signals: - void openUrl(const QUrl &url); - -public: - BookmarksToolBar(BookmarksModel *model, QWidget *parent = 0); - void setRootIndex(const QModelIndex &index); - QModelIndex rootIndex() const; - -protected: - void dragEnterEvent(QDragEnterEvent *event); - void dropEvent(QDropEvent *event); - -private slots: - void triggered(QAction *action); - void activated(const QModelIndex &index); - void build(); - -private: - BookmarksModel *m_bookmarksModel; - QPersistentModelIndex m_root; -}; - -#endif // BOOKMARKS_H diff --git a/examples/gestures/browser/bookmarks.ui b/examples/gestures/browser/bookmarks.ui deleted file mode 100644 index c893e94..0000000 --- a/examples/gestures/browser/bookmarks.ui +++ /dev/null @@ -1,106 +0,0 @@ - - BookmarksDialog - - - - 0 - 0 - 758 - 450 - - - - Bookmarks - - - - - - Qt::Horizontal - - - - 252 - 20 - - - - - - - - - - - - - - - - &Remove - - - - - - - Add Folder - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QDialogButtonBox::Ok - - - - - - - - - - SearchLineEdit - QLineEdit -
    searchlineedit.h
    -
    - - EditTreeView - QTreeView -
    edittreeview.h
    -
    -
    - - - - buttonBox - accepted() - BookmarksDialog - accept() - - - 472 - 329 - - - 461 - 356 - - - - -
    diff --git a/examples/gestures/browser/browser.icns b/examples/gestures/browser/browser.icns deleted file mode 100644 index f591ae4..0000000 Binary files a/examples/gestures/browser/browser.icns and /dev/null differ diff --git a/examples/gestures/browser/browser.ico b/examples/gestures/browser/browser.ico deleted file mode 100644 index 7f9be93..0000000 Binary files a/examples/gestures/browser/browser.ico and /dev/null differ diff --git a/examples/gestures/browser/browser.pro b/examples/gestures/browser/browser.pro deleted file mode 100644 index d970f99..0000000 --- a/examples/gestures/browser/browser.pro +++ /dev/null @@ -1,91 +0,0 @@ -TEMPLATE = app -TARGET = browser -QT += webkit network - -CONFIG += qt warn_on -contains(QT_BUILD_PARTS, tools): CONFIG += uitools -else: DEFINES += QT_NO_UITOOLS - -FORMS += \ - addbookmarkdialog.ui \ - bookmarks.ui \ - cookies.ui \ - cookiesexceptions.ui \ - downloaditem.ui \ - downloads.ui \ - history.ui \ - passworddialog.ui \ - proxy.ui \ - settings.ui - -HEADERS += \ - autosaver.h \ - bookmarks.h \ - browserapplication.h \ - browsermainwindow.h \ - chasewidget.h \ - cookiejar.h \ - downloadmanager.h \ - edittableview.h \ - edittreeview.h \ - history.h \ - modelmenu.h \ - networkaccessmanager.h \ - searchlineedit.h \ - settings.h \ - squeezelabel.h \ - tabwidget.h \ - toolbarsearch.h \ - urllineedit.h \ - webview.h \ - xbel.h - -SOURCES += \ - autosaver.cpp \ - bookmarks.cpp \ - browserapplication.cpp \ - browsermainwindow.cpp \ - chasewidget.cpp \ - cookiejar.cpp \ - downloadmanager.cpp \ - edittableview.cpp \ - edittreeview.cpp \ - history.cpp \ - modelmenu.cpp \ - networkaccessmanager.cpp \ - searchlineedit.cpp \ - settings.cpp \ - squeezelabel.cpp \ - tabwidget.cpp \ - toolbarsearch.cpp \ - urllineedit.cpp \ - webview.cpp \ - xbel.cpp \ - main.cpp - -RESOURCES += data/data.qrc htmls/htmls.qrc - -build_all:!build_pass { - CONFIG -= build_all - CONFIG += release -} - -win32 { - RC_FILE = browser.rc -} - -mac { - ICON = browser.icns - QMAKE_INFO_PLIST = Info_mac.plist - TARGET = Browser -} - -wince*: { - DEPLOYMENT_PLUGIN += qjpeg qgif -} - -# install -target.path = $$[QT_INSTALL_DEMOS]/browser -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.plist *.icns *.ico *.rc *.pro *.html *.doc images htmls -sources.path = $$[QT_INSTALL_DEMOS]/browser -INSTALLS += target sources diff --git a/examples/gestures/browser/browser.rc b/examples/gestures/browser/browser.rc deleted file mode 100644 index 89a237c..0000000 --- a/examples/gestures/browser/browser.rc +++ /dev/null @@ -1,2 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "browser.ico" - diff --git a/examples/gestures/browser/browserapplication.cpp b/examples/gestures/browser/browserapplication.cpp deleted file mode 100644 index 718a8ec..0000000 --- a/examples/gestures/browser/browserapplication.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "browserapplication.h" - -#include "bookmarks.h" -#include "browsermainwindow.h" -#include "cookiejar.h" -#include "downloadmanager.h" -#include "history.h" -#include "networkaccessmanager.h" -#include "tabwidget.h" -#include "webview.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -#include - -DownloadManager *BrowserApplication::s_downloadManager = 0; -HistoryManager *BrowserApplication::s_historyManager = 0; -NetworkAccessManager *BrowserApplication::s_networkAccessManager = 0; -BookmarksManager *BrowserApplication::s_bookmarksManager = 0; - -BrowserApplication::BrowserApplication(int &argc, char **argv) - : QApplication(argc, argv) - , m_localServer(0) -{ - QCoreApplication::setOrganizationName(QLatin1String("Trolltech")); - QCoreApplication::setApplicationName(QLatin1String("demobrowser")); - QCoreApplication::setApplicationVersion(QLatin1String("0.1")); -#ifdef Q_WS_QWS - // Use a different server name for QWS so we can run an X11 - // browser and a QWS browser in parallel on the same machine for - // debugging - QString serverName = QCoreApplication::applicationName() + QLatin1String("_qws"); -#else - QString serverName = QCoreApplication::applicationName(); -#endif - QLocalSocket socket; - socket.connectToServer(serverName); - if (socket.waitForConnected(500)) { - QTextStream stream(&socket); - QStringList args = QCoreApplication::arguments(); - if (args.count() > 1) - stream << args.last(); - else - stream << QString(); - stream.flush(); - socket.waitForBytesWritten(); - return; - } - -#if defined(Q_WS_MAC) - QApplication::setQuitOnLastWindowClosed(false); -#else - QApplication::setQuitOnLastWindowClosed(true); -#endif - - m_localServer = new QLocalServer(this); - connect(m_localServer, SIGNAL(newConnection()), - this, SLOT(newLocalSocketConnection())); - if (!m_localServer->listen(serverName)) { - if (m_localServer->serverError() == QAbstractSocket::AddressInUseError - && QFile::exists(m_localServer->serverName())) { - QFile::remove(m_localServer->serverName()); - m_localServer->listen(serverName); - } - } - - QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl"); - QString localSysName = QLocale::system().name(); - - installTranslator(QLatin1String("qt_") + localSysName); - - QSettings settings; - settings.beginGroup(QLatin1String("sessions")); - m_lastSession = settings.value(QLatin1String("lastSession")).toByteArray(); - settings.endGroup(); - -#if defined(Q_WS_MAC) - connect(this, SIGNAL(lastWindowClosed()), - this, SLOT(lastWindowClosed())); -#endif - - QTimer::singleShot(0, this, SLOT(postLaunch())); -} - -BrowserApplication::~BrowserApplication() -{ - delete s_downloadManager; - for (int i = 0; i < m_mainWindows.size(); ++i) { - BrowserMainWindow *window = m_mainWindows.at(i); - delete window; - } - delete s_networkAccessManager; - delete s_bookmarksManager; -} - -#if defined(Q_WS_MAC) -void BrowserApplication::lastWindowClosed() -{ - clean(); - BrowserMainWindow *mw = new BrowserMainWindow; - mw->slotHome(); - m_mainWindows.prepend(mw); -} -#endif - -BrowserApplication *BrowserApplication::instance() -{ - return (static_cast(QCoreApplication::instance())); -} - -#if defined(Q_WS_MAC) -#include -void BrowserApplication::quitBrowser() -{ - clean(); - int tabCount = 0; - for (int i = 0; i < m_mainWindows.count(); ++i) { - tabCount =+ m_mainWindows.at(i)->tabWidget()->count(); - } - - if (tabCount > 1) { - int ret = QMessageBox::warning(mainWindow(), QString(), - tr("There are %1 windows and %2 tabs open\n" - "Do you want to quit anyway?").arg(m_mainWindows.count()).arg(tabCount), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); - if (ret == QMessageBox::No) - return; - } - - exit(0); -} -#endif - -/*! - Any actions that can be delayed until the window is visible - */ -void BrowserApplication::postLaunch() -{ - QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - if (directory.isEmpty()) - directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); - QWebSettings::setIconDatabasePath(directory); - - setWindowIcon(QIcon(QLatin1String(":browser.svg"))); - - loadSettings(); - - // newMainWindow() needs to be called in main() for this to happen - if (m_mainWindows.count() > 0) { - QStringList args = QCoreApplication::arguments(); - if (args.count() > 1) - mainWindow()->loadPage(args.last()); - else - mainWindow()->slotHome(); - } - BrowserApplication::historyManager(); -} - -void BrowserApplication::loadSettings() -{ - QSettings settings; - settings.beginGroup(QLatin1String("websettings")); - - QWebSettings *defaultSettings = QWebSettings::globalSettings(); - QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); - int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); - QFont standardFont = QFont(standardFontFamily, standardFontSize); - standardFont = qVariantValue(settings.value(QLatin1String("standardFont"), standardFont)); - defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); - - QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); - int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); - QFont fixedFont = QFont(fixedFontFamily, fixedFontSize); - fixedFont = qVariantValue(settings.value(QLatin1String("fixedFont"), fixedFont)); - defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); - - defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool()); - defaultSettings->setAttribute(QWebSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool()); - - QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl(); - defaultSettings->setUserStyleSheetUrl(url); - - settings.endGroup(); -} - -QList BrowserApplication::mainWindows() -{ - clean(); - QList list; - for (int i = 0; i < m_mainWindows.count(); ++i) - list.append(m_mainWindows.at(i)); - return list; -} - -void BrowserApplication::clean() -{ - // cleanup any deleted main windows first - for (int i = m_mainWindows.count() - 1; i >= 0; --i) - if (m_mainWindows.at(i).isNull()) - m_mainWindows.removeAt(i); -} - -void BrowserApplication::saveSession() -{ - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return; - - clean(); - - QSettings settings; - settings.beginGroup(QLatin1String("sessions")); - - QByteArray data; - QBuffer buffer(&data); - QDataStream stream(&buffer); - buffer.open(QIODevice::ReadWrite); - - stream << m_mainWindows.count(); - for (int i = 0; i < m_mainWindows.count(); ++i) - stream << m_mainWindows.at(i)->saveState(); - settings.setValue(QLatin1String("lastSession"), data); - settings.endGroup(); -} - -bool BrowserApplication::canRestoreSession() const -{ - return !m_lastSession.isEmpty(); -} - -void BrowserApplication::restoreLastSession() -{ - QList windows; - QBuffer buffer(&m_lastSession); - QDataStream stream(&buffer); - buffer.open(QIODevice::ReadOnly); - int windowCount; - stream >> windowCount; - for (int i = 0; i < windowCount; ++i) { - QByteArray windowState; - stream >> windowState; - windows.append(windowState); - } - for (int i = 0; i < windows.count(); ++i) { - BrowserMainWindow *newWindow = 0; - if (m_mainWindows.count() == 1 - && mainWindow()->tabWidget()->count() == 1 - && mainWindow()->currentTab()->url() == QUrl()) { - newWindow = mainWindow(); - } else { - newWindow = newMainWindow(); - } - newWindow->restoreState(windows.at(i)); - } -} - -bool BrowserApplication::isTheOnlyBrowser() const -{ - return (m_localServer != 0); -} - -void BrowserApplication::installTranslator(const QString &name) -{ - QTranslator *translator = new QTranslator(this); - translator->load(name, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - QApplication::installTranslator(translator); -} - -#if defined(Q_WS_MAC) -bool BrowserApplication::event(QEvent* event) -{ - switch (event->type()) { - case QEvent::ApplicationActivate: { - clean(); - if (!m_mainWindows.isEmpty()) { - BrowserMainWindow *mw = mainWindow(); - if (mw && !mw->isMinimized()) { - mainWindow()->show(); - } - return true; - } - } - case QEvent::FileOpen: - if (!m_mainWindows.isEmpty()) { - mainWindow()->loadPage(static_cast(event)->file()); - return true; - } - default: - break; - } - return QApplication::event(event); -} -#endif - -void BrowserApplication::openUrl(const QUrl &url) -{ - mainWindow()->loadPage(url.toString()); -} - -BrowserMainWindow *BrowserApplication::newMainWindow() -{ - BrowserMainWindow *browser = new BrowserMainWindow(); - m_mainWindows.prepend(browser); - browser->show(); - return browser; -} - -BrowserMainWindow *BrowserApplication::mainWindow() -{ - clean(); - if (m_mainWindows.isEmpty()) - newMainWindow(); - return m_mainWindows[0]; -} - -void BrowserApplication::newLocalSocketConnection() -{ - QLocalSocket *socket = m_localServer->nextPendingConnection(); - if (!socket) - return; - socket->waitForReadyRead(1000); - QTextStream stream(socket); - QString url; - stream >> url; - if (!url.isEmpty()) { - QSettings settings; - settings.beginGroup(QLatin1String("general")); - int openLinksIn = settings.value(QLatin1String("openLinksIn"), 0).toInt(); - settings.endGroup(); - if (openLinksIn == 1) - newMainWindow(); - else - mainWindow()->tabWidget()->newTab(); - openUrl(url); - } - delete socket; - mainWindow()->raise(); - mainWindow()->activateWindow(); -} - -CookieJar *BrowserApplication::cookieJar() -{ - return (CookieJar*)networkAccessManager()->cookieJar(); -} - -DownloadManager *BrowserApplication::downloadManager() -{ - if (!s_downloadManager) { - s_downloadManager = new DownloadManager(); - } - return s_downloadManager; -} - -NetworkAccessManager *BrowserApplication::networkAccessManager() -{ - if (!s_networkAccessManager) { - s_networkAccessManager = new NetworkAccessManager(); - s_networkAccessManager->setCookieJar(new CookieJar); - } - return s_networkAccessManager; -} - -HistoryManager *BrowserApplication::historyManager() -{ - if (!s_historyManager) { - s_historyManager = new HistoryManager(); - QWebHistoryInterface::setDefaultInterface(s_historyManager); - } - return s_historyManager; -} - -BookmarksManager *BrowserApplication::bookmarksManager() -{ - if (!s_bookmarksManager) { - s_bookmarksManager = new BookmarksManager; - } - return s_bookmarksManager; -} - -QIcon BrowserApplication::icon(const QUrl &url) const -{ - QIcon icon = QWebSettings::iconForUrl(url); - if (!icon.isNull()) - return icon.pixmap(16, 16); - if (m_defaultIcon.isNull()) - m_defaultIcon = QIcon(QLatin1String(":defaulticon.png")); - return m_defaultIcon.pixmap(16, 16); -} - diff --git a/examples/gestures/browser/browserapplication.h b/examples/gestures/browser/browserapplication.h deleted file mode 100644 index db83a85..0000000 --- a/examples/gestures/browser/browserapplication.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BROWSERAPPLICATION_H -#define BROWSERAPPLICATION_H - -#include - -#include -#include - -#include - -QT_BEGIN_NAMESPACE -class QLocalServer; -QT_END_NAMESPACE - -class BookmarksManager; -class BrowserMainWindow; -class CookieJar; -class DownloadManager; -class HistoryManager; -class NetworkAccessManager; -class BrowserApplication : public QApplication -{ - Q_OBJECT - -public: - BrowserApplication(int &argc, char **argv); - ~BrowserApplication(); - static BrowserApplication *instance(); - void loadSettings(); - - bool isTheOnlyBrowser() const; - BrowserMainWindow *mainWindow(); - QList mainWindows(); - QIcon icon(const QUrl &url) const; - - void saveSession(); - bool canRestoreSession() const; - - static HistoryManager *historyManager(); - static CookieJar *cookieJar(); - static DownloadManager *downloadManager(); - static NetworkAccessManager *networkAccessManager(); - static BookmarksManager *bookmarksManager(); - -#if defined(Q_WS_MAC) - bool event(QEvent *event); -#endif - -public slots: - BrowserMainWindow *newMainWindow(); - void restoreLastSession(); -#if defined(Q_WS_MAC) - void lastWindowClosed(); - void quitBrowser(); -#endif - -private slots: - void postLaunch(); - void openUrl(const QUrl &url); - void newLocalSocketConnection(); - -private: - void clean(); - void installTranslator(const QString &name); - - static HistoryManager *s_historyManager; - static DownloadManager *s_downloadManager; - static NetworkAccessManager *s_networkAccessManager; - static BookmarksManager *s_bookmarksManager; - - QList > m_mainWindows; - QLocalServer *m_localServer; - QByteArray m_lastSession; - mutable QIcon m_defaultIcon; -}; - -#endif // BROWSERAPPLICATION_H - diff --git a/examples/gestures/browser/browsermainwindow.cpp b/examples/gestures/browser/browsermainwindow.cpp deleted file mode 100644 index c6fe82d..0000000 --- a/examples/gestures/browser/browsermainwindow.cpp +++ /dev/null @@ -1,991 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "browsermainwindow.h" - -#include "autosaver.h" -#include "bookmarks.h" -#include "browserapplication.h" -#include "chasewidget.h" -#include "downloadmanager.h" -#include "history.h" -#include "settings.h" -#include "tabwidget.h" -#include "toolbarsearch.h" -#include "ui_passworddialog.h" -#include "webview.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags) - : QMainWindow(parent, flags) - , m_tabWidget(new TabWidget(this)) - , m_autoSaver(new AutoSaver(this)) - , m_historyBack(0) - , m_historyForward(0) - , m_stop(0) - , m_reload(0) -{ - setAttribute(Qt::WA_DeleteOnClose, true); - statusBar()->setSizeGripEnabled(true); - setupMenu(); - setupToolBar(); - - QWidget *centralWidget = new QWidget(this); - BookmarksModel *boomarksModel = BrowserApplication::bookmarksManager()->bookmarksModel(); - m_bookmarksToolbar = new BookmarksToolBar(boomarksModel, this); - connect(m_bookmarksToolbar, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); - connect(m_bookmarksToolbar->toggleViewAction(), SIGNAL(toggled(bool)), - this, SLOT(updateBookmarksToolbarActionText(bool))); - - QVBoxLayout *layout = new QVBoxLayout; - layout->setSpacing(0); - layout->setMargin(0); -#if defined(Q_WS_MAC) - layout->addWidget(m_bookmarksToolbar); - layout->addWidget(new QWidget); // <- OS X tab widget style bug -#else - addToolBarBreak(); - addToolBar(m_bookmarksToolbar); -#endif - layout->addWidget(m_tabWidget); - centralWidget->setLayout(layout); - setCentralWidget(centralWidget); - - connect(m_tabWidget, SIGNAL(loadPage(const QString &)), - this, SLOT(loadPage(const QString &))); - connect(m_tabWidget, SIGNAL(setCurrentTitle(const QString &)), - this, SLOT(slotUpdateWindowTitle(const QString &))); - connect(m_tabWidget, SIGNAL(showStatusBarMessage(const QString&)), - statusBar(), SLOT(showMessage(const QString&))); - connect(m_tabWidget, SIGNAL(linkHovered(const QString&)), - statusBar(), SLOT(showMessage(const QString&))); - connect(m_tabWidget, SIGNAL(loadProgress(int)), - this, SLOT(slotLoadProgress(int))); - connect(m_tabWidget, SIGNAL(tabsChanged()), - m_autoSaver, SLOT(changeOccurred())); - connect(m_tabWidget, SIGNAL(geometryChangeRequested(const QRect &)), - this, SLOT(geometryChangeRequested(const QRect &))); - connect(m_tabWidget, SIGNAL(printRequested(QWebFrame *)), - this, SLOT(printRequested(QWebFrame *))); - connect(m_tabWidget, SIGNAL(menuBarVisibilityChangeRequested(bool)), - menuBar(), SLOT(setVisible(bool))); - connect(m_tabWidget, SIGNAL(statusBarVisibilityChangeRequested(bool)), - statusBar(), SLOT(setVisible(bool))); - connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)), - m_navigationBar, SLOT(setVisible(bool))); - connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)), - m_bookmarksToolbar, SLOT(setVisible(bool))); -#if defined(Q_WS_MAC) - connect(m_tabWidget, SIGNAL(lastTabClosed()), - this, SLOT(close())); -#else - connect(m_tabWidget, SIGNAL(lastTabClosed()), - m_tabWidget, SLOT(newTab())); -#endif - - slotUpdateWindowTitle(); - loadDefaultState(); - m_tabWidget->newTab(); - - int size = m_tabWidget->lineEditStack()->sizeHint().height(); - m_navigationBar->setIconSize(QSize(size, size)); - -} - -BrowserMainWindow::~BrowserMainWindow() -{ - m_autoSaver->changeOccurred(); - m_autoSaver->saveIfNeccessary(); -} - -void BrowserMainWindow::loadDefaultState() -{ - QSettings settings; - settings.beginGroup(QLatin1String("BrowserMainWindow")); - QByteArray data = settings.value(QLatin1String("defaultState")).toByteArray(); - restoreState(data); - settings.endGroup(); -} - -QSize BrowserMainWindow::sizeHint() const -{ - QRect desktopRect = QApplication::desktop()->screenGeometry(); - QSize size = desktopRect.size() * qreal(0.9); - return size; -} - -void BrowserMainWindow::save() -{ - BrowserApplication::instance()->saveSession(); - - QSettings settings; - settings.beginGroup(QLatin1String("BrowserMainWindow")); - QByteArray data = saveState(false); - settings.setValue(QLatin1String("defaultState"), data); - settings.endGroup(); -} - -static const qint32 BrowserMainWindowMagic = 0xba; - -QByteArray BrowserMainWindow::saveState(bool withTabs) const -{ - int version = 2; - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - - stream << qint32(BrowserMainWindowMagic); - stream << qint32(version); - - stream << size(); - stream << !m_navigationBar->isHidden(); - stream << !m_bookmarksToolbar->isHidden(); - stream << !statusBar()->isHidden(); - if (withTabs) - stream << tabWidget()->saveState(); - else - stream << QByteArray(); - return data; -} - -bool BrowserMainWindow::restoreState(const QByteArray &state) -{ - int version = 2; - QByteArray sd = state; - QDataStream stream(&sd, QIODevice::ReadOnly); - if (stream.atEnd()) - return false; - - qint32 marker; - qint32 v; - stream >> marker; - stream >> v; - if (marker != BrowserMainWindowMagic || v != version) - return false; - - QSize size; - bool showToolbar; - bool showBookmarksBar; - bool showStatusbar; - QByteArray tabState; - - stream >> size; - stream >> showToolbar; - stream >> showBookmarksBar; - stream >> showStatusbar; - stream >> tabState; - - resize(size); - - m_navigationBar->setVisible(showToolbar); - updateToolbarActionText(showToolbar); - - m_bookmarksToolbar->setVisible(showBookmarksBar); - updateBookmarksToolbarActionText(showBookmarksBar); - - statusBar()->setVisible(showStatusbar); - updateStatusbarActionText(showStatusbar); - - if (!tabWidget()->restoreState(tabState)) - return false; - - return true; -} - -void BrowserMainWindow::setupMenu() -{ - new QShortcut(QKeySequence(Qt::Key_F6), this, SLOT(slotSwapFocus())); - - // File - QMenu *fileMenu = menuBar()->addMenu(tr("&File")); - - fileMenu->addAction(tr("&New Window"), this, SLOT(slotFileNew()), QKeySequence::New); - fileMenu->addAction(m_tabWidget->newTabAction()); - fileMenu->addAction(tr("&Open File..."), this, SLOT(slotFileOpen()), QKeySequence::Open); - fileMenu->addAction(tr("Open &Location..."), this, - SLOT(slotSelectLineEdit()), QKeySequence(Qt::ControlModifier + Qt::Key_L)); - fileMenu->addSeparator(); - fileMenu->addAction(m_tabWidget->closeTabAction()); - fileMenu->addSeparator(); - fileMenu->addAction(tr("&Save As..."), this, - SLOT(slotFileSaveAs()), QKeySequence(QKeySequence::Save)); - fileMenu->addSeparator(); - BookmarksManager *bookmarksManager = BrowserApplication::bookmarksManager(); - fileMenu->addAction(tr("&Import Bookmarks..."), bookmarksManager, SLOT(importBookmarks())); - fileMenu->addAction(tr("&Export Bookmarks..."), bookmarksManager, SLOT(exportBookmarks())); - fileMenu->addSeparator(); - fileMenu->addAction(tr("P&rint Preview..."), this, SLOT(slotFilePrintPreview())); - fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print); - fileMenu->addSeparator(); - QAction *action = fileMenu->addAction(tr("Private &Browsing..."), this, SLOT(slotPrivateBrowsing())); - action->setCheckable(true); - fileMenu->addSeparator(); - -#if defined(Q_WS_MAC) - fileMenu->addAction(tr("&Quit"), BrowserApplication::instance(), SLOT(quitBrowser()), QKeySequence(Qt::CTRL | Qt::Key_Q)); -#else - fileMenu->addAction(tr("&Quit"), this, SLOT(close()), QKeySequence(Qt::CTRL | Qt::Key_Q)); -#endif - - // Edit - QMenu *editMenu = menuBar()->addMenu(tr("&Edit")); - QAction *m_undo = editMenu->addAction(tr("&Undo")); - m_undo->setShortcuts(QKeySequence::Undo); - m_tabWidget->addWebAction(m_undo, QWebPage::Undo); - QAction *m_redo = editMenu->addAction(tr("&Redo")); - m_redo->setShortcuts(QKeySequence::Redo); - m_tabWidget->addWebAction(m_redo, QWebPage::Redo); - editMenu->addSeparator(); - QAction *m_cut = editMenu->addAction(tr("Cu&t")); - m_cut->setShortcuts(QKeySequence::Cut); - m_tabWidget->addWebAction(m_cut, QWebPage::Cut); - QAction *m_copy = editMenu->addAction(tr("&Copy")); - m_copy->setShortcuts(QKeySequence::Copy); - m_tabWidget->addWebAction(m_copy, QWebPage::Copy); - QAction *m_paste = editMenu->addAction(tr("&Paste")); - m_paste->setShortcuts(QKeySequence::Paste); - m_tabWidget->addWebAction(m_paste, QWebPage::Paste); - editMenu->addSeparator(); - - QAction *m_find = editMenu->addAction(tr("&Find")); - m_find->setShortcuts(QKeySequence::Find); - connect(m_find, SIGNAL(triggered()), this, SLOT(slotEditFind())); - new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind())); - - QAction *m_findNext = editMenu->addAction(tr("&Find Next")); - m_findNext->setShortcuts(QKeySequence::FindNext); - connect(m_findNext, SIGNAL(triggered()), this, SLOT(slotEditFindNext())); - - QAction *m_findPrevious = editMenu->addAction(tr("&Find Previous")); - m_findPrevious->setShortcuts(QKeySequence::FindPrevious); - connect(m_findPrevious, SIGNAL(triggered()), this, SLOT(slotEditFindPrevious())); - - editMenu->addSeparator(); - editMenu->addAction(tr("&Preferences"), this, SLOT(slotPreferences()), tr("Ctrl+,")); - - // View - QMenu *viewMenu = menuBar()->addMenu(tr("&View")); - - m_viewBookmarkBar = new QAction(this); - updateBookmarksToolbarActionText(true); - m_viewBookmarkBar->setShortcut(tr("Shift+Ctrl+B")); - connect(m_viewBookmarkBar, SIGNAL(triggered()), this, SLOT(slotViewBookmarksBar())); - viewMenu->addAction(m_viewBookmarkBar); - - m_viewToolbar = new QAction(this); - updateToolbarActionText(true); - m_viewToolbar->setShortcut(tr("Ctrl+|")); - connect(m_viewToolbar, SIGNAL(triggered()), this, SLOT(slotViewToolbar())); - viewMenu->addAction(m_viewToolbar); - - m_viewStatusbar = new QAction(this); - updateStatusbarActionText(true); - m_viewStatusbar->setShortcut(tr("Ctrl+/")); - connect(m_viewStatusbar, SIGNAL(triggered()), this, SLOT(slotViewStatusbar())); - viewMenu->addAction(m_viewStatusbar); - - viewMenu->addSeparator(); - - m_stop = viewMenu->addAction(tr("&Stop")); - QList shortcuts; - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Period)); - shortcuts.append(Qt::Key_Escape); - m_stop->setShortcuts(shortcuts); - m_tabWidget->addWebAction(m_stop, QWebPage::Stop); - - m_reload = viewMenu->addAction(tr("Reload Page")); - m_reload->setShortcuts(QKeySequence::Refresh); - m_tabWidget->addWebAction(m_reload, QWebPage::Reload); - - viewMenu->addAction(tr("Zoom &In"), this, SLOT(slotViewZoomIn()), QKeySequence(Qt::CTRL | Qt::Key_Plus)); - viewMenu->addAction(tr("Zoom &Out"), this, SLOT(slotViewZoomOut()), QKeySequence(Qt::CTRL | Qt::Key_Minus)); - viewMenu->addAction(tr("Reset &Zoom"), this, SLOT(slotViewResetZoom()), QKeySequence(Qt::CTRL | Qt::Key_0)); - QAction *zoomTextOnlyAction = viewMenu->addAction(tr("Zoom &Text Only")); - connect(zoomTextOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotViewZoomTextOnly(bool))); - zoomTextOnlyAction->setCheckable(true); - zoomTextOnlyAction->setChecked(false); - - viewMenu->addSeparator(); - viewMenu->addAction(tr("Page S&ource"), this, SLOT(slotViewPageSource()), tr("Ctrl+Alt+U")); - QAction *a = viewMenu->addAction(tr("&Full Screen"), this, SLOT(slotViewFullScreen(bool)), Qt::Key_F11); - a->setCheckable(true); - - // History - HistoryMenu *historyMenu = new HistoryMenu(this); - connect(historyMenu, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); - connect(historyMenu, SIGNAL(hovered(const QString&)), this, - SLOT(slotUpdateStatusbar(const QString&))); - historyMenu->setTitle(tr("Hi&story")); - menuBar()->addMenu(historyMenu); - QList historyActions; - - m_historyBack = new QAction(tr("Back"), this); - m_tabWidget->addWebAction(m_historyBack, QWebPage::Back); - m_historyBack->setShortcuts(QKeySequence::Back); - m_historyBack->setIconVisibleInMenu(false); - - m_historyForward = new QAction(tr("Forward"), this); - m_tabWidget->addWebAction(m_historyForward, QWebPage::Forward); - m_historyForward->setShortcuts(QKeySequence::Forward); - m_historyForward->setIconVisibleInMenu(false); - - QAction *m_historyHome = new QAction(tr("Home"), this); - connect(m_historyHome, SIGNAL(triggered()), this, SLOT(slotHome())); - m_historyHome->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_H)); - - m_restoreLastSession = new QAction(tr("Restore Last Session"), this); - connect(m_restoreLastSession, SIGNAL(triggered()), BrowserApplication::instance(), SLOT(restoreLastSession())); - m_restoreLastSession->setEnabled(BrowserApplication::instance()->canRestoreSession()); - - historyActions.append(m_historyBack); - historyActions.append(m_historyForward); - historyActions.append(m_historyHome); - historyActions.append(m_tabWidget->recentlyClosedTabsAction()); - historyActions.append(m_restoreLastSession); - historyMenu->setInitialActions(historyActions); - - // Bookmarks - BookmarksMenu *bookmarksMenu = new BookmarksMenu(this); - connect(bookmarksMenu, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); - connect(bookmarksMenu, SIGNAL(hovered(const QString&)), - this, SLOT(slotUpdateStatusbar(const QString&))); - bookmarksMenu->setTitle(tr("&Bookmarks")); - menuBar()->addMenu(bookmarksMenu); - - QList bookmarksActions; - - QAction *showAllBookmarksAction = new QAction(tr("Show All Bookmarks"), this); - connect(showAllBookmarksAction, SIGNAL(triggered()), this, SLOT(slotShowBookmarksDialog())); - m_addBookmark = new QAction(QIcon(QLatin1String(":addbookmark.png")), tr("Add Bookmark..."), this); - m_addBookmark->setIconVisibleInMenu(false); - - connect(m_addBookmark, SIGNAL(triggered()), this, SLOT(slotAddBookmark())); - m_addBookmark->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_D)); - - bookmarksActions.append(showAllBookmarksAction); - bookmarksActions.append(m_addBookmark); - bookmarksMenu->setInitialActions(bookmarksActions); - - // Window - m_windowMenu = menuBar()->addMenu(tr("&Window")); - connect(m_windowMenu, SIGNAL(aboutToShow()), - this, SLOT(slotAboutToShowWindowMenu())); - slotAboutToShowWindowMenu(); - - QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools")); - toolsMenu->addAction(tr("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence(tr("Ctrl+K", "Web Search"))); -#ifndef Q_CC_MINGW - a = toolsMenu->addAction(tr("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); - a->setCheckable(true); -#endif - - QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); - helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); - helpMenu->addAction(tr("About &Demo Browser"), this, SLOT(slotAboutApplication())); -} - -void BrowserMainWindow::setupToolBar() -{ - setUnifiedTitleAndToolBarOnMac(true); - m_navigationBar = addToolBar(tr("Navigation")); - connect(m_navigationBar->toggleViewAction(), SIGNAL(toggled(bool)), - this, SLOT(updateToolbarActionText(bool))); - - m_historyBack->setIcon(style()->standardIcon(QStyle::SP_ArrowBack, 0, this)); - m_historyBackMenu = new QMenu(this); - m_historyBack->setMenu(m_historyBackMenu); - connect(m_historyBackMenu, SIGNAL(aboutToShow()), - this, SLOT(slotAboutToShowBackMenu())); - connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), - this, SLOT(slotOpenActionUrl(QAction *))); - m_navigationBar->addAction(m_historyBack); - - m_historyForward->setIcon(style()->standardIcon(QStyle::SP_ArrowForward, 0, this)); - m_historyForwardMenu = new QMenu(this); - connect(m_historyForwardMenu, SIGNAL(aboutToShow()), - this, SLOT(slotAboutToShowForwardMenu())); - connect(m_historyForwardMenu, SIGNAL(triggered(QAction *)), - this, SLOT(slotOpenActionUrl(QAction *))); - m_historyForward->setMenu(m_historyForwardMenu); - m_navigationBar->addAction(m_historyForward); - - m_stopReload = new QAction(this); - m_reloadIcon = style()->standardIcon(QStyle::SP_BrowserReload); - m_stopReload->setIcon(m_reloadIcon); - - m_navigationBar->addAction(m_stopReload); - - m_navigationBar->addWidget(m_tabWidget->lineEditStack()); - - m_toolbarSearch = new ToolbarSearch(m_navigationBar); - m_navigationBar->addWidget(m_toolbarSearch); - connect(m_toolbarSearch, SIGNAL(search(const QUrl&)), SLOT(loadUrl(const QUrl&))); - - m_chaseWidget = new ChaseWidget(this); - m_navigationBar->addWidget(m_chaseWidget); -} - -void BrowserMainWindow::slotShowBookmarksDialog() -{ - BookmarksDialog *dialog = new BookmarksDialog(this); - connect(dialog, SIGNAL(openUrl(const QUrl&)), - m_tabWidget, SLOT(loadUrlInCurrentTab(const QUrl&))); - dialog->show(); -} - -void BrowserMainWindow::slotAddBookmark() -{ - WebView *webView = currentTab(); - QString url = webView->url().toString(); - QString title = webView->title(); - AddBookmarkDialog dialog(url, title); - dialog.exec(); -} - -void BrowserMainWindow::slotViewToolbar() -{ - if (m_navigationBar->isVisible()) { - updateToolbarActionText(false); - m_navigationBar->close(); - } else { - updateToolbarActionText(true); - m_navigationBar->show(); - } - m_autoSaver->changeOccurred(); -} - -void BrowserMainWindow::slotViewBookmarksBar() -{ - if (m_bookmarksToolbar->isVisible()) { - updateBookmarksToolbarActionText(false); - m_bookmarksToolbar->close(); - } else { - updateBookmarksToolbarActionText(true); - m_bookmarksToolbar->show(); - } - m_autoSaver->changeOccurred(); -} - -void BrowserMainWindow::updateStatusbarActionText(bool visible) -{ - m_viewStatusbar->setText(!visible ? tr("Show Status Bar") : tr("Hide Status Bar")); -} - -void BrowserMainWindow::updateToolbarActionText(bool visible) -{ - m_viewToolbar->setText(!visible ? tr("Show Toolbar") : tr("Hide Toolbar")); -} - -void BrowserMainWindow::updateBookmarksToolbarActionText(bool visible) -{ - m_viewBookmarkBar->setText(!visible ? tr("Show Bookmarks bar") : tr("Hide Bookmarks bar")); -} - -void BrowserMainWindow::slotViewStatusbar() -{ - if (statusBar()->isVisible()) { - updateStatusbarActionText(false); - statusBar()->close(); - } else { - updateStatusbarActionText(true); - statusBar()->show(); - } - m_autoSaver->changeOccurred(); -} - -QUrl BrowserMainWindow::guessUrlFromString(const QString &string) -{ - QString urlStr = string.trimmed(); - QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); - - // Check if it looks like a qualified URL. Try parsing it and see. - bool hasSchema = test.exactMatch(urlStr); - if (hasSchema) { - QUrl url = QUrl::fromEncoded(urlStr.toUtf8(), QUrl::TolerantMode); - if (url.isValid()) - return url; - } - - // Might be a file. - if (QFile::exists(urlStr)) { - QFileInfo info(urlStr); - return QUrl::fromLocalFile(info.absoluteFilePath()); - } - - // Might be a shorturl - try to detect the schema. - if (!hasSchema) { - int dotIndex = urlStr.indexOf(QLatin1Char('.')); - if (dotIndex != -1) { - QString prefix = urlStr.left(dotIndex).toLower(); - QByteArray schema = (prefix == QLatin1String("ftp")) ? prefix.toLatin1() : "http"; - QUrl url = - QUrl::fromEncoded(schema + "://" + urlStr.toUtf8(), QUrl::TolerantMode); - if (url.isValid()) - return url; - } - } - - // Fall back to QUrl's own tolerant parser. - QUrl url = QUrl::fromEncoded(string.toUtf8(), QUrl::TolerantMode); - - // finally for cases where the user just types in a hostname add http - if (url.scheme().isEmpty()) - url = QUrl::fromEncoded("http://" + string.toUtf8(), QUrl::TolerantMode); - return url; -} - -void BrowserMainWindow::loadUrl(const QUrl &url) -{ - if (!currentTab() || !url.isValid()) - return; - - m_tabWidget->currentLineEdit()->setText(QString::fromUtf8(url.toEncoded())); - m_tabWidget->loadUrlInCurrentTab(url); -} - -void BrowserMainWindow::slotDownloadManager() -{ - BrowserApplication::downloadManager()->show(); -} - -void BrowserMainWindow::slotSelectLineEdit() -{ - m_tabWidget->currentLineEdit()->selectAll(); - m_tabWidget->currentLineEdit()->setFocus(); -} - -void BrowserMainWindow::slotFileSaveAs() -{ - BrowserApplication::downloadManager()->download(currentTab()->url(), true); -} - -void BrowserMainWindow::slotPreferences() -{ - SettingsDialog *s = new SettingsDialog(this); - s->show(); -} - -void BrowserMainWindow::slotUpdateStatusbar(const QString &string) -{ - statusBar()->showMessage(string, 2000); -} - -void BrowserMainWindow::slotUpdateWindowTitle(const QString &title) -{ - if (title.isEmpty()) { - setWindowTitle(tr("Qt Demo Browser")); - } else { -#if defined(Q_WS_MAC) - setWindowTitle(title); -#else - setWindowTitle(tr("%1 - Qt Demo Browser", "Page title and Browser name").arg(title)); -#endif - } -} - -void BrowserMainWindow::slotAboutApplication() -{ - QMessageBox::about(this, tr("About"), tr( - "Version %1" - "

    This demo demonstrates Qt's " - "webkit facilities in action, providing an example " - "browser for you to experiment with.

    " - "

    QtWebKit is based on the Open Source WebKit Project developed at http://webkit.org/." - ).arg(QCoreApplication::applicationVersion())); -} - -void BrowserMainWindow::slotFileNew() -{ - BrowserApplication::instance()->newMainWindow(); - BrowserMainWindow *mw = BrowserApplication::instance()->mainWindow(); - mw->slotHome(); -} - -void BrowserMainWindow::slotFileOpen() -{ - QString file = QFileDialog::getOpenFileName(this, tr("Open Web Resource"), QString(), - tr("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)")); - - if (file.isEmpty()) - return; - - loadPage(file); -} - -void BrowserMainWindow::slotFilePrintPreview() -{ -#ifndef QT_NO_PRINTER - if (!currentTab()) - return; - QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this); - connect(dialog, SIGNAL(paintRequested(QPrinter *)), - currentTab(), SLOT(print(QPrinter *))); - dialog->exec(); -#endif -} - -void BrowserMainWindow::slotFilePrint() -{ - if (!currentTab()) - return; - printRequested(currentTab()->page()->mainFrame()); -} - -void BrowserMainWindow::printRequested(QWebFrame *frame) -{ -#ifndef QT_NO_PRINTER - QPrinter printer; - QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(tr("Print Document")); - if (dialog->exec() != QDialog::Accepted) - return; - frame->print(&printer); -#endif -} - -void BrowserMainWindow::slotPrivateBrowsing() -{ - QWebSettings *settings = QWebSettings::globalSettings(); - bool pb = settings->testAttribute(QWebSettings::PrivateBrowsingEnabled); - if (!pb) { - QString title = tr("Are you sure you want to turn on private browsing?"); - QString text = tr("%1

    When private browsing in turned on," - " webpages are not added to the history," - " items are automatically removed from the Downloads window," \ - " new cookies are not stored, current cookies can't be accessed," \ - " site icons wont be stored, session wont be saved, " \ - " and searches are not addded to the pop-up menu in the Google search box." \ - " Until you close the window, you can still click the Back and Forward buttons" \ - " to return to the webpages you have opened.").arg(title); - - QMessageBox::StandardButton button = QMessageBox::question(this, QString(), text, - QMessageBox::Ok | QMessageBox::Cancel, - QMessageBox::Ok); - if (button == QMessageBox::Ok) { - settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); - } - } else { - settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); - - QList windows = BrowserApplication::instance()->mainWindows(); - for (int i = 0; i < windows.count(); ++i) { - BrowserMainWindow *window = windows.at(i); - window->m_lastSearch = QString::null; - window->tabWidget()->clear(); - } - } -} - -void BrowserMainWindow::closeEvent(QCloseEvent *event) -{ - if (m_tabWidget->count() > 1) { - int ret = QMessageBox::warning(this, QString(), - tr("Are you sure you want to close the window?" - " There are %1 tab open").arg(m_tabWidget->count()), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); - if (ret == QMessageBox::No) { - event->ignore(); - return; - } - } - event->accept(); - deleteLater(); -} - -void BrowserMainWindow::slotEditFind() -{ - if (!currentTab()) - return; - bool ok; - QString search = QInputDialog::getText(this, tr("Find"), - tr("Text:"), QLineEdit::Normal, - m_lastSearch, &ok); - if (ok && !search.isEmpty()) { - m_lastSearch = search; - if (!currentTab()->findText(m_lastSearch)) - slotUpdateStatusbar(tr("\"%1\" not found.").arg(m_lastSearch)); - } -} - -void BrowserMainWindow::slotEditFindNext() -{ - if (!currentTab() && !m_lastSearch.isEmpty()) - return; - currentTab()->findText(m_lastSearch); -} - -void BrowserMainWindow::slotEditFindPrevious() -{ - if (!currentTab() && !m_lastSearch.isEmpty()) - return; - currentTab()->findText(m_lastSearch, QWebPage::FindBackward); -} - -void BrowserMainWindow::slotViewZoomIn() -{ - if (!currentTab()) - return; - currentTab()->setZoomFactor(currentTab()->zoomFactor() + 0.1); -} - -void BrowserMainWindow::slotViewZoomOut() -{ - if (!currentTab()) - return; - currentTab()->setZoomFactor(currentTab()->zoomFactor() - 0.1); -} - -void BrowserMainWindow::slotViewResetZoom() -{ - if (!currentTab()) - return; - currentTab()->setZoomFactor(1.0); -} - -void BrowserMainWindow::slotViewZoomTextOnly(bool enable) -{ - if (!currentTab()) - return; - currentTab()->page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, enable); -} - -void BrowserMainWindow::slotViewFullScreen(bool makeFullScreen) -{ - if (makeFullScreen) { - showFullScreen(); - } else { - if (isMinimized()) - showMinimized(); - else if (isMaximized()) - showMaximized(); - else showNormal(); - } -} - -void BrowserMainWindow::slotViewPageSource() -{ - if (!currentTab()) - return; - - QString markup = currentTab()->page()->mainFrame()->toHtml(); - QPlainTextEdit *view = new QPlainTextEdit(markup); - view->setWindowTitle(tr("Page Source of %1").arg(currentTab()->title())); - view->setMinimumWidth(640); - view->setAttribute(Qt::WA_DeleteOnClose); - view->show(); -} - -void BrowserMainWindow::slotHome() -{ - QSettings settings; - settings.beginGroup(QLatin1String("MainWindow")); - QString home = settings.value(QLatin1String("home"), QLatin1String("http://qtsoftware.com/")).toString(); - loadPage(home); -} - -void BrowserMainWindow::slotWebSearch() -{ - m_toolbarSearch->lineEdit()->selectAll(); - m_toolbarSearch->lineEdit()->setFocus(); -} - -void BrowserMainWindow::slotToggleInspector(bool enable) -{ - QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); - if (enable) { - int result = QMessageBox::question(this, tr("Web Inspector"), - tr("The web inspector will only work correctly for pages that were loaded after enabling.\n" - "Do you want to reload all pages?"), - QMessageBox::Yes | QMessageBox::No); - if (result == QMessageBox::Yes) { - m_tabWidget->reloadAllTabs(); - } - } -} - -void BrowserMainWindow::slotSwapFocus() -{ - if (currentTab()->hasFocus()) - m_tabWidget->currentLineEdit()->setFocus(); - else - currentTab()->setFocus(); -} - -void BrowserMainWindow::loadPage(const QString &page) -{ - QUrl url = guessUrlFromString(page); - loadUrl(url); -} - -TabWidget *BrowserMainWindow::tabWidget() const -{ - return m_tabWidget; -} - -WebView *BrowserMainWindow::currentTab() const -{ - return m_tabWidget->currentWebView(); -} - -void BrowserMainWindow::slotLoadProgress(int progress) -{ - if (progress < 100 && progress > 0) { - m_chaseWidget->setAnimated(true); - disconnect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); - if (m_stopIcon.isNull()) - m_stopIcon = style()->standardIcon(QStyle::SP_BrowserStop); - m_stopReload->setIcon(m_stopIcon); - connect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); - m_stopReload->setToolTip(tr("Stop loading the current page")); - } else { - m_chaseWidget->setAnimated(false); - disconnect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); - m_stopReload->setIcon(m_reloadIcon); - connect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); - m_stopReload->setToolTip(tr("Reload the current page")); - } -} - -void BrowserMainWindow::slotAboutToShowBackMenu() -{ - m_historyBackMenu->clear(); - if (!currentTab()) - return; - QWebHistory *history = currentTab()->history(); - int historyCount = history->count(); - for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) { - QWebHistoryItem item = history->backItems(history->count()).at(i); - QAction *action = new QAction(this); - action->setData(-1*(historyCount-i-1)); - QIcon icon = BrowserApplication::instance()->icon(item.url()); - action->setIcon(icon); - action->setText(item.title()); - m_historyBackMenu->addAction(action); - } -} - -void BrowserMainWindow::slotAboutToShowForwardMenu() -{ - m_historyForwardMenu->clear(); - if (!currentTab()) - return; - QWebHistory *history = currentTab()->history(); - int historyCount = history->count(); - for (int i = 0; i < history->forwardItems(history->count()).count(); ++i) { - QWebHistoryItem item = history->forwardItems(historyCount).at(i); - QAction *action = new QAction(this); - action->setData(historyCount-i); - QIcon icon = BrowserApplication::instance()->icon(item.url()); - action->setIcon(icon); - action->setText(item.title()); - m_historyForwardMenu->addAction(action); - } -} - -void BrowserMainWindow::slotAboutToShowWindowMenu() -{ - m_windowMenu->clear(); - m_windowMenu->addAction(m_tabWidget->nextTabAction()); - m_windowMenu->addAction(m_tabWidget->previousTabAction()); - m_windowMenu->addSeparator(); - m_windowMenu->addAction(tr("Downloads"), this, SLOT(slotDownloadManager()), QKeySequence(tr("Alt+Ctrl+L", "Download Manager"))); - - m_windowMenu->addSeparator(); - QList windows = BrowserApplication::instance()->mainWindows(); - for (int i = 0; i < windows.count(); ++i) { - BrowserMainWindow *window = windows.at(i); - QAction *action = m_windowMenu->addAction(window->windowTitle(), this, SLOT(slotShowWindow())); - action->setData(i); - action->setCheckable(true); - if (window == this) - action->setChecked(true); - } -} - -void BrowserMainWindow::slotShowWindow() -{ - if (QAction *action = qobject_cast(sender())) { - QVariant v = action->data(); - if (v.canConvert()) { - int offset = qvariant_cast(v); - QList windows = BrowserApplication::instance()->mainWindows(); - windows.at(offset)->activateWindow(); - windows.at(offset)->currentTab()->setFocus(); - } - } -} - -void BrowserMainWindow::slotOpenActionUrl(QAction *action) -{ - int offset = action->data().toInt(); - QWebHistory *history = currentTab()->history(); - if (offset < 0) - history->goToItem(history->backItems(-1*offset).first()); // back - else if (offset > 0) - history->goToItem(history->forwardItems(history->count() - offset + 1).back()); // forward - } - -void BrowserMainWindow::geometryChangeRequested(const QRect &geometry) -{ - setGeometry(geometry); -} - diff --git a/examples/gestures/browser/browsermainwindow.h b/examples/gestures/browser/browsermainwindow.h deleted file mode 100644 index 04f6c0c..0000000 --- a/examples/gestures/browser/browsermainwindow.h +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BROWSERMAINWINDOW_H -#define BROWSERMAINWINDOW_H - -#include -#include -#include - -class AutoSaver; -class BookmarksToolBar; -class ChaseWidget; -class QWebFrame; -class TabWidget; -class ToolbarSearch; -class WebView; - -/*! - The MainWindow of the Browser Application. - - Handles the tab widget and all the actions - */ -class BrowserMainWindow : public QMainWindow { - Q_OBJECT - -public: - BrowserMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0); - ~BrowserMainWindow(); - QSize sizeHint() const; - -public: - static QUrl guessUrlFromString(const QString &url); - TabWidget *tabWidget() const; - WebView *currentTab() const; - QByteArray saveState(bool withTabs = true) const; - bool restoreState(const QByteArray &state); - -public slots: - void loadPage(const QString &url); - void slotHome(); - -protected: - void closeEvent(QCloseEvent *event); - -private slots: - void save(); - - void slotLoadProgress(int); - void slotUpdateStatusbar(const QString &string); - void slotUpdateWindowTitle(const QString &title = QString()); - - void loadUrl(const QUrl &url); - void slotPreferences(); - - void slotFileNew(); - void slotFileOpen(); - void slotFilePrintPreview(); - void slotFilePrint(); - void slotPrivateBrowsing(); - void slotFileSaveAs(); - void slotEditFind(); - void slotEditFindNext(); - void slotEditFindPrevious(); - void slotShowBookmarksDialog(); - void slotAddBookmark(); - void slotViewZoomIn(); - void slotViewZoomOut(); - void slotViewResetZoom(); - void slotViewZoomTextOnly(bool enable); - void slotViewToolbar(); - void slotViewBookmarksBar(); - void slotViewStatusbar(); - void slotViewPageSource(); - void slotViewFullScreen(bool enable); - - void slotWebSearch(); - void slotToggleInspector(bool enable); - void slotAboutApplication(); - void slotDownloadManager(); - void slotSelectLineEdit(); - - void slotAboutToShowBackMenu(); - void slotAboutToShowForwardMenu(); - void slotAboutToShowWindowMenu(); - void slotOpenActionUrl(QAction *action); - void slotShowWindow(); - void slotSwapFocus(); - - void printRequested(QWebFrame *frame); - void geometryChangeRequested(const QRect &geometry); - void updateToolbarActionText(bool visible); - void updateBookmarksToolbarActionText(bool visible); - -private: - void loadDefaultState(); - void setupMenu(); - void setupToolBar(); - void updateStatusbarActionText(bool visible); - -private: - QToolBar *m_navigationBar; - ToolbarSearch *m_toolbarSearch; - BookmarksToolBar *m_bookmarksToolbar; - ChaseWidget *m_chaseWidget; - TabWidget *m_tabWidget; - AutoSaver *m_autoSaver; - - QAction *m_historyBack; - QMenu *m_historyBackMenu; - QAction *m_historyForward; - QMenu *m_historyForwardMenu; - QMenu *m_windowMenu; - - QAction *m_stop; - QAction *m_reload; - QAction *m_stopReload; - QAction *m_viewToolbar; - QAction *m_viewBookmarkBar; - QAction *m_viewStatusbar; - QAction *m_restoreLastSession; - QAction *m_addBookmark; - - QIcon m_reloadIcon; - QIcon m_stopIcon; - - QString m_lastSearch; -}; - -#endif // BROWSERMAINWINDOW_H - diff --git a/examples/gestures/browser/chasewidget.cpp b/examples/gestures/browser/chasewidget.cpp deleted file mode 100644 index de6c90b..0000000 --- a/examples/gestures/browser/chasewidget.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "chasewidget.h" - -#include - -#include -#include -#include -#include -#include - -ChaseWidget::ChaseWidget(QWidget *parent, QPixmap pixmap, bool pixmapEnabled) - : QWidget(parent) - , m_segment(0) - , m_delay(100) - , m_step(40) - , m_timerId(-1) - , m_animated(false) - , m_pixmap(pixmap) - , m_pixmapEnabled(pixmapEnabled) -{ -} - -void ChaseWidget::setAnimated(bool value) -{ - if (m_animated == value) - return; - m_animated = value; - if (m_timerId != -1) { - killTimer(m_timerId); - m_timerId = -1; - } - if (m_animated) { - m_segment = 0; - m_timerId = startTimer(m_delay); - } - update(); -} - -void ChaseWidget::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - QPainter p(this); - if (m_pixmapEnabled && !m_pixmap.isNull()) { - p.drawPixmap(0, 0, m_pixmap); - return; - } - - const int extent = qMin(width() - 8, height() - 8); - const int displ = extent / 4; - const int ext = extent / 4 - 1; - - p.setRenderHint(QPainter::Antialiasing, true); - - if(m_animated) - p.setPen(Qt::gray); - else - p.setPen(QPen(palette().dark().color())); - - p.translate(width() / 2, height() / 2); // center - - for (int segment = 0; segment < segmentCount(); ++segment) { - p.rotate(QApplication::isRightToLeft() ? m_step : -m_step); - if(m_animated) - p.setBrush(colorForSegment(segment)); - else - p.setBrush(palette().background()); - p.drawEllipse(QRect(displ, -ext / 2, ext, ext)); - } -} - -QSize ChaseWidget::sizeHint() const -{ - return QSize(32, 32); -} - -void ChaseWidget::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == m_timerId) { - ++m_segment; - update(); - } - QWidget::timerEvent(event); -} - -QColor ChaseWidget::colorForSegment(int seg) const -{ - int index = ((seg + m_segment) % segmentCount()); - int comp = qMax(0, 255 - (index * (255 / segmentCount()))); - return QColor(comp, comp, comp, 255); -} - -int ChaseWidget::segmentCount() const -{ - return 360 / m_step; -} - -void ChaseWidget::setPixmapEnabled(bool enable) -{ - m_pixmapEnabled = enable; -} - diff --git a/examples/gestures/browser/chasewidget.h b/examples/gestures/browser/chasewidget.h deleted file mode 100644 index 5b983e4..0000000 --- a/examples/gestures/browser/chasewidget.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CHASEWIDGET_H -#define CHASEWIDGET_H - -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QHideEvent; -class QShowEvent; -class QPaintEvent; -class QTimerEvent; -QT_END_NAMESPACE - -class ChaseWidget : public QWidget -{ - Q_OBJECT -public: - ChaseWidget(QWidget *parent = 0, QPixmap pixmap = QPixmap(), bool pixmapEnabled = false); - - void setAnimated(bool value); - void setPixmapEnabled(bool enable); - QSize sizeHint() const; - -protected: - void paintEvent(QPaintEvent *event); - void timerEvent(QTimerEvent *event); - -private: - int segmentCount() const; - QColor colorForSegment(int segment) const; - - int m_segment; - int m_delay; - int m_step; - int m_timerId; - bool m_animated; - QPixmap m_pixmap; - bool m_pixmapEnabled; -}; - -#endif diff --git a/examples/gestures/browser/cookiejar.cpp b/examples/gestures/browser/cookiejar.cpp deleted file mode 100644 index 3ae443f..0000000 --- a/examples/gestures/browser/cookiejar.cpp +++ /dev/null @@ -1,733 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "cookiejar.h" - -#include "autosaver.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -static const unsigned int JAR_VERSION = 23; - -QT_BEGIN_NAMESPACE -QDataStream &operator<<(QDataStream &stream, const QList &list) -{ - stream << JAR_VERSION; - stream << quint32(list.size()); - for (int i = 0; i < list.size(); ++i) - stream << list.at(i).toRawForm(); - return stream; -} - -QDataStream &operator>>(QDataStream &stream, QList &list) -{ - list.clear(); - - quint32 version; - stream >> version; - - if (version != JAR_VERSION) - return stream; - - quint32 count; - stream >> count; - for(quint32 i = 0; i < count; ++i) - { - QByteArray value; - stream >> value; - QList newCookies = QNetworkCookie::parseCookies(value); - if (newCookies.count() == 0 && value.length() != 0) { - qWarning() << "CookieJar: Unable to parse saved cookie:" << value; - } - for (int j = 0; j < newCookies.count(); ++j) - list.append(newCookies.at(j)); - if (stream.atEnd()) - break; - } - return stream; -} -QT_END_NAMESPACE - -CookieJar::CookieJar(QObject *parent) - : QNetworkCookieJar(parent) - , m_loaded(false) - , m_saveTimer(new AutoSaver(this)) - , m_acceptCookies(AcceptOnlyFromSitesNavigatedTo) -{ -} - -CookieJar::~CookieJar() -{ - if (m_keepCookies == KeepUntilExit) - clear(); - m_saveTimer->saveIfNeccessary(); -} - -void CookieJar::clear() -{ - setAllCookies(QList()); - m_saveTimer->changeOccurred(); - emit cookiesChanged(); -} - -void CookieJar::load() -{ - if (m_loaded) - return; - // load cookies and exceptions - qRegisterMetaTypeStreamOperators >("QList"); - QSettings cookieSettings(QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/cookies.ini"), QSettings::IniFormat); - setAllCookies(qvariant_cast >(cookieSettings.value(QLatin1String("cookies")))); - cookieSettings.beginGroup(QLatin1String("Exceptions")); - m_exceptions_block = cookieSettings.value(QLatin1String("block")).toStringList(); - m_exceptions_allow = cookieSettings.value(QLatin1String("allow")).toStringList(); - m_exceptions_allowForSession = cookieSettings.value(QLatin1String("allowForSession")).toStringList(); - qSort(m_exceptions_block.begin(), m_exceptions_block.end()); - qSort(m_exceptions_allow.begin(), m_exceptions_allow.end()); - qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end()); - - loadSettings(); -} - -void CookieJar::loadSettings() -{ - QSettings settings; - settings.beginGroup(QLatin1String("cookies")); - QByteArray value = settings.value(QLatin1String("acceptCookies"), - QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray(); - QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy")); - m_acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ? - AcceptOnlyFromSitesNavigatedTo : - static_cast(acceptPolicyEnum.keyToValue(value)); - - value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("KeepUntilExpire")).toByteArray(); - QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy")); - m_keepCookies = keepPolicyEnum.keyToValue(value) == -1 ? - KeepUntilExpire : - static_cast(keepPolicyEnum.keyToValue(value)); - - if (m_keepCookies == KeepUntilExit) - setAllCookies(QList()); - - m_loaded = true; - emit cookiesChanged(); -} - -void CookieJar::save() -{ - if (!m_loaded) - return; - purgeOldCookies(); - QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - if (directory.isEmpty()) - directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); - if (!QFile::exists(directory)) { - QDir dir; - dir.mkpath(directory); - } - QSettings cookieSettings(directory + QLatin1String("/cookies.ini"), QSettings::IniFormat); - QList cookies = allCookies(); - for (int i = cookies.count() - 1; i >= 0; --i) { - if (cookies.at(i).isSessionCookie()) - cookies.removeAt(i); - } - cookieSettings.setValue(QLatin1String("cookies"), qVariantFromValue >(cookies)); - cookieSettings.beginGroup(QLatin1String("Exceptions")); - cookieSettings.setValue(QLatin1String("block"), m_exceptions_block); - cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow); - cookieSettings.setValue(QLatin1String("allowForSession"), m_exceptions_allowForSession); - - // save cookie settings - QSettings settings; - settings.beginGroup(QLatin1String("cookies")); - QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy")); - settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(m_acceptCookies))); - - QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy")); - settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(m_keepCookies))); -} - -void CookieJar::purgeOldCookies() -{ - QList cookies = allCookies(); - if (cookies.isEmpty()) - return; - int oldCount = cookies.count(); - QDateTime now = QDateTime::currentDateTime(); - for (int i = cookies.count() - 1; i >= 0; --i) { - if (!cookies.at(i).isSessionCookie() && cookies.at(i).expirationDate() < now) - cookies.removeAt(i); - } - if (oldCount == cookies.count()) - return; - setAllCookies(cookies); - emit cookiesChanged(); -} - -QList CookieJar::cookiesForUrl(const QUrl &url) const -{ - CookieJar *that = const_cast(this); - if (!m_loaded) - that->load(); - - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { - QList noCookies; - return noCookies; - } - - return QNetworkCookieJar::cookiesForUrl(url); -} - -bool CookieJar::setCookiesFromUrl(const QList &cookieList, const QUrl &url) -{ - if (!m_loaded) - load(); - - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return false; - - QString host = url.host(); - bool eBlock = qBinaryFind(m_exceptions_block.begin(), m_exceptions_block.end(), host) != m_exceptions_block.end(); - bool eAllow = qBinaryFind(m_exceptions_allow.begin(), m_exceptions_allow.end(), host) != m_exceptions_allow.end(); - bool eAllowSession = qBinaryFind(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end(), host) != m_exceptions_allowForSession.end(); - - bool addedCookies = false; - // pass exceptions - bool acceptInitially = (m_acceptCookies != AcceptNever); - if ((acceptInitially && !eBlock) - || (!acceptInitially && (eAllow || eAllowSession))) { - // pass url domain == cookie domain - QDateTime soon = QDateTime::currentDateTime(); - soon = soon.addDays(90); - foreach(QNetworkCookie cookie, cookieList) { - QList lst; - if (m_keepCookies == KeepUntilTimeLimit - && !cookie.isSessionCookie() - && cookie.expirationDate() > soon) { - cookie.setExpirationDate(soon); - } - lst += cookie; - if (QNetworkCookieJar::setCookiesFromUrl(lst, url)) { - addedCookies = true; - } else { - // finally force it in if wanted - if (m_acceptCookies == AcceptAlways) { - QList cookies = allCookies(); - cookies += cookie; - setAllCookies(cookies); - addedCookies = true; - } -#if 0 - else - qWarning() << "setCookiesFromUrl failed" << url << cookieList.value(0).toRawForm(); -#endif - } - } - } - - if (addedCookies) { - m_saveTimer->changeOccurred(); - emit cookiesChanged(); - } - return addedCookies; -} - -CookieJar::AcceptPolicy CookieJar::acceptPolicy() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_acceptCookies; -} - -void CookieJar::setAcceptPolicy(AcceptPolicy policy) -{ - if (!m_loaded) - load(); - if (policy == m_acceptCookies) - return; - m_acceptCookies = policy; - m_saveTimer->changeOccurred(); -} - -CookieJar::KeepPolicy CookieJar::keepPolicy() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_keepCookies; -} - -void CookieJar::setKeepPolicy(KeepPolicy policy) -{ - if (!m_loaded) - load(); - if (policy == m_keepCookies) - return; - m_keepCookies = policy; - m_saveTimer->changeOccurred(); -} - -QStringList CookieJar::blockedCookies() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_exceptions_block; -} - -QStringList CookieJar::allowedCookies() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_exceptions_allow; -} - -QStringList CookieJar::allowForSessionCookies() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_exceptions_allowForSession; -} - -void CookieJar::setBlockedCookies(const QStringList &list) -{ - if (!m_loaded) - load(); - m_exceptions_block = list; - qSort(m_exceptions_block.begin(), m_exceptions_block.end()); - m_saveTimer->changeOccurred(); -} - -void CookieJar::setAllowedCookies(const QStringList &list) -{ - if (!m_loaded) - load(); - m_exceptions_allow = list; - qSort(m_exceptions_allow.begin(), m_exceptions_allow.end()); - m_saveTimer->changeOccurred(); -} - -void CookieJar::setAllowForSessionCookies(const QStringList &list) -{ - if (!m_loaded) - load(); - m_exceptions_allowForSession = list; - qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end()); - m_saveTimer->changeOccurred(); -} - -CookieModel::CookieModel(CookieJar *cookieJar, QObject *parent) - : QAbstractTableModel(parent) - , m_cookieJar(cookieJar) -{ - connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged())); - m_cookieJar->load(); -} - -QVariant CookieModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role == Qt::SizeHintRole) { - QFont font; - font.setPointSize(10); - QFontMetrics fm(font); - int height = fm.height() + fm.height()/3; - int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString()); - return QSize(width, height); - } - - if (orientation == Qt::Horizontal) { - if (role != Qt::DisplayRole) - return QVariant(); - - switch (section) { - case 0: - return tr("Website"); - case 1: - return tr("Name"); - case 2: - return tr("Path"); - case 3: - return tr("Secure"); - case 4: - return tr("Expires"); - case 5: - return tr("Contents"); - default: - return QVariant(); - } - } - return QAbstractTableModel::headerData(section, orientation, role); -} - -QVariant CookieModel::data(const QModelIndex &index, int role) const -{ - QList lst; - if (m_cookieJar) - lst = m_cookieJar->allCookies(); - if (index.row() < 0 || index.row() >= lst.size()) - return QVariant(); - - switch (role) { - case Qt::DisplayRole: - case Qt::EditRole: { - QNetworkCookie cookie = lst.at(index.row()); - switch (index.column()) { - case 0: - return cookie.domain(); - case 1: - return cookie.name(); - case 2: - return cookie.path(); - case 3: - return cookie.isSecure(); - case 4: - return cookie.expirationDate(); - case 5: - return cookie.value(); - } - } - case Qt::FontRole:{ - QFont font; - font.setPointSize(10); - return font; - } - } - - return QVariant(); -} - -int CookieModel::columnCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : 6; -} - -int CookieModel::rowCount(const QModelIndex &parent) const -{ - return (parent.isValid() || !m_cookieJar) ? 0 : m_cookieJar->allCookies().count(); -} - -bool CookieModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (parent.isValid() || !m_cookieJar) - return false; - int lastRow = row + count - 1; - beginRemoveRows(parent, row, lastRow); - QList lst = m_cookieJar->allCookies(); - for (int i = lastRow; i >= row; --i) { - lst.removeAt(i); - } - m_cookieJar->setAllCookies(lst); - endRemoveRows(); - return true; -} - -void CookieModel::cookiesChanged() -{ - reset(); -} - -CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent) : QDialog(parent) -{ - setupUi(this); - setWindowFlags(Qt::Sheet); - CookieModel *model = new CookieModel(cookieJar, this); - m_proxyModel = new QSortFilterProxyModel(this); - connect(search, SIGNAL(textChanged(QString)), - m_proxyModel, SLOT(setFilterFixedString(QString))); - connect(removeButton, SIGNAL(clicked()), cookiesTable, SLOT(removeOne())); - connect(removeAllButton, SIGNAL(clicked()), cookiesTable, SLOT(removeAll())); - m_proxyModel->setSourceModel(model); - cookiesTable->verticalHeader()->hide(); - cookiesTable->setSelectionBehavior(QAbstractItemView::SelectRows); - cookiesTable->setModel(m_proxyModel); - cookiesTable->setAlternatingRowColors(true); - cookiesTable->setTextElideMode(Qt::ElideMiddle); - cookiesTable->setShowGrid(false); - cookiesTable->setSortingEnabled(true); - QFont f = font(); - f.setPointSize(10); - QFontMetrics fm(f); - int height = fm.height() + fm.height()/3; - cookiesTable->verticalHeader()->setDefaultSectionSize(height); - cookiesTable->verticalHeader()->setMinimumSectionSize(-1); - for (int i = 0; i < model->columnCount(); ++i){ - int header = cookiesTable->horizontalHeader()->sectionSizeHint(i); - switch (i) { - case 0: - header = fm.width(QLatin1String("averagehost.domain.com")); - break; - case 1: - header = fm.width(QLatin1String("_session_id")); - break; - case 4: - header = fm.width(QDateTime::currentDateTime().toString(Qt::LocalDate)); - break; - } - int buffer = fm.width(QLatin1String("xx")); - header += buffer; - cookiesTable->horizontalHeader()->resizeSection(i, header); - } - cookiesTable->horizontalHeader()->setStretchLastSection(true); -} - - - -CookieExceptionsModel::CookieExceptionsModel(CookieJar *cookiejar, QObject *parent) - : QAbstractTableModel(parent) - , m_cookieJar(cookiejar) -{ - m_allowedCookies = m_cookieJar->allowedCookies(); - m_blockedCookies = m_cookieJar->blockedCookies(); - m_sessionCookies = m_cookieJar->allowForSessionCookies(); -} - -QVariant CookieExceptionsModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role == Qt::SizeHintRole) { - QFont font; - font.setPointSize(10); - QFontMetrics fm(font); - int height = fm.height() + fm.height()/3; - int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString()); - return QSize(width, height); - } - - if (orientation == Qt::Horizontal - && role == Qt::DisplayRole) { - switch (section) { - case 0: - return tr("Website"); - case 1: - return tr("Status"); - } - } - return QAbstractTableModel::headerData(section, orientation, role); -} - -QVariant CookieExceptionsModel::data(const QModelIndex &index, int role) const -{ - if (index.row() < 0 || index.row() >= rowCount()) - return QVariant(); - - switch (role) { - case Qt::DisplayRole: - case Qt::EditRole: { - int row = index.row(); - if (row < m_allowedCookies.count()) { - switch (index.column()) { - case 0: - return m_allowedCookies.at(row); - case 1: - return tr("Allow"); - } - } - row = row - m_allowedCookies.count(); - if (row < m_blockedCookies.count()) { - switch (index.column()) { - case 0: - return m_blockedCookies.at(row); - case 1: - return tr("Block"); - } - } - row = row - m_blockedCookies.count(); - if (row < m_sessionCookies.count()) { - switch (index.column()) { - case 0: - return m_sessionCookies.at(row); - case 1: - return tr("Allow For Session"); - } - } - } - case Qt::FontRole:{ - QFont font; - font.setPointSize(10); - return font; - } - } - return QVariant(); -} - -int CookieExceptionsModel::columnCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : 2; -} - -int CookieExceptionsModel::rowCount(const QModelIndex &parent) const -{ - return (parent.isValid() || !m_cookieJar) ? 0 : m_allowedCookies.count() + m_blockedCookies.count() + m_sessionCookies.count(); -} - -bool CookieExceptionsModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (parent.isValid() || !m_cookieJar) - return false; - - int lastRow = row + count - 1; - beginRemoveRows(parent, row, lastRow); - for (int i = lastRow; i >= row; --i) { - if (i < m_allowedCookies.count()) { - m_allowedCookies.removeAt(row); - continue; - } - i = i - m_allowedCookies.count(); - if (i < m_blockedCookies.count()) { - m_blockedCookies.removeAt(row); - continue; - } - i = i - m_blockedCookies.count(); - if (i < m_sessionCookies.count()) { - m_sessionCookies.removeAt(row); - continue; - } - } - m_cookieJar->setAllowedCookies(m_allowedCookies); - m_cookieJar->setBlockedCookies(m_blockedCookies); - m_cookieJar->setAllowForSessionCookies(m_sessionCookies); - endRemoveRows(); - return true; -} - -CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent) - : QDialog(parent) - , m_cookieJar(cookieJar) -{ - setupUi(this); - setWindowFlags(Qt::Sheet); - connect(removeButton, SIGNAL(clicked()), exceptionTable, SLOT(removeOne())); - connect(removeAllButton, SIGNAL(clicked()), exceptionTable, SLOT(removeAll())); - exceptionTable->verticalHeader()->hide(); - exceptionTable->setSelectionBehavior(QAbstractItemView::SelectRows); - exceptionTable->setAlternatingRowColors(true); - exceptionTable->setTextElideMode(Qt::ElideMiddle); - exceptionTable->setShowGrid(false); - exceptionTable->setSortingEnabled(true); - m_exceptionsModel = new CookieExceptionsModel(cookieJar, this); - m_proxyModel = new QSortFilterProxyModel(this); - m_proxyModel->setSourceModel(m_exceptionsModel); - connect(search, SIGNAL(textChanged(QString)), - m_proxyModel, SLOT(setFilterFixedString(QString))); - exceptionTable->setModel(m_proxyModel); - - CookieModel *cookieModel = new CookieModel(cookieJar, this); - domainLineEdit->setCompleter(new QCompleter(cookieModel, domainLineEdit)); - - connect(domainLineEdit, SIGNAL(textChanged(const QString &)), - this, SLOT(textChanged(const QString &))); - connect(blockButton, SIGNAL(clicked()), this, SLOT(block())); - connect(allowButton, SIGNAL(clicked()), this, SLOT(allow())); - connect(allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession())); - - QFont f = font(); - f.setPointSize(10); - QFontMetrics fm(f); - int height = fm.height() + fm.height()/3; - exceptionTable->verticalHeader()->setDefaultSectionSize(height); - exceptionTable->verticalHeader()->setMinimumSectionSize(-1); - for (int i = 0; i < m_exceptionsModel->columnCount(); ++i){ - int header = exceptionTable->horizontalHeader()->sectionSizeHint(i); - switch (i) { - case 0: - header = fm.width(QLatin1String("averagebiglonghost.domain.com")); - break; - case 1: - header = fm.width(QLatin1String("Allow For Session")); - break; - } - int buffer = fm.width(QLatin1String("xx")); - header += buffer; - exceptionTable->horizontalHeader()->resizeSection(i, header); - } -} - -void CookiesExceptionsDialog::textChanged(const QString &text) -{ - bool enabled = !text.isEmpty(); - blockButton->setEnabled(enabled); - allowButton->setEnabled(enabled); - allowForSessionButton->setEnabled(enabled); -} - -void CookiesExceptionsDialog::block() -{ - if (domainLineEdit->text().isEmpty()) - return; - m_exceptionsModel->m_blockedCookies.append(domainLineEdit->text()); - m_cookieJar->setBlockedCookies(m_exceptionsModel->m_blockedCookies); - m_exceptionsModel->reset(); -} - -void CookiesExceptionsDialog::allow() -{ - if (domainLineEdit->text().isEmpty()) - return; - m_exceptionsModel->m_allowedCookies.append(domainLineEdit->text()); - m_cookieJar->setAllowedCookies(m_exceptionsModel->m_allowedCookies); - m_exceptionsModel->reset(); -} - -void CookiesExceptionsDialog::allowForSession() -{ - if (domainLineEdit->text().isEmpty()) - return; - m_exceptionsModel->m_sessionCookies.append(domainLineEdit->text()); - m_cookieJar->setAllowForSessionCookies(m_exceptionsModel->m_sessionCookies); - m_exceptionsModel->reset(); -} - diff --git a/examples/gestures/browser/cookiejar.h b/examples/gestures/browser/cookiejar.h deleted file mode 100644 index 55ba185..0000000 --- a/examples/gestures/browser/cookiejar.h +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef COOKIEJAR_H -#define COOKIEJAR_H - -#include - -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE -class QSortFilterProxyModel; -class QKeyEvent; -QT_END_NAMESPACE - -class AutoSaver; - -class CookieJar : public QNetworkCookieJar -{ - friend class CookieModel; - Q_OBJECT - Q_PROPERTY(AcceptPolicy acceptPolicy READ acceptPolicy WRITE setAcceptPolicy) - Q_PROPERTY(KeepPolicy keepPolicy READ keepPolicy WRITE setKeepPolicy) - Q_PROPERTY(QStringList blockedCookies READ blockedCookies WRITE setBlockedCookies) - Q_PROPERTY(QStringList allowedCookies READ allowedCookies WRITE setAllowedCookies) - Q_PROPERTY(QStringList allowForSessionCookies READ allowForSessionCookies WRITE setAllowForSessionCookies) - Q_ENUMS(KeepPolicy) - Q_ENUMS(AcceptPolicy) - -signals: - void cookiesChanged(); - -public: - enum AcceptPolicy { - AcceptAlways, - AcceptNever, - AcceptOnlyFromSitesNavigatedTo - }; - - enum KeepPolicy { - KeepUntilExpire, - KeepUntilExit, - KeepUntilTimeLimit - }; - - CookieJar(QObject *parent = 0); - ~CookieJar(); - - QList cookiesForUrl(const QUrl &url) const; - bool setCookiesFromUrl(const QList &cookieList, const QUrl &url); - - AcceptPolicy acceptPolicy() const; - void setAcceptPolicy(AcceptPolicy policy); - - KeepPolicy keepPolicy() const; - void setKeepPolicy(KeepPolicy policy); - - QStringList blockedCookies() const; - QStringList allowedCookies() const; - QStringList allowForSessionCookies() const; - - void setBlockedCookies(const QStringList &list); - void setAllowedCookies(const QStringList &list); - void setAllowForSessionCookies(const QStringList &list); - -public slots: - void clear(); - void loadSettings(); - -private slots: - void save(); - -private: - void purgeOldCookies(); - void load(); - bool m_loaded; - AutoSaver *m_saveTimer; - - AcceptPolicy m_acceptCookies; - KeepPolicy m_keepCookies; - - QStringList m_exceptions_block; - QStringList m_exceptions_allow; - QStringList m_exceptions_allowForSession; -}; - -class CookieModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - CookieModel(CookieJar *jar, QObject *parent = 0); - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - -private slots: - void cookiesChanged(); - -private: - CookieJar *m_cookieJar; -}; - -#include "ui_cookies.h" -#include "ui_cookiesexceptions.h" - -class CookiesDialog : public QDialog, public Ui_CookiesDialog -{ - Q_OBJECT - -public: - CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0); - -private: - QSortFilterProxyModel *m_proxyModel; -}; - -class CookieExceptionsModel : public QAbstractTableModel -{ - Q_OBJECT - friend class CookiesExceptionsDialog; - -public: - CookieExceptionsModel(CookieJar *cookieJar, QObject *parent = 0); - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - -private: - CookieJar *m_cookieJar; - - // Domains we allow, Domains we block, Domains we allow for this session - QStringList m_allowedCookies; - QStringList m_blockedCookies; - QStringList m_sessionCookies; -}; - -class CookiesExceptionsDialog : public QDialog, public Ui_CookiesExceptionsDialog -{ - Q_OBJECT - -public: - CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0); - -private slots: - void block(); - void allow(); - void allowForSession(); - void textChanged(const QString &text); - -private: - CookieExceptionsModel *m_exceptionsModel; - QSortFilterProxyModel *m_proxyModel; - CookieJar *m_cookieJar; -}; - -#endif // COOKIEJAR_H - diff --git a/examples/gestures/browser/cookies.ui b/examples/gestures/browser/cookies.ui deleted file mode 100644 index c4bccc5..0000000 --- a/examples/gestures/browser/cookies.ui +++ /dev/null @@ -1,106 +0,0 @@ - - CookiesDialog - - - - 0 - 0 - 550 - 370 - - - - Cookies - - - - - - Qt::Horizontal - - - - 252 - 20 - - - - - - - - - - - - - - - - &Remove - - - - - - - Remove &All Cookies - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QDialogButtonBox::Ok - - - - - - - - - - SearchLineEdit - QLineEdit -

    searchlineedit.h
    - - - EditTableView - QTableView -
    edittableview.h
    -
    - - - - - buttonBox - accepted() - CookiesDialog - accept() - - - 472 - 329 - - - 461 - 356 - - - - - diff --git a/examples/gestures/browser/cookiesexceptions.ui b/examples/gestures/browser/cookiesexceptions.ui deleted file mode 100644 index 3d9ef62..0000000 --- a/examples/gestures/browser/cookiesexceptions.ui +++ /dev/null @@ -1,184 +0,0 @@ - - CookiesExceptionsDialog - - - - 0 - 0 - 466 - 446 - - - - Cookie Exceptions - - - - - - New Exception - - - - - - - - Domain: - - - - - - - - - - - - - - Qt::Horizontal - - - - 81 - 25 - - - - - - - - false - - - Block - - - - - - - false - - - Allow For Session - - - - - - - false - - - Allow - - - - - - - - - - - - Exceptions - - - - - - Qt::Horizontal - - - - 252 - 20 - - - - - - - - - - - - - - &Remove - - - - - - - Remove &All - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - SearchLineEdit - QLineEdit -
    searchlineedit.h
    -
    - - EditTableView - QTableView -
    edittableview.h
    -
    -
    - - - - buttonBox - accepted() - CookiesExceptionsDialog - accept() - - - 381 - 428 - - - 336 - 443 - - - - -
    diff --git a/examples/gestures/browser/data/addtab.png b/examples/gestures/browser/data/addtab.png deleted file mode 100644 index 20928fb..0000000 Binary files a/examples/gestures/browser/data/addtab.png and /dev/null differ diff --git a/examples/gestures/browser/data/browser.svg b/examples/gestures/browser/data/browser.svg deleted file mode 100644 index 4b0fa72..0000000 --- a/examples/gestures/browser/data/browser.svg +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Qt Browser - - - Jens Bache-Wiig - - - - - Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/gestures/browser/data/closetab.png b/examples/gestures/browser/data/closetab.png deleted file mode 100644 index ab9d669..0000000 Binary files a/examples/gestures/browser/data/closetab.png and /dev/null differ diff --git a/examples/gestures/browser/data/data.qrc b/examples/gestures/browser/data/data.qrc deleted file mode 100644 index c7d0294..0000000 --- a/examples/gestures/browser/data/data.qrc +++ /dev/null @@ -1,11 +0,0 @@ - - - addtab.png - closetab.png - history.png - browser.svg - defaultbookmarks.xbel - loading.gif - defaulticon.png - - diff --git a/examples/gestures/browser/data/defaultbookmarks.xbel b/examples/gestures/browser/data/defaultbookmarks.xbel deleted file mode 100644 index a168244..0000000 --- a/examples/gestures/browser/data/defaultbookmarks.xbel +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Bookmarks Bar - - Qt Software - - - WebKit.org - - - Qt Documentation - - - Qt Quarterly - - - Qt Labs - - - Qt Centre - - - Qt-Apps.org - - - qtnode - - - xkcd - - - - Bookmarks Menu - - reddit.com: what's new online! - - - diff --git a/examples/gestures/browser/data/defaulticon.png b/examples/gestures/browser/data/defaulticon.png deleted file mode 100644 index 01a0920..0000000 Binary files a/examples/gestures/browser/data/defaulticon.png and /dev/null differ diff --git a/examples/gestures/browser/data/history.png b/examples/gestures/browser/data/history.png deleted file mode 100644 index 552a1cb..0000000 Binary files a/examples/gestures/browser/data/history.png and /dev/null differ diff --git a/examples/gestures/browser/data/loading.gif b/examples/gestures/browser/data/loading.gif deleted file mode 100644 index c1545eb..0000000 Binary files a/examples/gestures/browser/data/loading.gif and /dev/null differ diff --git a/examples/gestures/browser/downloaditem.ui b/examples/gestures/browser/downloaditem.ui deleted file mode 100644 index 4a0a0fd..0000000 --- a/examples/gestures/browser/downloaditem.ui +++ /dev/null @@ -1,134 +0,0 @@ - - DownloadItem - - - - 0 - 0 - 423 - 110 - - - - Form - - - - 0 - - - - - - 0 - 0 - - - - Ico - - - - - - - - - - 0 - 0 - - - - Filename - - - - - - - 0 - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Qt::Vertical - - - - 17 - 1 - - - - - - - - false - - - Try Again - - - - - - - Stop - - - - - - - Open - - - - - - - Qt::Vertical - - - - 17 - 5 - - - - - - - - - - - SqueezeLabel - QWidget -
    squeezelabel.h
    -
    -
    - - -
    diff --git a/examples/gestures/browser/downloadmanager.cpp b/examples/gestures/browser/downloadmanager.cpp deleted file mode 100644 index 8e23795..0000000 --- a/examples/gestures/browser/downloadmanager.cpp +++ /dev/null @@ -1,579 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "downloadmanager.h" - -#include "autosaver.h" -#include "browserapplication.h" -#include "networkaccessmanager.h" - -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include - -/*! - DownloadItem is a widget that is displayed in the download manager list. - It moves the data from the QNetworkReply into the QFile as well - as update the information/progressbar and report errors. - */ -DownloadItem::DownloadItem(QNetworkReply *reply, bool requestFileName, QWidget *parent) - : QWidget(parent) - , m_reply(reply) - , m_requestFileName(requestFileName) - , m_bytesReceived(0) -{ - setupUi(this); - QPalette p = downloadInfoLabel->palette(); - p.setColor(QPalette::Text, Qt::darkGray); - downloadInfoLabel->setPalette(p); - progressBar->setMaximum(0); - tryAgainButton->hide(); - connect(stopButton, SIGNAL(clicked()), this, SLOT(stop())); - connect(openButton, SIGNAL(clicked()), this, SLOT(open())); - connect(tryAgainButton, SIGNAL(clicked()), this, SLOT(tryAgain())); - - init(); -} - -void DownloadItem::init() -{ - if (!m_reply) - return; - - // attach to the m_reply - m_url = m_reply->url(); - m_reply->setParent(this); - connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); - connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(error(QNetworkReply::NetworkError))); - connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(downloadProgress(qint64, qint64))); - connect(m_reply, SIGNAL(metaDataChanged()), - this, SLOT(metaDataChanged())); - connect(m_reply, SIGNAL(finished()), - this, SLOT(finished())); - - // reset info - downloadInfoLabel->clear(); - progressBar->setValue(0); - getFileName(); - - // start timer for the download estimation - m_downloadTime.start(); - - if (m_reply->error() != QNetworkReply::NoError) { - error(m_reply->error()); - finished(); - } -} - -void DownloadItem::getFileName() -{ - QSettings settings; - settings.beginGroup(QLatin1String("downloadmanager")); - QString defaultLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); - QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString(); - if (!downloadDirectory.isEmpty()) - downloadDirectory += QLatin1Char('/'); - - QString defaultFileName = saveFileName(downloadDirectory); - QString fileName = defaultFileName; - if (m_requestFileName) { - fileName = QFileDialog::getSaveFileName(this, tr("Save File"), defaultFileName); - if (fileName.isEmpty()) { - m_reply->close(); - fileNameLabel->setText(tr("Download canceled: %1").arg(QFileInfo(defaultFileName).fileName())); - return; - } - } - m_output.setFileName(fileName); - fileNameLabel->setText(QFileInfo(m_output.fileName()).fileName()); - if (m_requestFileName) - downloadReadyRead(); -} - -QString DownloadItem::saveFileName(const QString &directory) const -{ - // Move this function into QNetworkReply to also get file name sent from the server - QString path = m_url.path(); - QFileInfo info(path); - QString baseName = info.completeBaseName(); - QString endName = info.suffix(); - - if (baseName.isEmpty()) { - baseName = QLatin1String("unnamed_download"); - qDebug() << "DownloadManager:: downloading unknown file:" << m_url; - } - QString name = directory + baseName + QLatin1Char('.') + endName; - if (QFile::exists(name)) { - // already exists, don't overwrite - int i = 1; - do { - name = directory + baseName + QLatin1Char('-') + QString::number(i++) + QLatin1Char('.') + endName; - } while (QFile::exists(name)); - } - return name; -} - - -void DownloadItem::stop() -{ - setUpdatesEnabled(false); - stopButton->setEnabled(false); - stopButton->hide(); - tryAgainButton->setEnabled(true); - tryAgainButton->show(); - setUpdatesEnabled(true); - m_reply->abort(); -} - -void DownloadItem::open() -{ - QFileInfo info(m_output); - QUrl url = QUrl::fromLocalFile(info.absolutePath()); - QDesktopServices::openUrl(url); -} - -void DownloadItem::tryAgain() -{ - if (!tryAgainButton->isEnabled()) - return; - - tryAgainButton->setEnabled(false); - tryAgainButton->setVisible(false); - stopButton->setEnabled(true); - stopButton->setVisible(true); - progressBar->setVisible(true); - - QNetworkReply *r = BrowserApplication::networkAccessManager()->get(QNetworkRequest(m_url)); - if (m_reply) - m_reply->deleteLater(); - if (m_output.exists()) - m_output.remove(); - m_reply = r; - init(); - emit statusChanged(); -} - -void DownloadItem::downloadReadyRead() -{ - if (m_requestFileName && m_output.fileName().isEmpty()) - return; - if (!m_output.isOpen()) { - // in case someone else has already put a file there - if (!m_requestFileName) - getFileName(); - if (!m_output.open(QIODevice::WriteOnly)) { - downloadInfoLabel->setText(tr("Error opening save file: %1") - .arg(m_output.errorString())); - stopButton->click(); - emit statusChanged(); - return; - } - emit statusChanged(); - } - if (-1 == m_output.write(m_reply->readAll())) { - downloadInfoLabel->setText(tr("Error saving: %1") - .arg(m_output.errorString())); - stopButton->click(); - } -} - -void DownloadItem::error(QNetworkReply::NetworkError) -{ - qDebug() << "DownloadItem::error" << m_reply->errorString() << m_url; - downloadInfoLabel->setText(tr("Network Error: %1").arg(m_reply->errorString())); - tryAgainButton->setEnabled(true); - tryAgainButton->setVisible(true); -} - -void DownloadItem::metaDataChanged() -{ - qDebug() << "DownloadItem::metaDataChanged: not handled."; -} - -void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) -{ - m_bytesReceived = bytesReceived; - if (bytesTotal == -1) { - progressBar->setValue(0); - progressBar->setMaximum(0); - } else { - progressBar->setValue(bytesReceived); - progressBar->setMaximum(bytesTotal); - } - updateInfoLabel(); -} - -void DownloadItem::updateInfoLabel() -{ - if (m_reply->error() == QNetworkReply::NoError) - return; - - qint64 bytesTotal = progressBar->maximum(); - bool running = !downloadedSuccessfully(); - - // update info label - double speed = m_bytesReceived * 1000.0 / m_downloadTime.elapsed(); - double timeRemaining = ((double)(bytesTotal - m_bytesReceived)) / speed; - QString timeRemainingString = tr("seconds"); - if (timeRemaining > 60) { - timeRemaining = timeRemaining / 60; - timeRemainingString = tr("minutes"); - } - timeRemaining = floor(timeRemaining); - - // When downloading the eta should never be 0 - if (timeRemaining == 0) - timeRemaining = 1; - - QString info; - if (running) { - QString remaining; - if (bytesTotal != 0) - remaining = tr("- %4 %5 remaining") - .arg(timeRemaining) - .arg(timeRemainingString); - info = QString(tr("%1 of %2 (%3/sec) %4")) - .arg(dataString(m_bytesReceived)) - .arg(bytesTotal == 0 ? tr("?") : dataString(bytesTotal)) - .arg(dataString((int)speed)) - .arg(remaining); - } else { - if (m_bytesReceived == bytesTotal) - info = dataString(m_output.size()); - else - info = tr("%1 of %2 - Stopped") - .arg(dataString(m_bytesReceived)) - .arg(dataString(bytesTotal)); - } - downloadInfoLabel->setText(info); -} - -QString DownloadItem::dataString(int size) const -{ - QString unit; - if (size < 1024) { - unit = tr("bytes"); - } else if (size < 1024*1024) { - size /= 1024; - unit = tr("kB"); - } else { - size /= 1024*1024; - unit = tr("MB"); - } - return QString(QLatin1String("%1 %2")).arg(size).arg(unit); -} - -bool DownloadItem::downloading() const -{ - return (progressBar->isVisible()); -} - -bool DownloadItem::downloadedSuccessfully() const -{ - return (stopButton->isHidden() && tryAgainButton->isHidden()); -} - -void DownloadItem::finished() -{ - progressBar->hide(); - stopButton->setEnabled(false); - stopButton->hide(); - m_output.close(); - updateInfoLabel(); - emit statusChanged(); -} - -/*! - DownloadManager is a Dialog that contains a list of DownloadItems - - It is a basic download manager. It only downloads the file, doesn't do BitTorrent, - extract zipped files or anything fancy. - */ -DownloadManager::DownloadManager(QWidget *parent) - : QDialog(parent) - , m_autoSaver(new AutoSaver(this)) - , m_manager(BrowserApplication::networkAccessManager()) - , m_iconProvider(0) - , m_removePolicy(Never) -{ - setupUi(this); - downloadsView->setShowGrid(false); - downloadsView->verticalHeader()->hide(); - downloadsView->horizontalHeader()->hide(); - downloadsView->setAlternatingRowColors(true); - downloadsView->horizontalHeader()->setStretchLastSection(true); - m_model = new DownloadModel(this); - downloadsView->setModel(m_model); - connect(cleanupButton, SIGNAL(clicked()), this, SLOT(cleanup())); - load(); -} - -DownloadManager::~DownloadManager() -{ - m_autoSaver->changeOccurred(); - m_autoSaver->saveIfNeccessary(); - if (m_iconProvider) - delete m_iconProvider; -} - -int DownloadManager::activeDownloads() const -{ - int count = 0; - for (int i = 0; i < m_downloads.count(); ++i) { - if (m_downloads.at(i)->stopButton->isEnabled()) - ++count; - } - return count; -} - -void DownloadManager::download(const QNetworkRequest &request, bool requestFileName) -{ - if (request.url().isEmpty()) - return; - handleUnsupportedContent(m_manager->get(request), requestFileName); -} - -void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool requestFileName) -{ - if (!reply || reply->url().isEmpty()) - return; - QVariant header = reply->header(QNetworkRequest::ContentLengthHeader); - bool ok; - int size = header.toInt(&ok); - if (ok && size == 0) - return; - - qDebug() << "DownloadManager::handleUnsupportedContent" << reply->url() << "requestFileName" << requestFileName; - DownloadItem *item = new DownloadItem(reply, requestFileName, this); - addItem(item); -} - -void DownloadManager::addItem(DownloadItem *item) -{ - connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow())); - int row = m_downloads.count(); - m_model->beginInsertRows(QModelIndex(), row, row); - m_downloads.append(item); - m_model->endInsertRows(); - updateItemCount(); - if (row == 0) - show(); - downloadsView->setIndexWidget(m_model->index(row, 0), item); - QIcon icon = style()->standardIcon(QStyle::SP_FileIcon); - item->fileIcon->setPixmap(icon.pixmap(48, 48)); - downloadsView->setRowHeight(row, item->sizeHint().height()); -} - -void DownloadManager::updateRow() -{ - DownloadItem *item = qobject_cast(sender()); - int row = m_downloads.indexOf(item); - if (-1 == row) - return; - if (!m_iconProvider) - m_iconProvider = new QFileIconProvider(); - QIcon icon = m_iconProvider->icon(item->m_output.fileName()); - if (icon.isNull()) - icon = style()->standardIcon(QStyle::SP_FileIcon); - item->fileIcon->setPixmap(icon.pixmap(48, 48)); - downloadsView->setRowHeight(row, item->minimumSizeHint().height()); - - bool remove = false; - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (!item->downloading() - && globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - remove = true; - - if (item->downloadedSuccessfully() - && removePolicy() == DownloadManager::SuccessFullDownload) { - remove = true; - } - if (remove) - m_model->removeRow(row); - - cleanupButton->setEnabled(m_downloads.count() - activeDownloads() > 0); -} - -DownloadManager::RemovePolicy DownloadManager::removePolicy() const -{ - return m_removePolicy; -} - -void DownloadManager::setRemovePolicy(RemovePolicy policy) -{ - if (policy == m_removePolicy) - return; - m_removePolicy = policy; - m_autoSaver->changeOccurred(); -} - -void DownloadManager::save() const -{ - QSettings settings; - settings.beginGroup(QLatin1String("downloadmanager")); - QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy")); - settings.setValue(QLatin1String("removeDownloadsPolicy"), QLatin1String(removePolicyEnum.valueToKey(m_removePolicy))); - settings.setValue(QLatin1String("size"), size()); - if (m_removePolicy == Exit) - return; - - for (int i = 0; i < m_downloads.count(); ++i) { - QString key = QString(QLatin1String("download_%1_")).arg(i); - settings.setValue(key + QLatin1String("url"), m_downloads[i]->m_url); - settings.setValue(key + QLatin1String("location"), QFileInfo(m_downloads[i]->m_output).filePath()); - settings.setValue(key + QLatin1String("done"), m_downloads[i]->downloadedSuccessfully()); - } - int i = m_downloads.count(); - QString key = QString(QLatin1String("download_%1_")).arg(i); - while (settings.contains(key + QLatin1String("url"))) { - settings.remove(key + QLatin1String("url")); - settings.remove(key + QLatin1String("location")); - settings.remove(key + QLatin1String("done")); - key = QString(QLatin1String("download_%1_")).arg(++i); - } -} - -void DownloadManager::load() -{ - QSettings settings; - settings.beginGroup(QLatin1String("downloadmanager")); - QSize size = settings.value(QLatin1String("size")).toSize(); - if (size.isValid()) - resize(size); - QByteArray value = settings.value(QLatin1String("removeDownloadsPolicy"), QLatin1String("Never")).toByteArray(); - QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy")); - m_removePolicy = removePolicyEnum.keyToValue(value) == -1 ? - Never : - static_cast(removePolicyEnum.keyToValue(value)); - - int i = 0; - QString key = QString(QLatin1String("download_%1_")).arg(i); - while (settings.contains(key + QLatin1String("url"))) { - QUrl url = settings.value(key + QLatin1String("url")).toUrl(); - QString fileName = settings.value(key + QLatin1String("location")).toString(); - bool done = settings.value(key + QLatin1String("done"), true).toBool(); - if (!url.isEmpty() && !fileName.isEmpty()) { - DownloadItem *item = new DownloadItem(0, this); - item->m_output.setFileName(fileName); - item->fileNameLabel->setText(QFileInfo(item->m_output.fileName()).fileName()); - item->m_url = url; - item->stopButton->setVisible(false); - item->stopButton->setEnabled(false); - item->tryAgainButton->setVisible(!done); - item->tryAgainButton->setEnabled(!done); - item->progressBar->setVisible(!done); - addItem(item); - } - key = QString(QLatin1String("download_%1_")).arg(++i); - } - cleanupButton->setEnabled(m_downloads.count() - activeDownloads() > 0); -} - -void DownloadManager::cleanup() -{ - if (m_downloads.isEmpty()) - return; - m_model->removeRows(0, m_downloads.count()); - updateItemCount(); - if (m_downloads.isEmpty() && m_iconProvider) { - delete m_iconProvider; - m_iconProvider = 0; - } - m_autoSaver->changeOccurred(); -} - -void DownloadManager::updateItemCount() -{ - int count = m_downloads.count(); - itemCount->setText(count == 1 ? tr("1 Download") : tr("%1 Downloads").arg(count)); -} - -DownloadModel::DownloadModel(DownloadManager *downloadManager, QObject *parent) - : QAbstractListModel(parent) - , m_downloadManager(downloadManager) -{ -} - -QVariant DownloadModel::data(const QModelIndex &index, int role) const -{ - if (index.row() < 0 || index.row() >= rowCount(index.parent())) - return QVariant(); - if (role == Qt::ToolTipRole) - if (!m_downloadManager->m_downloads.at(index.row())->downloadedSuccessfully()) - return m_downloadManager->m_downloads.at(index.row())->downloadInfoLabel->text(); - return QVariant(); -} - -int DownloadModel::rowCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : m_downloadManager->m_downloads.count(); -} - -bool DownloadModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (parent.isValid()) - return false; - - int lastRow = row + count - 1; - for (int i = lastRow; i >= row; --i) { - if (m_downloadManager->m_downloads.at(i)->downloadedSuccessfully() - || m_downloadManager->m_downloads.at(i)->tryAgainButton->isEnabled()) { - beginRemoveRows(parent, i, i); - m_downloadManager->m_downloads.takeAt(i)->deleteLater(); - endRemoveRows(); - } - } - m_downloadManager->m_autoSaver->changeOccurred(); - return true; -} - diff --git a/examples/gestures/browser/downloadmanager.h b/examples/gestures/browser/downloadmanager.h deleted file mode 100644 index af13fec..0000000 --- a/examples/gestures/browser/downloadmanager.h +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DOWNLOADMANAGER_H -#define DOWNLOADMANAGER_H - -#include "ui_downloads.h" -#include "ui_downloaditem.h" - -#include - -#include -#include - -class DownloadItem : public QWidget, public Ui_DownloadItem -{ - Q_OBJECT - -signals: - void statusChanged(); - -public: - DownloadItem(QNetworkReply *reply = 0, bool requestFileName = false, QWidget *parent = 0); - bool downloading() const; - bool downloadedSuccessfully() const; - - QUrl m_url; - - QFile m_output; - QNetworkReply *m_reply; - -private slots: - void stop(); - void tryAgain(); - void open(); - - void downloadReadyRead(); - void error(QNetworkReply::NetworkError code); - void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); - void metaDataChanged(); - void finished(); - -private: - void getFileName(); - void init(); - void updateInfoLabel(); - QString dataString(int size) const; - - QString saveFileName(const QString &directory) const; - - bool m_requestFileName; - qint64 m_bytesReceived; - QTime m_downloadTime; -}; - -class AutoSaver; -class DownloadModel; -QT_BEGIN_NAMESPACE -class QFileIconProvider; -QT_END_NAMESPACE - -class DownloadManager : public QDialog, public Ui_DownloadDialog -{ - Q_OBJECT - Q_PROPERTY(RemovePolicy removePolicy READ removePolicy WRITE setRemovePolicy) - Q_ENUMS(RemovePolicy) - -public: - enum RemovePolicy { - Never, - Exit, - SuccessFullDownload - }; - - DownloadManager(QWidget *parent = 0); - ~DownloadManager(); - int activeDownloads() const; - - RemovePolicy removePolicy() const; - void setRemovePolicy(RemovePolicy policy); - -public slots: - void download(const QNetworkRequest &request, bool requestFileName = false); - inline void download(const QUrl &url, bool requestFileName = false) - { download(QNetworkRequest(url), requestFileName); } - void handleUnsupportedContent(QNetworkReply *reply, bool requestFileName = false); - void cleanup(); - -private slots: - void save() const; - void updateRow(); - -private: - void addItem(DownloadItem *item); - void updateItemCount(); - void load(); - - AutoSaver *m_autoSaver; - DownloadModel *m_model; - QNetworkAccessManager *m_manager; - QFileIconProvider *m_iconProvider; - QList m_downloads; - RemovePolicy m_removePolicy; - friend class DownloadModel; -}; - -class DownloadModel : public QAbstractListModel -{ - friend class DownloadManager; - Q_OBJECT - -public: - DownloadModel(DownloadManager *downloadManager, QObject *parent = 0); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - -private: - DownloadManager *m_downloadManager; - -}; - -#endif // DOWNLOADMANAGER_H - diff --git a/examples/gestures/browser/downloads.ui b/examples/gestures/browser/downloads.ui deleted file mode 100644 index a2e2569..0000000 --- a/examples/gestures/browser/downloads.ui +++ /dev/null @@ -1,83 +0,0 @@ - - DownloadDialog - - - - 0 - 0 - 332 - 252 - - - - Downloads - - - - 0 - - - 0 - - - - - - - - - - false - - - Clean up - - - - - - - Qt::Horizontal - - - - 58 - 24 - - - - - - - - - - 0 Items - - - - - - - Qt::Horizontal - - - - 148 - 20 - - - - - - - - - EditTableView - QTableView -
    edittableview.h
    -
    -
    - - -
    diff --git a/examples/gestures/browser/edittableview.cpp b/examples/gestures/browser/edittableview.cpp deleted file mode 100644 index f7d5e67..0000000 --- a/examples/gestures/browser/edittableview.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "edittableview.h" -#include - -EditTableView::EditTableView(QWidget *parent) - : QTableView(parent) -{ -} - -void EditTableView::keyPressEvent(QKeyEvent *event) -{ - if ((event->key() == Qt::Key_Delete - || event->key() == Qt::Key_Backspace) - && model()) { - removeOne(); - } else { - QAbstractItemView::keyPressEvent(event); - } -} - -void EditTableView::removeOne() -{ - if (!model() || !selectionModel()) - return; - int row = currentIndex().row(); - model()->removeRow(row, rootIndex()); - QModelIndex idx = model()->index(row, 0, rootIndex()); - if (!idx.isValid()) - idx = model()->index(row - 1, 0, rootIndex()); - selectionModel()->select(idx, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); -} - -void EditTableView::removeAll() -{ - if (model()) - model()->removeRows(0, model()->rowCount(rootIndex()), rootIndex()); -} - diff --git a/examples/gestures/browser/edittableview.h b/examples/gestures/browser/edittableview.h deleted file mode 100644 index fb033ce..0000000 --- a/examples/gestures/browser/edittableview.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef EDITTABLEVIEW_H -#define EDITTABLEVIEW_H - -#include - -class EditTableView : public QTableView -{ - Q_OBJECT - -public: - EditTableView(QWidget *parent = 0); - void keyPressEvent(QKeyEvent *event); - -public slots: - void removeOne(); - void removeAll(); -}; - -#endif // EDITTABLEVIEW_H - diff --git a/examples/gestures/browser/edittreeview.cpp b/examples/gestures/browser/edittreeview.cpp deleted file mode 100644 index c7cefe6..0000000 --- a/examples/gestures/browser/edittreeview.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "edittreeview.h" - -#include - -EditTreeView::EditTreeView(QWidget *parent) - : QTreeView(parent) -{ -} - -void EditTreeView::keyPressEvent(QKeyEvent *event) -{ - if ((event->key() == Qt::Key_Delete - || event->key() == Qt::Key_Backspace) - && model()) { - removeOne(); - } else { - QAbstractItemView::keyPressEvent(event); - } -} - -void EditTreeView::removeOne() -{ - if (!model()) - return; - QModelIndex ci = currentIndex(); - int row = ci.row(); - model()->removeRow(row, ci.parent()); -} - -void EditTreeView::removeAll() -{ - if (!model()) - return; - model()->removeRows(0, model()->rowCount(rootIndex()), rootIndex()); -} - diff --git a/examples/gestures/browser/edittreeview.h b/examples/gestures/browser/edittreeview.h deleted file mode 100644 index 3a6fcaf..0000000 --- a/examples/gestures/browser/edittreeview.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef EDITTREEVIEW_H -#define EDITTREEVIEW_H - -#include - -class EditTreeView : public QTreeView -{ - Q_OBJECT - -public: - EditTreeView(QWidget *parent = 0); - void keyPressEvent(QKeyEvent *event); - -public slots: - void removeOne(); - void removeAll(); -}; - -#endif // EDITTREEVIEW_H - diff --git a/examples/gestures/browser/history.cpp b/examples/gestures/browser/history.cpp deleted file mode 100644 index 0e0652d..0000000 --- a/examples/gestures/browser/history.cpp +++ /dev/null @@ -1,1282 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "history.h" - -#include "autosaver.h" -#include "browserapplication.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include - -#include - -static const unsigned int HISTORY_VERSION = 23; - -HistoryManager::HistoryManager(QObject *parent) - : QWebHistoryInterface(parent) - , m_saveTimer(new AutoSaver(this)) - , m_historyLimit(30) - , m_historyModel(0) - , m_historyFilterModel(0) - , m_historyTreeModel(0) -{ - m_expiredTimer.setSingleShot(true); - connect(&m_expiredTimer, SIGNAL(timeout()), - this, SLOT(checkForExpired())); - connect(this, SIGNAL(entryAdded(const HistoryItem &)), - m_saveTimer, SLOT(changeOccurred())); - connect(this, SIGNAL(entryRemoved(const HistoryItem &)), - m_saveTimer, SLOT(changeOccurred())); - load(); - - m_historyModel = new HistoryModel(this, this); - m_historyFilterModel = new HistoryFilterModel(m_historyModel, this); - m_historyTreeModel = new HistoryTreeModel(m_historyFilterModel, this); - - // QWebHistoryInterface will delete the history manager - QWebHistoryInterface::setDefaultInterface(this); -} - -HistoryManager::~HistoryManager() -{ - m_saveTimer->saveIfNeccessary(); -} - -QList HistoryManager::history() const -{ - return m_history; -} - -bool HistoryManager::historyContains(const QString &url) const -{ - return m_historyFilterModel->historyContains(url); -} - -void HistoryManager::addHistoryEntry(const QString &url) -{ - QUrl cleanUrl(url); - cleanUrl.setPassword(QString()); - cleanUrl.setHost(cleanUrl.host().toLower()); - HistoryItem item(cleanUrl.toString(), QDateTime::currentDateTime()); - addHistoryItem(item); -} - -void HistoryManager::setHistory(const QList &history, bool loadedAndSorted) -{ - m_history = history; - - // verify that it is sorted by date - if (!loadedAndSorted) - qSort(m_history.begin(), m_history.end()); - - checkForExpired(); - - if (loadedAndSorted) { - m_lastSavedUrl = m_history.value(0).url; - } else { - m_lastSavedUrl = QString(); - m_saveTimer->changeOccurred(); - } - emit historyReset(); -} - -HistoryModel *HistoryManager::historyModel() const -{ - return m_historyModel; -} - -HistoryFilterModel *HistoryManager::historyFilterModel() const -{ - return m_historyFilterModel; -} - -HistoryTreeModel *HistoryManager::historyTreeModel() const -{ - return m_historyTreeModel; -} - -void HistoryManager::checkForExpired() -{ - if (m_historyLimit < 0 || m_history.isEmpty()) - return; - - QDateTime now = QDateTime::currentDateTime(); - int nextTimeout = 0; - - while (!m_history.isEmpty()) { - QDateTime checkForExpired = m_history.last().dateTime; - checkForExpired.setDate(checkForExpired.date().addDays(m_historyLimit)); - if (now.daysTo(checkForExpired) > 7) { - // check at most in a week to prevent int overflows on the timer - nextTimeout = 7 * 86400; - } else { - nextTimeout = now.secsTo(checkForExpired); - } - if (nextTimeout > 0) - break; - HistoryItem item = m_history.takeLast(); - // remove from saved file also - m_lastSavedUrl = QString(); - emit entryRemoved(item); - } - - if (nextTimeout > 0) - m_expiredTimer.start(nextTimeout * 1000); -} - -void HistoryManager::addHistoryItem(const HistoryItem &item) -{ - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return; - - m_history.prepend(item); - emit entryAdded(item); - if (m_history.count() == 1) - checkForExpired(); -} - -void HistoryManager::updateHistoryItem(const QUrl &url, const QString &title) -{ - for (int i = 0; i < m_history.count(); ++i) { - if (url == m_history.at(i).url) { - m_history[i].title = title; - m_saveTimer->changeOccurred(); - if (m_lastSavedUrl.isEmpty()) - m_lastSavedUrl = m_history.at(i).url; - emit entryUpdated(i); - break; - } - } -} - -int HistoryManager::historyLimit() const -{ - return m_historyLimit; -} - -void HistoryManager::setHistoryLimit(int limit) -{ - if (m_historyLimit == limit) - return; - m_historyLimit = limit; - checkForExpired(); - m_saveTimer->changeOccurred(); -} - -void HistoryManager::clear() -{ - m_history.clear(); - m_lastSavedUrl = QString(); - m_saveTimer->changeOccurred(); - m_saveTimer->saveIfNeccessary(); - historyReset(); -} - -void HistoryManager::loadSettings() -{ - // load settings - QSettings settings; - settings.beginGroup(QLatin1String("history")); - m_historyLimit = settings.value(QLatin1String("historyLimit"), 30).toInt(); -} - -void HistoryManager::load() -{ - loadSettings(); - - QFile historyFile(QDesktopServices::storageLocation(QDesktopServices::DataLocation) - + QLatin1String("/history")); - if (!historyFile.exists()) - return; - if (!historyFile.open(QFile::ReadOnly)) { - qWarning() << "Unable to open history file" << historyFile.fileName(); - return; - } - - QList list; - QDataStream in(&historyFile); - // Double check that the history file is sorted as it is read in - bool needToSort = false; - HistoryItem lastInsertedItem; - QByteArray data; - QDataStream stream; - QBuffer buffer; - stream.setDevice(&buffer); - while (!historyFile.atEnd()) { - in >> data; - buffer.close(); - buffer.setBuffer(&data); - buffer.open(QIODevice::ReadOnly); - quint32 ver; - stream >> ver; - if (ver != HISTORY_VERSION) - continue; - HistoryItem item; - stream >> item.url; - stream >> item.dateTime; - stream >> item.title; - - if (!item.dateTime.isValid()) - continue; - - if (item == lastInsertedItem) { - if (lastInsertedItem.title.isEmpty() && !list.isEmpty()) - list[0].title = item.title; - continue; - } - - if (!needToSort && !list.isEmpty() && lastInsertedItem < item) - needToSort = true; - - list.prepend(item); - lastInsertedItem = item; - } - if (needToSort) - qSort(list.begin(), list.end()); - - setHistory(list, true); - - // If we had to sort re-write the whole history sorted - if (needToSort) { - m_lastSavedUrl = QString(); - m_saveTimer->changeOccurred(); - } -} - -void HistoryManager::save() -{ - QSettings settings; - settings.beginGroup(QLatin1String("history")); - settings.setValue(QLatin1String("historyLimit"), m_historyLimit); - - bool saveAll = m_lastSavedUrl.isEmpty(); - int first = m_history.count() - 1; - if (!saveAll) { - // find the first one to save - for (int i = 0; i < m_history.count(); ++i) { - if (m_history.at(i).url == m_lastSavedUrl) { - first = i - 1; - break; - } - } - } - if (first == m_history.count() - 1) - saveAll = true; - - QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - if (directory.isEmpty()) - directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); - if (!QFile::exists(directory)) { - QDir dir; - dir.mkpath(directory); - } - - QFile historyFile(directory + QLatin1String("/history")); - // When saving everything use a temporary file to prevent possible data loss. - QTemporaryFile tempFile; - tempFile.setAutoRemove(false); - bool open = false; - if (saveAll) { - open = tempFile.open(); - } else { - open = historyFile.open(QFile::Append); - } - - if (!open) { - qWarning() << "Unable to open history file for saving" - << (saveAll ? tempFile.fileName() : historyFile.fileName()); - return; - } - - QDataStream out(saveAll ? &tempFile : &historyFile); - for (int i = first; i >= 0; --i) { - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - HistoryItem item = m_history.at(i); - stream << HISTORY_VERSION << item.url << item.dateTime << item.title; - out << data; - } - tempFile.close(); - - if (saveAll) { - if (historyFile.exists() && !historyFile.remove()) - qWarning() << "History: error removing old history." << historyFile.errorString(); - if (!tempFile.rename(historyFile.fileName())) - qWarning() << "History: error moving new history over old." << tempFile.errorString() << historyFile.fileName(); - } - m_lastSavedUrl = m_history.value(0).url; -} - -HistoryModel::HistoryModel(HistoryManager *history, QObject *parent) - : QAbstractTableModel(parent) - , m_history(history) -{ - Q_ASSERT(m_history); - connect(m_history, SIGNAL(historyReset()), - this, SLOT(historyReset())); - connect(m_history, SIGNAL(entryRemoved(const HistoryItem &)), - this, SLOT(historyReset())); - - connect(m_history, SIGNAL(entryAdded(const HistoryItem &)), - this, SLOT(entryAdded())); - connect(m_history, SIGNAL(entryUpdated(int)), - this, SLOT(entryUpdated(int))); -} - -void HistoryModel::historyReset() -{ - reset(); -} - -void HistoryModel::entryAdded() -{ - beginInsertRows(QModelIndex(), 0, 0); - endInsertRows(); -} - -void HistoryModel::entryUpdated(int offset) -{ - QModelIndex idx = index(offset, 0); - emit dataChanged(idx, idx); -} - -QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (orientation == Qt::Horizontal - && role == Qt::DisplayRole) { - switch (section) { - case 0: return tr("Title"); - case 1: return tr("Address"); - } - } - return QAbstractTableModel::headerData(section, orientation, role); -} - -QVariant HistoryModel::data(const QModelIndex &index, int role) const -{ - QList lst = m_history->history(); - if (index.row() < 0 || index.row() >= lst.size()) - return QVariant(); - - const HistoryItem &item = lst.at(index.row()); - switch (role) { - case DateTimeRole: - return item.dateTime; - case DateRole: - return item.dateTime.date(); - case UrlRole: - return QUrl(item.url); - case UrlStringRole: - return item.url; - case Qt::DisplayRole: - case Qt::EditRole: { - switch (index.column()) { - case 0: - // when there is no title try to generate one from the url - if (item.title.isEmpty()) { - QString page = QFileInfo(QUrl(item.url).path()).fileName(); - if (!page.isEmpty()) - return page; - return item.url; - } - return item.title; - case 1: - return item.url; - } - } - case Qt::DecorationRole: - if (index.column() == 0) { - return BrowserApplication::instance()->icon(item.url); - } - } - return QVariant(); -} - -int HistoryModel::columnCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : 2; -} - -int HistoryModel::rowCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : m_history->history().count(); -} - -bool HistoryModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (parent.isValid()) - return false; - int lastRow = row + count - 1; - beginRemoveRows(parent, row, lastRow); - QList lst = m_history->history(); - for (int i = lastRow; i >= row; --i) - lst.removeAt(i); - disconnect(m_history, SIGNAL(historyReset()), this, SLOT(historyReset())); - m_history->setHistory(lst); - connect(m_history, SIGNAL(historyReset()), this, SLOT(historyReset())); - endRemoveRows(); - return true; -} - -#define MOVEDROWS 15 - -/* - Maps the first bunch of items of the source model to the root -*/ -HistoryMenuModel::HistoryMenuModel(HistoryTreeModel *sourceModel, QObject *parent) - : QAbstractProxyModel(parent) - , m_treeModel(sourceModel) -{ - setSourceModel(sourceModel); -} - -int HistoryMenuModel::bumpedRows() const -{ - QModelIndex first = m_treeModel->index(0, 0); - if (!first.isValid()) - return 0; - return qMin(m_treeModel->rowCount(first), MOVEDROWS); -} - -int HistoryMenuModel::columnCount(const QModelIndex &parent) const -{ - return m_treeModel->columnCount(mapToSource(parent)); -} - -int HistoryMenuModel::rowCount(const QModelIndex &parent) const -{ - if (parent.column() > 0) - return 0; - - if (!parent.isValid()) { - int folders = sourceModel()->rowCount(); - int bumpedItems = bumpedRows(); - if (bumpedItems <= MOVEDROWS - && bumpedItems == sourceModel()->rowCount(sourceModel()->index(0, 0))) - --folders; - return bumpedItems + folders; - } - - if (parent.internalId() == -1) { - if (parent.row() < bumpedRows()) - return 0; - } - - QModelIndex idx = mapToSource(parent); - int defaultCount = sourceModel()->rowCount(idx); - if (idx == sourceModel()->index(0, 0)) - return defaultCount - bumpedRows(); - return defaultCount; -} - -QModelIndex HistoryMenuModel::mapFromSource(const QModelIndex &sourceIndex) const -{ - // currently not used or autotested - Q_ASSERT(false); - int sr = m_treeModel->mapToSource(sourceIndex).row(); - return createIndex(sourceIndex.row(), sourceIndex.column(), sr); -} - -QModelIndex HistoryMenuModel::mapToSource(const QModelIndex &proxyIndex) const -{ - if (!proxyIndex.isValid()) - return QModelIndex(); - - if (proxyIndex.internalId() == -1) { - int bumpedItems = bumpedRows(); - if (proxyIndex.row() < bumpedItems) - return m_treeModel->index(proxyIndex.row(), proxyIndex.column(), m_treeModel->index(0, 0)); - if (bumpedItems <= MOVEDROWS && bumpedItems == sourceModel()->rowCount(m_treeModel->index(0, 0))) - --bumpedItems; - return m_treeModel->index(proxyIndex.row() - bumpedItems, proxyIndex.column()); - } - - QModelIndex historyIndex = m_treeModel->sourceModel()->index(proxyIndex.internalId(), proxyIndex.column()); - QModelIndex treeIndex = m_treeModel->mapFromSource(historyIndex); - return treeIndex; -} - -QModelIndex HistoryMenuModel::index(int row, int column, const QModelIndex &parent) const -{ - if (row < 0 - || column < 0 || column >= columnCount(parent) - || parent.column() > 0) - return QModelIndex(); - if (!parent.isValid()) - return createIndex(row, column, -1); - - QModelIndex treeIndexParent = mapToSource(parent); - - int bumpedItems = 0; - if (treeIndexParent == m_treeModel->index(0, 0)) - bumpedItems = bumpedRows(); - QModelIndex treeIndex = m_treeModel->index(row + bumpedItems, column, treeIndexParent); - QModelIndex historyIndex = m_treeModel->mapToSource(treeIndex); - int historyRow = historyIndex.row(); - if (historyRow == -1) - historyRow = treeIndex.row(); - return createIndex(row, column, historyRow); -} - -QModelIndex HistoryMenuModel::parent(const QModelIndex &index) const -{ - int offset = index.internalId(); - if (offset == -1 || !index.isValid()) - return QModelIndex(); - - QModelIndex historyIndex = m_treeModel->sourceModel()->index(index.internalId(), 0); - QModelIndex treeIndex = m_treeModel->mapFromSource(historyIndex); - QModelIndex treeIndexParent = treeIndex.parent(); - - int sr = m_treeModel->mapToSource(treeIndexParent).row(); - int bumpedItems = bumpedRows(); - if (bumpedItems <= MOVEDROWS && bumpedItems == sourceModel()->rowCount(sourceModel()->index(0, 0))) - --bumpedItems; - return createIndex(bumpedItems + treeIndexParent.row(), treeIndexParent.column(), sr); -} - - -HistoryMenu::HistoryMenu(QWidget *parent) - : ModelMenu(parent) - , m_history(0) -{ - connect(this, SIGNAL(activated(const QModelIndex &)), - this, SLOT(activated(const QModelIndex &))); - setHoverRole(HistoryModel::UrlStringRole); -} - -void HistoryMenu::activated(const QModelIndex &index) -{ - emit openUrl(index.data(HistoryModel::UrlRole).toUrl()); -} - -bool HistoryMenu::prePopulated() -{ - if (!m_history) { - m_history = BrowserApplication::historyManager(); - m_historyMenuModel = new HistoryMenuModel(m_history->historyTreeModel(), this); - setModel(m_historyMenuModel); - } - // initial actions - for (int i = 0; i < m_initialActions.count(); ++i) - addAction(m_initialActions.at(i)); - if (!m_initialActions.isEmpty()) - addSeparator(); - setFirstSeparator(m_historyMenuModel->bumpedRows()); - - return false; -} - -void HistoryMenu::postPopulated() -{ - if (m_history->history().count() > 0) - addSeparator(); - - QAction *showAllAction = new QAction(tr("Show All History"), this); - connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog())); - addAction(showAllAction); - - QAction *clearAction = new QAction(tr("Clear History"), this); - connect(clearAction, SIGNAL(triggered()), m_history, SLOT(clear())); - addAction(clearAction); -} - -void HistoryMenu::showHistoryDialog() -{ - HistoryDialog *dialog = new HistoryDialog(this); - connect(dialog, SIGNAL(openUrl(const QUrl&)), - this, SIGNAL(openUrl(const QUrl&))); - dialog->show(); -} - -void HistoryMenu::setInitialActions(QList actions) -{ - m_initialActions = actions; - for (int i = 0; i < m_initialActions.count(); ++i) - addAction(m_initialActions.at(i)); -} - -TreeProxyModel::TreeProxyModel(QObject *parent) : QSortFilterProxyModel(parent) -{ - setSortRole(HistoryModel::DateTimeRole); - setFilterCaseSensitivity(Qt::CaseInsensitive); -} - -bool TreeProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const -{ - if (!source_parent.isValid()) - return true; - return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); -} - -HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) : QDialog(parent) -{ - HistoryManager *history = setHistory; - if (!history) - history = BrowserApplication::historyManager(); - setupUi(this); - tree->setUniformRowHeights(true); - tree->setSelectionBehavior(QAbstractItemView::SelectRows); - tree->setTextElideMode(Qt::ElideMiddle); - QAbstractItemModel *model = history->historyTreeModel(); - TreeProxyModel *proxyModel = new TreeProxyModel(this); - connect(search, SIGNAL(textChanged(QString)), - proxyModel, SLOT(setFilterFixedString(QString))); - connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne())); - connect(removeAllButton, SIGNAL(clicked()), history, SLOT(clear())); - proxyModel->setSourceModel(model); - tree->setModel(proxyModel); - tree->setExpanded(proxyModel->index(0, 0), true); - tree->setAlternatingRowColors(true); - QFontMetrics fm(font()); - int header = fm.width(QLatin1Char('m')) * 40; - tree->header()->resizeSection(0, header); - tree->header()->setStretchLastSection(true); - connect(tree, SIGNAL(activated(const QModelIndex&)), - this, SLOT(open())); - tree->setContextMenuPolicy(Qt::CustomContextMenu); - connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(customContextMenuRequested(const QPoint &))); -} - -void HistoryDialog::customContextMenuRequested(const QPoint &pos) -{ - QMenu menu; - QModelIndex index = tree->indexAt(pos); - index = index.sibling(index.row(), 0); - if (index.isValid() && !tree->model()->hasChildren(index)) { - menu.addAction(tr("Open"), this, SLOT(open())); - menu.addSeparator(); - menu.addAction(tr("Copy"), this, SLOT(copy())); - } - menu.addAction(tr("Delete"), tree, SLOT(removeOne())); - menu.exec(QCursor::pos()); -} - -void HistoryDialog::open() -{ - QModelIndex index = tree->currentIndex(); - if (!index.parent().isValid()) - return; - emit openUrl(index.data(HistoryModel::UrlRole).toUrl()); -} - -void HistoryDialog::copy() -{ - QModelIndex index = tree->currentIndex(); - if (!index.parent().isValid()) - return; - QString url = index.data(HistoryModel::UrlStringRole).toString(); - - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(url); -} - -HistoryFilterModel::HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent) - : QAbstractProxyModel(parent), - m_loaded(false) -{ - setSourceModel(sourceModel); -} - -int HistoryFilterModel::historyLocation(const QString &url) const -{ - load(); - if (!m_historyHash.contains(url)) - return 0; - return sourceModel()->rowCount() - m_historyHash.value(url); -} - -QVariant HistoryFilterModel::data(const QModelIndex &index, int role) const -{ - return QAbstractProxyModel::data(index, role); -} - -void HistoryFilterModel::setSourceModel(QAbstractItemModel *newSourceModel) -{ - if (sourceModel()) { - disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); - disconnect(sourceModel(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(dataChanged(const QModelIndex &, const QModelIndex &))); - disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); - } - - QAbstractProxyModel::setSourceModel(newSourceModel); - - if (sourceModel()) { - m_loaded = false; - connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); - connect(sourceModel(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(sourceDataChanged(const QModelIndex &, const QModelIndex &))); - connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); - } -} - -void HistoryFilterModel::sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) -{ - emit dataChanged(mapFromSource(topLeft), mapFromSource(bottomRight)); -} - -QVariant HistoryFilterModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - return sourceModel()->headerData(section, orientation, role); -} - -void HistoryFilterModel::sourceReset() -{ - m_loaded = false; - reset(); -} - -int HistoryFilterModel::rowCount(const QModelIndex &parent) const -{ - load(); - if (parent.isValid()) - return 0; - return m_historyHash.count(); -} - -int HistoryFilterModel::columnCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : 2; -} - -QModelIndex HistoryFilterModel::mapToSource(const QModelIndex &proxyIndex) const -{ - load(); - int sourceRow = sourceModel()->rowCount() - proxyIndex.internalId(); - return sourceModel()->index(sourceRow, proxyIndex.column()); -} - -QModelIndex HistoryFilterModel::mapFromSource(const QModelIndex &sourceIndex) const -{ - load(); - QString url = sourceIndex.data(HistoryModel::UrlStringRole).toString(); - if (!m_historyHash.contains(url)) - return QModelIndex(); - - // This can be done in a binary search, but we can't use qBinary find - // because it can't take: qBinaryFind(m_sourceRow.end(), m_sourceRow.begin(), v); - // so if this is a performance bottlneck then convert to binary search, until then - // the cleaner/easier to read code wins the day. - int realRow = -1; - int sourceModelRow = sourceModel()->rowCount() - sourceIndex.row(); - - for (int i = 0; i < m_sourceRow.count(); ++i) { - if (m_sourceRow.at(i) == sourceModelRow) { - realRow = i; - break; - } - } - if (realRow == -1) - return QModelIndex(); - - return createIndex(realRow, sourceIndex.column(), sourceModel()->rowCount() - sourceIndex.row()); -} - -QModelIndex HistoryFilterModel::index(int row, int column, const QModelIndex &parent) const -{ - load(); - if (row < 0 || row >= rowCount(parent) - || column < 0 || column >= columnCount(parent)) - return QModelIndex(); - - return createIndex(row, column, m_sourceRow[row]); -} - -QModelIndex HistoryFilterModel::parent(const QModelIndex &) const -{ - return QModelIndex(); -} - -void HistoryFilterModel::load() const -{ - if (m_loaded) - return; - m_sourceRow.clear(); - m_historyHash.clear(); - m_historyHash.reserve(sourceModel()->rowCount()); - for (int i = 0; i < sourceModel()->rowCount(); ++i) { - QModelIndex idx = sourceModel()->index(i, 0); - QString url = idx.data(HistoryModel::UrlStringRole).toString(); - if (!m_historyHash.contains(url)) { - m_sourceRow.append(sourceModel()->rowCount() - i); - m_historyHash[url] = sourceModel()->rowCount() - i; - } - } - m_loaded = true; -} - -void HistoryFilterModel::sourceRowsInserted(const QModelIndex &parent, int start, int end) -{ - Q_ASSERT(start == end && start == 0); - Q_UNUSED(end); - if (!m_loaded) - return; - QModelIndex idx = sourceModel()->index(start, 0, parent); - QString url = idx.data(HistoryModel::UrlStringRole).toString(); - if (m_historyHash.contains(url)) { - int sourceRow = sourceModel()->rowCount() - m_historyHash[url]; - int realRow = mapFromSource(sourceModel()->index(sourceRow, 0)).row(); - beginRemoveRows(QModelIndex(), realRow, realRow); - m_sourceRow.removeAt(realRow); - m_historyHash.remove(url); - endRemoveRows(); - } - beginInsertRows(QModelIndex(), 0, 0); - m_historyHash.insert(url, sourceModel()->rowCount() - start); - m_sourceRow.insert(0, sourceModel()->rowCount()); - endInsertRows(); -} - -void HistoryFilterModel::sourceRowsRemoved(const QModelIndex &, int start, int end) -{ - Q_UNUSED(start); - Q_UNUSED(end); - sourceReset(); -} - -/* - Removing a continuous block of rows will remove filtered rows too as this is - the users intention. -*/ -bool HistoryFilterModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (row < 0 || count <= 0 || row + count > rowCount(parent) || parent.isValid()) - return false; - int lastRow = row + count - 1; - disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); - beginRemoveRows(parent, row, lastRow); - int oldCount = rowCount(); - int start = sourceModel()->rowCount() - m_sourceRow.value(row); - int end = sourceModel()->rowCount() - m_sourceRow.value(lastRow); - sourceModel()->removeRows(start, end - start + 1); - endRemoveRows(); - connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); - m_loaded = false; - if (oldCount - count != rowCount()) - reset(); - return true; -} - -HistoryCompletionModel::HistoryCompletionModel(QObject *parent) - : QAbstractProxyModel(parent) -{ -} - -QVariant HistoryCompletionModel::data(const QModelIndex &index, int role) const -{ - if (sourceModel() - && (role == Qt::EditRole || role == Qt::DisplayRole) - && index.isValid()) { - QModelIndex idx = mapToSource(index); - idx = idx.sibling(idx.row(), 1); - QString urlString = idx.data(HistoryModel::UrlStringRole).toString(); - if (index.row() % 2) { - QUrl url = urlString; - QString s = url.toString(QUrl::RemoveScheme - | QUrl::RemoveUserInfo - | QUrl::StripTrailingSlash); - return s.mid(2); // strip // from the front - } - return urlString; - } - return QAbstractProxyModel::data(index, role); -} - -int HistoryCompletionModel::rowCount(const QModelIndex &parent) const -{ - return (parent.isValid() || !sourceModel()) ? 0 : sourceModel()->rowCount(parent) * 2; -} - -int HistoryCompletionModel::columnCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : 1; -} - -QModelIndex HistoryCompletionModel::mapFromSource(const QModelIndex &sourceIndex) const -{ - int row = sourceIndex.row() * 2; - return index(row, sourceIndex.column()); -} - -QModelIndex HistoryCompletionModel::mapToSource(const QModelIndex &proxyIndex) const -{ - if (!sourceModel()) - return QModelIndex(); - int row = proxyIndex.row() / 2; - return sourceModel()->index(row, proxyIndex.column()); -} - -QModelIndex HistoryCompletionModel::index(int row, int column, const QModelIndex &parent) const -{ - if (row < 0 || row >= rowCount(parent) - || column < 0 || column >= columnCount(parent)) - return QModelIndex(); - return createIndex(row, column, 0); -} - -QModelIndex HistoryCompletionModel::parent(const QModelIndex &) const -{ - return QModelIndex(); -} - -void HistoryCompletionModel::setSourceModel(QAbstractItemModel *newSourceModel) -{ - if (sourceModel()) { - disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); - disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceReset())); - disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceReset())); - } - - QAbstractProxyModel::setSourceModel(newSourceModel); - - if (newSourceModel) { - connect(newSourceModel, SIGNAL(modelReset()), this, SLOT(sourceReset())); - connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceReset())); - connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceReset())); - } - - reset(); -} - -void HistoryCompletionModel::sourceReset() -{ - reset(); -} - -HistoryTreeModel::HistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent) - : QAbstractProxyModel(parent) -{ - setSourceModel(sourceModel); -} - -QVariant HistoryTreeModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - return sourceModel()->headerData(section, orientation, role); -} - -QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const -{ - if ((role == Qt::EditRole || role == Qt::DisplayRole)) { - int start = index.internalId(); - if (start == 0) { - int offset = sourceDateRow(index.row()); - if (index.column() == 0) { - QModelIndex idx = sourceModel()->index(offset, 0); - QDate date = idx.data(HistoryModel::DateRole).toDate(); - if (date == QDate::currentDate()) - return tr("Earlier Today"); - return date.toString(QLatin1String("dddd, MMMM d, yyyy")); - } - if (index.column() == 1) { - return tr("%1 items").arg(rowCount(index.sibling(index.row(), 0))); - } - } - } - if (role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid()) - return QIcon(QLatin1String(":history.png")); - if (role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0) { - int offset = sourceDateRow(index.row()); - QModelIndex idx = sourceModel()->index(offset, 0); - return idx.data(HistoryModel::DateRole); - } - - return QAbstractProxyModel::data(index, role); -} - -int HistoryTreeModel::columnCount(const QModelIndex &parent) const -{ - return sourceModel()->columnCount(mapToSource(parent)); -} - -int HistoryTreeModel::rowCount(const QModelIndex &parent) const -{ - if ( parent.internalId() != 0 - || parent.column() > 0 - || !sourceModel()) - return 0; - - // row count OF dates - if (!parent.isValid()) { - if (!m_sourceRowCache.isEmpty()) - return m_sourceRowCache.count(); - QDate currentDate; - int rows = 0; - int totalRows = sourceModel()->rowCount(); - - for (int i = 0; i < totalRows; ++i) { - QDate rowDate = sourceModel()->index(i, 0).data(HistoryModel::DateRole).toDate(); - if (rowDate != currentDate) { - m_sourceRowCache.append(i); - currentDate = rowDate; - ++rows; - } - } - Q_ASSERT(m_sourceRowCache.count() == rows); - return rows; - } - - // row count FOR a date - int start = sourceDateRow(parent.row()); - int end = sourceDateRow(parent.row() + 1); - return (end - start); -} - -// Translate the top level date row into the offset where that date starts -int HistoryTreeModel::sourceDateRow(int row) const -{ - if (row <= 0) - return 0; - - if (m_sourceRowCache.isEmpty()) - rowCount(QModelIndex()); - - if (row >= m_sourceRowCache.count()) { - if (!sourceModel()) - return 0; - return sourceModel()->rowCount(); - } - return m_sourceRowCache.at(row); -} - -QModelIndex HistoryTreeModel::mapToSource(const QModelIndex &proxyIndex) const -{ - int offset = proxyIndex.internalId(); - if (offset == 0) - return QModelIndex(); - int startDateRow = sourceDateRow(offset - 1); - return sourceModel()->index(startDateRow + proxyIndex.row(), proxyIndex.column()); -} - -QModelIndex HistoryTreeModel::index(int row, int column, const QModelIndex &parent) const -{ - if (row < 0 - || column < 0 || column >= columnCount(parent) - || parent.column() > 0) - return QModelIndex(); - - if (!parent.isValid()) - return createIndex(row, column, 0); - return createIndex(row, column, parent.row() + 1); -} - -QModelIndex HistoryTreeModel::parent(const QModelIndex &index) const -{ - int offset = index.internalId(); - if (offset == 0 || !index.isValid()) - return QModelIndex(); - return createIndex(offset - 1, 0, 0); -} - -bool HistoryTreeModel::hasChildren(const QModelIndex &parent) const -{ - QModelIndex grandparent = parent.parent(); - if (!grandparent.isValid()) - return true; - return false; -} - -Qt::ItemFlags HistoryTreeModel::flags(const QModelIndex &index) const -{ - if (!index.isValid()) - return Qt::NoItemFlags; - return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled; -} - -bool HistoryTreeModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (row < 0 || count <= 0 || row + count > rowCount(parent)) - return false; - - if (parent.isValid()) { - // removing pages - int offset = sourceDateRow(parent.row()); - return sourceModel()->removeRows(offset + row, count); - } else { - // removing whole dates - for (int i = row + count - 1; i >= row; --i) { - QModelIndex dateParent = index(i, 0); - int offset = sourceDateRow(dateParent.row()); - if (!sourceModel()->removeRows(offset, rowCount(dateParent))) - return false; - } - } - return true; -} - -void HistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel) -{ - if (sourceModel()) { - disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); - disconnect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset())); - disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); - } - - QAbstractProxyModel::setSourceModel(newSourceModel); - - if (newSourceModel) { - connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); - connect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset())); - connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); - } - - reset(); -} - -void HistoryTreeModel::sourceReset() -{ - m_sourceRowCache.clear(); - reset(); -} - -void HistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start, int end) -{ - Q_UNUSED(parent); // Avoid warnings when compiling release - Q_ASSERT(!parent.isValid()); - if (start != 0 || start != end) { - m_sourceRowCache.clear(); - reset(); - return; - } - - m_sourceRowCache.clear(); - QModelIndex treeIndex = mapFromSource(sourceModel()->index(start, 0)); - QModelIndex treeParent = treeIndex.parent(); - if (rowCount(treeParent) == 1) { - beginInsertRows(QModelIndex(), 0, 0); - endInsertRows(); - } else { - beginInsertRows(treeParent, treeIndex.row(), treeIndex.row()); - endInsertRows(); - } -} - -QModelIndex HistoryTreeModel::mapFromSource(const QModelIndex &sourceIndex) const -{ - if (!sourceIndex.isValid()) - return QModelIndex(); - - if (m_sourceRowCache.isEmpty()) - rowCount(QModelIndex()); - - QList::iterator it; - it = qLowerBound(m_sourceRowCache.begin(), m_sourceRowCache.end(), sourceIndex.row()); - if (*it != sourceIndex.row()) - --it; - int dateRow = qMax(0, it - m_sourceRowCache.begin()); - int row = sourceIndex.row() - m_sourceRowCache.at(dateRow); - return createIndex(row, sourceIndex.column(), dateRow + 1); -} - -void HistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, int end) -{ - Q_UNUSED(parent); // Avoid warnings when compiling release - Q_ASSERT(!parent.isValid()); - if (m_sourceRowCache.isEmpty()) - return; - for (int i = end; i >= start;) { - QList::iterator it; - it = qLowerBound(m_sourceRowCache.begin(), m_sourceRowCache.end(), i); - // playing it safe - if (it == m_sourceRowCache.end()) { - m_sourceRowCache.clear(); - reset(); - return; - } - - if (*it != i) - --it; - int row = qMax(0, it - m_sourceRowCache.begin()); - int offset = m_sourceRowCache[row]; - QModelIndex dateParent = index(row, 0); - // If we can remove all the rows in the date do that and skip over them - int rc = rowCount(dateParent); - if (i - rc + 1 == offset && start <= i - rc + 1) { - beginRemoveRows(QModelIndex(), row, row); - m_sourceRowCache.removeAt(row); - i -= rc + 1; - } else { - beginRemoveRows(dateParent, i - offset, i - offset); - ++row; - --i; - } - for (int j = row; j < m_sourceRowCache.count(); ++j) - --m_sourceRowCache[j]; - endRemoveRows(); - } -} - diff --git a/examples/gestures/browser/history.h b/examples/gestures/browser/history.h deleted file mode 100644 index 626e2f3..0000000 --- a/examples/gestures/browser/history.h +++ /dev/null @@ -1,350 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef HISTORY_H -#define HISTORY_H - -#include "modelmenu.h" - -#include -#include -#include -#include -#include - -#include - -#include - -class HistoryItem -{ -public: - HistoryItem() {} - HistoryItem(const QString &u, - const QDateTime &d = QDateTime(), const QString &t = QString()) - : title(t), url(u), dateTime(d) {} - - inline bool operator==(const HistoryItem &other) const - { return other.title == title - && other.url == url && other.dateTime == dateTime; } - - // history is sorted in reverse - inline bool operator <(const HistoryItem &other) const - { return dateTime > other.dateTime; } - - QString title; - QString url; - QDateTime dateTime; -}; - -class AutoSaver; -class HistoryModel; -class HistoryFilterModel; -class HistoryTreeModel; -class HistoryManager : public QWebHistoryInterface -{ - Q_OBJECT - Q_PROPERTY(int historyLimit READ historyLimit WRITE setHistoryLimit) - -signals: - void historyReset(); - void entryAdded(const HistoryItem &item); - void entryRemoved(const HistoryItem &item); - void entryUpdated(int offset); - -public: - HistoryManager(QObject *parent = 0); - ~HistoryManager(); - - bool historyContains(const QString &url) const; - void addHistoryEntry(const QString &url); - - void updateHistoryItem(const QUrl &url, const QString &title); - - int historyLimit() const; - void setHistoryLimit(int limit); - - QList history() const; - void setHistory(const QList &history, bool loadedAndSorted = false); - - // History manager keeps around these models for use by the completer and other classes - HistoryModel *historyModel() const; - HistoryFilterModel *historyFilterModel() const; - HistoryTreeModel *historyTreeModel() const; - -public slots: - void clear(); - void loadSettings(); - -private slots: - void save(); - void checkForExpired(); - -protected: - void addHistoryItem(const HistoryItem &item); - -private: - void load(); - - AutoSaver *m_saveTimer; - int m_historyLimit; - QTimer m_expiredTimer; - QList m_history; - QString m_lastSavedUrl; - - HistoryModel *m_historyModel; - HistoryFilterModel *m_historyFilterModel; - HistoryTreeModel *m_historyTreeModel; -}; - -class HistoryModel : public QAbstractTableModel -{ - Q_OBJECT - -public slots: - void historyReset(); - void entryAdded(); - void entryUpdated(int offset); - -public: - enum Roles { - DateRole = Qt::UserRole + 1, - DateTimeRole = Qt::UserRole + 2, - UrlRole = Qt::UserRole + 3, - UrlStringRole = Qt::UserRole + 4 - }; - - HistoryModel(HistoryManager *history, QObject *parent = 0); - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - -private: - HistoryManager *m_history; -}; - -/*! - Proxy model that will remove any duplicate entries. - Both m_sourceRow and m_historyHash store their offsets not from - the front of the list, but as offsets from the back. - */ -class HistoryFilterModel : public QAbstractProxyModel -{ - Q_OBJECT - -public: - HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent = 0); - - inline bool historyContains(const QString &url) const - { load(); return m_historyHash.contains(url); } - int historyLocation(const QString &url) const; - - QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; - QModelIndex mapToSource(const QModelIndex &proxyIndex) const; - void setSourceModel(QAbstractItemModel *sourceModel); - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const; - QModelIndex parent(const QModelIndex& index= QModelIndex()) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - -private slots: - void sourceReset(); - void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - void sourceRowsInserted(const QModelIndex &parent, int start, int end); - void sourceRowsRemoved(const QModelIndex &, int, int); - -private: - void load() const; - - mutable QList m_sourceRow; - mutable QHash m_historyHash; - mutable bool m_loaded; -}; - -/* - The history menu - - Removes the first twenty entries and puts them as children of the top level. - - If there are less then twenty entries then the first folder is also removed. - - The mapping is done by knowing that HistoryTreeModel is over a table - We store that row offset in our index's private data. -*/ -class HistoryMenuModel : public QAbstractProxyModel -{ - Q_OBJECT - -public: - HistoryMenuModel(HistoryTreeModel *sourceModel, QObject *parent = 0); - int columnCount(const QModelIndex &parent) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QModelIndex mapFromSource(const QModelIndex & sourceIndex) const; - QModelIndex mapToSource(const QModelIndex & proxyIndex) const; - QModelIndex index(int, int, const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index = QModelIndex()) const; - - int bumpedRows() const; - -private: - HistoryTreeModel *m_treeModel; -}; - -// Menu that is dynamically populated from the history -class HistoryMenu : public ModelMenu -{ - Q_OBJECT - -signals: - void openUrl(const QUrl &url); - -public: - HistoryMenu(QWidget *parent = 0); - void setInitialActions(QList actions); - -protected: - bool prePopulated(); - void postPopulated(); - -private slots: - void activated(const QModelIndex &index); - void showHistoryDialog(); - -private: - HistoryManager *m_history; - HistoryMenuModel *m_historyMenuModel; - QList m_initialActions; -}; - -// proxy model for the history model that -// exposes each url http://www.foo.com and it url starting at the host www.foo.com -class HistoryCompletionModel : public QAbstractProxyModel -{ - Q_OBJECT - -public: - HistoryCompletionModel(QObject *parent = 0); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; - QModelIndex mapToSource(const QModelIndex &proxyIndex) const; - QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const; - QModelIndex parent(const QModelIndex& index= QModelIndex()) const; - void setSourceModel(QAbstractItemModel *sourceModel); - -private slots: - void sourceReset(); - -}; - -// proxy model for the history model that converts the list -// into a tree, one top level node per day. -// Used in the HistoryDialog. -class HistoryTreeModel : public QAbstractProxyModel -{ - Q_OBJECT - -public: - HistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent = 0); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int columnCount(const QModelIndex &parent) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; - QModelIndex mapToSource(const QModelIndex &proxyIndex) const; - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index= QModelIndex()) const; - bool hasChildren(const QModelIndex &parent = QModelIndex()) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - - void setSourceModel(QAbstractItemModel *sourceModel); - -private slots: - void sourceReset(); - void sourceRowsInserted(const QModelIndex &parent, int start, int end); - void sourceRowsRemoved(const QModelIndex &parent, int start, int end); - -private: - int sourceDateRow(int row) const; - mutable QList m_sourceRowCache; - -}; - -// A modified QSortFilterProxyModel that always accepts the root nodes in the tree -// so filtering is only done on the children. -// Used in the HistoryDialog -class TreeProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - TreeProxyModel(QObject *parent = 0); - -protected: - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; -}; - -#include "ui_history.h" - -class HistoryDialog : public QDialog, public Ui_HistoryDialog -{ - Q_OBJECT - -signals: - void openUrl(const QUrl &url); - -public: - HistoryDialog(QWidget *parent = 0, HistoryManager *history = 0); - -private slots: - void customContextMenuRequested(const QPoint &pos); - void open(); - void copy(); - -}; - -#endif // HISTORY_H - diff --git a/examples/gestures/browser/history.ui b/examples/gestures/browser/history.ui deleted file mode 100644 index 0944940..0000000 --- a/examples/gestures/browser/history.ui +++ /dev/null @@ -1,106 +0,0 @@ - - HistoryDialog - - - - 0 - 0 - 758 - 450 - - - - History - - - - - - Qt::Horizontal - - - - 252 - 20 - - - - - - - - - - - - - - - - &Remove - - - - - - - Remove &All - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QDialogButtonBox::Ok - - - - - - - - - - SearchLineEdit - QLineEdit -
    searchlineedit.h
    -
    - - EditTreeView - QTreeView -
    edittreeview.h
    -
    -
    - - - - buttonBox - accepted() - HistoryDialog - accept() - - - 472 - 329 - - - 461 - 356 - - - - -
    diff --git a/examples/gestures/browser/htmls/htmls.qrc b/examples/gestures/browser/htmls/htmls.qrc deleted file mode 100644 index 03b256c..0000000 --- a/examples/gestures/browser/htmls/htmls.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - notfound.html - - diff --git a/examples/gestures/browser/htmls/notfound.html b/examples/gestures/browser/htmls/notfound.html deleted file mode 100644 index b04a9f8..0000000 --- a/examples/gestures/browser/htmls/notfound.html +++ /dev/null @@ -1,63 +0,0 @@ - - -%1 - - - -
    - -

    %2

    -

    When connecting to: %3.

    -
      -
    • Check the address for errors such as ww.trolltech.com - instead of www.trolltech.com
    • -
    • If the address is correct, try checking the network - connection.
    • -
    • If your computer or network is protected by a firewall or - proxy, make sure that the browser demo is permitted to access - the network.
    • -
    -

    -
    - - diff --git a/examples/gestures/browser/main.cpp b/examples/gestures/browser/main.cpp deleted file mode 100644 index b9e2830..0000000 --- a/examples/gestures/browser/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "browserapplication.h" - -int main(int argc, char **argv) -{ - Q_INIT_RESOURCE(data); - BrowserApplication application(argc, argv); - if (!application.isTheOnlyBrowser()) - return 0; - application.newMainWindow(); - return application.exec(); -} - diff --git a/examples/gestures/browser/modelmenu.cpp b/examples/gestures/browser/modelmenu.cpp deleted file mode 100644 index 2e81d0d..0000000 --- a/examples/gestures/browser/modelmenu.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "modelmenu.h" - -#include -#include - -ModelMenu::ModelMenu(QWidget * parent) - : QMenu(parent) - , m_maxRows(7) - , m_firstSeparator(-1) - , m_maxWidth(-1) - , m_hoverRole(0) - , m_separatorRole(0) - , m_model(0) -{ - connect(this, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); -} - -bool ModelMenu::prePopulated() -{ - return false; -} - -void ModelMenu::postPopulated() -{ -} - -void ModelMenu::setModel(QAbstractItemModel *model) -{ - m_model = model; -} - -QAbstractItemModel *ModelMenu::model() const -{ - return m_model; -} - -void ModelMenu::setMaxRows(int max) -{ - m_maxRows = max; -} - -int ModelMenu::maxRows() const -{ - return m_maxRows; -} - -void ModelMenu::setFirstSeparator(int offset) -{ - m_firstSeparator = offset; -} - -int ModelMenu::firstSeparator() const -{ - return m_firstSeparator; -} - -void ModelMenu::setRootIndex(const QModelIndex &index) -{ - m_root = index; -} - -QModelIndex ModelMenu::rootIndex() const -{ - return m_root; -} - -void ModelMenu::setHoverRole(int role) -{ - m_hoverRole = role; -} - -int ModelMenu::hoverRole() const -{ - return m_hoverRole; -} - -void ModelMenu::setSeparatorRole(int role) -{ - m_separatorRole = role; -} - -int ModelMenu::separatorRole() const -{ - return m_separatorRole; -} - -Q_DECLARE_METATYPE(QModelIndex) -void ModelMenu::aboutToShow() -{ - if (QMenu *menu = qobject_cast(sender())) { - QVariant v = menu->menuAction()->data(); - if (v.canConvert()) { - QModelIndex idx = qvariant_cast(v); - createMenu(idx, -1, menu, menu); - disconnect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); - return; - } - } - - clear(); - if (prePopulated()) - addSeparator(); - int max = m_maxRows; - if (max != -1) - max += m_firstSeparator; - createMenu(m_root, max, this, this); - postPopulated(); -} - -void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu) -{ - if (!menu) { - QString title = parent.data().toString(); - menu = new QMenu(title, this); - QIcon icon = qvariant_cast(parent.data(Qt::DecorationRole)); - menu->setIcon(icon); - parentMenu->addMenu(menu); - QVariant v; - v.setValue(parent); - menu->menuAction()->setData(v); - connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); - return; - } - - int end = m_model->rowCount(parent); - if (max != -1) - end = qMin(max, end); - - connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*))); - connect(menu, SIGNAL(hovered(QAction*)), this, SLOT(hovered(QAction*))); - - for (int i = 0; i < end; ++i) { - QModelIndex idx = m_model->index(i, 0, parent); - if (m_model->hasChildren(idx)) { - createMenu(idx, -1, menu); - } else { - if (m_separatorRole != 0 - && idx.data(m_separatorRole).toBool()) - addSeparator(); - else - menu->addAction(makeAction(idx)); - } - if (menu == this && i == m_firstSeparator - 1) - addSeparator(); - } -} - -QAction *ModelMenu::makeAction(const QModelIndex &index) -{ - QIcon icon = qvariant_cast(index.data(Qt::DecorationRole)); - QAction *action = makeAction(icon, index.data().toString(), this); - QVariant v; - v.setValue(index); - action->setData(v); - return action; -} - -QAction *ModelMenu::makeAction(const QIcon &icon, const QString &text, QObject *parent) -{ - QFontMetrics fm(font()); - if (-1 == m_maxWidth) - m_maxWidth = fm.width(QLatin1Char('m')) * 30; - QString smallText = fm.elidedText(text, Qt::ElideMiddle, m_maxWidth); - return new QAction(icon, smallText, parent); -} - -void ModelMenu::triggered(QAction *action) -{ - QVariant v = action->data(); - if (v.canConvert()) { - QModelIndex idx = qvariant_cast(v); - emit activated(idx); - } -} - -void ModelMenu::hovered(QAction *action) -{ - QVariant v = action->data(); - if (v.canConvert()) { - QModelIndex idx = qvariant_cast(v); - QString hoveredString = idx.data(m_hoverRole).toString(); - if (!hoveredString.isEmpty()) - emit hovered(hoveredString); - } -} - diff --git a/examples/gestures/browser/modelmenu.h b/examples/gestures/browser/modelmenu.h deleted file mode 100644 index b44daa8..0000000 --- a/examples/gestures/browser/modelmenu.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MODELMENU_H -#define MODELMENU_H - -#include -#include - -// A QMenu that is dynamically populated from a QAbstractItemModel -class ModelMenu : public QMenu -{ - Q_OBJECT - -signals: - void activated(const QModelIndex &index); - void hovered(const QString &text); - -public: - ModelMenu(QWidget *parent = 0); - - void setModel(QAbstractItemModel *model); - QAbstractItemModel *model() const; - - void setMaxRows(int max); - int maxRows() const; - - void setFirstSeparator(int offset); - int firstSeparator() const; - - void setRootIndex(const QModelIndex &index); - QModelIndex rootIndex() const; - - void setHoverRole(int role); - int hoverRole() const; - - void setSeparatorRole(int role); - int separatorRole() const; - - QAction *makeAction(const QIcon &icon, const QString &text, QObject *parent); - -protected: - // add any actions before the tree, return true if any actions are added. - virtual bool prePopulated(); - // add any actions after the tree - virtual void postPopulated(); - // put all of the children of parent into menu up to max - void createMenu(const QModelIndex &parent, int max, QMenu *parentMenu = 0, QMenu *menu = 0); - -private slots: - void aboutToShow(); - void triggered(QAction *action); - void hovered(QAction *action); - -private: - QAction *makeAction(const QModelIndex &index); - int m_maxRows; - int m_firstSeparator; - int m_maxWidth; - int m_hoverRole; - int m_separatorRole; - QAbstractItemModel *m_model; - QPersistentModelIndex m_root; -}; - -#endif // MODELMENU_H - diff --git a/examples/gestures/browser/networkaccessmanager.cpp b/examples/gestures/browser/networkaccessmanager.cpp deleted file mode 100644 index 3a4598c..0000000 --- a/examples/gestures/browser/networkaccessmanager.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "networkaccessmanager.h" - -#include "browserapplication.h" -#include "browsermainwindow.h" -#include "ui_passworddialog.h" -#include "ui_proxy.h" - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -NetworkAccessManager::NetworkAccessManager(QObject *parent) - : QNetworkAccessManager(parent) -{ - connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), - SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); - connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), - SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); -#ifndef QT_NO_OPENSSL - connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList&)), - SLOT(sslErrors(QNetworkReply*, const QList&))); -#endif - loadSettings(); - - QNetworkDiskCache *diskCache = new QNetworkDiskCache(this); - QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); - diskCache->setCacheDirectory(location); - setCache(diskCache); -} - -void NetworkAccessManager::loadSettings() -{ - QSettings settings; - settings.beginGroup(QLatin1String("proxy")); - QNetworkProxy proxy; - if (settings.value(QLatin1String("enabled"), false).toBool()) { - if (settings.value(QLatin1String("type"), 0).toInt() == 0) - proxy = QNetworkProxy::Socks5Proxy; - else - proxy = QNetworkProxy::HttpProxy; - proxy.setHostName(settings.value(QLatin1String("hostName")).toString()); - proxy.setPort(settings.value(QLatin1String("port"), 1080).toInt()); - proxy.setUser(settings.value(QLatin1String("userName")).toString()); - proxy.setPassword(settings.value(QLatin1String("password")).toString()); - } - setProxy(proxy); -} - -void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth) -{ - BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); - - QDialog dialog(mainWindow); - dialog.setWindowFlags(Qt::Sheet); - - Ui::PasswordDialog passwordDialog; - passwordDialog.setupUi(&dialog); - - passwordDialog.iconLabel->setText(QString()); - passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); - - QString introMessage = tr("Enter username and password for \"%1\" at %2"); - introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString())); - passwordDialog.introLabel->setText(introMessage); - passwordDialog.introLabel->setWordWrap(true); - - if (dialog.exec() == QDialog::Accepted) { - auth->setUser(passwordDialog.userNameLineEdit->text()); - auth->setPassword(passwordDialog.passwordLineEdit->text()); - } -} - -void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth) -{ - BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); - - QDialog dialog(mainWindow); - dialog.setWindowFlags(Qt::Sheet); - - Ui::ProxyDialog proxyDialog; - proxyDialog.setupUi(&dialog); - - proxyDialog.iconLabel->setText(QString()); - proxyDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); - - QString introMessage = tr("Connect to proxy \"%1\" using:"); - introMessage = introMessage.arg(Qt::escape(proxy.hostName())); - proxyDialog.introLabel->setText(introMessage); - proxyDialog.introLabel->setWordWrap(true); - - if (dialog.exec() == QDialog::Accepted) { - auth->setUser(proxyDialog.userNameLineEdit->text()); - auth->setPassword(proxyDialog.passwordLineEdit->text()); - } -} - -#ifndef QT_NO_OPENSSL -void NetworkAccessManager::sslErrors(QNetworkReply *reply, const QList &error) -{ - // check if SSL certificate has been trusted already - QString replyHost = reply->url().host() + ":" + reply->url().port(); - if(! sslTrustedHostList.contains(replyHost)) { - BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); - - QStringList errorStrings; - for (int i = 0; i < error.count(); ++i) - errorStrings += error.at(i).errorString(); - QString errors = errorStrings.join(QLatin1String("\n")); - int ret = QMessageBox::warning(mainWindow, QCoreApplication::applicationName(), - tr("SSL Errors:\n\n%1\n\n%2\n\n" - "Do you want to ignore these errors for this host?").arg(reply->url().toString()).arg(errors), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); - if (ret == QMessageBox::Yes) { - reply->ignoreSslErrors(); - sslTrustedHostList.append(replyHost); - } - } -} -#endif diff --git a/examples/gestures/browser/networkaccessmanager.h b/examples/gestures/browser/networkaccessmanager.h deleted file mode 100644 index d90a4d4..0000000 --- a/examples/gestures/browser/networkaccessmanager.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef NETWORKACCESSMANAGER_H -#define NETWORKACCESSMANAGER_H - -#include - -class NetworkAccessManager : public QNetworkAccessManager -{ - Q_OBJECT - -public: - NetworkAccessManager(QObject *parent = 0); - -private: - QList sslTrustedHostList; - -public slots: - void loadSettings(); - -private slots: - void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth); - void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); -#ifndef QT_NO_OPENSSL - void sslErrors(QNetworkReply *reply, const QList &error); -#endif -}; - -#endif // NETWORKACCESSMANAGER_H diff --git a/examples/gestures/browser/passworddialog.ui b/examples/gestures/browser/passworddialog.ui deleted file mode 100644 index 7c16658..0000000 --- a/examples/gestures/browser/passworddialog.ui +++ /dev/null @@ -1,111 +0,0 @@ - - PasswordDialog - - - - 0 - 0 - 399 - 148 - - - - Authentication Required - - - - - - - - DUMMY ICON - - - - - - - - 0 - 0 - - - - INTRO TEXT DUMMY - - - - - - - - - Username: - - - - - - - - - - Password: - - - - - - - QLineEdit::Password - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - PasswordDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - PasswordDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/examples/gestures/browser/proxy.ui b/examples/gestures/browser/proxy.ui deleted file mode 100644 index 62a8be6..0000000 --- a/examples/gestures/browser/proxy.ui +++ /dev/null @@ -1,104 +0,0 @@ - - ProxyDialog - - - - 0 - 0 - 369 - 144 - - - - Proxy Authentication - - - - - - ICON - - - - - - - Connect to proxy - - - true - - - - - - - Username: - - - - - - - - - - Password: - - - - - - - QLineEdit::Password - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - ProxyDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - ProxyDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/examples/gestures/browser/searchlineedit.cpp b/examples/gestures/browser/searchlineedit.cpp deleted file mode 100644 index e04010d..0000000 --- a/examples/gestures/browser/searchlineedit.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "searchlineedit.h" - -#include -#include -#include -#include -#include - -ClearButton::ClearButton(QWidget *parent) - : QAbstractButton(parent) -{ - setCursor(Qt::ArrowCursor); - setToolTip(tr("Clear")); - setVisible(false); - setFocusPolicy(Qt::NoFocus); -} - -void ClearButton::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - QPainter painter(this); - int height = this->height(); - - painter.setRenderHint(QPainter::Antialiasing, true); - QColor color = palette().color(QPalette::Mid); - painter.setBrush(isDown() - ? palette().color(QPalette::Dark) - : palette().color(QPalette::Mid)); - painter.setPen(painter.brush().color()); - int size = width(); - int offset = size / 5; - int radius = size - offset * 2; - painter.drawEllipse(offset, offset, radius, radius); - - painter.setPen(palette().color(QPalette::Base)); - int border = offset * 2; - painter.drawLine(border, border, width() - border, height - border); - painter.drawLine(border, height - border, width() - border, border); -} - -void ClearButton::textChanged(const QString &text) -{ - setVisible(!text.isEmpty()); -} - -/* - Search icon on the left hand side of the search widget - When a menu is set a down arrow appears - */ -class SearchButton : public QAbstractButton { -public: - SearchButton(QWidget *parent = 0); - void paintEvent(QPaintEvent *event); - QMenu *m_menu; - -protected: - void mousePressEvent(QMouseEvent *event); -}; - -SearchButton::SearchButton(QWidget *parent) - : QAbstractButton(parent), - m_menu(0) -{ - setObjectName(QLatin1String("SearchButton")); - setCursor(Qt::ArrowCursor); - setFocusPolicy(Qt::NoFocus); -} - -void SearchButton::mousePressEvent(QMouseEvent *event) -{ - if (m_menu && event->button() == Qt::LeftButton) { - QWidget *p = parentWidget(); - if (p) { - QPoint r = p->mapToGlobal(QPoint(0, p->height())); - m_menu->exec(QPoint(r.x() + height() / 2, r.y())); - } - event->accept(); - } - QAbstractButton::mousePressEvent(event); -} - -void SearchButton::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - QPainterPath myPath; - - int radius = (height() / 5) * 2; - QRect circle(height() / 3 - 1, height() / 4, radius, radius); - myPath.addEllipse(circle); - - myPath.arcMoveTo(circle, 300); - QPointF c = myPath.currentPosition(); - int diff = height() / 7; - myPath.lineTo(qMin(width() - 2, (int)c.x() + diff), c.y() + diff); - - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(QPen(Qt::darkGray, 2)); - painter.drawPath(myPath); - - if (m_menu) { - QPainterPath dropPath; - dropPath.arcMoveTo(circle, 320); - QPointF c = dropPath.currentPosition(); - c = QPointF(c.x() + 3.5, c.y() + 0.5); - dropPath.moveTo(c); - dropPath.lineTo(c.x() + 4, c.y()); - dropPath.lineTo(c.x() + 2, c.y() + 2); - dropPath.closeSubpath(); - painter.setPen(Qt::darkGray); - painter.setBrush(Qt::darkGray); - painter.setRenderHint(QPainter::Antialiasing, false); - painter.drawPath(dropPath); - } - painter.end(); -} - -/* - SearchLineEdit is an enhanced QLineEdit - - A Search icon on the left with optional menu - - When there is no text and doesn't have focus an "inactive text" is displayed - - When there is text a clear button is displayed on the right hand side - */ -SearchLineEdit::SearchLineEdit(QWidget *parent) : ExLineEdit(parent), - m_searchButton(new SearchButton(this)) -{ - connect(lineEdit(), SIGNAL(textChanged(const QString &)), - this, SIGNAL(textChanged(const QString &))); - setLeftWidget(m_searchButton); - m_inactiveText = tr("Search"); - - QSizePolicy policy = sizePolicy(); - setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy()); -} - -void SearchLineEdit::paintEvent(QPaintEvent *event) -{ - if (lineEdit()->text().isEmpty() && !hasFocus() && !m_inactiveText.isEmpty()) { - ExLineEdit::paintEvent(event); - QStyleOptionFrameV2 panel; - initStyleOption(&panel); - QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this); - QFontMetrics fm = fontMetrics(); - int horizontalMargin = lineEdit()->x(); - QRect lineRect(horizontalMargin + r.x(), r.y() + (r.height() - fm.height() + 1) / 2, - r.width() - 2 * horizontalMargin, fm.height()); - QPainter painter(this); - painter.setPen(palette().brush(QPalette::Disabled, QPalette::Text).color()); - painter.drawText(lineRect, Qt::AlignLeft|Qt::AlignVCenter, m_inactiveText); - } else { - ExLineEdit::paintEvent(event); - } -} - -void SearchLineEdit::resizeEvent(QResizeEvent *event) -{ - updateGeometries(); - ExLineEdit::resizeEvent(event); -} - -void SearchLineEdit::updateGeometries() -{ - int menuHeight = height(); - int menuWidth = menuHeight + 1; - if (!m_searchButton->m_menu) - menuWidth = (menuHeight / 5) * 4; - m_searchButton->resize(QSize(menuWidth, menuHeight)); -} - -QString SearchLineEdit::inactiveText() const -{ - return m_inactiveText; -} - -void SearchLineEdit::setInactiveText(const QString &text) -{ - m_inactiveText = text; -} - -void SearchLineEdit::setMenu(QMenu *menu) -{ - if (m_searchButton->m_menu) - m_searchButton->m_menu->deleteLater(); - m_searchButton->m_menu = menu; - updateGeometries(); -} - -QMenu *SearchLineEdit::menu() const -{ - if (!m_searchButton->m_menu) { - m_searchButton->m_menu = new QMenu(m_searchButton); - if (isVisible()) - (const_cast(this))->updateGeometries(); - } - return m_searchButton->m_menu; -} - diff --git a/examples/gestures/browser/searchlineedit.h b/examples/gestures/browser/searchlineedit.h deleted file mode 100644 index ad37dc7..0000000 --- a/examples/gestures/browser/searchlineedit.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SEARCHLINEEDIT_H -#define SEARCHLINEEDIT_H - -#include "urllineedit.h" - -#include -#include - -QT_BEGIN_NAMESPACE -class QMenu; -QT_END_NAMESPACE - -class SearchButton; - -/* - Clear button on the right hand side of the search widget. - Hidden by default - "A circle with an X in it" - */ -class ClearButton : public QAbstractButton -{ - Q_OBJECT - -public: - ClearButton(QWidget *parent = 0); - void paintEvent(QPaintEvent *event); - -public slots: - void textChanged(const QString &text); -}; - - -class SearchLineEdit : public ExLineEdit -{ - Q_OBJECT - Q_PROPERTY(QString inactiveText READ inactiveText WRITE setInactiveText) - -signals: - void textChanged(const QString &text); - -public: - SearchLineEdit(QWidget *parent = 0); - - QString inactiveText() const; - void setInactiveText(const QString &text); - - QMenu *menu() const; - void setMenu(QMenu *menu); - -protected: - void resizeEvent(QResizeEvent *event); - void paintEvent(QPaintEvent *event); - -private: - void updateGeometries(); - - SearchButton *m_searchButton; - QString m_inactiveText; -}; - -#endif // SEARCHLINEEDIT_H - diff --git a/examples/gestures/browser/settings.cpp b/examples/gestures/browser/settings.cpp deleted file mode 100644 index 2576449..0000000 --- a/examples/gestures/browser/settings.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "settings.h" - -#include "browserapplication.h" -#include "browsermainwindow.h" -#include "cookiejar.h" -#include "history.h" -#include "networkaccessmanager.h" -#include "webview.h" - -#include -#include -#include - -SettingsDialog::SettingsDialog(QWidget *parent) - : QDialog(parent) -{ - setupUi(this); - connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions())); - connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies())); - connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont())); - connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont())); - - loadDefaults(); - loadFromSettings(); -} - -void SettingsDialog::loadDefaults() -{ - QWebSettings *defaultSettings = QWebSettings::globalSettings(); - QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont); - int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize); - standardFont = QFont(standardFontFamily, standardFontSize); - standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize())); - - QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont); - int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize); - fixedFont = QFont(fixedFontFamily, fixedFontSize); - fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize())); - - downloadsLocation->setText(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); - - enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled)); - enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled)); -} - -void SettingsDialog::loadFromSettings() -{ - QSettings settings; - settings.beginGroup(QLatin1String("MainWindow")); - QString defaultHome = QLatin1String("http://qtsoftware.com"); - homeLineEdit->setText(settings.value(QLatin1String("home"), defaultHome).toString()); - settings.endGroup(); - - settings.beginGroup(QLatin1String("history")); - int historyExpire = settings.value(QLatin1String("historyExpire")).toInt(); - int idx = 0; - switch (historyExpire) { - case 1: idx = 0; break; - case 7: idx = 1; break; - case 14: idx = 2; break; - case 30: idx = 3; break; - case 365: idx = 4; break; - case -1: idx = 5; break; - default: - idx = 5; - } - expireHistory->setCurrentIndex(idx); - settings.endGroup(); - - settings.beginGroup(QLatin1String("downloadmanager")); - QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), downloadsLocation->text()).toString(); - downloadsLocation->setText(downloadDirectory); - settings.endGroup(); - - settings.beginGroup(QLatin1String("general")); - openLinksIn->setCurrentIndex(settings.value(QLatin1String("openLinksIn"), openLinksIn->currentIndex()).toInt()); - - settings.endGroup(); - - // Appearance - settings.beginGroup(QLatin1String("websettings")); - fixedFont = qVariantValue(settings.value(QLatin1String("fixedFont"), fixedFont)); - standardFont = qVariantValue(settings.value(QLatin1String("standardFont"), standardFont)); - - standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize())); - fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize())); - - enableJavascript->setChecked(settings.value(QLatin1String("enableJavascript"), enableJavascript->isChecked()).toBool()); - enablePlugins->setChecked(settings.value(QLatin1String("enablePlugins"), enablePlugins->isChecked()).toBool()); - userStyleSheet->setText(settings.value(QLatin1String("userStyleSheet")).toUrl().toString()); - settings.endGroup(); - - // Privacy - settings.beginGroup(QLatin1String("cookies")); - - CookieJar *jar = BrowserApplication::cookieJar(); - QByteArray value = settings.value(QLatin1String("acceptCookies"), QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray(); - QMetaEnum acceptPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("AcceptPolicy")); - CookieJar::AcceptPolicy acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ? - CookieJar::AcceptOnlyFromSitesNavigatedTo : - static_cast(acceptPolicyEnum.keyToValue(value)); - switch(acceptCookies) { - case CookieJar::AcceptAlways: - acceptCombo->setCurrentIndex(0); - break; - case CookieJar::AcceptNever: - acceptCombo->setCurrentIndex(1); - break; - case CookieJar::AcceptOnlyFromSitesNavigatedTo: - acceptCombo->setCurrentIndex(2); - break; - } - - value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("Expire")).toByteArray(); - QMetaEnum keepPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("KeepPolicy")); - CookieJar::KeepPolicy keepCookies = keepPolicyEnum.keyToValue(value) == -1 ? - CookieJar::KeepUntilExpire : - static_cast(keepPolicyEnum.keyToValue(value)); - switch(keepCookies) { - case CookieJar::KeepUntilExpire: - keepUntilCombo->setCurrentIndex(0); - break; - case CookieJar::KeepUntilExit: - keepUntilCombo->setCurrentIndex(1); - break; - case CookieJar::KeepUntilTimeLimit: - keepUntilCombo->setCurrentIndex(2); - break; - } - settings.endGroup(); - - - // Proxy - settings.beginGroup(QLatin1String("proxy")); - proxySupport->setChecked(settings.value(QLatin1String("enabled"), false).toBool()); - proxyType->setCurrentIndex(settings.value(QLatin1String("type"), 0).toInt()); - proxyHostName->setText(settings.value(QLatin1String("hostName")).toString()); - proxyPort->setValue(settings.value(QLatin1String("port"), 1080).toInt()); - proxyUserName->setText(settings.value(QLatin1String("userName")).toString()); - proxyPassword->setText(settings.value(QLatin1String("password")).toString()); - settings.endGroup(); -} - -void SettingsDialog::saveToSettings() -{ - QSettings settings; - settings.beginGroup(QLatin1String("MainWindow")); - settings.setValue(QLatin1String("home"), homeLineEdit->text()); - settings.endGroup(); - - settings.beginGroup(QLatin1String("general")); - settings.setValue(QLatin1String("openLinksIn"), openLinksIn->currentIndex()); - settings.endGroup(); - - settings.beginGroup(QLatin1String("history")); - int historyExpire = expireHistory->currentIndex(); - int idx = -1; - switch (historyExpire) { - case 0: idx = 1; break; - case 1: idx = 7; break; - case 2: idx = 14; break; - case 3: idx = 30; break; - case 4: idx = 365; break; - case 5: idx = -1; break; - } - settings.setValue(QLatin1String("historyExpire"), idx); - settings.endGroup(); - - // Appearance - settings.beginGroup(QLatin1String("websettings")); - settings.setValue(QLatin1String("fixedFont"), fixedFont); - settings.setValue(QLatin1String("standardFont"), standardFont); - settings.setValue(QLatin1String("enableJavascript"), enableJavascript->isChecked()); - settings.setValue(QLatin1String("enablePlugins"), enablePlugins->isChecked()); - QString userStyleSheetString = userStyleSheet->text(); - if (QFile::exists(userStyleSheetString)) - settings.setValue(QLatin1String("userStyleSheet"), QUrl::fromLocalFile(userStyleSheetString)); - else - settings.setValue(QLatin1String("userStyleSheet"), QUrl(userStyleSheetString)); - settings.endGroup(); - - //Privacy - settings.beginGroup(QLatin1String("cookies")); - - CookieJar::KeepPolicy keepCookies; - switch(acceptCombo->currentIndex()) { - default: - case 0: - keepCookies = CookieJar::KeepUntilExpire; - break; - case 1: - keepCookies = CookieJar::KeepUntilExit; - break; - case 2: - keepCookies = CookieJar::KeepUntilTimeLimit; - break; - } - CookieJar *jar = BrowserApplication::cookieJar(); - QMetaEnum acceptPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("AcceptPolicy")); - settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(keepCookies))); - - CookieJar::KeepPolicy keepPolicy; - switch(keepUntilCombo->currentIndex()) { - default: - case 0: - keepPolicy = CookieJar::KeepUntilExpire; - break; - case 1: - keepPolicy = CookieJar::KeepUntilExit; - break; - case 2: - keepPolicy = CookieJar::KeepUntilTimeLimit; - break; - } - - QMetaEnum keepPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("KeepPolicy")); - settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(keepPolicy))); - - settings.endGroup(); - - // proxy - settings.beginGroup(QLatin1String("proxy")); - settings.setValue(QLatin1String("enabled"), proxySupport->isChecked()); - settings.setValue(QLatin1String("type"), proxyType->currentIndex()); - settings.setValue(QLatin1String("hostName"), proxyHostName->text()); - settings.setValue(QLatin1String("port"), proxyPort->text()); - settings.setValue(QLatin1String("userName"), proxyUserName->text()); - settings.setValue(QLatin1String("password"), proxyPassword->text()); - settings.endGroup(); - - BrowserApplication::instance()->loadSettings(); - BrowserApplication::networkAccessManager()->loadSettings(); - BrowserApplication::cookieJar()->loadSettings(); - BrowserApplication::historyManager()->loadSettings(); -} - -void SettingsDialog::accept() -{ - saveToSettings(); - QDialog::accept(); -} - -void SettingsDialog::showCookies() -{ - CookiesDialog *dialog = new CookiesDialog(BrowserApplication::cookieJar(), this); - dialog->exec(); -} - -void SettingsDialog::showExceptions() -{ - CookiesExceptionsDialog *dialog = new CookiesExceptionsDialog(BrowserApplication::cookieJar(), this); - dialog->exec(); -} - -void SettingsDialog::chooseFont() -{ - bool ok; - QFont font = QFontDialog::getFont(&ok, standardFont, this); - if ( ok ) { - standardFont = font; - standardLabel->setText(QString(QLatin1String("%1 %2")).arg(font.family()).arg(font.pointSize())); - } -} - -void SettingsDialog::chooseFixedFont() -{ - bool ok; - QFont font = QFontDialog::getFont(&ok, fixedFont, this); - if ( ok ) { - fixedFont = font; - fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(font.family()).arg(font.pointSize())); - } -} - -void SettingsDialog::setHomeToCurrentPage() -{ - BrowserMainWindow *mw = static_cast(parent()); - WebView *webView = mw->currentTab(); - if (webView) - homeLineEdit->setText(webView->url().toString()); -} - diff --git a/examples/gestures/browser/settings.h b/examples/gestures/browser/settings.h deleted file mode 100644 index 900be7b..0000000 --- a/examples/gestures/browser/settings.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SETTINGS_H -#define SETTINGS_H - -#include -#include "ui_settings.h" - -class SettingsDialog : public QDialog, public Ui_Settings -{ - Q_OBJECT - -public: - SettingsDialog(QWidget *parent = 0); - void accept(); - -private slots: - void loadDefaults(); - void loadFromSettings(); - void saveToSettings(); - - void setHomeToCurrentPage(); - void showCookies(); - void showExceptions(); - - void chooseFont(); - void chooseFixedFont(); - -private: - QFont standardFont; - QFont fixedFont; -}; - -#endif // SETTINGS_H - diff --git a/examples/gestures/browser/settings.ui b/examples/gestures/browser/settings.ui deleted file mode 100644 index 3491ce0..0000000 --- a/examples/gestures/browser/settings.ui +++ /dev/null @@ -1,614 +0,0 @@ - - Settings - - - - 0 - 0 - 657 - 322 - - - - Settings - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - 0 - - - - - 0 - 0 - 627 - 243 - - - - General - - - - - - Home: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Set to current page - - - - - - - Qt::Horizontal - - - - 280 - 18 - - - - - - - - Remove history items: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - After one day - - - - - After one week - - - - - After two weeks - - - - - After one month - - - - - After one year - - - - - Manually - - - - - - - - Save downloads to: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Open links from applications: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - In a tab in the current window - - - - - In a new window - - - - - - - - Qt::Vertical - - - - 391 - 262 - - - - - - - - - - 0 - 0 - 627 - 243 - - - - Appearance - - - - - - Standard font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - Times 16 - - - Qt::AlignCenter - - - - - - - Select... - - - - - - - Fixed-width font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - QFrame::StyledPanel - - - Courier 13 - - - Qt::AlignCenter - - - - - - - Select... - - - - - - - Qt::Vertical - - - - 20 - 93 - - - - - - - - - - 0 - 0 - 627 - 243 - - - - Privacy - - - - - - Web Content - - - - - - Enable Plugins - - - true - - - - - - - Enable Javascript - - - true - - - - - - - - - - Cookies - - - - - - Accept Cookies: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Always - - - - - Never - - - - - Only from sites you navigate to - - - - - - - - Exceptions... - - - - - - - Keep until: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - They expire - - - - - I exit the application - - - - - At most 90 days - - - - - - - - Cookies... - - - - - - - - - - Qt::Vertical - - - - 371 - 177 - - - - - - - - - - 0 - 0 - 627 - 243 - - - - Proxy - - - - - - Enable proxy - - - true - - - - - - Type: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Socks5 - - - - - Http - - - - - - - - Host: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Port: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 10000 - - - 1080 - - - - - - - Qt::Horizontal - - - - 293 - 20 - - - - - - - - User Name: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Password: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - QLineEdit::Password - - - - - - - Qt::Vertical - - - - 20 - 8 - - - - - - - - - - - - Advanced - - - - - - Style Sheet: - - - - - - - - - - Qt::Vertical - - - - 20 - 176 - - - - - - - - - - - - - - buttonBox - accepted() - Settings - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Settings - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/examples/gestures/browser/squeezelabel.cpp b/examples/gestures/browser/squeezelabel.cpp deleted file mode 100644 index 3247330..0000000 --- a/examples/gestures/browser/squeezelabel.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "squeezelabel.h" - -SqueezeLabel::SqueezeLabel(QWidget *parent) : QLabel(parent) -{ -} - -void SqueezeLabel::paintEvent(QPaintEvent *event) -{ - QFontMetrics fm = fontMetrics(); - if (fm.width(text()) > contentsRect().width()) { - QString elided = fm.elidedText(text(), Qt::ElideMiddle, width()); - QString oldText = text(); - setText(elided); - QLabel::paintEvent(event); - setText(oldText); - } else { - QLabel::paintEvent(event); - } -} - diff --git a/examples/gestures/browser/squeezelabel.h b/examples/gestures/browser/squeezelabel.h deleted file mode 100644 index 550a275..0000000 --- a/examples/gestures/browser/squeezelabel.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SQUEEZELABEL_H -#define SQUEEZELABEL_H - -#include - -class SqueezeLabel : public QLabel -{ - Q_OBJECT - -public: - SqueezeLabel(QWidget *parent = 0); - -protected: - void paintEvent(QPaintEvent *event); - -}; - -#endif // SQUEEZELABEL_H - diff --git a/examples/gestures/browser/tabwidget.cpp b/examples/gestures/browser/tabwidget.cpp deleted file mode 100644 index 67714e4..0000000 --- a/examples/gestures/browser/tabwidget.cpp +++ /dev/null @@ -1,830 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tabwidget.h" - -#include "browserapplication.h" -#include "browsermainwindow.h" -#include "history.h" -#include "urllineedit.h" -#include "webview.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -TabBar::TabBar(QWidget *parent) - : QTabBar(parent) -{ - setContextMenuPolicy(Qt::CustomContextMenu); - setAcceptDrops(true); - connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(contextMenuRequested(const QPoint &))); - - QString alt = QLatin1String("Alt+%1"); - for (int i = 1; i <= 10; ++i) { - int key = i; - if (key == 10) - key = 0; - QShortcut *shortCut = new QShortcut(alt.arg(key), this); - m_tabShortcuts.append(shortCut); - connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); - } - setTabsClosable(true); - connect(this, SIGNAL(tabCloseRequested(int)), - this, SIGNAL(closeTab(int))); - setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); - setMovable(true); -} - -void TabBar::selectTabAction() -{ - if (QShortcut *shortCut = qobject_cast(sender())) { - int index = m_tabShortcuts.indexOf(shortCut); - if (index == 0) - index = 10; - setCurrentIndex(index); - } -} - -void TabBar::contextMenuRequested(const QPoint &position) -{ - QMenu menu; - menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab); - int index = tabAt(position); - if (-1 != index) { - QAction *action = menu.addAction(tr("Clone Tab"), - this, SLOT(cloneTab())); - action->setData(index); - - menu.addSeparator(); - - action = menu.addAction(tr("&Close Tab"), - this, SLOT(closeTab()), QKeySequence::Close); - action->setData(index); - - action = menu.addAction(tr("Close &Other Tabs"), - this, SLOT(closeOtherTabs())); - action->setData(index); - - menu.addSeparator(); - - action = menu.addAction(tr("Reload Tab"), - this, SLOT(reloadTab()), QKeySequence::Refresh); - action->setData(index); - } else { - menu.addSeparator(); - } - menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs())); - menu.exec(QCursor::pos()); -} - -void TabBar::cloneTab() -{ - if (QAction *action = qobject_cast(sender())) { - int index = action->data().toInt(); - emit cloneTab(index); - } -} - -void TabBar::closeTab() -{ - if (QAction *action = qobject_cast(sender())) { - int index = action->data().toInt(); - emit closeTab(index); - } -} - -void TabBar::closeOtherTabs() -{ - if (QAction *action = qobject_cast(sender())) { - int index = action->data().toInt(); - emit closeOtherTabs(index); - } -} - -void TabBar::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - m_dragStartPos = event->pos(); - QTabBar::mousePressEvent(event); -} - -void TabBar::mouseMoveEvent(QMouseEvent *event) -{ - if (event->buttons() == Qt::LeftButton) { - int diffX = event->pos().x() - m_dragStartPos.x(); - int diffY = event->pos().y() - m_dragStartPos.y(); - if ((event->pos() - m_dragStartPos).manhattanLength() > QApplication::startDragDistance() - && diffX < 3 && diffX > -3 - && diffY < -10) { - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - QList urls; - int index = tabAt(event->pos()); - QUrl url = tabData(index).toUrl(); - urls.append(url); - mimeData->setUrls(urls); - mimeData->setText(tabText(index)); - mimeData->setData(QLatin1String("action"), "tab-reordering"); - drag->setMimeData(mimeData); - drag->exec(); - } - } - QTabBar::mouseMoveEvent(event); -} - -// When index is -1 index chooses the current tab -void TabWidget::reloadTab(int index) -{ - if (index < 0) - index = currentIndex(); - if (index < 0 || index >= count()) - return; - - QWidget *widget = this->widget(index); - if (WebView *tab = qobject_cast(widget)) - tab->reload(); -} - -void TabBar::reloadTab() -{ - if (QAction *action = qobject_cast(sender())) { - int index = action->data().toInt(); - emit reloadTab(index); - } -} - -TabWidget::TabWidget(QWidget *parent) - : QTabWidget(parent) - , m_recentlyClosedTabsAction(0) - , m_newTabAction(0) - , m_closeTabAction(0) - , m_nextTabAction(0) - , m_previousTabAction(0) - , m_recentlyClosedTabsMenu(0) - , m_lineEditCompleter(0) - , m_lineEdits(0) - , m_tabBar(new TabBar(this)) -{ - setElideMode(Qt::ElideRight); - - connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab())); - connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); - connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int))); - connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int))); - connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); - connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs())); - connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(moveTab(int, int))); - setTabBar(m_tabBar); - setDocumentMode(true); - - // Actions - m_newTabAction = new QAction(QIcon(QLatin1String(":addtab.png")), tr("New &Tab"), this); - m_newTabAction->setShortcuts(QKeySequence::AddTab); - m_newTabAction->setIconVisibleInMenu(false); - connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab())); - - m_closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this); - m_closeTabAction->setShortcuts(QKeySequence::Close); - m_closeTabAction->setIconVisibleInMenu(false); - connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab())); - - m_nextTabAction = new QAction(tr("Show Next Tab"), this); - QList shortcuts; - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceRight)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageDown)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketRight)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Less)); - m_nextTabAction->setShortcuts(shortcuts); - connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab())); - - m_previousTabAction = new QAction(tr("Show Previous Tab"), this); - shortcuts.clear(); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceLeft)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageUp)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketLeft)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Greater)); - m_previousTabAction->setShortcuts(shortcuts); - connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab())); - - m_recentlyClosedTabsMenu = new QMenu(this); - connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()), - this, SLOT(aboutToShowRecentTabsMenu())); - connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), - this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); - m_recentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this); - m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu); - m_recentlyClosedTabsAction->setEnabled(false); - - connect(this, SIGNAL(currentChanged(int)), - this, SLOT(currentChanged(int))); - - m_lineEdits = new QStackedWidget(this); -} - -void TabWidget::clear() -{ - // clear the recently closed tabs - m_recentlyClosedTabs.clear(); - // clear the line edit history - for (int i = 0; i < m_lineEdits->count(); ++i) { - QLineEdit *qLineEdit = lineEdit(i); - qLineEdit->setText(qLineEdit->text()); - } -} - -void TabWidget::moveTab(int fromIndex, int toIndex) -{ - QWidget *lineEdit = m_lineEdits->widget(fromIndex); - m_lineEdits->removeWidget(lineEdit); - m_lineEdits->insertWidget(toIndex, lineEdit); -} - -void TabWidget::addWebAction(QAction *action, QWebPage::WebAction webAction) -{ - if (!action) - return; - m_actions.append(new WebActionMapper(action, webAction, this)); -} - -void TabWidget::currentChanged(int index) -{ - WebView *webView = this->webView(index); - if (!webView) - return; - - Q_ASSERT(m_lineEdits->count() == count()); - - WebView *oldWebView = this->webView(m_lineEdits->currentIndex()); - if (oldWebView) { - disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)), - this, SIGNAL(showStatusBarMessage(const QString&))); - disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), - this, SIGNAL(linkHovered(const QString&))); - disconnect(oldWebView, SIGNAL(loadProgress(int)), - this, SIGNAL(loadProgress(int))); - } - - connect(webView, SIGNAL(statusBarMessage(const QString&)), - this, SIGNAL(showStatusBarMessage(const QString&))); - connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), - this, SIGNAL(linkHovered(const QString&))); - connect(webView, SIGNAL(loadProgress(int)), - this, SIGNAL(loadProgress(int))); - - for (int i = 0; i < m_actions.count(); ++i) { - WebActionMapper *mapper = m_actions[i]; - mapper->updateCurrent(webView->page()); - } - emit setCurrentTitle(webView->title()); - m_lineEdits->setCurrentIndex(index); - emit loadProgress(webView->progress()); - emit showStatusBarMessage(webView->lastStatusBarText()); - if (webView->url().isEmpty()) - m_lineEdits->currentWidget()->setFocus(); - else - webView->setFocus(); -} - -QAction *TabWidget::newTabAction() const -{ - return m_newTabAction; -} - -QAction *TabWidget::closeTabAction() const -{ - return m_closeTabAction; -} - -QAction *TabWidget::recentlyClosedTabsAction() const -{ - return m_recentlyClosedTabsAction; -} - -QAction *TabWidget::nextTabAction() const -{ - return m_nextTabAction; -} - -QAction *TabWidget::previousTabAction() const -{ - return m_previousTabAction; -} - -QWidget *TabWidget::lineEditStack() const -{ - return m_lineEdits; -} - -QLineEdit *TabWidget::currentLineEdit() const -{ - return lineEdit(m_lineEdits->currentIndex()); -} - -WebView *TabWidget::currentWebView() const -{ - return webView(currentIndex()); -} - -QLineEdit *TabWidget::lineEdit(int index) const -{ - UrlLineEdit *urlLineEdit = qobject_cast(m_lineEdits->widget(index)); - if (urlLineEdit) - return urlLineEdit->lineEdit(); - return 0; -} - -WebView *TabWidget::webView(int index) const -{ - QWidget *widget = this->widget(index); - if (WebView *webView = qobject_cast(widget)) { - return webView; - } else { - // optimization to delay creating the first webview - if (count() == 1) { - TabWidget *that = const_cast(this); - that->setUpdatesEnabled(false); - that->newTab(); - that->closeTab(0); - that->setUpdatesEnabled(true); - return currentWebView(); - } - } - return 0; -} - -int TabWidget::webViewIndex(WebView *webView) const -{ - int index = indexOf(webView); - return index; -} - -WebView *TabWidget::newTab(bool makeCurrent) -{ - // line edit - UrlLineEdit *urlLineEdit = new UrlLineEdit; - QLineEdit *lineEdit = urlLineEdit->lineEdit(); - if (!m_lineEditCompleter && count() > 0) { - HistoryCompletionModel *completionModel = new HistoryCompletionModel(this); - completionModel->setSourceModel(BrowserApplication::historyManager()->historyFilterModel()); - m_lineEditCompleter = new QCompleter(completionModel, this); - // Should this be in Qt by default? - QAbstractItemView *popup = m_lineEditCompleter->popup(); - QListView *listView = qobject_cast(popup); - if (listView) - listView->setUniformItemSizes(true); - } - lineEdit->setCompleter(m_lineEditCompleter); - connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(lineEditReturnPressed())); - m_lineEdits->addWidget(urlLineEdit); - m_lineEdits->setSizePolicy(lineEdit->sizePolicy()); - - // optimization to delay creating the more expensive WebView, history, etc - if (count() == 0) { - QWidget *emptyWidget = new QWidget; - QPalette p = emptyWidget->palette(); - p.setColor(QPalette::Window, palette().color(QPalette::Base)); - emptyWidget->setPalette(p); - emptyWidget->setAutoFillBackground(true); - disconnect(this, SIGNAL(currentChanged(int)), - this, SLOT(currentChanged(int))); - addTab(emptyWidget, tr("(Untitled)")); - connect(this, SIGNAL(currentChanged(int)), - this, SLOT(currentChanged(int))); - return 0; - } - - // webview - WebView *webView = new WebView; - urlLineEdit->setWebView(webView); - connect(webView, SIGNAL(loadStarted()), - this, SLOT(webViewLoadStarted())); - connect(webView, SIGNAL(loadFinished(bool)), - this, SLOT(webViewIconChanged())); - connect(webView, SIGNAL(iconChanged()), - this, SLOT(webViewIconChanged())); - connect(webView, SIGNAL(titleChanged(const QString &)), - this, SLOT(webViewTitleChanged(const QString &))); - connect(webView, SIGNAL(urlChanged(const QUrl &)), - this, SLOT(webViewUrlChanged(const QUrl &))); - connect(webView->page(), SIGNAL(windowCloseRequested()), - this, SLOT(windowCloseRequested())); - connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)), - this, SIGNAL(geometryChangeRequested(const QRect &))); - connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), - this, SIGNAL(printRequested(QWebFrame *))); - connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), - this, SIGNAL(menuBarVisibilityChangeRequested(bool))); - connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), - this, SIGNAL(statusBarVisibilityChangeRequested(bool))); - connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), - this, SIGNAL(toolBarVisibilityChangeRequested(bool))); - addTab(webView, tr("(Untitled)")); - if (makeCurrent) - setCurrentWidget(webView); - - // webview actions - for (int i = 0; i < m_actions.count(); ++i) { - WebActionMapper *mapper = m_actions[i]; - mapper->addChild(webView->page()->action(mapper->webAction())); - } - - if (count() == 1) - currentChanged(currentIndex()); - emit tabsChanged(); - return webView; -} - -void TabWidget::reloadAllTabs() -{ - for (int i = 0; i < count(); ++i) { - QWidget *tabWidget = widget(i); - if (WebView *tab = qobject_cast(tabWidget)) { - tab->reload(); - } - } -} - -void TabWidget::lineEditReturnPressed() -{ - if (QLineEdit *lineEdit = qobject_cast(sender())) { - emit loadPage(lineEdit->text()); - if (m_lineEdits->currentWidget() == lineEdit) - currentWebView()->setFocus(); - } -} - -void TabWidget::windowCloseRequested() -{ - WebPage *webPage = qobject_cast(sender()); - WebView *webView = qobject_cast(webPage->view()); - int index = webViewIndex(webView); - if (index >= 0) { - if (count() == 1) - webView->webPage()->mainWindow()->close(); - else - closeTab(index); - } -} - -void TabWidget::closeOtherTabs(int index) -{ - if (-1 == index) - return; - for (int i = count() - 1; i > index; --i) - closeTab(i); - for (int i = index - 1; i >= 0; --i) - closeTab(i); -} - -// When index is -1 index chooses the current tab -void TabWidget::cloneTab(int index) -{ - if (index < 0) - index = currentIndex(); - if (index < 0 || index >= count()) - return; - WebView *tab = newTab(false); - tab->setUrl(webView(index)->url()); -} - -// When index is -1 index chooses the current tab -void TabWidget::closeTab(int index) -{ - if (index < 0) - index = currentIndex(); - if (index < 0 || index >= count()) - return; - - bool hasFocus = false; - if (WebView *tab = webView(index)) { - if (tab->isModified()) { - QMessageBox closeConfirmation(tab); - closeConfirmation.setWindowFlags(Qt::Sheet); - closeConfirmation.setWindowTitle(tr("Do you really want to close this page?")); - closeConfirmation.setInformativeText(tr("You have modified this page and when closing it you would lose the modification.\n" - "Do you really want to close this page?\n")); - closeConfirmation.setIcon(QMessageBox::Question); - closeConfirmation.addButton(QMessageBox::Yes); - closeConfirmation.addButton(QMessageBox::No); - closeConfirmation.setEscapeButton(QMessageBox::No); - if (closeConfirmation.exec() == QMessageBox::No) - return; - } - hasFocus = tab->hasFocus(); - - m_recentlyClosedTabsAction->setEnabled(true); - m_recentlyClosedTabs.prepend(tab->url()); - if (m_recentlyClosedTabs.size() >= TabWidget::m_recentlyClosedTabsSize) - m_recentlyClosedTabs.removeLast(); - } - QWidget *lineEdit = m_lineEdits->widget(index); - m_lineEdits->removeWidget(lineEdit); - lineEdit->deleteLater(); - QWidget *webView = widget(index); - removeTab(index); - webView->deleteLater(); - emit tabsChanged(); - if (hasFocus && count() > 0) - currentWebView()->setFocus(); - if (count() == 0) - emit lastTabClosed(); -} - -void TabWidget::webViewLoadStarted() -{ - WebView *webView = qobject_cast(sender()); - int index = webViewIndex(webView); - if (-1 != index) { - QIcon icon(QLatin1String(":loading.gif")); - setTabIcon(index, icon); - } -} - -void TabWidget::webViewIconChanged() -{ - WebView *webView = qobject_cast(sender()); - int index = webViewIndex(webView); - if (-1 != index) { - QIcon icon = BrowserApplication::instance()->icon(webView->url()); - setTabIcon(index, icon); - } -} - -void TabWidget::webViewTitleChanged(const QString &title) -{ - WebView *webView = qobject_cast(sender()); - int index = webViewIndex(webView); - if (-1 != index) { - setTabText(index, title); - } - if (currentIndex() == index) - emit setCurrentTitle(title); - BrowserApplication::historyManager()->updateHistoryItem(webView->url(), title); -} - -void TabWidget::webViewUrlChanged(const QUrl &url) -{ - WebView *webView = qobject_cast(sender()); - int index = webViewIndex(webView); - if (-1 != index) { - m_tabBar->setTabData(index, url); - } - emit tabsChanged(); -} - -void TabWidget::aboutToShowRecentTabsMenu() -{ - m_recentlyClosedTabsMenu->clear(); - for (int i = 0; i < m_recentlyClosedTabs.count(); ++i) { - QAction *action = new QAction(m_recentlyClosedTabsMenu); - action->setData(m_recentlyClosedTabs.at(i)); - QIcon icon = BrowserApplication::instance()->icon(m_recentlyClosedTabs.at(i)); - action->setIcon(icon); - action->setText(m_recentlyClosedTabs.at(i).toString()); - m_recentlyClosedTabsMenu->addAction(action); - } -} - -void TabWidget::aboutToShowRecentTriggeredAction(QAction *action) -{ - QUrl url = action->data().toUrl(); - loadUrlInCurrentTab(url); -} - -void TabWidget::mouseDoubleClickEvent(QMouseEvent *event) -{ - if (!childAt(event->pos()) - // Remove the line below when QTabWidget does not have a one pixel frame - && event->pos().y() < (tabBar()->y() + tabBar()->height())) { - newTab(); - return; - } - QTabWidget::mouseDoubleClickEvent(event); -} - -void TabWidget::contextMenuEvent(QContextMenuEvent *event) -{ - if (!childAt(event->pos())) { - m_tabBar->contextMenuRequested(event->pos()); - return; - } - QTabWidget::contextMenuEvent(event); -} - -void TabWidget::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::MidButton && !childAt(event->pos()) - // Remove the line below when QTabWidget does not have a one pixel frame - && event->pos().y() < (tabBar()->y() + tabBar()->height())) { - QUrl url(QApplication::clipboard()->text(QClipboard::Selection)); - if (!url.isEmpty() && url.isValid() && !url.scheme().isEmpty()) { - WebView *webView = newTab(); - webView->setUrl(url); - } - } -} - -void TabWidget::loadUrlInCurrentTab(const QUrl &url) -{ - WebView *webView = currentWebView(); - if (webView) { - webView->loadUrl(url); - webView->setFocus(); - } -} - -void TabWidget::nextTab() -{ - int next = currentIndex() + 1; - if (next == count()) - next = 0; - setCurrentIndex(next); -} - -void TabWidget::previousTab() -{ - int next = currentIndex() - 1; - if (next < 0) - next = count() - 1; - setCurrentIndex(next); -} - -static const qint32 TabWidgetMagic = 0xaa; - -QByteArray TabWidget::saveState() const -{ - int version = 1; - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - - stream << qint32(TabWidgetMagic); - stream << qint32(version); - - QStringList tabs; - for (int i = 0; i < count(); ++i) { - if (WebView *tab = qobject_cast(widget(i))) { - tabs.append(tab->url().toString()); - } else { - tabs.append(QString::null); - } - } - stream << tabs; - stream << currentIndex(); - return data; -} - -bool TabWidget::restoreState(const QByteArray &state) -{ - int version = 1; - QByteArray sd = state; - QDataStream stream(&sd, QIODevice::ReadOnly); - if (stream.atEnd()) - return false; - - qint32 marker; - qint32 v; - stream >> marker; - stream >> v; - if (marker != TabWidgetMagic || v != version) - return false; - - QStringList openTabs; - stream >> openTabs; - - for (int i = 0; i < openTabs.count(); ++i) { - if (i != 0) - newTab(); - loadPage(openTabs.at(i)); - } - - int currentTab; - stream >> currentTab; - setCurrentIndex(currentTab); - - return true; -} - -WebActionMapper::WebActionMapper(QAction *root, QWebPage::WebAction webAction, QObject *parent) - : QObject(parent) - , m_currentParent(0) - , m_root(root) - , m_webAction(webAction) -{ - if (!m_root) - return; - connect(m_root, SIGNAL(triggered()), this, SLOT(rootTriggered())); - connect(root, SIGNAL(destroyed(QObject *)), this, SLOT(rootDestroyed())); - root->setEnabled(false); -} - -void WebActionMapper::rootDestroyed() -{ - m_root = 0; -} - -void WebActionMapper::currentDestroyed() -{ - updateCurrent(0); -} - -void WebActionMapper::addChild(QAction *action) -{ - if (!action) - return; - connect(action, SIGNAL(changed()), this, SLOT(childChanged())); -} - -QWebPage::WebAction WebActionMapper::webAction() const -{ - return m_webAction; -} - -void WebActionMapper::rootTriggered() -{ - if (m_currentParent) { - QAction *gotoAction = m_currentParent->action(m_webAction); - gotoAction->trigger(); - } -} - -void WebActionMapper::childChanged() -{ - if (QAction *source = qobject_cast(sender())) { - if (m_root - && m_currentParent - && source->parent() == m_currentParent) { - m_root->setChecked(source->isChecked()); - m_root->setEnabled(source->isEnabled()); - } - } -} - -void WebActionMapper::updateCurrent(QWebPage *currentParent) -{ - if (m_currentParent) - disconnect(m_currentParent, SIGNAL(destroyed(QObject *)), - this, SLOT(currentDestroyed())); - - m_currentParent = currentParent; - if (!m_root) - return; - if (!m_currentParent) { - m_root->setEnabled(false); - m_root->setChecked(false); - return; - } - QAction *source = m_currentParent->action(m_webAction); - m_root->setChecked(source->isChecked()); - m_root->setEnabled(source->isEnabled()); - connect(m_currentParent, SIGNAL(destroyed(QObject *)), - this, SLOT(currentDestroyed())); -} - diff --git a/examples/gestures/browser/tabwidget.h b/examples/gestures/browser/tabwidget.h deleted file mode 100644 index ee7b226..0000000 --- a/examples/gestures/browser/tabwidget.h +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TABWIDGET_H -#define TABWIDGET_H - -#include - -#include -/* - Tab bar with a few more features such as a context menu and shortcuts - */ -class TabBar : public QTabBar -{ - Q_OBJECT - -signals: - void newTab(); - void cloneTab(int index); - void closeTab(int index); - void closeOtherTabs(int index); - void reloadTab(int index); - void reloadAllTabs(); - void tabMoveRequested(int fromIndex, int toIndex); - -public: - TabBar(QWidget *parent = 0); - -protected: - void mousePressEvent(QMouseEvent* event); - void mouseMoveEvent(QMouseEvent* event); - -private slots: - void selectTabAction(); - void cloneTab(); - void closeTab(); - void closeOtherTabs(); - void reloadTab(); - void contextMenuRequested(const QPoint &position); - -private: - QList m_tabShortcuts; - friend class TabWidget; - - QPoint m_dragStartPos; - int m_dragCurrentIndex; -}; - -#include - -QT_BEGIN_NAMESPACE -class QAction; -QT_END_NAMESPACE -class WebView; -/*! - A proxy object that connects a single browser action - to one child webpage action at a time. - - Example usage: used to keep the main window stop action in sync with - the current tabs webview's stop action. - */ -class WebActionMapper : public QObject -{ - Q_OBJECT - -public: - WebActionMapper(QAction *root, QWebPage::WebAction webAction, QObject *parent); - QWebPage::WebAction webAction() const; - void addChild(QAction *action); - void updateCurrent(QWebPage *currentParent); - -private slots: - void rootTriggered(); - void childChanged(); - void rootDestroyed(); - void currentDestroyed(); - -private: - QWebPage *m_currentParent; - QAction *m_root; - QWebPage::WebAction m_webAction; -}; - -#include -#include -QT_BEGIN_NAMESPACE -class QCompleter; -class QLineEdit; -class QMenu; -class QStackedWidget; -QT_END_NAMESPACE -/*! - TabWidget that contains WebViews and a stack widget of associated line edits. - - Connects up the current tab's signals to this class's signal and uses WebActionMapper - to proxy the actions. - */ -class TabWidget : public QTabWidget -{ - Q_OBJECT - -signals: - // tab widget signals - void loadPage(const QString &url); - void tabsChanged(); - void lastTabClosed(); - - // current tab signals - void setCurrentTitle(const QString &url); - void showStatusBarMessage(const QString &message); - void linkHovered(const QString &link); - void loadProgress(int progress); - void geometryChangeRequested(const QRect &geometry); - void menuBarVisibilityChangeRequested(bool visible); - void statusBarVisibilityChangeRequested(bool visible); - void toolBarVisibilityChangeRequested(bool visible); - void printRequested(QWebFrame *frame); - -public: - TabWidget(QWidget *parent = 0); - void clear(); - void addWebAction(QAction *action, QWebPage::WebAction webAction); - - QAction *newTabAction() const; - QAction *closeTabAction() const; - QAction *recentlyClosedTabsAction() const; - QAction *nextTabAction() const; - QAction *previousTabAction() const; - - QWidget *lineEditStack() const; - QLineEdit *currentLineEdit() const; - WebView *currentWebView() const; - WebView *webView(int index) const; - QLineEdit *lineEdit(int index) const; - int webViewIndex(WebView *webView) const; - - QByteArray saveState() const; - bool restoreState(const QByteArray &state); - -protected: - void mouseDoubleClickEvent(QMouseEvent *event); - void contextMenuEvent(QContextMenuEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - -public slots: - void loadUrlInCurrentTab(const QUrl &url); - WebView *newTab(bool makeCurrent = true); - void cloneTab(int index = -1); - void closeTab(int index = -1); - void closeOtherTabs(int index); - void reloadTab(int index = -1); - void reloadAllTabs(); - void nextTab(); - void previousTab(); - -private slots: - void currentChanged(int index); - void aboutToShowRecentTabsMenu(); - void aboutToShowRecentTriggeredAction(QAction *action); - void webViewLoadStarted(); - void webViewIconChanged(); - void webViewTitleChanged(const QString &title); - void webViewUrlChanged(const QUrl &url); - void lineEditReturnPressed(); - void windowCloseRequested(); - void moveTab(int fromIndex, int toIndex); - -private: - QAction *m_recentlyClosedTabsAction; - QAction *m_newTabAction; - QAction *m_closeTabAction; - QAction *m_nextTabAction; - QAction *m_previousTabAction; - - QMenu *m_recentlyClosedTabsMenu; - static const int m_recentlyClosedTabsSize = 10; - QList m_recentlyClosedTabs; - QList m_actions; - - QCompleter *m_lineEditCompleter; - QStackedWidget *m_lineEdits; - TabBar *m_tabBar; -}; - -#endif // TABWIDGET_H - diff --git a/examples/gestures/browser/toolbarsearch.cpp b/examples/gestures/browser/toolbarsearch.cpp deleted file mode 100644 index 0fb5322..0000000 --- a/examples/gestures/browser/toolbarsearch.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "toolbarsearch.h" -#include "autosaver.h" - -#include -#include - -#include -#include -#include - -#include - -/* - ToolbarSearch is a very basic search widget that also contains a small history. - Searches are turned into urls that use Google to perform search - */ -ToolbarSearch::ToolbarSearch(QWidget *parent) - : SearchLineEdit(parent) - , m_autosaver(new AutoSaver(this)) - , m_maxSavedSearches(10) - , m_stringListModel(new QStringListModel(this)) -{ - QMenu *m = menu(); - connect(m, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu())); - connect(m, SIGNAL(triggered(QAction*)), this, SLOT(triggeredMenuAction(QAction*))); - - QCompleter *completer = new QCompleter(m_stringListModel, this); - completer->setCompletionMode(QCompleter::InlineCompletion); - lineEdit()->setCompleter(completer); - - connect(lineEdit(), SIGNAL(returnPressed()), SLOT(searchNow())); - setInactiveText(tr("Google")); - load(); -} - -ToolbarSearch::~ToolbarSearch() -{ - m_autosaver->saveIfNeccessary(); -} - -void ToolbarSearch::save() -{ - QSettings settings; - settings.beginGroup(QLatin1String("toolbarsearch")); - settings.setValue(QLatin1String("recentSearches"), m_stringListModel->stringList()); - settings.setValue(QLatin1String("maximumSaved"), m_maxSavedSearches); - settings.endGroup(); -} - -void ToolbarSearch::load() -{ - QSettings settings; - settings.beginGroup(QLatin1String("toolbarsearch")); - QStringList list = settings.value(QLatin1String("recentSearches")).toStringList(); - m_maxSavedSearches = settings.value(QLatin1String("maximumSaved"), m_maxSavedSearches).toInt(); - m_stringListModel->setStringList(list); - settings.endGroup(); -} - -void ToolbarSearch::searchNow() -{ - QString searchText = lineEdit()->text(); - QStringList newList = m_stringListModel->stringList(); - if (newList.contains(searchText)) - newList.removeAt(newList.indexOf(searchText)); - newList.prepend(searchText); - if (newList.size() >= m_maxSavedSearches) - newList.removeLast(); - - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (!globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { - m_stringListModel->setStringList(newList); - m_autosaver->changeOccurred(); - } - - QUrl url(QLatin1String("http://www.google.com/search")); - url.addQueryItem(QLatin1String("q"), searchText); - url.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8")); - url.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8")); - url.addQueryItem(QLatin1String("client"), QLatin1String("qtdemobrowser")); - emit search(url); -} - -void ToolbarSearch::aboutToShowMenu() -{ - lineEdit()->selectAll(); - QMenu *m = menu(); - m->clear(); - QStringList list = m_stringListModel->stringList(); - if (list.isEmpty()) { - m->addAction(tr("No Recent Searches")); - return; - } - - QAction *recent = m->addAction(tr("Recent Searches")); - recent->setEnabled(false); - for (int i = 0; i < list.count(); ++i) { - QString text = list.at(i); - m->addAction(text)->setData(text); - } - m->addSeparator(); - m->addAction(tr("Clear Recent Searches"), this, SLOT(clear())); -} - -void ToolbarSearch::triggeredMenuAction(QAction *action) -{ - QVariant v = action->data(); - if (v.canConvert()) { - QString text = v.toString(); - lineEdit()->setText(text); - searchNow(); - } -} - -void ToolbarSearch::clear() -{ - m_stringListModel->setStringList(QStringList()); - m_autosaver->changeOccurred();; -} - diff --git a/examples/gestures/browser/toolbarsearch.h b/examples/gestures/browser/toolbarsearch.h deleted file mode 100644 index 02c1871..0000000 --- a/examples/gestures/browser/toolbarsearch.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TOOLBARSEARCH_H -#define TOOLBARSEARCH_H - -#include "searchlineedit.h" - -QT_BEGIN_NAMESPACE -class QUrl; -class QAction; -class QStringListModel; -QT_END_NAMESPACE - -class AutoSaver; - -class ToolbarSearch : public SearchLineEdit -{ - Q_OBJECT - -signals: - void search(const QUrl &url); - -public: - ToolbarSearch(QWidget *parent = 0); - ~ToolbarSearch(); - -public slots: - void clear(); - void searchNow(); - -private slots: - void save(); - void aboutToShowMenu(); - void triggeredMenuAction(QAction *action); - -private: - void load(); - - AutoSaver *m_autosaver; - int m_maxSavedSearches; - QStringListModel *m_stringListModel; -}; - -#endif // TOOLBARSEARCH_H - diff --git a/examples/gestures/browser/urllineedit.cpp b/examples/gestures/browser/urllineedit.cpp deleted file mode 100644 index 70951d1..0000000 --- a/examples/gestures/browser/urllineedit.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "urllineedit.h" - -#include "browserapplication.h" -#include "searchlineedit.h" -#include "webview.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -ExLineEdit::ExLineEdit(QWidget *parent) - : QWidget(parent) - , m_leftWidget(0) - , m_lineEdit(new QLineEdit(this)) - , m_clearButton(0) -{ - setFocusPolicy(m_lineEdit->focusPolicy()); - setAttribute(Qt::WA_InputMethodEnabled); - setSizePolicy(m_lineEdit->sizePolicy()); - setBackgroundRole(m_lineEdit->backgroundRole()); - setMouseTracking(true); - setAcceptDrops(true); - setAttribute(Qt::WA_MacShowFocusRect, true); - QPalette p = m_lineEdit->palette(); - setPalette(p); - - // line edit - m_lineEdit->setFrame(false); - m_lineEdit->setFocusProxy(this); - m_lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); - QPalette clearPalette = m_lineEdit->palette(); - clearPalette.setBrush(QPalette::Base, QBrush(Qt::transparent)); - m_lineEdit->setPalette(clearPalette); - - // clearButton - m_clearButton = new ClearButton(this); - connect(m_clearButton, SIGNAL(clicked()), - m_lineEdit, SLOT(clear())); - connect(m_lineEdit, SIGNAL(textChanged(const QString&)), - m_clearButton, SLOT(textChanged(const QString&))); -} - -void ExLineEdit::setLeftWidget(QWidget *widget) -{ - m_leftWidget = widget; -} - -QWidget *ExLineEdit::leftWidget() const -{ - return m_leftWidget; -} - -void ExLineEdit::resizeEvent(QResizeEvent *event) -{ - Q_ASSERT(m_leftWidget); - updateGeometries(); - QWidget::resizeEvent(event); -} - -void ExLineEdit::updateGeometries() -{ - QStyleOptionFrameV2 panel; - initStyleOption(&panel); - QRect rect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this); - - int height = rect.height(); - int width = rect.width(); - - int m_leftWidgetHeight = m_leftWidget->height(); - m_leftWidget->setGeometry(rect.x() + 2, rect.y() + (height - m_leftWidgetHeight)/2, - m_leftWidget->width(), m_leftWidget->height()); - - int clearButtonWidth = this->height(); - m_lineEdit->setGeometry(m_leftWidget->x() + m_leftWidget->width(), 0, - width - clearButtonWidth - m_leftWidget->width(), this->height()); - - m_clearButton->setGeometry(this->width() - clearButtonWidth, 0, - clearButtonWidth, this->height()); -} - -void ExLineEdit::initStyleOption(QStyleOptionFrameV2 *option) const -{ - option->initFrom(this); - option->rect = contentsRect(); - option->lineWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, option, this); - option->midLineWidth = 0; - option->state |= QStyle::State_Sunken; - if (m_lineEdit->isReadOnly()) - option->state |= QStyle::State_ReadOnly; -#ifdef QT_KEYPAD_NAVIGATION - if (hasEditFocus()) - option->state |= QStyle::State_HasEditFocus; -#endif - option->features = QStyleOptionFrameV2::None; -} - -QSize ExLineEdit::sizeHint() const -{ - m_lineEdit->setFrame(true); - QSize size = m_lineEdit->sizeHint(); - m_lineEdit->setFrame(false); - return size; -} - -void ExLineEdit::focusInEvent(QFocusEvent *event) -{ - m_lineEdit->event(event); - QWidget::focusInEvent(event); -} - -void ExLineEdit::focusOutEvent(QFocusEvent *event) -{ - m_lineEdit->event(event); - - if (m_lineEdit->completer()) { - connect(m_lineEdit->completer(), SIGNAL(activated(QString)), - m_lineEdit, SLOT(setText(QString))); - connect(m_lineEdit->completer(), SIGNAL(highlighted(QString)), - m_lineEdit, SLOT(_q_completionHighlighted(QString))); - } - QWidget::focusOutEvent(event); -} - -void ExLineEdit::keyPressEvent(QKeyEvent *event) -{ - m_lineEdit->event(event); -} - -bool ExLineEdit::event(QEvent *event) -{ - if (event->type() == QEvent::ShortcutOverride) - return m_lineEdit->event(event); - return QWidget::event(event); -} - -void ExLineEdit::paintEvent(QPaintEvent *) -{ - QPainter p(this); - QStyleOptionFrameV2 panel; - initStyleOption(&panel); - style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this); -} - -QVariant ExLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const -{ - return m_lineEdit->inputMethodQuery(property); -} - -void ExLineEdit::inputMethodEvent(QInputMethodEvent *e) -{ - m_lineEdit->event(e); -} - - -class UrlIconLabel : public QLabel -{ - -public: - UrlIconLabel(QWidget *parent); - - WebView *m_webView; - -protected: - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - -private: - QPoint m_dragStartPos; - -}; - -UrlIconLabel::UrlIconLabel(QWidget *parent) - : QLabel(parent) - , m_webView(0) -{ - setMinimumWidth(16); - setMinimumHeight(16); -} - -void UrlIconLabel::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - m_dragStartPos = event->pos(); - QLabel::mousePressEvent(event); -} - -void UrlIconLabel::mouseMoveEvent(QMouseEvent *event) -{ - if (event->buttons() == Qt::LeftButton - && (event->pos() - m_dragStartPos).manhattanLength() > QApplication::startDragDistance() - && m_webView) { - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - mimeData->setText(QString::fromUtf8(m_webView->url().toEncoded())); - QList urls; - urls.append(m_webView->url()); - mimeData->setUrls(urls); - drag->setMimeData(mimeData); - drag->exec(); - } -} - -UrlLineEdit::UrlLineEdit(QWidget *parent) - : ExLineEdit(parent) - , m_webView(0) - , m_iconLabel(0) -{ - // icon - m_iconLabel = new UrlIconLabel(this); - m_iconLabel->resize(16, 16); - setLeftWidget(m_iconLabel); - m_defaultBaseColor = palette().color(QPalette::Base); - - webViewIconChanged(); -} - -void UrlLineEdit::setWebView(WebView *webView) -{ - Q_ASSERT(!m_webView); - m_webView = webView; - m_iconLabel->m_webView = webView; - connect(webView, SIGNAL(urlChanged(const QUrl &)), - this, SLOT(webViewUrlChanged(const QUrl &))); - connect(webView, SIGNAL(loadFinished(bool)), - this, SLOT(webViewIconChanged())); - connect(webView, SIGNAL(iconChanged()), - this, SLOT(webViewIconChanged())); - connect(webView, SIGNAL(loadProgress(int)), - this, SLOT(update())); -} - -void UrlLineEdit::webViewUrlChanged(const QUrl &url) -{ - m_lineEdit->setText(QString::fromUtf8(url.toEncoded())); - m_lineEdit->setCursorPosition(0); -} - -void UrlLineEdit::webViewIconChanged() -{ - QUrl url = (m_webView) ? m_webView->url() : QUrl(); - QIcon icon = BrowserApplication::instance()->icon(url); - QPixmap pixmap(icon.pixmap(16, 16)); - m_iconLabel->setPixmap(pixmap); -} - -QLinearGradient UrlLineEdit::generateGradient(const QColor &color) const -{ - QLinearGradient gradient(0, 0, 0, height()); - gradient.setColorAt(0, m_defaultBaseColor); - gradient.setColorAt(0.15, color.lighter(120)); - gradient.setColorAt(0.5, color); - gradient.setColorAt(0.85, color.lighter(120)); - gradient.setColorAt(1, m_defaultBaseColor); - return gradient; -} - -void UrlLineEdit::focusOutEvent(QFocusEvent *event) -{ - if (m_lineEdit->text().isEmpty() && m_webView) - m_lineEdit->setText(QString::fromUtf8(m_webView->url().toEncoded())); - ExLineEdit::focusOutEvent(event); -} - -void UrlLineEdit::paintEvent(QPaintEvent *event) -{ - QPalette p = palette(); - if (m_webView && m_webView->url().scheme() == QLatin1String("https")) { - QColor lightYellow(248, 248, 210); - p.setBrush(QPalette::Base, generateGradient(lightYellow)); - } else { - p.setBrush(QPalette::Base, m_defaultBaseColor); - } - setPalette(p); - ExLineEdit::paintEvent(event); - - QPainter painter(this); - QStyleOptionFrameV2 panel; - initStyleOption(&panel); - QRect backgroundRect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this); - if (m_webView && !hasFocus()) { - int progress = m_webView->progress(); - QColor loadingColor = QColor(116, 192, 250); - painter.setBrush(generateGradient(loadingColor)); - painter.setPen(Qt::transparent); - int mid = backgroundRect.width() / 100 * progress; - QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height()); - painter.drawRect(progressRect); - } -} diff --git a/examples/gestures/browser/urllineedit.h b/examples/gestures/browser/urllineedit.h deleted file mode 100644 index 0727e6a..0000000 --- a/examples/gestures/browser/urllineedit.h +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef URLLINEEDIT_H -#define URLLINEEDIT_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QLineEdit; -QT_END_NAMESPACE - -class ClearButton; -class ExLineEdit : public QWidget -{ - Q_OBJECT - -public: - ExLineEdit(QWidget *parent = 0); - - inline QLineEdit *lineEdit() const { return m_lineEdit; } - - void setLeftWidget(QWidget *widget); - QWidget *leftWidget() const; - - QSize sizeHint() const; - - QVariant inputMethodQuery(Qt::InputMethodQuery property) const; -protected: - void focusInEvent(QFocusEvent *event); - void focusOutEvent(QFocusEvent *event); - void keyPressEvent(QKeyEvent *event); - void paintEvent(QPaintEvent *event); - void resizeEvent(QResizeEvent *event); - void inputMethodEvent(QInputMethodEvent *e); - bool event(QEvent *event); - -protected: - void updateGeometries(); - void initStyleOption(QStyleOptionFrameV2 *option) const; - - QWidget *m_leftWidget; - QLineEdit *m_lineEdit; - ClearButton *m_clearButton; -}; - -class UrlIconLabel; -class WebView; -class UrlLineEdit : public ExLineEdit -{ - Q_OBJECT - -public: - UrlLineEdit(QWidget *parent = 0); - void setWebView(WebView *webView); - -protected: - void paintEvent(QPaintEvent *event); - void focusOutEvent(QFocusEvent *event); - -private slots: - void webViewUrlChanged(const QUrl &url); - void webViewIconChanged(); - -private: - QLinearGradient generateGradient(const QColor &color) const; - WebView *m_webView; - UrlIconLabel *m_iconLabel; - QColor m_defaultBaseColor; - -}; - - -#endif // URLLINEEDIT_H - diff --git a/examples/gestures/browser/webview.cpp b/examples/gestures/browser/webview.cpp deleted file mode 100644 index e50872f..0000000 --- a/examples/gestures/browser/webview.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "browserapplication.h" -#include "browsermainwindow.h" -#include "cookiejar.h" -#include "downloadmanager.h" -#include "networkaccessmanager.h" -#include "tabwidget.h" -#include "webview.h" - -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -WebPage::WebPage(QObject *parent) - : QWebPage(parent) - , m_keyboardModifiers(Qt::NoModifier) - , m_pressedButtons(Qt::NoButton) - , m_openInNewTab(false) -{ - setNetworkAccessManager(BrowserApplication::networkAccessManager()); - connect(this, SIGNAL(unsupportedContent(QNetworkReply *)), - this, SLOT(handleUnsupportedContent(QNetworkReply *))); -} - -BrowserMainWindow *WebPage::mainWindow() -{ - QObject *w = this->parent(); - while (w) { - if (BrowserMainWindow *mw = qobject_cast(w)) - return mw; - w = w->parent(); - } - return BrowserApplication::instance()->mainWindow(); -} - -bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) -{ - // ctrl open in new tab - // ctrl-shift open in new tab and select - // ctrl-alt open in new window - if (type == QWebPage::NavigationTypeLinkClicked - && (m_keyboardModifiers & Qt::ControlModifier - || m_pressedButtons == Qt::MidButton)) { - bool newWindow = (m_keyboardModifiers & Qt::AltModifier); - WebView *webView; - if (newWindow) { - BrowserApplication::instance()->newMainWindow(); - BrowserMainWindow *newMainWindow = BrowserApplication::instance()->mainWindow(); - webView = newMainWindow->currentTab(); - newMainWindow->raise(); - newMainWindow->activateWindow(); - webView->setFocus(); - } else { - bool selectNewTab = (m_keyboardModifiers & Qt::ShiftModifier); - webView = mainWindow()->tabWidget()->newTab(selectNewTab); - } - webView->load(request); - m_keyboardModifiers = Qt::NoModifier; - m_pressedButtons = Qt::NoButton; - return false; - } - if (frame == mainFrame()) { - m_loadingUrl = request.url(); - emit loadingUrl(m_loadingUrl); - } - return QWebPage::acceptNavigationRequest(frame, request, type); -} - -QWebPage *WebPage::createWindow(QWebPage::WebWindowType type) -{ - Q_UNUSED(type); - if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) - m_openInNewTab = true; - if (m_openInNewTab) { - m_openInNewTab = false; - return mainWindow()->tabWidget()->newTab()->page(); - } - BrowserApplication::instance()->newMainWindow(); - BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); - return mainWindow->currentTab()->page(); -} - -#if !defined(QT_NO_UITOOLS) -QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) -{ - Q_UNUSED(url); - Q_UNUSED(paramNames); - Q_UNUSED(paramValues); - QUiLoader loader; - return loader.createWidget(classId, view()); -} -#endif // !defined(QT_NO_UITOOLS) - -void WebPage::handleUnsupportedContent(QNetworkReply *reply) -{ - if (reply->error() == QNetworkReply::NoError) { - BrowserApplication::downloadManager()->handleUnsupportedContent(reply); - return; - } - - QFile file(QLatin1String(":/notfound.html")); - bool isOpened = file.open(QIODevice::ReadOnly); - Q_ASSERT(isOpened); - QString title = tr("Error loading page: %1").arg(reply->url().toString()); - QString html = QString(QLatin1String(file.readAll())) - .arg(title) - .arg(reply->errorString()) - .arg(reply->url().toString()); - - QBuffer imageBuffer; - imageBuffer.open(QBuffer::ReadWrite); - QIcon icon = view()->style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, view()); - QPixmap pixmap = icon.pixmap(QSize(32,32)); - if (pixmap.save(&imageBuffer, "PNG")) { - html.replace(QLatin1String("IMAGE_BINARY_DATA_HERE"), - QString(QLatin1String(imageBuffer.buffer().toBase64()))); - } - - QList frames; - frames.append(mainFrame()); - while (!frames.isEmpty()) { - QWebFrame *frame = frames.takeFirst(); - if (frame->url() == reply->url()) { - frame->setHtml(html, reply->url()); - return; - } - QList children = frame->childFrames(); - foreach(QWebFrame *frame, children) - frames.append(frame); - } - if (m_loadingUrl == reply->url()) { - mainFrame()->setHtml(html, reply->url()); - } -} - - -WebView::WebView(QWidget* parent) - : QWebView(parent) - , m_progress(0) - , m_page(new WebPage(this)) - , m_currentPanFrame(0) -{ - grabGesture(Qt::PanGesture); - setPage(m_page); - connect(page(), SIGNAL(statusBarMessage(const QString&)), - SLOT(setStatusBarText(const QString&))); - connect(this, SIGNAL(loadProgress(int)), - this, SLOT(setProgress(int))); - connect(this, SIGNAL(loadFinished(bool)), - this, SLOT(loadFinished())); - connect(page(), SIGNAL(loadingUrl(const QUrl&)), - this, SIGNAL(urlChanged(const QUrl &))); - connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)), - this, SLOT(downloadRequested(const QNetworkRequest &))); - page()->setForwardUnsupportedContent(true); - -} - -void WebView::contextMenuEvent(QContextMenuEvent *event) -{ - QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); - if (!r.linkUrl().isEmpty()) { - QMenu menu(this); - menu.addAction(pageAction(QWebPage::OpenLinkInNewWindow)); - menu.addAction(tr("Open in New Tab"), this, SLOT(openLinkInNewTab())); - menu.addSeparator(); - menu.addAction(pageAction(QWebPage::DownloadLinkToDisk)); - // Add link to bookmarks... - menu.addSeparator(); - menu.addAction(pageAction(QWebPage::CopyLinkToClipboard)); - if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) - menu.addAction(pageAction(QWebPage::InspectElement)); - menu.exec(mapToGlobal(event->pos())); - return; - } - QWebView::contextMenuEvent(event); -} - -void WebView::wheelEvent(QWheelEvent *event) -{ - if (QApplication::keyboardModifiers() & Qt::ControlModifier) { - int numDegrees = event->delta() / 8; - int numSteps = numDegrees / 15; - setTextSizeMultiplier(textSizeMultiplier() + numSteps * 0.1); - event->accept(); - return; - } - QWebView::wheelEvent(event); -} - -void WebView::openLinkInNewTab() -{ - m_page->m_openInNewTab = true; - pageAction(QWebPage::OpenLinkInNewWindow)->trigger(); -} - -void WebView::setProgress(int progress) -{ - m_progress = progress; -} - -void WebView::loadFinished() -{ - if (100 != m_progress) { - qWarning() << "Recieved finished signal while progress is still:" << progress() - << "Url:" << url(); - } - m_progress = 0; -} - -void WebView::loadUrl(const QUrl &url) -{ - m_initialUrl = url; - load(url); -} - -QString WebView::lastStatusBarText() const -{ - return m_statusBarText; -} - -QUrl WebView::url() const -{ - QUrl url = QWebView::url(); - if (!url.isEmpty()) - return url; - - return m_initialUrl; -} - -void WebView::mousePressEvent(QMouseEvent *event) -{ - m_page->m_pressedButtons = event->buttons(); - m_page->m_keyboardModifiers = event->modifiers(); - QWebView::mousePressEvent(event); -} - -void WebView::mouseReleaseEvent(QMouseEvent *event) -{ - QWebView::mouseReleaseEvent(event); - if (!event->isAccepted() && (m_page->m_pressedButtons & Qt::MidButton)) { - QUrl url(QApplication::clipboard()->text(QClipboard::Selection)); - if (!url.isEmpty() && url.isValid() && !url.scheme().isEmpty()) { - setUrl(url); - } - } -} - -void WebView::setStatusBarText(const QString &string) -{ - m_statusBarText = string; -} - -void WebView::downloadRequested(const QNetworkRequest &request) -{ - BrowserApplication::downloadManager()->download(request); -} - -bool WebView::event(QEvent *event) -{ - if (event->type() == QEvent::Gesture) - { - gestureEvent(static_cast(event)); - return true; - } - return QWebView::event(event); -} - -void WebView::gestureEvent(QGestureEvent *event) -{ - if (const QGesture *g = event->gesture(Qt::PanGesture)) { - if (g->state() == Qt::GestureUpdated) { - if (m_currentPanFrame) { - m_panSpeed = g->pos() - g->lastPos(); - m_currentPanFrame->scroll(-m_panSpeed.x(), -m_panSpeed.y()); - } - } else if (g->state() == Qt::GestureStarted) { - startTimer(20); - m_currentPanFrame = 0; - if (QWebFrame *frame = page()->mainFrame()) { - QWebHitTestResult result = frame->hitTestContent(g->startPos()); - if (!result.isNull()) - m_currentPanFrame = result.frame(); - while (m_currentPanFrame && - m_currentPanFrame->scrollBarMinimum(Qt::Vertical) == 0 && - m_currentPanFrame->scrollBarMaximum(Qt::Vertical) == 0 && - m_currentPanFrame->scrollBarMinimum(Qt::Horizontal) == 0 && - m_currentPanFrame->scrollBarMaximum(Qt::Horizontal) == 0) { - m_currentPanFrame = m_currentPanFrame->parentFrame(); - } - } - } else { - } - event->accept(); - } -} - -static QPoint deaccelerate(const QPoint &speed, int a = 1, int max = 64) -{ - int x = qBound(-max, speed.x(), max); - int y = qBound(-max, speed.y(), max); - x = (x == 0) ? x : (x > 0) ? qMax(0, x - a) : qMin(0, x + a); - y = (y == 0) ? y : (y > 0) ? qMax(0, y - a) : qMin(0, y + a); - return QPoint(x, y); -} - -void WebView::timerEvent(QTimerEvent *event) -{ - m_panSpeed = deaccelerate(m_panSpeed); - if (m_panSpeed.isNull()) - killTimer(event->timerId()); - if (m_currentPanFrame) - m_currentPanFrame->scroll(-m_panSpeed.x(), -m_panSpeed.y()); -} diff --git a/examples/gestures/browser/webview.h b/examples/gestures/browser/webview.h deleted file mode 100644 index 71aca1a..0000000 --- a/examples/gestures/browser/webview.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WEBVIEW_H -#define WEBVIEW_H - -#include - -QT_BEGIN_NAMESPACE -class QAuthenticator; -class QMouseEvent; -class QNetworkProxy; -class QNetworkReply; -class QSslError; -QT_END_NAMESPACE - -class BrowserMainWindow; -class WebPage : public QWebPage { - Q_OBJECT - -signals: - void loadingUrl(const QUrl &url); - -public: - WebPage(QObject *parent = 0); - BrowserMainWindow *mainWindow(); - -protected: - bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type); - QWebPage *createWindow(QWebPage::WebWindowType type); -#if !defined(QT_NO_UITOOLS) - QObject *createPlugin(const QString &classId, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); -#endif - -private slots: - void handleUnsupportedContent(QNetworkReply *reply); - -private: - friend class WebView; - - // set the webview mousepressedevent - Qt::KeyboardModifiers m_keyboardModifiers; - Qt::MouseButtons m_pressedButtons; - bool m_openInNewTab; - QUrl m_loadingUrl; -}; - -class WebView : public QWebView { - Q_OBJECT - -public: - WebView(QWidget *parent = 0); - WebPage *webPage() const { return m_page; } - - void loadUrl(const QUrl &url); - QUrl url() const; - - QString lastStatusBarText() const; - inline int progress() const { return m_progress; } - -protected: - bool event(QEvent *event); - void gestureEvent(QGestureEvent *event); - void timerEvent(QTimerEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void contextMenuEvent(QContextMenuEvent *event); - void wheelEvent(QWheelEvent *event); - -private slots: - void setProgress(int progress); - void loadFinished(); - void setStatusBarText(const QString &string); - void downloadRequested(const QNetworkRequest &request); - void openLinkInNewTab(); - -private: - QString m_statusBarText; - QUrl m_initialUrl; - int m_progress; - WebPage *m_page; - QPoint m_panSpeed; - QWebFrame *m_currentPanFrame; -}; - -#endif diff --git a/examples/gestures/browser/xbel.cpp b/examples/gestures/browser/xbel.cpp deleted file mode 100644 index 6145281..0000000 --- a/examples/gestures/browser/xbel.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "xbel.h" - -#include - -BookmarkNode::BookmarkNode(BookmarkNode::Type type, BookmarkNode *parent) : - expanded(false) - , m_parent(parent) - , m_type(type) -{ - if (parent) - parent->add(this); -} - -BookmarkNode::~BookmarkNode() -{ - if (m_parent) - m_parent->remove(this); - qDeleteAll(m_children); - m_parent = 0; - m_type = BookmarkNode::Root; -} - -bool BookmarkNode::operator==(const BookmarkNode &other) -{ - if (url != other.url - || title != other.title - || desc != other.desc - || expanded != other.expanded - || m_type != other.m_type - || m_children.count() != other.m_children.count()) - return false; - - for (int i = 0; i < m_children.count(); ++i) - if (!((*(m_children[i])) == (*(other.m_children[i])))) - return false; - return true; -} - -BookmarkNode::Type BookmarkNode::type() const -{ - return m_type; -} - -void BookmarkNode::setType(Type type) -{ - m_type = type; -} - -QList BookmarkNode::children() const -{ - return m_children; -} - -BookmarkNode *BookmarkNode::parent() const -{ - return m_parent; -} - -void BookmarkNode::add(BookmarkNode *child, int offset) -{ - Q_ASSERT(child->m_type != Root); - if (child->m_parent) - child->m_parent->remove(child); - child->m_parent = this; - if (-1 == offset) - offset = m_children.size(); - m_children.insert(offset, child); -} - -void BookmarkNode::remove(BookmarkNode *child) -{ - child->m_parent = 0; - m_children.removeAll(child); -} - - -XbelReader::XbelReader() -{ -} - -BookmarkNode *XbelReader::read(const QString &fileName) -{ - QFile file(fileName); - if (!file.exists()) { - return new BookmarkNode(BookmarkNode::Root); - } - file.open(QFile::ReadOnly); - return read(&file); -} - -BookmarkNode *XbelReader::read(QIODevice *device) -{ - BookmarkNode *root = new BookmarkNode(BookmarkNode::Root); - setDevice(device); - while (!atEnd()) { - readNext(); - if (isStartElement()) { - QString version = attributes().value(QLatin1String("version")).toString(); - if (name() == QLatin1String("xbel") - && (version.isEmpty() || version == QLatin1String("1.0"))) { - readXBEL(root); - } else { - raiseError(QObject::tr("The file is not an XBEL version 1.0 file.")); - } - } - } - return root; -} - -void XbelReader::readXBEL(BookmarkNode *parent) -{ - Q_ASSERT(isStartElement() && name() == QLatin1String("xbel")); - - while (!atEnd()) { - readNext(); - if (isEndElement()) - break; - - if (isStartElement()) { - if (name() == QLatin1String("folder")) - readFolder(parent); - else if (name() == QLatin1String("bookmark")) - readBookmarkNode(parent); - else if (name() == QLatin1String("separator")) - readSeparator(parent); - else - skipUnknownElement(); - } - } -} - -void XbelReader::readFolder(BookmarkNode *parent) -{ - Q_ASSERT(isStartElement() && name() == QLatin1String("folder")); - - BookmarkNode *folder = new BookmarkNode(BookmarkNode::Folder, parent); - folder->expanded = (attributes().value(QLatin1String("folded")) == QLatin1String("no")); - - while (!atEnd()) { - readNext(); - - if (isEndElement()) - break; - - if (isStartElement()) { - if (name() == QLatin1String("title")) - readTitle(folder); - else if (name() == QLatin1String("desc")) - readDescription(folder); - else if (name() == QLatin1String("folder")) - readFolder(folder); - else if (name() == QLatin1String("bookmark")) - readBookmarkNode(folder); - else if (name() == QLatin1String("separator")) - readSeparator(folder); - else - skipUnknownElement(); - } - } -} - -void XbelReader::readTitle(BookmarkNode *parent) -{ - Q_ASSERT(isStartElement() && name() == QLatin1String("title")); - parent->title = readElementText(); -} - -void XbelReader::readDescription(BookmarkNode *parent) -{ - Q_ASSERT(isStartElement() && name() == QLatin1String("desc")); - parent->desc = readElementText(); -} - -void XbelReader::readSeparator(BookmarkNode *parent) -{ - new BookmarkNode(BookmarkNode::Separator, parent); - // empty elements have a start and end element - readNext(); -} - -void XbelReader::readBookmarkNode(BookmarkNode *parent) -{ - Q_ASSERT(isStartElement() && name() == QLatin1String("bookmark")); - BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark, parent); - bookmark->url = attributes().value(QLatin1String("href")).toString(); - while (!atEnd()) { - readNext(); - if (isEndElement()) - break; - - if (isStartElement()) { - if (name() == QLatin1String("title")) - readTitle(bookmark); - else if (name() == QLatin1String("desc")) - readDescription(bookmark); - else - skipUnknownElement(); - } - } - if (bookmark->title.isEmpty()) - bookmark->title = QObject::tr("Unknown title"); -} - -void XbelReader::skipUnknownElement() -{ - Q_ASSERT(isStartElement()); - - while (!atEnd()) { - readNext(); - - if (isEndElement()) - break; - - if (isStartElement()) - skipUnknownElement(); - } -} - - -XbelWriter::XbelWriter() -{ - setAutoFormatting(true); -} - -bool XbelWriter::write(const QString &fileName, const BookmarkNode *root) -{ - QFile file(fileName); - if (!root || !file.open(QFile::WriteOnly)) - return false; - return write(&file, root); -} - -bool XbelWriter::write(QIODevice *device, const BookmarkNode *root) -{ - setDevice(device); - - writeStartDocument(); - writeDTD(QLatin1String("")); - writeStartElement(QLatin1String("xbel")); - writeAttribute(QLatin1String("version"), QLatin1String("1.0")); - if (root->type() == BookmarkNode::Root) { - for (int i = 0; i < root->children().count(); ++i) - writeItem(root->children().at(i)); - } else { - writeItem(root); - } - - writeEndDocument(); - return true; -} - -void XbelWriter::writeItem(const BookmarkNode *parent) -{ - switch (parent->type()) { - case BookmarkNode::Folder: - writeStartElement(QLatin1String("folder")); - writeAttribute(QLatin1String("folded"), parent->expanded ? QLatin1String("no") : QLatin1String("yes")); - writeTextElement(QLatin1String("title"), parent->title); - for (int i = 0; i < parent->children().count(); ++i) - writeItem(parent->children().at(i)); - writeEndElement(); - break; - case BookmarkNode::Bookmark: - writeStartElement(QLatin1String("bookmark")); - if (!parent->url.isEmpty()) - writeAttribute(QLatin1String("href"), parent->url); - writeTextElement(QLatin1String("title"), parent->title); - if (!parent->desc.isEmpty()) - writeAttribute(QLatin1String("desc"), parent->desc); - writeEndElement(); - break; - case BookmarkNode::Separator: - writeEmptyElement(QLatin1String("separator")); - break; - default: - break; - } -} - diff --git a/examples/gestures/browser/xbel.h b/examples/gestures/browser/xbel.h deleted file mode 100644 index 20cbda6..0000000 --- a/examples/gestures/browser/xbel.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XBEL_H -#define XBEL_H - -#include -#include - -class BookmarkNode -{ -public: - enum Type { - Root, - Folder, - Bookmark, - Separator - }; - - BookmarkNode(Type type = Root, BookmarkNode *parent = 0); - ~BookmarkNode(); - bool operator==(const BookmarkNode &other); - - Type type() const; - void setType(Type type); - QList children() const; - BookmarkNode *parent() const; - - void add(BookmarkNode *child, int offset = -1); - void remove(BookmarkNode *child); - - QString url; - QString title; - QString desc; - bool expanded; - -private: - BookmarkNode *m_parent; - Type m_type; - QList m_children; - -}; - -class XbelReader : public QXmlStreamReader -{ -public: - XbelReader(); - BookmarkNode *read(const QString &fileName); - BookmarkNode *read(QIODevice *device); - -private: - void skipUnknownElement(); - void readXBEL(BookmarkNode *parent); - void readTitle(BookmarkNode *parent); - void readDescription(BookmarkNode *parent); - void readSeparator(BookmarkNode *parent); - void readFolder(BookmarkNode *parent); - void readBookmarkNode(BookmarkNode *parent); -}; - -#include - -class XbelWriter : public QXmlStreamWriter -{ -public: - XbelWriter(); - bool write(const QString &fileName, const BookmarkNode *root); - bool write(QIODevice *device, const BookmarkNode *root); - -private: - void writeItem(const BookmarkNode *parent); -}; - -#endif // XBEL_H - diff --git a/examples/gestures/collidingmice/collidingmice.pro b/examples/gestures/collidingmice/collidingmice.pro deleted file mode 100644 index 15164ce..0000000 --- a/examples/gestures/collidingmice/collidingmice.pro +++ /dev/null @@ -1,18 +0,0 @@ -HEADERS += \ - mouse.h \ - gesturerecognizerlinjazax.h \ - linjazaxgesture.h - -SOURCES += \ - main.cpp \ - mouse.cpp \ - gesturerecognizerlinjazax.cpp - -RESOURCES += \ - mice.qrc - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/gestures/collidingmice -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS collidingmice.pro images -sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/collidingmice -INSTALLS += target sources diff --git a/examples/gestures/collidingmice/gesturerecognizerlinjazax.cpp b/examples/gestures/collidingmice/gesturerecognizerlinjazax.cpp deleted file mode 100644 index 2070f6f..0000000 --- a/examples/gestures/collidingmice/gesturerecognizerlinjazax.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "gesturerecognizerlinjazax.h" - -#include -#include - -static const int SIZE = 20; - -DirectionSimpleRecognizer::DirectionSimpleRecognizer() -{ -} - -Direction DirectionSimpleRecognizer::addPosition(const QPoint &pos) -{ - if (!directions.isEmpty()) { - const QPoint tmp = pos - directions.back().point; - if (tmp.manhattanLength() < 5) - return Direction(); - } - if (lastPoint.isNull()) { - lastPoint = pos; - return Direction(); - } - int dx = pos.x() - lastPoint.x(); - int dy = pos.y() - lastPoint.y(); - QString direction; - if (dx < 0) { - if (-1*dx >= SIZE/2) - direction = "4"; - } else { - if (dx >= SIZE/2) - direction = "6"; - } - if (dy < 0) { - if (-1*dy >= SIZE/2) - direction = "8"; - } else { - if (dy >= SIZE/2) - direction = "2"; - } - if (direction.isEmpty()) - return Direction(); - - lastPoint = pos; - directions.push_back(Direction(direction, pos)); - return Direction(direction, pos); -} - - -DirectionList DirectionSimpleRecognizer::getDirections() const -{ - return directions; -} - -void DirectionSimpleRecognizer::reset() -{ - directions.clear(); - lastPoint = QPoint(); -} - -/////////////////////////////////////////////////////////////////////////// - -GestureRecognizerLinjaZax::GestureRecognizerLinjaZax() - : QGestureRecognizer(QLatin1String("LinjaZax")), mousePressed(false), gestureFinished(false), - zoomState(LinjaZaxGesture::NoZoom) -{ -} - -QGestureRecognizer::Result GestureRecognizerLinjaZax::filterEvent(const QEvent *event) -{ - if (zoomState != LinjaZaxGesture::NoZoom && !lastDirections.isEmpty()) { - lastDirections = lastDirections.right(1); - zoomState = LinjaZaxGesture::NoZoom; - } - - if (event->type() == QEvent::MouseButtonPress) { - if (!currentDirection.isEmpty()) { - reset(); - return QGestureRecognizer::NotGesture; - } - mousePressed = true; - const QMouseEvent *ev = static_cast(event); - pressedPos = lastPos = currentPos = ev->pos(); - return QGestureRecognizer::MaybeGesture; - } else if (event->type() == QEvent::MouseButtonRelease) { - const QMouseEvent *ev = static_cast(event); - if (mousePressed && !currentDirection.isEmpty()) { - gestureFinished = true; - currentPos = ev->pos(); - internalReset(); - return QGestureRecognizer::GestureFinished; - } - reset(); - return QGestureRecognizer::NotGesture; - } else if (event->type() == QEvent::MouseMove) { - if (!mousePressed) - return QGestureRecognizer::NotGesture; - lastPos = currentPos; - const QMouseEvent *ev = static_cast(event); - currentPos = ev->pos(); - QString direction = - simpleRecognizer.addPosition(ev->pos()).direction; - QGestureRecognizer::Result result = QGestureRecognizer::NotGesture; - if (currentDirection.isEmpty()) { - if (direction.isEmpty()) - result = QGestureRecognizer::MaybeGesture; - else - result = QGestureRecognizer::GestureStarted; - } else { - result = QGestureRecognizer::GestureStarted; - } - if (!direction.isEmpty()) { - lastDirections.append(direction); - currentDirection = direction; - if (lastDirections.length() > 5) - lastDirections.remove(0, 1); - if (lastDirections.contains("248") || lastDirections.contains("2448")) - zoomState = LinjaZaxGesture::ZoomingIn; - else if (lastDirections.contains("268") || lastDirections.contains("2668")) - zoomState = LinjaZaxGesture::ZoomingOut; - } - return result; - } - return QGestureRecognizer::NotGesture; -} - -static inline LinjaZaxGesture::DirectionType convertPanningDirection(const QString &direction) -{ - if (direction.length() == 1) { - if (direction == "4") - return LinjaZaxGesture::Left; - else if (direction == "6") - return LinjaZaxGesture::Right; - else if (direction == "8") - return LinjaZaxGesture::Up; - else if (direction == "2") - return LinjaZaxGesture::Down; - } - return LinjaZaxGesture::None; -} - -QGesture* GestureRecognizerLinjaZax::getGesture() -{ - LinjaZaxGesture::DirectionType dir = convertPanningDirection(currentDirection); - LinjaZaxGesture::DirectionType lastDir = convertPanningDirection(lastDirections.right(1)); - if (dir == LinjaZaxGesture::None) - return 0; - LinjaZaxGesture *g = - new LinjaZaxGesture(this, pressedPos, lastPos, currentPos, - QRect(), pressedPos, QDateTime(), 0, - gestureFinished ? Qt::GestureFinished : Qt::GestureStarted); - g->lastDirection_ = lastDir; - g->direction_ = dir; - g->zoomState_ = zoomState; - - return g; -} - -void GestureRecognizerLinjaZax::reset() -{ - mousePressed = false; - lastDirections.clear(); - currentDirection.clear(); - gestureFinished = false; - simpleRecognizer.reset(); - zoomState = LinjaZaxGesture::NoZoom; -} - -void GestureRecognizerLinjaZax::internalReset() -{ - mousePressed = false; - simpleRecognizer.reset(); -} diff --git a/examples/gestures/collidingmice/gesturerecognizerlinjazax.h b/examples/gestures/collidingmice/gesturerecognizerlinjazax.h deleted file mode 100644 index 79b2c2b..0000000 --- a/examples/gestures/collidingmice/gesturerecognizerlinjazax.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GESTURERECOGNIZERLINJAZAX_H -#define GESTURERECOGNIZERLINJAZAX_H - -#include -#include -#include -#include -#include - -#include "linjazaxgesture.h" - -struct Direction -{ - QString direction; - QPoint point; - - Direction(QString dir, const QPoint &pt) - : direction(dir), point(pt) { } - Direction() - : direction() { } - - inline bool isEmpty() const { return direction.isEmpty(); } - inline bool isNull() const { return direction.isEmpty(); } -}; -typedef QList DirectionList; - -class DirectionSimpleRecognizer -{ -public: - DirectionSimpleRecognizer(); - Direction addPosition(const QPoint &pos); - DirectionList getDirections() const; - void reset(); - -private: - QPoint lastPoint; - DirectionList directions; -}; - -class GestureRecognizerLinjaZax : public QGestureRecognizer -{ - Q_OBJECT -public: - GestureRecognizerLinjaZax(); - - QGestureRecognizer::Result filterEvent(const QEvent *event); - QGesture* getGesture(); - - void reset(); - -private: - void internalReset(); - - QPoint pressedPos; - QPoint lastPos; - QPoint currentPos; - bool mousePressed; - bool gestureFinished; - QString lastDirections; - QString currentDirection; - DirectionSimpleRecognizer simpleRecognizer; - LinjaZaxGesture::ZoomState zoomState; -}; - -#endif diff --git a/examples/gestures/collidingmice/images/cheese.jpg b/examples/gestures/collidingmice/images/cheese.jpg deleted file mode 100644 index dea5795..0000000 Binary files a/examples/gestures/collidingmice/images/cheese.jpg and /dev/null differ diff --git a/examples/gestures/collidingmice/linjazaxgesture.h b/examples/gestures/collidingmice/linjazaxgesture.h deleted file mode 100644 index 53b907e..0000000 --- a/examples/gestures/collidingmice/linjazaxgesture.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef LINJAZAXGESTURE_H -#define LINJAZAXGESTURE_H - -#include - -class LinjaZaxGesture : public QGesture -{ -public: - enum DirectionType - { - None = 0, - LeftDown = 1, - DownLeft = LeftDown, - Down = 2, - RightDown = 3, - DownRight = RightDown, - Left = 4, - Right = 6, - LeftUp = 7, - UpLeft = LeftUp, - Up = 8, - RightUp = 9, - UpRight = RightUp - }; - - enum ZoomState - { - NoZoom, - ZoomingIn, - ZoomingOut - }; - -public: - explicit LinjaZaxGesture(QObject *parent, - Qt::GestureState state = Qt::GestureStarted) - : QGesture(parent, QLatin1String("LinjaZax"), state), lastDirection_(None), - direction_(None), zoomState_(NoZoom) { } - LinjaZaxGesture(QObject *parent, const QPoint &startPos, - const QPoint &lastPos, const QPoint &pos, const QRect &rect, - const QPoint &hotSpot, const QDateTime &startTime, - uint duration, Qt::GestureState state) - : QGesture(parent, QLatin1String("LinjaZax"), startPos, lastPos, - pos, rect, hotSpot, startTime, duration, state) { } - ~LinjaZaxGesture() { } - - DirectionType lastDirection() const - { return lastDirection_; } - DirectionType direction() const - { return direction_; } - - ZoomState zoomState() const - { return zoomState_; } - -private: - DirectionType lastDirection_; - DirectionType direction_; - ZoomState zoomState_; - friend class GestureRecognizerLinjaZax; -}; - -#endif diff --git a/examples/gestures/collidingmice/main.cpp b/examples/gestures/collidingmice/main.cpp deleted file mode 100644 index 3638442..0000000 --- a/examples/gestures/collidingmice/main.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mouse.h" - -#include "gesturerecognizerlinjazax.h" -#include "linjazaxgesture.h" - -#include - -#include - -#define ZOOMING_ANIMATION -#ifdef ZOOMING_ANIMATION -static const int AnimationSteps = 10; -#endif - -static const int MouseCount = 7; - -class PannableGraphicsView : public QGraphicsView -{ - Q_OBJECT -public: - PannableGraphicsView(QGraphicsScene *scene, QWidget *parent = 0) - : QGraphicsView(scene, parent) - { - grabGesture(QLatin1String("LinjaZax")); -#ifdef ZOOMING_ANIMATION - timeline = new QTimeLine(700, this); - timeline->setFrameRange(0, AnimationSteps); - connect(timeline, SIGNAL(frameChanged(int)), this, SLOT(animationStep(int))); -#endif - } -protected: - bool event(QEvent *event) - { - if (event->type() == QEvent::Gesture) { - QGestureEvent *ge = static_cast(event); - const LinjaZaxGesture *g = static_cast(ge->gesture("LinjaZax")); - if (g) { - switch (g->zoomState()) { - case LinjaZaxGesture::ZoomingIn: -#ifdef ZOOMING_ANIMATION - scaleStep = 1. + 0.5/AnimationSteps; - timeline->stop(); - timeline->start(); -#else - scale(1.5, 1.5); -#endif - break; - case LinjaZaxGesture::ZoomingOut: -#ifdef ZOOMING_ANIMATION - scaleStep = 1. - 0.5/AnimationSteps; - timeline->stop(); - timeline->start(); -#else - scale(0.6, 0.6); -#endif - break; - default: - break; - }; - QPoint pt = g->pos() - g->lastPos(); - horizontalScrollBar()->setValue(horizontalScrollBar()->value() - pt.x()); - verticalScrollBar()->setValue(verticalScrollBar()->value() - pt.y()); - event->accept(); - return true; - } - } - return QGraphicsView::event(event); - } -private slots: -#ifdef ZOOMING_ANIMATION - void animationStep(int step) - { - scale(scaleStep, scaleStep); - } -private: - qreal scaleStep; - QTimeLine *timeline; -#endif -}; - -//! [0] -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - app.addGestureRecognizer(new GestureRecognizerLinjaZax); - qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); -//! [0] - -//! [1] - QGraphicsScene scene; - scene.setSceneRect(-600, -600, 1200, 1200); -//! [1] //! [2] - scene.setItemIndexMethod(QGraphicsScene::NoIndex); -//! [2] - -//! [3] - for (int i = 0; i < MouseCount; ++i) { - Mouse *mouse = new Mouse; - mouse->setPos(::sin((i * 6.28) / MouseCount) * 200, - ::cos((i * 6.28) / MouseCount) * 200); - scene.addItem(mouse); - } -//! [3] - -//! [4] - PannableGraphicsView view(&scene); - view.setRenderHint(QPainter::Antialiasing); - view.setBackgroundBrush(QPixmap(":/images/cheese.jpg")); -//! [4] //! [5] - view.setCacheMode(QGraphicsView::CacheBackground); - view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - //view.setDragMode(QGraphicsView::ScrollHandDrag); -//! [5] //! [6] - view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice")); - view.resize(400, 300); - view.show(); - - return app.exec(); -} -//! [6] - -#include "main.moc" diff --git a/examples/gestures/collidingmice/mice.qrc b/examples/gestures/collidingmice/mice.qrc deleted file mode 100644 index accdb4d..0000000 --- a/examples/gestures/collidingmice/mice.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - images/cheese.jpg - - diff --git a/examples/gestures/collidingmice/mouse.cpp b/examples/gestures/collidingmice/mouse.cpp deleted file mode 100644 index 256811a..0000000 --- a/examples/gestures/collidingmice/mouse.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mouse.h" - -#include -#include -#include - -#include - -static const double Pi = 3.14159265358979323846264338327950288419717; -static double TwoPi = 2.0 * Pi; - -static qreal normalizeAngle(qreal angle) -{ - while (angle < 0) - angle += TwoPi; - while (angle > TwoPi) - angle -= TwoPi; - return angle; -} - -//! [0] -Mouse::Mouse() - : angle(0), speed(0), mouseEyeDirection(0), - color(qrand() % 256, qrand() % 256, qrand() % 256) -{ - rotate(qrand() % (360 * 16)); - startTimer(1000 / 33); -} -//! [0] - -//! [1] -QRectF Mouse::boundingRect() const -{ - qreal adjust = 0.5; - return QRectF(-18 - adjust, -22 - adjust, - 36 + adjust, 60 + adjust); -} -//! [1] - -//! [2] -QPainterPath Mouse::shape() const -{ - QPainterPath path; - path.addRect(-10, -20, 20, 40); - return path; -} -//! [2] - -//! [3] -void Mouse::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) -{ - // Body - painter->setBrush(color); - painter->drawEllipse(-10, -20, 20, 40); - - // Eyes - painter->setBrush(Qt::white); - painter->drawEllipse(-10, -17, 8, 8); - painter->drawEllipse(2, -17, 8, 8); - - // Nose - painter->setBrush(Qt::black); - painter->drawEllipse(QRectF(-2, -22, 4, 4)); - - // Pupils - painter->drawEllipse(QRectF(-8.0 + mouseEyeDirection, -17, 4, 4)); - painter->drawEllipse(QRectF(4.0 + mouseEyeDirection, -17, 4, 4)); - - // Ears - painter->setBrush(scene()->collidingItems(this).isEmpty() ? Qt::darkYellow : Qt::red); - painter->drawEllipse(-17, -12, 16, 16); - painter->drawEllipse(1, -12, 16, 16); - - // Tail - QPainterPath path(QPointF(0, 20)); - path.cubicTo(-5, 22, -5, 22, 0, 25); - path.cubicTo(5, 27, 5, 32, 0, 30); - path.cubicTo(-5, 32, -5, 42, 0, 35); - painter->setBrush(Qt::NoBrush); - painter->drawPath(path); -} -//! [3] - -//! [4] -void Mouse::timerEvent(QTimerEvent *) -{ -//! [4] - // Don't move too far away -//! [5] - QLineF lineToCenter(QPointF(0, 0), mapFromScene(0, 0)); - if (lineToCenter.length() > 150) { - qreal angleToCenter = ::acos(lineToCenter.dx() / lineToCenter.length()); - if (lineToCenter.dy() < 0) - angleToCenter = TwoPi - angleToCenter; - angleToCenter = normalizeAngle((Pi - angleToCenter) + Pi / 2); - - if (angleToCenter < Pi && angleToCenter > Pi / 4) { - // Rotate left - angle += (angle < -Pi / 2) ? 0.25 : -0.25; - } else if (angleToCenter >= Pi && angleToCenter < (Pi + Pi / 2 + Pi / 4)) { - // Rotate right - angle += (angle < Pi / 2) ? 0.25 : -0.25; - } - } else if (::sin(angle) < 0) { - angle += 0.25; - } else if (::sin(angle) > 0) { - angle -= 0.25; -//! [5] //! [6] - } -//! [6] - - // Try not to crash with any other mice -//! [7] - QList dangerMice = scene()->items(QPolygonF() - << mapToScene(0, 0) - << mapToScene(-30, -50) - << mapToScene(30, -50)); - foreach (QGraphicsItem *item, dangerMice) { - if (item == this) - continue; - - QLineF lineToMouse(QPointF(0, 0), mapFromItem(item, 0, 0)); - qreal angleToMouse = ::acos(lineToMouse.dx() / lineToMouse.length()); - if (lineToMouse.dy() < 0) - angleToMouse = TwoPi - angleToMouse; - angleToMouse = normalizeAngle((Pi - angleToMouse) + Pi / 2); - - if (angleToMouse >= 0 && angleToMouse < Pi / 2) { - // Rotate right - angle += 0.5; - } else if (angleToMouse <= TwoPi && angleToMouse > (TwoPi - Pi / 2)) { - // Rotate left - angle -= 0.5; -//! [7] //! [8] - } -//! [8] //! [9] - } -//! [9] - - // Add some random movement -//! [10] - if (dangerMice.size() > 1 && (qrand() % 10) == 0) { - if (qrand() % 1) - angle += (qrand() % 100) / 500.0; - else - angle -= (qrand() % 100) / 500.0; - } -//! [10] - -//! [11] - speed += (-50 + qrand() % 100) / 100.0; - - qreal dx = ::sin(angle) * 10; - mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5; - - rotate(dx); - setPos(mapToParent(0, -(3 + sin(speed) * 3))); -} -//! [11] diff --git a/examples/gestures/collidingmice/mouse.h b/examples/gestures/collidingmice/mouse.h deleted file mode 100644 index 6c8486f..0000000 --- a/examples/gestures/collidingmice/mouse.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOUSE_H -#define MOUSE_H - -#include -#include - -//! [0] -class Mouse : public QObject, public QGraphicsItem -{ - Q_OBJECT - -public: - Mouse(); - - QRectF boundingRect() const; - QPainterPath shape() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - -protected: - void timerEvent(QTimerEvent *event); - -private: - qreal angle; - qreal speed; - qreal mouseEyeDirection; - QColor color; -}; -//! [0] - -#endif diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro index d0735ae..09cd56a 100644 --- a/examples/gestures/gestures.pro +++ b/examples/gestures/gestures.pro @@ -1,14 +1,7 @@ TEMPLATE = \ subdirs SUBDIRS = \ - imageviewer \ - graphicsview \ - collidingmice - -contains(QT_CONFIG, webkit) { - SUBDIRS += pannablewebview - contains(QT_CONFIG, svg):SUBDIRS += browser -} + imageviewer # install target.path = $$[QT_INSTALL_EXAMPLES]/gestures diff --git a/examples/gestures/graphicsview/graphicsview.pro b/examples/gestures/graphicsview/graphicsview.pro deleted file mode 100644 index 9cef564..0000000 --- a/examples/gestures/graphicsview/graphicsview.pro +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES = main.cpp - diff --git a/examples/gestures/graphicsview/main.cpp b/examples/gestures/graphicsview/main.cpp deleted file mode 100644 index 12f4e75..0000000 --- a/examples/gestures/graphicsview/main.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -class PannableGraphicsView : public QGraphicsView -{ -public: - PannableGraphicsView() - { - grabGesture(Qt::PanGesture); - } -protected: - bool event(QEvent *event) - { - if (event->type() == QEvent::Gesture) { - QGestureEvent *gestureEvent = static_cast(event); - if (const QGesture *g = gestureEvent->gesture(Qt::PanGesture)) { - QPoint pt = g->pos() - g->lastPos(); - horizontalScrollBar()->setValue(horizontalScrollBar()->value() - pt.x()); - verticalScrollBar()->setValue(verticalScrollBar()->value() - pt.y()); - event->accept(); - return true; - } - } - return QGraphicsView::event(event); - } -}; - -class ImageItem : public QGraphicsItem -{ -public: - ImageItem() - : colored(false) - { - grabGesture(Qt::DoubleTapGesture); - } - - QRectF boundingRect() const - { - return pixmap.isNull() ? QRectF(0, 0, 100, 100) - : QRectF(QPointF(0,0), QSizeF(pixmap.size())); - } - - void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*) - { - if (pixmap.isNull()) { - painter->setBrush(QBrush( colored ? Qt::green : Qt::white)); - painter->drawRect(0, 0, 100, 100); - painter->drawLine(0, 0, 100, 100); - painter->drawLine(0, 100, 100, 0); - return; - } - painter->drawPixmap(0, 0, pixmap); - } - - bool sceneEvent(QEvent *event) - { - if (event->type() == QEvent::GraphicsSceneGesture) { - QGraphicsSceneGestureEvent *gestureEvent = static_cast(event); - if (gestureEvent->gesture(Qt::DoubleTapGesture)) { - event->accept(); - colored = !colored; - update(); - return true; - } else { - qWarning("Item received unknown gesture"); - } - } - return QGraphicsItem::sceneEvent(event); - } - -private: - QPixmap pixmap; - bool colored; -}; - -class MainWidget : public QWidget -{ - Q_OBJECT - -public: - MainWidget(QWidget *parent = 0) - : QWidget(parent) - { - QVBoxLayout *l = new QVBoxLayout(this); - view = new PannableGraphicsView; - l->addWidget(view); - scene = new QGraphicsScene(0, 0, 1024, 768, view); - view->setScene(scene); - - ImageItem *item = new ImageItem; - scene->addItem(item); - item->setPos(scene->width()/3, scene->height()/3); - } - -signals: -public slots: -private: - QGraphicsView *view; - QGraphicsScene *scene; -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - MainWidget w; - w.show(); - return app.exec(); -} - -#include "main.moc" diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp index a4f3c9a..717bb09 100644 --- a/examples/gestures/imageviewer/imagewidget.cpp +++ b/examples/gestures/imageviewer/imagewidget.cpp @@ -46,6 +46,7 @@ ImageWidget::ImageWidget(QWidget *parent) : QWidget(parent) { + setAttribute(Qt::WA_AcceptTouchEvents); setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); @@ -61,9 +62,11 @@ ImageWidget::ImageWidget(QWidget *parent) horizontalOffset = 0; verticalOffset = 0; - grabGesture(Qt::DoubleTapGesture); - grabGesture(Qt::PanGesture); - grabGesture(Qt::TapAndHoldGesture); + panGesture = new QPanGesture(this); + connect(panGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered())); + + tapAndHoldGesture = new QTapAndHoldGesture(this); + connect(tapAndHoldGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered())); } void ImageWidget::paintEvent(QPaintEvent*) @@ -131,30 +134,33 @@ void ImageWidget::paintEvent(QPaintEvent*) p.restore(); } -bool ImageWidget::event(QEvent *event) +void ImageWidget::mousePressEvent(QMouseEvent *event) { - if (event->type() == QEvent::Gesture) { - gestureEvent(static_cast(event)); - return true; - } - return QWidget::event(event); + touchFeedback.tapped = true; + touchFeedback.position = event->pos(); +} + +void ImageWidget::mouseDoubleClickEvent(QMouseEvent *event) +{ + touchFeedback.doubleTapped = true; + const QPoint p = event->pos(); + touchFeedback.position = p; + horizontalOffset = p.x() - currentImage.width()*1.0*p.x()/width(); + verticalOffset = p.y() - currentImage.height()*1.0*p.y()/height(); + setZoomedIn(!zoomedIn); + zoomed = rotated = false; + updateImage(); + + feedbackFadeOutTimer.start(500, this); } -void ImageWidget::gestureEvent(QGestureEvent *event) +void ImageWidget::gestureTriggered() { + touchFeedback.tapped = false; touchFeedback.doubleTapped = false; - Q_ASSERT(event); - if (event->contains(Qt::TapGesture)) { - // - } else if (const QGesture *g = event->gesture(Qt::DoubleTapGesture)) { - touchFeedback.doubleTapped = true; - horizontalOffset = g->hotSpot().x() - currentImage.width()*1.0*g->hotSpot().x()/width(); - verticalOffset = g->hotSpot().y() - currentImage.height()*1.0*g->hotSpot().y()/height(); - setZoomedIn(!zoomedIn); - zoomed = rotated = false; - updateImage(); - } else if (const QGesture *g = event->gesture(Qt::PanGesture)) { + QGesture *g = qobject_cast(sender()); + if (sender() == panGesture) { if (zoomedIn) { // usual panning #ifndef QT_NO_CURSOR @@ -170,24 +176,22 @@ void ImageWidget::gestureEvent(QGestureEvent *event) update(); } else { // only slide gesture should be accepted - const QPanningGesture *pg = static_cast(g); - if (pg->direction() != pg->lastDirection()) { - // ###: event->cancel(); - } + const QPanGesture *pg = static_cast(g); if (g->state() == Qt::GestureFinished) { touchFeedback.sliding = false; zoomed = rotated = false; - if (pg->direction() == Qt::RightDirection) { + if (pg->totalOffset().width() > 0) { qDebug() << "slide right"; goNextImage(); - } else if (pg->direction() == Qt::LeftDirection) { + } else { qDebug() << "slide left"; goPrevImage(); } updateImage(); } } - } else if (const QGesture *g = event->gesture(Qt::TapAndHoldGesture)) { + feedbackFadeOutTimer.start(500, this); + } else if (sender() == tapAndHoldGesture) { if (g->state() == Qt::GestureFinished) { qDebug() << "tap and hold detected"; touchFeedback.reset(); @@ -197,13 +201,20 @@ void ImageWidget::gestureEvent(QGestureEvent *event) menu.addAction("Action 1"); menu.addAction("Action 2"); menu.addAction("Action 3"); - menu.exec(mapToGlobal(g->hotSpot())); + menu.exec(mapToGlobal(g->pos())); } - } else { - qDebug() << "unknown gesture"; + feedbackFadeOutTimer.start(500, this); } - feedbackFadeOutTimer.start(500, this); - event->accept(); +} + +void ImageWidget::gestureFinished() +{ + qDebug() << "gesture finished" << sender(); +} + +void ImageWidget::gestureCancelled() +{ + qDebug() << "gesture cancelled" << sender(); } void ImageWidget::resizeEvent(QResizeEvent*) @@ -345,3 +356,5 @@ void ImageWidget::timerEvent(QTimerEvent *event) } update(); } + +#include "moc_imagewidget.cpp" diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imageviewer/imagewidget.h index 7ec73a7..e12634d 100644 --- a/examples/gestures/imageviewer/imagewidget.h +++ b/examples/gestures/imageviewer/imagewidget.h @@ -50,17 +50,24 @@ class ImageWidget : public QWidget { + Q_OBJECT + public: ImageWidget(QWidget *parent = 0); void openDirectory(const QString &path); protected: - bool event(QEvent *event); void paintEvent(QPaintEvent*); - void gestureEvent(QGestureEvent *event); void resizeEvent(QResizeEvent*); void timerEvent(QTimerEvent*); + void mousePressEvent(QMouseEvent*); + void mouseDoubleClickEvent(QMouseEvent*); + +private slots: + void gestureTriggered(); + void gestureFinished(); + void gestureCancelled(); private: void updateImage(); @@ -71,6 +78,9 @@ private: void goPrevImage(); void goToImage(int index); + QPanGesture *panGesture; + QTapAndHoldGesture *tapAndHoldGesture; + QString path; QStringList files; int position; diff --git a/examples/gestures/pannablewebview/main.cpp b/examples/gestures/pannablewebview/main.cpp deleted file mode 100644 index 89c1fce..0000000 --- a/examples/gestures/pannablewebview/main.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -class PannableWebView : public QWebView -{ -public: - PannableWebView(QWidget *parent = 0) - : QWebView(parent) - { -#if 0 - QPushButton *btn = new QPushButton("Some test button", this); - btn->resize(300, 200); - btn->move(40, 300); -#endif - grabGesture(Qt::PanGesture); - } -protected: - bool event(QEvent *event) - { - if (event->type() == QEvent::Gesture) - { - QGestureEvent *ev = static_cast(event); - if (const QGesture *g = ev->gesture(Qt::PanGesture)) { - if (QWebFrame *frame = page()->mainFrame()) { - QPoint offset = g->pos() - g->lastPos(); - frame->setScrollPosition(frame->scrollPosition() - offset); - } - event->accept(); - } - return true; - } - return QWebView::event(event); - } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QGraphicsScene scene; - QGraphicsView w(&scene); - - QWebView *wv = new PannableWebView; - wv->resize(480, 800); - wv->setUrl(QUrl("http://www.trolltech.com")); - scene.addWidget(wv); - w.show(); - - return app.exec(); -} diff --git a/examples/gestures/pannablewebview/pannablewebview.pro b/examples/gestures/pannablewebview/pannablewebview.pro deleted file mode 100644 index 07d8f91..0000000 --- a/examples/gestures/pannablewebview/pannablewebview.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES += \ - main.cpp - -QT += webkit diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 0006026..e0584e5 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1562,18 +1562,6 @@ public: }; Q_DECLARE_FLAGS(TouchPointStates, TouchPointState) - enum GestureType - { - UnknownGesture, - TapGesture, - DoubleTapGesture, - TrippleTapGesture, - TapAndHoldGesture, - PanGesture, - PinchGesture - }; - - enum GestureState { NoGesture, @@ -1582,23 +1570,6 @@ public: GestureFinished = 3 }; - enum DirectionType - { - NoDirection = 0, - LeftDownDirection = 1, - DownLeftDirection = LeftDownDirection, - DownDirection = 2, - RightDownDirection = 3, - DownRightDirection = RightDownDirection, - LeftDirection = 4, - RightDirection = 6, - LeftUpDirection = 7, - UpLeftDirection = LeftUpDirection, - UpDirection = 8, - RightUpDirection = 9, - UpRightDirection = RightUpDirection - }; - } #ifdef Q_MOC_RUN ; diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 504ae84..c636716 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -225,8 +225,6 @@ QT_BEGIN_NAMESPACE \value TouchBegin Beginning of a sequence of touch-screen and/or track-pad events (QTouchEvent) \value TouchUpdate Touch-screen event (QTouchEvent) \value TouchEnd End of touch-event sequence (QTouchEvent) - \value Gesture A gesture has occured. - \value GraphicsSceneGesture A gesture has occured on a graphics scene. User events should have values between \c User and \c{MaxUser}: @@ -271,6 +269,7 @@ QT_BEGIN_NAMESPACE \omitvalue CocoaRequestModal \omitvalue Wrapped \omitvalue Signal + \omitvalue WinGesture */ /*! diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 4929c51..1d86f47 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -276,8 +276,7 @@ public: TouchUpdate = 195, TouchEnd = 196, - Gesture = 197, - GraphicsSceneGesture = 198, + WinGesture = 197, // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2223f5d..c82c2e5 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -574,7 +574,6 @@ #include #include #include -#include #ifdef Q_WS_X11 #include @@ -615,8 +614,6 @@ public: }; Q_GLOBAL_STATIC(QGraphicsItemCustomDataStore, qt_dataStore) -QString qt_getStandardGestureTypeName(Qt::GestureType type); - /*! \internal @@ -1131,7 +1128,6 @@ QGraphicsItem::~QGraphicsItem() { d_ptr->inDestructor = 1; d_ptr->removeExtraItemCache(); - d_ptr->removeExtraGestures(); clearFocus(); if (!d_ptr->children.isEmpty()) { @@ -6251,104 +6247,6 @@ QVariant QGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const } /*! - \since 4.6 - - Subscribes the graphics item to the specified \a gesture type. - - Returns the id of the gesture. - - \sa releaseGesture(), setGestureEnabled() -*/ -int QGraphicsItem::grabGesture(Qt::GestureType gesture) -{ - /// TODO: if we are QGraphicsProxyWidget we should subscribe the widget to gesture as well. - return grabGesture(qt_getStandardGestureTypeName(gesture)); -} - -/*! - \since 4.6 - - Subscribes the graphics item to the specified \a gesture type. - - Returns the id of the gesture. - - \sa releaseGesture(), setGestureEnabled() -*/ -int QGraphicsItem::grabGesture(const QString &gesture) -{ - int id = QGestureManager::instance()->makeGestureId(gesture); - d_ptr->grabGesture(id); - return id; -} - -void QGraphicsItemPrivate::grabGesture(int id) -{ - Q_Q(QGraphicsItem); - extraGestures()->gestures << id; - if (scene) - scene->d_func()->grabGesture(q, id); -} - -bool QGraphicsItemPrivate::releaseGesture(int id) -{ - Q_Q(QGraphicsItem); - QGestureExtraData *extra = maybeExtraGestures(); - if (extra && extra->gestures.contains(id)) { - if (scene) - scene->d_func()->releaseGesture(q, id); - extra->gestures.remove(id); - return true; - } - return false; -} - -/*! - \since 4.6 - - Unsubscribes the graphics item from a gesture, which is specified - by the \a gestureId. - - \sa grabGesture(), setGestureEnabled() -*/ -void QGraphicsItem::releaseGesture(int gestureId) -{ - /// TODO: if we are QGraphicsProxyWidget we should unsubscribe the widget from gesture as well. - if (d_ptr->releaseGesture(gestureId)) - QGestureManager::instance()->releaseGestureId(gestureId); -} - -/*! - \since 4.6 - - If \a enable is true, the gesture with the given \a gestureId is - enabled; otherwise the gesture is disabled. - - The id of the gesture is returned by the grabGesture(). - - \sa grabGesture(), releaseGesture() -*/ -void QGraphicsItem::setGestureEnabled(int gestureId, bool enable) -{ - Q_UNUSED(gestureId); - Q_UNUSED(enable); - //### -} - -bool QGraphicsItemPrivate::hasGesture(const QString &name) const -{ - if (QGestureExtraData *extra = maybeExtraGestures()) { - QGestureManager *gm = QGestureManager::instance(); - QSet::const_iterator it = extra->gestures.begin(), - e = extra->gestures.end(); - for (; it != e; ++it) { - if (gm->gestureNameFromId(*it) == name) - return true; - } - } - return false; -} - -/*! This virtual function is called by QGraphicsItem to notify custom items that some part of the item's state changes. By reimplementing this function, your can react to a change, and in some cases, (depending on \a @@ -6372,23 +6270,6 @@ bool QGraphicsItemPrivate::hasGesture(const QString &name) const QVariant QGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value) { Q_UNUSED(change); - if (change == QGraphicsItem::ItemSceneChange) { - QGestureExtraData *extra = d_ptr->maybeExtraGestures(); - if (!qVariantValue(value) && extra) { - // the item has been removed from a scene, unsubscribe gestures. - Q_ASSERT(d_ptr->scene); - foreach(int id, extra->gestures) - d_ptr->scene->d_func()->releaseGesture(this, id); - } - } else if (change == QGraphicsItem::ItemSceneHasChanged) { - QGraphicsScene *scene = qVariantValue(value); - QGestureExtraData *extra = d_ptr->maybeExtraGestures(); - if (scene && extra) { - // item has been added to the scene - foreach(int id, extra->gestures) - scene->d_func()->grabGesture(this, id); - } - } return value; } diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 3a3d1a1..b0571c2 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -379,11 +379,6 @@ public: QVariant data(int key) const; void setData(int key, const QVariant &value); - int grabGesture(Qt::GestureType gesture); - int grabGesture(const QString &gesture); - void releaseGesture(int gestureId); - void setGestureEnabled(int gestureId, bool enable = true); - enum { Type = 1, UserType = 65536 diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index a0d061b..a977e1e 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -93,12 +93,6 @@ public: void purge(); }; -class QGestureExtraData -{ -public: - QSet gestures; -}; - class Q_AUTOTEST_EXPORT QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QGraphicsItem) @@ -108,8 +102,7 @@ public: ExtraCursor, ExtraCacheData, ExtraMaxDeviceCoordCacheSize, - ExtraBoundingRegionGranularity, - ExtraGestures + ExtraBoundingRegionGranularity }; enum AncestorFlag { @@ -394,30 +387,6 @@ public: int index; int depth; - inline QGestureExtraData* extraGestures() const - { - QGestureExtraData *c = (QGestureExtraData *)qVariantValue(extra(ExtraGestures)); - if (!c) { - QGraphicsItemPrivate *that = const_cast(this); - c = new QGestureExtraData; - that->setExtra(ExtraGestures, qVariantFromValue(c)); - } - return c; - } - QGestureExtraData* maybeExtraGestures() const - { - return (QGestureExtraData *)qVariantValue(extra(ExtraGestures)); - } - inline void removeExtraGestures() - { - QGestureExtraData *c = (QGestureExtraData *)qVariantValue(extra(ExtraGestures)); - delete c; - unsetExtra(ExtraGestures); - } - bool hasGesture(const QString &gesture) const; - void grabGesture(int id); - bool releaseGesture(int id); - // Packed 32 bytes quint32 acceptedMouseButtons : 5; quint32 visible : 1; diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index f081222..0b421ad 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -48,7 +48,6 @@ #include "private/qgraphicsproxywidget_p.h" #include "private/qwidget_p.h" #include "private/qapplication_p.h" -#include "private/qgesturemanager_p.h" #include #include @@ -649,9 +648,6 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto q->setAttribute(Qt::WA_OpaquePaintEvent); widget = newWidget; - foreach(int gestureId, widget->d_func()->gestures) { - grabGesture(gestureId); - } // Changes only go from the widget to the proxy. enabledChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; @@ -875,15 +871,6 @@ bool QGraphicsProxyWidget::event(QEvent *event) } break; } - case QEvent::GraphicsSceneGesture: { - qDebug() << "QGraphicsProxyWidget: graphicsscenegesture"; - if (d->widget && d->widget->isVisible()) { - //### TODO: widget->childAt(): decompose gesture event and find widget under hotspots. - //QGestureManager::instance()->sendGestureEvent(d->widget, ge->gestures().toSet(), ge->cancelledGestures()); - return true; - } - break; - } default: break; } diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index e50ee94..c3f72e6 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -247,8 +247,6 @@ #ifdef Q_WS_X11 #include #endif -#include -#include QT_BEGIN_NAMESPACE @@ -4018,47 +4016,6 @@ bool QGraphicsScene::event(QEvent *event) // geometries that do not have an explicit style set. update(); break; - case QEvent::GraphicsSceneGesture: { - QGraphicsSceneGestureEvent *ev = static_cast(event); - QGraphicsView *view = qobject_cast(ev->widget()); - if (!view) { - qWarning("QGraphicsScene::event: gesture event was received without a view"); - break; - } - - // get a list of gestures that just started. - QSet startedGestures; - QList gestures = ev->gestures(); - for(QList::const_iterator it = gestures.begin(), e = gestures.end(); - it != e; ++it) { - QGesture *g = *it; - QGesturePrivate *gd = g->d_func(); - if (g->state() == Qt::GestureStarted || gd->singleshot) { - startedGestures.insert(g); - } - } - if (!startedGestures.isEmpty()) { - // find a target for each started gesture. - for(QSet::const_iterator it = startedGestures.begin(), e = startedGestures.end(); - it != e; ++it) { - QGesture *g = *it; - QGesturePrivate *gd = g->d_func(); - gd->graphicsItem = 0; - QList itemsInGestureArea = items(g->hotSpot()); - const QString gestureName = g->type(); - foreach(QGraphicsItem *item, itemsInGestureArea) { - if (item->d_func()->hasGesture(gestureName)) { - Q_ASSERT(gd->graphicsItem == 0); - gd->graphicsItem = item; - d->itemsWithGestures[item].insert(g); - break; - } - } - } - } - d->sendGestureEvent(ev->gestures().toSet(), ev->cancelledGestures()); - } - break; case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: @@ -4080,69 +4037,6 @@ bool QGraphicsScene::event(QEvent *event) return true; } -void QGraphicsScenePrivate::sendGestureEvent(const QSet &gestures, const QSet &cancelled) -{ - Q_Q(QGraphicsScene); - typedef QMap > ItemGesturesMap; - ItemGesturesMap itemGestures; - QSet startedGestures; - for(QSet::const_iterator it = gestures.begin(), e = gestures.end(); - it != e; ++it) { - QGesture *g = *it; - Q_ASSERT(g != 0); - QGesturePrivate *gd = g->d_func(); - if (gd->graphicsItem != 0) { - itemGestures[gd->graphicsItem].insert(g); - if (g->state() == Qt::GestureStarted || gd->singleshot) - startedGestures.insert(g); - } - } - - QSet ignoredGestures; - for(ItemGesturesMap::const_iterator it = itemGestures.begin(), e = itemGestures.end(); - it != e; ++it) { - QGraphicsItem *receiver = it.key(); - Q_ASSERT(receiver != 0); - QGraphicsSceneGestureEvent event; - event.setGestures(it.value()); - event.setCancelledGestures(cancelled); - bool processed = sendEvent(receiver, &event); - QSet started = startedGestures.intersect(it.value()); - if (event.isAccepted()) - foreach(QGesture *g, started) - g->accept(); - if (!started.isEmpty() && !(processed && event.isAccepted())) { - // there are started gestures event that weren't - // accepted, so propagating each gesture independently. - QSet::const_iterator it = started.begin(), - e = started.end(); - for(; it != e; ++it) { - QGesture *g = *it; - if (processed && g->isAccepted()) { - continue; - } - QGesturePrivate *gd = g->d_func(); - gd->graphicsItem = 0; - - //### THIS IS BS, DONT FORGET TO REWRITE THIS CODE - // need to make sure we try to deliver event just once to each widget - const QString gestureType = g->type(); - QList itemsUnderGesture = q->items(g->hotSpot()); - for (int i = 0; i < itemsUnderGesture.size(); ++i) { - QGraphicsItem *item = itemsUnderGesture.at(i); - if (item != receiver && item->d_func()->hasGesture(gestureType)) { - ignoredGestures.insert(g); - gd->graphicsItem = item; - break; - } - } - } - } - } - if (!ignoredGestures.isEmpty()) - sendGestureEvent(ignoredGestures, cancelled); -} - /*! \reimp @@ -6018,32 +5912,11 @@ bool QGraphicsScene::sendEvent(QGraphicsItem *item, QEvent *event) void QGraphicsScenePrivate::addView(QGraphicsView *view) { views << view; - foreach(int gestureId, grabbedGestures) - view->d_func()->grabGesture(gestureId); } void QGraphicsScenePrivate::removeView(QGraphicsView *view) { views.removeAll(view); - foreach(int gestureId, grabbedGestures) - view->releaseGesture(gestureId); -} - -void QGraphicsScenePrivate::grabGesture(QGraphicsItem *item, int gestureId) -{ - if (!grabbedGestures.contains(gestureId)) { - foreach(QGraphicsView *view, views) - view->d_func()->grabGesture(gestureId); - } - (void)itemsWithGestures[item]; - grabbedGestures << gestureId; -} - -void QGraphicsScenePrivate::releaseGesture(QGraphicsItem *item, int gestureId) -{ - Q_UNUSED(gestureId); - itemsWithGestures.remove(item); - //### } void QGraphicsScenePrivate::updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent) diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index c8b147f..6aaeb91 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -79,7 +79,6 @@ class QGraphicsSceneHelpEvent; class QGraphicsSceneHoverEvent; class QGraphicsSceneMouseEvent; class QGraphicsSceneWheelEvent; -class QGraphicsSceneGestureEvent; class QGraphicsSimpleTextItem; class QGraphicsTextItem; class QGraphicsView; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 3c3a811..d2d603a 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -78,7 +78,6 @@ QT_BEGIN_NAMESPACE class QGraphicsView; class QGraphicsWidget; -class QGesture; class QGraphicsScenePrivate : public QObjectPrivate { @@ -309,13 +308,6 @@ public: QStyleOptionGraphicsItem styleOptionTmp; - // items with gestures -> list of started gestures. - QMap > itemsWithGestures; - QSet grabbedGestures; - void grabGesture(QGraphicsItem *item, int gestureId); - void releaseGesture(QGraphicsItem *item, int gestureId); - void sendGestureEvent(const QSet &gestures, const QSet &cancelled); - QMap sceneCurrentTouchPoints; QMap itemForTouchPointId; static void updateTouchPointsForItem(QGraphicsItem *item, QTouchEvent *touchEvent); diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index 27a2d7e..53019f2 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -275,8 +275,6 @@ QT_BEGIN_NAMESPACE -QString qt_getStandardGestureTypeName(Qt::GestureType type); - class QGraphicsSceneEventPrivate { public: @@ -1679,253 +1677,6 @@ void QGraphicsSceneMoveEvent::setNewPos(const QPointF &pos) d->newPos = pos; } -/*! - \class QGraphicsSceneGestureEvent - \brief The QGraphicsSceneGestureEvent class provides gesture events for - the graphics view framework. - \since 4.6 - \ingroup multimedia - \ingroup graphicsview-api - - QGraphicsSceneGestureEvent extends information provided by - QGestureEvent by adding some convenience functions like - \l{QGraphicsSceneEvent::}{widget()} to get a widget that received - original gesture event, and convenience functions mapToScene(), - mapToItem() for converting positions of the gesture into - QGraphicsScene and QGraphicsItem coordinate system respectively. - - The scene sends the event to the first QGraphicsItem under the - mouse cursor that accepts gestures; a graphics item is set to accept - gestures with \l{QGraphicsItem::}{grabGesture()}. - - \sa QGestureEvent -*/ - -/*! - Constructs a QGraphicsSceneGestureEvent. -*/ -QGraphicsSceneGestureEvent::QGraphicsSceneGestureEvent() - : QGraphicsSceneEvent(QEvent::GraphicsSceneGesture) -{ - setAccepted(false); -} - -/*! - Destroys a QGraphicsSceneGestureEvent. -*/ -QGraphicsSceneGestureEvent::~QGraphicsSceneGestureEvent() -{ -} - -/*! - Returns true if the gesture event contains gesture of specific \a - type; returns false otherwise. -*/ -bool QGraphicsSceneGestureEvent::contains(const QString &type) const -{ - return gesture(type) != 0; -} - -/*! - Returns true if the gesture event contains gesture of specific \a - type; returns false otherwise. -*/ -bool QGraphicsSceneGestureEvent::contains(Qt::GestureType type) const -{ - return contains(qt_getStandardGestureTypeName(type)); -} - -/*! - Returns a list of gesture names that this event contains. -*/ -QList QGraphicsSceneGestureEvent::gestureTypes() const -{ - return m_gestures.keys(); -} - -/*! - Returns extended information about a gesture of specific \a type. -*/ -const QGesture* QGraphicsSceneGestureEvent::gesture(const QString &type) const -{ - return m_gestures.value(type, 0); -} - -/*! - Returns extended information about a gesture of specific \a type. -*/ -const QGesture* QGraphicsSceneGestureEvent::gesture(Qt::GestureType type) const -{ - return gesture(qt_getStandardGestureTypeName(type)); -} - -/*! - Returns extended information about all gestures in the event. -*/ -QList QGraphicsSceneGestureEvent::gestures() const -{ - return m_gestures.values(); -} - -/*! - Returns a set of gesture names that used to be executed, but were - cancelled (i.e. they were not finished properly). -*/ -QSet QGraphicsSceneGestureEvent::cancelledGestures() const -{ - return m_cancelledGestures; -} - -/*! - Sets a list of gesture names \a cancelledGestures that used to be - executed, but were cancelled (i.e. they were not finished - properly). -*/ -void QGraphicsSceneGestureEvent::setCancelledGestures(const QSet &cancelledGestures) -{ - m_cancelledGestures = cancelledGestures; -} - -/*! - Maps the point \a point, which is in a view coordinate system, to - scene coordinate system, and returns the mapped coordinate. - - A \a point is in coordinate system of the widget that received - gesture event. - - \sa mapToItem(), {The Graphics View Coordinate System} -*/ -QPointF QGraphicsSceneGestureEvent::mapToScene(const QPoint &point) const -{ - if (QGraphicsView *view = qobject_cast(widget())) - return view->mapToScene(point); - return QPointF(); -} - -/*! - Maps the rectangular \a rect, which is in a view coordinate system, to - scene coordinate system, and returns the mapped coordinate. - - A \a rect is in coordinate system of the widget that received - gesture event. - - \sa mapToItem(), {The Graphics View Coordinate System} -*/ -QPolygonF QGraphicsSceneGestureEvent::mapToScene(const QRect &rect) const -{ - if (QGraphicsView *view = qobject_cast(widget())) - return view->mapToScene(rect); - return QPolygonF(); -} - -/*! - Maps the point \a point, which is in a view coordinate system, to - item's \a item coordinate system, and returns the mapped coordinate. - - If \a item is 0, this function returns the same as mapToScene(). - - \sa mapToScene(), {The Graphics View Coordinate System} -*/ -QPointF QGraphicsSceneGestureEvent::mapToItem(const QPoint &point, QGraphicsItem *item) const -{ - if (item) { - if (QGraphicsView *view = qobject_cast(widget())) - return item->mapFromScene(view->mapToScene(point)); - } else { - return mapToScene(point); - } - return QPointF(); -} - -/*! - Maps the rectangualar \a rect, which is in a view coordinate system, to - item's \a item coordinate system, and returns the mapped coordinate. - - If \a item is 0, this function returns the same as mapToScene(). - - \sa mapToScene(), {The Graphics View Coordinate System} -*/ -QPolygonF QGraphicsSceneGestureEvent::mapToItem(const QRect &rect, QGraphicsItem *item) const -{ - if (item) { - if (QGraphicsView *view = qobject_cast(widget())) - return item->mapFromScene(view->mapToScene(rect)); - } else { - return mapToScene(rect); - } - return QPolygonF(); -} - -/*! - Set a list of gesture objects containing extended information about \a gestures. -*/ -void QGraphicsSceneGestureEvent::setGestures(const QList &gestures) -{ - foreach(QGesture *g, gestures) - m_gestures.insert(g->type(), g); -} - -/*! - Set a list of gesture objects containing extended information about \a gestures. -*/ -void QGraphicsSceneGestureEvent::setGestures(const QSet &gestures) -{ - foreach(QGesture *g, gestures) - m_gestures.insert(g->type(), g); -} - -/*! - Sets the accept flag of the all gestures for the event object. - This is the equivalent of calling \l{QEvent::accept()} {accept()} - or \l{QEvent::setAccepted()}{setAccepted(true)}. - - Setting the accept flag indicates that the event receiver wants - the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGraphicsSceneGestureEvent::acceptAll() -{ - QHash::iterator it = m_gestures.begin(), - e = m_gestures.end(); - for(; it != e; ++it) - it.value()->accept(); - setAccepted(true); -} - -/*! \fn void QGraphicsSceneGestureEvent::accept() - Calls QEvent::accept(). -*/ - -/*! - Sets the accept flag of the gesture specified by \a type. This is - equivalent to calling \l{QGestureEvent::gesture()} {gesture(type)}-> - \l{QGesture::accept()}{accept()} - - Setting the accept flag indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGraphicsSceneGestureEvent::accept(Qt::GestureType type) -{ - if (QGesture *g = m_gestures.value(qt_getStandardGestureTypeName(type), 0)) - g->accept(); -} - -/*! - - Sets the accept flag of the gesture specified by \a type. This is - equivalent to calling \l{QGestureEvent::gesture()} {gesture(type)}-> - \l{QGesture::accept()}{accept()} - - Setting the accept flag indicates that the event receiver wants the - gesture. Unwanted gestures might be propagated to the parent widget. -*/ -void QGraphicsSceneGestureEvent::accept(const QString &type) -{ - if (QGesture *g = m_gestures.value(type, 0)) - g->accept(); -} - QT_END_NAMESPACE #endif // QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index 8a30bb8..b38e757 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -306,49 +306,6 @@ public: void setNewPos(const QPointF &pos); }; -class QGesture; -class QGraphicsItem; -class QGraphicsSceneGestureEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneGestureEvent : public QGraphicsSceneEvent -{ - Q_DECLARE_PRIVATE(QGraphicsSceneGestureEvent) -public: - QGraphicsSceneGestureEvent(); - ~QGraphicsSceneGestureEvent(); - - bool contains(const QString &type) const; - bool contains(Qt::GestureType type) const; - - QList gestureTypes() const; - - const QGesture* gesture(Qt::GestureType type) const; - const QGesture* gesture(const QString &type) const; - QList gestures() const; - void setGestures(const QList &gestures); - void setGestures(const QSet &gestures); - - QSet cancelledGestures() const; - void setCancelledGestures(const QSet &cancelledGestures); - - void acceptAll(); -#ifndef Q_NO_USING_KEYWORD - using QEvent::accept; -#else - inline void accept() { QEvent::accept(); } -#endif - void accept(Qt::GestureType type); - void accept(const QString &type); - - QPointF mapToScene(const QPoint &point) const; - QPolygonF mapToScene(const QRect &rect) const; - QPointF mapToItem(const QPoint &point, QGraphicsItem *item) const; - QPolygonF mapToItem(const QRect &rect, QGraphicsItem *item) const; - -protected: - QHash m_gestures; - QSet m_cancelledGestures; -}; - #endif // QT_NO_GRAPHICSVIEW QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index a2adf82..56a69f7 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2658,9 +2658,6 @@ bool QGraphicsView::event(QEvent *event) } } break; - case QEvent::Gesture: - viewportEvent(event); - return true; default: break; } @@ -2742,17 +2739,6 @@ bool QGraphicsView::viewportEvent(QEvent *event) d->scene->d_func()->updateAll = false; } break; - case QEvent::Gesture: { - QGraphicsSceneGestureEvent gestureEvent; - gestureEvent.setWidget(this); - QGestureEvent *ev = static_cast(event); - gestureEvent.setGestures(ev->gestures()); - gestureEvent.setCancelledGestures(ev->cancelledGestures()); - QApplication::sendEvent(d->scene, &gestureEvent); - event->setAccepted(gestureEvent.isAccepted()); - return true; - } - break; case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 2917592..e6eff6e 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -44,12 +44,8 @@ HEADERS += \ kernel/qkeymapper_p.h \ kernel/qgesture.h \ kernel/qgesture_p.h \ - kernel/qgesturemanager_p.h \ - kernel/qgesturerecognizer_p.h \ - kernel/qgesturerecognizer.h \ - kernel/qgesturestandardrecognizers_p.h \ - kernel/qdirectionrecognizer_p.h \ - kernel/qdirectionsimplificator_p.h + kernel/qstandardgestures.h \ + kernel/qstandardgestures_p.h SOURCES += \ kernel/qaction.cpp \ @@ -80,10 +76,7 @@ SOURCES += \ kernel/qwidgetaction.cpp \ kernel/qkeymapper.cpp \ kernel/qgesture.cpp \ - kernel/qgesturemanager.cpp \ - kernel/qgesturerecognizer.cpp \ - kernel/qgesturestandardrecognizers.cpp \ - kernel/qdirectionrecognizer.cpp + kernel/qstandardgestures.cpp win32 { DEFINES += QT_NO_DIRECTDRAW diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index a7b7a0a..0e8978f 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -90,8 +90,6 @@ #include "qapplication.h" -#include - #ifdef Q_WS_WINCE #include "qdatetime.h" #include "qguifunctions_wince.h" @@ -137,14 +135,6 @@ int QApplicationPrivate::autoMaximizeThreshold = -1; bool QApplicationPrivate::autoSipEnabled = false; #endif -QGestureManager* QGestureManager::instance() -{ - QApplicationPrivate *d = qApp->d_func(); - if (!d->gestureManager) - d->gestureManager = new QGestureManager(qApp); - return d->gestureManager; -} - QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type) : QCoreApplicationPrivate(argc, argv) { @@ -168,8 +158,6 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T directPainters = 0; #endif - gestureManager = 0; - if (!self) self = this; } @@ -3595,14 +3583,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT } - if (!d->grabbedGestures.isEmpty() && e->spontaneous() && receiver->isWidgetType()) { - const QEvent::Type t = e->type(); - if (t != QEvent::Gesture && t != QEvent::GraphicsSceneGesture) { - if (QGestureManager::instance()->filterEvent(static_cast(receiver), e)) - return true; - } - } - // User input and window activation makes tooltips sleep switch (e->type()) { case QEvent::Wheel: @@ -4061,6 +4041,19 @@ bool QApplication::notify(QObject *receiver, QEvent *e) touchEvent->setAccepted(eventAccepted); break; } + case QEvent::WinGesture: + { + // only propagate the first gesture event (after the GID_BEGIN) + QWidget *w = static_cast(receiver); + while (w) { + e->ignore(); + res = d->notify_helper(w, e); + if ((res && e->isAccepted()) || w->isWindow()) + break; + w = w->parentWidget(); + } + break; + } default: res = d->notify_helper(receiver, e); break; @@ -5057,57 +5050,6 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy) return true; } -/*! - \since 4.6 - - Adds custom gesture \a recognizer object. - - Qt takes ownership of the provided \a recognizer. - - \sa QGestureEvent -*/ -void QApplication::addGestureRecognizer(QGestureRecognizer *recognizer) -{ - QGestureManager::instance()->addRecognizer(recognizer); -} - -/*! - \since 4.6 - - Removes custom gesture \a recognizer object. - - \sa QGestureEvent -*/ -void QApplication::removeGestureRecognizer(QGestureRecognizer *recognizer) -{ - Q_D(QApplication); - if (!d->gestureManager) - return; - d->gestureManager->removeRecognizer(recognizer); -} - -/*! - \property QApplication::eventDeliveryDelayForGestures - \since 4.6 - - Specifies the \a delay before input events are delivered to the - gesture enabled widgets. - - The delay allows to postpone widget's input event handling until - gestures framework can successfully recognize a gesture. - - \sa QWidget::grabGesture() -*/ -void QApplication::setEventDeliveryDelayForGestures(int delay) -{ - QGestureManager::instance()->setEventDeliveryDelay(delay); -} - -int QApplication::eventDeliveryDelayForGestures() -{ - return QGestureManager::instance()->eventDeliveryDelay(); -} - /*! \fn QDecoration &QApplication::qwsDecoration() Return the QWSDecoration used for decorating windows. diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 954f824..19ae085 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -71,7 +71,6 @@ class QStyle; class QEventLoop; class QIcon; class QInputContext; -class QGestureRecognizer; template class QList; class QLocale; #if defined(Q_WS_QWS) @@ -107,7 +106,6 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold) Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled) #endif - Q_PROPERTY(int eventDeliveryDelayForGestures READ eventDeliveryDelayForGestures WRITE setEventDeliveryDelayForGestures) public: enum Type { Tty, GuiClient, GuiServer }; @@ -268,12 +266,6 @@ public: static bool keypadNavigationEnabled(); #endif - void addGestureRecognizer(QGestureRecognizer *recognizer); - void removeGestureRecognizer(QGestureRecognizer *recognizer); - - void setEventDeliveryDelayForGestures(int delay); - int eventDeliveryDelayForGestures(); - Q_SIGNALS: void lastWindowClosed(); void focusChanged(QWidget *old, QWidget *now); @@ -382,7 +374,6 @@ private: friend class QDirectPainter; friend class QDirectPainterPrivate; #endif - friend class QGestureManager; #if defined(Q_WS_WIN) friend QApplicationPrivate* getQApplicationPrivateInternal(); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 4b2bf15..db77b07 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -193,7 +193,109 @@ extern "C" { typedef BOOL (WINAPI *qt_RegisterTouchWindowPtr)(HWND, ULONG); typedef BOOL (WINAPI *qt_GetTouchInputInfoPtr)(HANDLE, UINT, PVOID, int); typedef BOOL (WINAPI *qt_CloseTouchInputHandlePtr)(HANDLE); -#endif + +#ifndef WM_GESTURE + +#define WM_GESTURE 0x0119 +#define WM_GESTURE_NOTIFY 0x011A + +DECLARE_HANDLE(HGESTUREINFO); + +#define GF_BEGIN 0x00000001 +#define GF_INERTIA 0x00000002 +#define GF_END 0x00000004 + +/* + * Gesture IDs + */ +#define GID_BEGIN 1 +#define GID_END 2 +#define GID_ZOOM 3 +#define GID_PAN 4 +#define GID_ROTATE 5 +#define GID_TWOFINGERTAP 6 +#define GID_ROLLOVER 7 + +typedef struct tagGESTUREINFO { + UINT cbSize; // size, in bytes, of this structure (including variable length Args field) + DWORD dwFlags; // see GF_* flags + DWORD dwID; // gesture ID, see GID_* defines + HWND hwndTarget; // handle to window targeted by this gesture + POINTS ptsLocation; // current location of this gesture + DWORD dwInstanceID; // internally used + DWORD dwSequenceID; // internally used + ULONGLONG ullArguments; // arguments for gestures whose arguments fit in 8 BYTES + UINT cbExtraArgs; // size, in bytes, of extra arguments, if any, that accompany this gesture +} GESTUREINFO, *PGESTUREINFO; +typedef GESTUREINFO const * PCGESTUREINFO; + +typedef struct tagGESTURENOTIFYSTRUCT { + UINT cbSize; // size, in bytes, of this structure + DWORD dwFlags; // unused + HWND hwndTarget; // handle to window targeted by the gesture + POINTS ptsLocation; // starting location + DWORD dwInstanceID; // internally used +} GESTURENOTIFYSTRUCT, *PGESTURENOTIFYSTRUCT; + +/* + * Gesture argument helpers + * - Angle should be a double in the range of -2pi to +2pi + * - Argument should be an unsigned 16-bit value + */ +#define GID_ROTATE_ANGLE_TO_ARGUMENT(_arg_) ((USHORT)((((_arg_) + 2.0 * 3.14159265) / (4.0 * 3.14159265)) * 65535.0)) +#define GID_ROTATE_ANGLE_FROM_ARGUMENT(_arg_) ((((double)(_arg_) / 65535.0) * 4.0 * 3.14159265) - 2.0 * 3.14159265) + +typedef struct tagGESTURECONFIG { + DWORD dwID; // gesture ID + DWORD dwWant; // settings related to gesture ID that are to be turned on + DWORD dwBlock; // settings related to gesture ID that are to be turned off +} GESTURECONFIG, *PGESTURECONFIG; + +#define GC_ALLGESTURES 0x00000001 +#define GC_ZOOM 0x00000001 +#define GC_PAN 0x00000001 +#define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002 +#define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004 +#define GC_PAN_WITH_GUTTER 0x00000008 +#define GC_PAN_WITH_INERTIA 0x00000010 +#define GC_ROTATE 0x00000001 +#define GC_TWOFINGERTAP 0x00000001 +#define GC_ROLLOVER 0x00000001 +#define GESTURECONFIGMAXCOUNT 256 // Maximum number of gestures that can be included + // in a single call to SetGestureConfig / GetGestureConfig + + + +#define GCF_INCLUDE_ANCESTORS 0x00000001 // If specified, GetGestureConfig returns consolidated configuration + // for the specified window and it's parent window chain + +typedef BOOL (*PtrGetGestureInfo)(HGESTUREINFO hGestureInfo, PGESTUREINFO pGestureInfo); +typedef BOOL (*PtrGetGestureExtraArgs)(HGESTUREINFO hGestureInfo, UINT cbExtraArgs, PBYTE pExtraArgs); +typedef BOOL (*PtrCloseGestureInfoHandle)(HGESTUREINFO hGestureInfo); +typedef BOOL (*PtrSetGestureConfig)(HWND hwnd, DWORD dwReserved, UINT cIDs, + PGESTURECONFIG pGestureConfig, + UINT cbSize); +typedef BOOL (*PtrGetGestureConfig)(HWND hwnd, DWORD dwReserved, + DWORD dwFlags, PUINT pcIDs, + PGESTURECONFIG pGestureConfig, + UINT cbSize); + +typedef BOOL (*PtrBeginPanningFeedback)(HWND hwnd); +typedef BOOL (*PtrUpdatePanningFeedback)(HWND hwnd, LONG, LONG, BOOL); +typedef BOOL (*PtrEndPanningFeedback)(HWND hwnd, BOOL); + +#endif // WM_GESTURE +#endif // Q_WS_WIN + +class QPanGesture; +class QPinchGesture; +struct StandardGestures +{ + QPanGesture *pan; + QPinchGesture *pinch; + StandardGestures() : pan(0), pinch(0) { } +}; + class QScopedLoopLevelCounter { @@ -439,10 +541,6 @@ public: void sendSyntheticEnterLeave(QWidget *widget); #endif - QGestureManager *gestureManager; - // map number of widget subscribed to it> - QMap grabbedGestures; - QMap widgetForTouchPointId; QMap appCurrentTouchPoints; static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent); @@ -465,6 +563,19 @@ public: QHash touchInputIDToTouchPointID; QList appAllTouchPoints; bool translateTouchEvent(const MSG &msg); + + typedef QMap WidgetStandardGesturesMap; + WidgetStandardGesturesMap widgetGestures; + ulong lastGestureId; + + PtrGetGestureInfo GetGestureInfo; + PtrGetGestureExtraArgs GetGestureExtraArgs; + PtrCloseGestureInfoHandle CloseGestureInfoHandle; + PtrSetGestureConfig SetGestureConfig; + PtrGetGestureConfig GetGestureConfig; + PtrBeginPanningFeedback BeginPanningFeedback; + PtrUpdatePanningFeedback UpdatePanningFeedback; + PtrEndPanningFeedback EndPanningFeedback; #endif #ifdef QT_RX71_MULTITOUCH diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index e1af0f7..13f19a3 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -89,6 +89,8 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #include #include #include "qevent_p.h" +#include "qstandardgestures.h" +#include "qstandardgestures_p.h" //#define ALIEN_DEBUG @@ -451,6 +453,7 @@ public: bool translateConfigEvent(const MSG &msg); bool translateCloseEvent(const MSG &msg); bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets); + bool translateGestureEvent(const MSG &msg); void repolishStyle(QStyle &style); inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); } inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); } @@ -809,6 +812,33 @@ void qt_init(QApplicationPrivate *priv, int) QLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware")) ptrSetProcessDPIAware(); #endif + + priv->lastGestureId = 0; + + priv->GetGestureInfo = + (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"), + "GetGestureInfo"); + priv->GetGestureExtraArgs = + (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"), + "GetGestureExtraArgs"); + priv->CloseGestureInfoHandle = + (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"), + "CloseGestureInfoHandle"); + priv->SetGestureConfig = + (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"), + "SetGestureConfig"); + priv->GetGestureConfig = + (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"), + "GetGestureConfig"); + priv->BeginPanningFeedback = + (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), + "BeginPanningFeedback"); + priv->UpdatePanningFeedback = + (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), + "UpdatePanningFeedback"); + priv->EndPanningFeedback = + (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), + "EndPanningFeedback"); } /***************************************************************************** @@ -2469,6 +2499,10 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam } result = false; break; + case WM_GESTURE: + widget->translateGestureEvent(msg); + result = true; + break; default: result = false; // event was not processed break; @@ -3649,6 +3683,60 @@ bool QETWidget::translateCloseEvent(const MSG &) return d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); } +bool QETWidget::translateGestureEvent(const MSG &msg) +{ + GESTUREINFO gi; + gi.cbSize = sizeof(GESTUREINFO); + gi.dwFlags = 0; + gi.ptsLocation.x = 0; + gi.ptsLocation.y = 0; + gi.dwID = 0; + gi.dwInstanceID = 0; + gi.dwSequenceID = 0; + + QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + BOOL bResult = qAppPriv->GetGestureInfo((HGESTUREINFO)msg.lParam, &gi); + + const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); + QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos); + if (alienWidget && alienWidget->internalWinId()) + alienWidget = 0; + QWidget *widget = alienWidget ? alienWidget : this; + + QWinGestureEvent event; + event.sequenceId = gi.dwSequenceID; + event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); + if (bResult) { + switch (gi.dwID) { + case GID_BEGIN: + // we are not interested in this type of event. + break; + case GID_END: + event.gestureType = QWinGestureEvent::GestureEnd; + break; + case GID_ZOOM: + event.gestureType = QWinGestureEvent::Pinch; + break; + case GID_PAN: + event.gestureType = QWinGestureEvent::Pan; + break; + case GID_ROTATE: + case GID_TWOFINGERTAP: + case GID_ROLLOVER: + default: + break; + } + if (event.gestureType != QWinGestureEvent::None) + qt_sendSpontaneousEvent(widget, &event); + } else { + DWORD dwErr = GetLastError(); + if (dwErr > 0) + qWarning() << "translateGestureEvent: error = " << dwErr; + } + qAppPriv->CloseGestureInfoHandle((HGESTUREINFO)msg.lParam); + return true; +} + void QApplication::setCursorFlashTime(int msecs) { @@ -3830,6 +3918,7 @@ void QSessionManager::cancel() #endif //QT_NO_SESSIONMANAGER + qt_RegisterTouchWindowPtr QApplicationPrivate::RegisterTouchWindow = 0; qt_GetTouchInputInfoPtr QApplicationPrivate::GetTouchInputInfo = 0; qt_CloseTouchInputHandlePtr QApplicationPrivate::CloseTouchInputHandle = 0; diff --git a/src/gui/kernel/qdirectionrecognizer.cpp b/src/gui/kernel/qdirectionrecognizer.cpp deleted file mode 100644 index a1bc5b1..0000000 --- a/src/gui/kernel/qdirectionrecognizer.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectionrecognizer_p.h" - -#include - -#ifndef M_PI -#define M_PI 3.141592653589793238462643 -#endif - -QT_BEGIN_NAMESPACE - -enum { - DistanceDelta = 20 -}; - -QDirectionSimpleRecognizer::QDirectionSimpleRecognizer() -{ -} - -Direction QDirectionSimpleRecognizer::addPosition(const QPoint &pos) -{ - if (!directions.isEmpty()) { - const QPoint tmp = pos - directions.back().point; - if (tmp.manhattanLength() < 5) - return Direction(); - } - if (lastPoint.isNull()) { - lastPoint = pos; - return Direction(); - } - int dx = pos.x() - lastPoint.x(); - int dy = pos.y() - lastPoint.y(); - Qt::DirectionType direction = Qt::NoDirection; - if (dx < 0) { - if (-1*dx >= DistanceDelta/2) - direction = Qt::LeftDirection; - } else { - if (dx >= DistanceDelta/2) - direction = Qt::RightDirection; - } - if (dy < 0) { - if (-1*dy >= DistanceDelta/2) - direction = Qt::UpDirection; - } else { - if (dy >= DistanceDelta/2) - direction = Qt::DownDirection; - } - if (direction == Qt::NoDirection) - return Direction(); - - lastPoint = pos; - directions.push_back(Direction(direction, pos)); - return Direction(direction, pos); -} - - -DirectionList QDirectionSimpleRecognizer::getDirections() const -{ - return directions; -} - -void QDirectionSimpleRecognizer::reset() -{ - directions.clear(); - lastPoint = QPoint(); -} - - -/// QDirectionDiagonalRecognizer - -QDirectionDiagonalRecognizer::QDirectionDiagonalRecognizer() -{ -} - -Direction QDirectionDiagonalRecognizer::addPosition(const QPoint &pos) -{ - if (!directions.isEmpty()) { - const QPoint tmp = pos - directions.back().point; - if (tmp.manhattanLength() < 5) - return Direction(); - } - if (lastPoint.isNull()) { - lastPoint = pos; - return Direction(); - } - int dx = pos.x() - lastPoint.x(); - int dy = pos.y() - lastPoint.y(); - int distance = sqrt(static_cast(dx*dx + dy*dy)); - if (distance < DistanceDelta/2) - return Direction(); - - Qt::DirectionType direction = Qt::NoDirection; - double angle = atan(1.0*qAbs(lastPoint.y() - pos.y())/qAbs(pos.x() - lastPoint.x())) * 180. / M_PI; - if (dx < 0 && dy <= 0) { - angle = 180 - angle; - } else if (dx <= 0 && dy > 0) { - angle += 180; - } else if (dx > 0 && dy > 0) { - angle = 360-angle; - } - if (angle < 0) - angle += 360; - if (angle <= 20) - direction = Qt::RightDirection; - else if (angle <= 65) - direction = Qt::RightUpDirection; - else if (angle <= 110) - direction = Qt::UpDirection; - else if (angle <= 155) - direction = Qt::LeftUpDirection; - else if (angle <= 200) - direction = Qt::LeftDirection; - else if (angle <= 245) - direction = Qt::LeftDownDirection; - else if (angle <= 290) - direction = Qt::DownDirection; - else if (angle <= 335) - direction = Qt::RightDownDirection; - else - direction = Qt::RightDirection; - - if (direction == Qt::NoDirection) - return Direction(); - - lastPoint = pos; - directions.push_back(Direction(direction, pos)); - return Direction(direction, pos); -} - - -DirectionList QDirectionDiagonalRecognizer::getDirections() const -{ - return directions; -} - -void QDirectionDiagonalRecognizer::reset() -{ - directions.clear(); - lastPoint = QPoint(); -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qdirectionrecognizer_p.h b/src/gui/kernel/qdirectionrecognizer_p.h deleted file mode 100644 index 12307c6..0000000 --- a/src/gui/kernel/qdirectionrecognizer_p.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDIRECTIONRECOGNIZER_P_H -#define QDIRECTIONRECOGNIZER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qpoint.h" -#include "qlist.h" - -QT_BEGIN_NAMESPACE - -struct Direction -{ - Qt::DirectionType direction; - QPoint point; - - Direction(Qt::DirectionType dir, const QPoint &pt) - : direction(dir), point(pt) { } - Direction() - : direction(Qt::NoDirection) { } - - inline bool isEmpty() const { return direction == Qt::NoDirection; } - inline bool isNull() const { return direction == Qt::NoDirection; } -}; - -typedef QList DirectionList; - -class QDirectionSimpleRecognizer -{ -public: - QDirectionSimpleRecognizer(); - Direction addPosition(const QPoint &pos); - DirectionList getDirections() const; - void reset(); - -private: - QPoint lastPoint; - DirectionList directions; -}; - -class QDirectionDiagonalRecognizer -{ -public: - QDirectionDiagonalRecognizer(); - Direction addPosition(const QPoint &pos); - DirectionList getDirections() const; - void reset(); - -private: - QPoint lastPoint; - DirectionList directions; -}; - -QT_END_NAMESPACE - -#endif // QDIRECTIONRECOGNIZER_P_H diff --git a/src/gui/kernel/qdirectionsimplificator_p.h b/src/gui/kernel/qdirectionsimplificator_p.h deleted file mode 100644 index d7491dc..0000000 --- a/src/gui/kernel/qdirectionsimplificator_p.h +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDIRECTIONSIMPLIFICATOR_P_H -#define QDIRECTIONSIMPLIFICATOR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "private/qdirectionrecognizer_p.h" - -QT_BEGIN_NAMESPACE - -class QDirectionSimplificator -{ -public: - QDirectionSimplificator(const DirectionList &dir); - - bool simplify(DirectionList *result); - -private: - DirectionList directions; - DirectionList lastResult; - enum State { - None, - Trim, // remove first and last element - AccidentalMoves, // 66866 => 6666 - ComplexAccidentalMoves, // 778788 => 777888 (swapping elements without changing direction) - ShortMoves, // (moves of length 1) - } state; - - struct SimplifyTrim - { - SimplifyTrim() : state(0) { } - bool operator()(DirectionList &directions) - { - if (state == 0) { - directions.removeFirst(); - state = 1; - } else if (state == 1) { - directions.removeLast(); - state = 2; - } else if (state == 2 && directions.size() >= 2) { - directions.removeFirst(); - directions.removeLast(); - state = 3; - } else { - return false; - } - return true; - } - int state; - }; - struct SimplifyAccidentalMoves - { - SimplifyAccidentalMoves() : state(0) { } - bool operator()(DirectionList &directions) - { - return false; - } - int state; - }; - struct SimplifyComplexAccidentalMoves - { - SimplifyComplexAccidentalMoves() : state(0) { } - bool operator()(DirectionList &directions) - { - return false; - } - int state; - }; - - SimplifyTrim trim; - SimplifyAccidentalMoves accidentalMoves; - SimplifyComplexAccidentalMoves complexAccidentalMoves; - //SimplifyShortMoves shortMoves; -}; - -QDirectionSimplificator::QDirectionSimplificator(const DirectionList &dir) - : directions(dir), state(None) -{ -} - -bool QDirectionSimplificator::simplify(DirectionList *result) -{ - if (directions.isEmpty() || !result) - return false; - *result = directions; - switch(state) { - case None: - state = Trim; - trim = SimplifyTrim(); - case Trim: - if (trim(*result)) - break; - *result = lastResult; - state = AccidentalMoves; - accidentalMoves = SimplifyAccidentalMoves(); - case AccidentalMoves: - if (accidentalMoves(*result)) - break; - *result = lastResult; - state = ComplexAccidentalMoves; - complexAccidentalMoves = SimplifyComplexAccidentalMoves(); - case ComplexAccidentalMoves: - if (complexAccidentalMoves(*result)) - break; - *result = lastResult; - // state = ShortMoves; - // shortMoves = SimplifyShortMoves(); - // case ShortMoves: - // if (shortMoves(*result)) - // break; - // state = None; - default: - return false; - } - lastResult = *result; - if (lastResult.isEmpty()) - return false; - return true; -} - -QT_END_NAMESPACE - -#endif // QDIRECTIONSIMPLIFICATOR_P_H diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a7a7f2d..bef7ee1 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -53,8 +53,6 @@ QT_BEGIN_NAMESPACE -QString qt_getStandardGestureTypeName(Qt::GestureType type); - /*! \class QInputEvent \ingroup events @@ -3332,9 +3330,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::ChildRemoved: n = n ? n : "ChildRemoved"; dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast(e))->child(); return dbg.space(); - case QEvent::Gesture: - n = "Gesture"; - break; default: dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')'; return dbg.space(); @@ -3531,157 +3526,6 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) #endif -/*! - \class QGestureEvent - \since 4.6 - \ingroup events - - \brief The QGestureEvent class provides the parameters used for - gesture recognition. - - The QGestureEvent class contains a list of gestures that are being - executed right now (\l{QGestureEvent::}{gestureTypes()}) and a - list of gestures that are cancelled (the gesture might be - cancelled because the window lost focus, or because of timeout, - etc). - - \sa QGesture -*/ - -/*! - Creates new QGestureEvent containing a list of \a gestures that - are being executed and a list of gesture that were cancelled (\a - cancelledGestures). -*/ -QGestureEvent::QGestureEvent(const QSet &gestures, - const QSet &cancelledGestures) - : QEvent(QEvent::Gesture), m_cancelledGestures(cancelledGestures) -{ - setAccepted(false); - foreach(QGesture *r, gestures) - m_gestures.insert(r->type(), r); -} - -/*! - Destroys the QGestureEvent object. -*/ -QGestureEvent::~QGestureEvent() -{ -} - -/*! - Returns true if the gesture event contains gesture of specific \a - type; returns false otherwise. -*/ -bool QGestureEvent::contains(Qt::GestureType type) const -{ - return contains(qt_getStandardGestureTypeName(type)); -} - -/*! - Returns true if the gesture event contains gesture of specific \a - type; returns false otherwise. -*/ -bool QGestureEvent::contains(const QString &type) const -{ - return gesture(type) != 0; -} - -/*! - Returns a list of gesture names that this event contains. -*/ -QList QGestureEvent::gestureTypes() const -{ - return m_gestures.keys(); -} - -/*! - Returns extended information about a gesture of specific \a type. -*/ -const QGesture* QGestureEvent::gesture(Qt::GestureType type) const -{ - return gesture(qt_getStandardGestureTypeName(type)); -} - -/*! - Returns extended information about a gesture of specific \a type. -*/ -const QGesture* QGestureEvent::gesture(const QString &type) const -{ - return m_gestures.value(type, 0); -} - -/*! - Returns extended information about all gestures in the event. -*/ -QList QGestureEvent::gestures() const -{ - return m_gestures.values(); -} - -/*! - Returns a set of gesture names that used to be executed, but were - cancelled (i.e. they were not finished properly). -*/ -QSet QGestureEvent::cancelledGestures() const -{ - return m_cancelledGestures; -} - -/*! \fn void QGestureEvent::accept() - Calls QEvent::accept(). -*/ - -/*! - Sets the accept flag of the all gestures inside the event object, - the equivalent of calling \l{QEvent::accept()}{accept()} or - \l{QEvent::setAccepted()}{setAccepted(true)}. - - Setting the accept parameter indicates that the event receiver - wants the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGestureEvent::acceptAll() -{ - QHash::iterator it = m_gestures.begin(), - e = m_gestures.end(); - for(; it != e; ++it) - it.value()->accept(); - setAccepted(true); -} - -/*! - Sets the accept flag of the gesture specified by \a type. - This is equivalent to calling - \l{QGestureEvent::gesture()}{gesture(type)}-> - \l{QGesture::accept()}{accept()} - - Setting the accept flag indicates that the event receiver wants - the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGestureEvent::accept(Qt::GestureType type) -{ - if (QGesture *g = m_gestures.value(qt_getStandardGestureTypeName(type), 0)) - g->accept(); -} - -/*! - Sets the accept flag of the gesture specified by \a type. - This is equivalent to calling - \l{QGestureEvent::gesture()}{gesture(type)}-> - \l{QGesture::accept()}{accept()} - - Setting the accept flag indicates that the event receiver wants - the gesture. Unwanted gestures might be propagated to the parent - widget. -*/ -void QGestureEvent::accept(const QString &type) -{ - if (QGesture *g = m_gestures.value(type, 0)) - g->accept(); -} - /*! \class QTouchEvent \brief The QTouchEvent class contains parameters that describe a touch event . diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 136dd7f..11843cb 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -714,41 +714,6 @@ private: }; #endif -class Q_GUI_EXPORT QGestureEvent : public QEvent -{ -public: - QGestureEvent(const QSet &gestures, - const QSet &cancelledGestures = QSet()); - ~QGestureEvent(); - - bool contains(Qt::GestureType type) const; - bool contains(const QString &type) const; - - QList gestureTypes() const; - - const QGesture* gesture(Qt::GestureType type) const; - const QGesture* gesture(const QString &type) const; - QList gestures() const; - - QSet cancelledGestures() const; - - void acceptAll(); -#ifndef Q_NO_USING_KEYWORD - using QEvent::accept; -#else - inline void accept() { QEvent::accept(); } -#endif - void accept(Qt::GestureType type); - void accept(const QString &type); - -protected: - QHash m_gestures; - QSet m_cancelledGestures; - - friend class QApplication; - friend class QGestureManager; -}; - #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *); #endif diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 8a2bb05..67441ea 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -119,6 +119,22 @@ public: qreal pressure; }; +class QWinGestureEvent : public QEvent +{ +public: + enum Type { + None, + GestureEnd, + Pan, + Pinch + }; + + QWinGestureEvent() : QEvent(QEvent::WinGesture), gestureType(None), sequenceId(0) { } + Type gestureType; + QPoint position; + ulong sequenceId; +}; + QT_END_NAMESPACE #endif // QEVENT_P_H diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index ff369e2..32a219c 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -41,190 +41,166 @@ #include "qgesture.h" #include +#include "qgraphicsitem.h" QT_BEGIN_NAMESPACE -QString qt_getStandardGestureTypeName(Qt::GestureType type); + +class QEventFilterProxyGraphicsItem : public QGraphicsItem +{ +public: + QEventFilterProxyGraphicsItem(QGesture *g) + : gesture(g) + { + } + bool sceneEventFilter(QGraphicsItem *, QEvent *event) + { + return gesture ? gesture->filterEvent(event) : false; + } + QRectF boundingRect() const { return QRectF(); } + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { } + +private: + QGesture *gesture; +}; /*! \class QGesture \since 4.6 - \brief The QGesture class represents a gesture, containing all - properties that describe a gesture. - - The widget receives a QGestureEvent with a list of QGesture - objects that represent gestures that are occuring on it. The class - has a list of properties that can be queried by the user to get - some gesture-specific arguments (i.e. position of the tap in the - DoubleTap gesture). - - When creating custom gesture recognizers, they might add new - properties to the gesture object, or custom gesture developers - might subclass the QGesture objects to provide some extended - information. However, if the gesture developer wants to add a new - property to the gesture object that describe coordinate (like a - QPoint or QRect), it is required to subclass the QGesture and - re-implement the \l{QGesture::}{translate()} function to make sure - the coordinates are translated properly when the gesture event is - propagated to parent widgets. - - \sa QGestureEvent, QGestureRecognizer -*/ + \brief The QGesture class is the base class for implementing custom + gestures. -/*! - Creates a new gesture object of type \a type in a \a state and - marks it as a child of \a parent. + This class represents both an object that recognizes a gesture out of a set + of input events (a gesture recognizer), and a gesture object itself that + can be used to get extended information about the triggered gesture. - Usually QGesture objects should only be contructed by the - QGestureRecognizer classes. -*/ -QGesture::QGesture(QObject *parent, const QString &type, Qt::GestureState state) - : QObject(*new QGesturePrivate, parent), m_accept(0) -{ - Q_D(QGesture); - d->type = type; - d->state = state; -} + The class has a list of properties that can be queried by the user to get + some gesture-specific parameters (for example, an offset of a Pan gesture). -/*! - Creates a new gesture object of type \a type in a \a state and - marks it as a child of \a parent. - - This constructor also fills some basic information about the - gesture like a \a startPos which describes the start point of the - gesture, \a lastPos - last point where the gesture happened, \a - pos - a current point, \a rect - a bounding rect of the gesture, - \a hotSpot - a center point of the gesture, \a startTime - a time - when the gesture has started, \a duration - how long the gesture - is going on. - - Usually QGesture objects should only be contructed by the - QGestureRecognizer classes. -*/ -QGesture::QGesture(QObject *parent, const QString &type, const QPoint &startPos, - const QPoint &lastPos, const QPoint &pos, const QRect &rect, - const QPoint &hotSpot, const QDateTime &startTime, - uint duration, Qt::GestureState state) - : QObject(*new QGesturePrivate, parent) -{ - Q_D(QGesture); - d->type = type; - d->state = state; - d->init(startPos, lastPos, pos, rect, hotSpot, startTime, duration); -} + Usually gesture recognizer implements a state machine, storing its state + internally in the recognizer object. The recognizer receives input events + through the \l{QGesture::}{filterEvent()} virtual function and decides + whether the event should change the state of the recognizer by emitting an + appropriate signal. -/*! \internal + Input events should be either fed to the recognizer one by one with a + filterEvent() function, or the gesture recognizer should be attached to an + object it filters events for by specifying it as a parent object. The + QGesture object installs itself as an event filter to the parent object + automatically, the unsetObject() function should be used to remove an event + filter from the parent object. To make a + gesture that operates on a QGraphicsItem, both the appropriate QGraphicsView + should be passed as a parent object and setGraphicsItem() functions should + be used to attach a gesture to a graphics item. + + This is a base class, to create a custom gesture type, you should subclass + it and implement its pure virtual functions. + + \sa QPanGesture, QTapAndHoldGesture */ -QGesture::QGesture(QGesturePrivate &dd, QObject *parent, const QString &type, - Qt::GestureState state) - : QObject(dd, parent) -{ - Q_D(QGesture); - d->type = type; - d->state = state; -} -/*! - Destroys the gesture object. +/*! \fn bool QGesture::filterEvent(QEvent *event) + + Parses input \a event and emits a signal when detects a gesture. + + In your reimplementation of this function, if you want to filter the \a + event out, i.e. stop it being handled further, return true; otherwise + return false; + + This is a pure virtual function that needs to be implemented in subclasses. */ -QGesture::~QGesture() -{ -} -/*! - \property QGesture::type +/*! \fn void QGesture::started() - \brief The type of the gesture. + The signal is emitted when the gesture is started. Extended information + about the gesture is contained in the signal sender object. + + In addition to started(), a triggered() signal should also be emitted. */ -QString QGesture::type() const -{ - return d_func()->type; -} +/*! \fn void QGesture::triggered() -/*! - \property QGesture::state + The signal is emitted when the gesture is detected. Extended information + about the gesture is contained in the signal sender object. +*/ - \brief The current state of the gesture. +/*! \fn void QGesture::finished() + + The signal is emitted when the gesture is finished. Extended information + about the gesture is contained in the signal sender object. */ -Qt::GestureState QGesture::state() const -{ - return d_func()->state; -} -/*! - Translates the internal gesture properties that represent - coordinates by \a offset. +/*! \fn void QGesture::cancelled() - Custom gesture recognizer developer have to re-implement this - function if they want to store custom properties that represent - coordinates. + The signal is emitted when the gesture is cancelled, for example the reset() + function is called while the gesture was in the process of emitting a + triggered() signal. Extended information about the gesture is contained in + the sender object. */ -void QGesture::translate(const QPoint &offset) -{ - Q_D(QGesture); - d->rect.translate(offset); - d->hotSpot += offset; - d->startPos += offset; - d->lastPos += offset; - d->pos += offset; -} + /*! - \property QGesture::rect + Creates a new gesture handler object and marks it as a child of \a parent. + + The \a parent object is also the default event source for the gesture, + meaning that the gesture installs itself as an event filter for the \a + parent. - \brief The bounding rect of a gesture. + \sa setGraphicsItem() */ -QRect QGesture::rect() const +QGesture::QGesture(QObject *parent) + : QObject(*new QGesturePrivate, parent) { - return d_func()->rect; + if (parent) + installEventFilter(parent); } -void QGesture::setRect(const QRect &rect) +/*! \internal + */ +QGesture::QGesture(QGesturePrivate &dd, QObject *parent) + : QObject(dd, parent) { - d_func()->rect = rect; + if (parent) + installEventFilter(parent); } /*! - \property QGesture::hotSpot - - \brief The center point of a gesture. + Destroys the gesture object. */ -QPoint QGesture::hotSpot() const +QGesture::~QGesture() { - return d_func()->hotSpot; } -void QGesture::setHotSpot(const QPoint &point) +/*! \internal + */ +bool QGesture::eventFilter(QObject *receiver, QEvent *event) { - d_func()->hotSpot = point; + Q_D(QGesture); + if (d->graphicsItem && receiver == parent()) + return false; + return filterEvent(event); } /*! - \property QGesture::startTime + \property QGesture::state - \brief The time when the gesture has started. + \brief The current state of the gesture. */ -QDateTime QGesture::startTime() const +Qt::GestureState QGesture::state() const { - return d_func()->startTime; + return d_func()->state; } -/*! - \property QGesture::duration - - \brief The duration time of a gesture. -*/ -uint QGesture::duration() const +void QGesture::setState(Qt::GestureState state) { - return d_func()->duration; + d_func()->state = state; } /*! \property QGesture::startPos - \brief The start position of the pointer. + \brief The start position of the gesture (if relevant). */ QPoint QGesture::startPos() const { @@ -239,7 +215,7 @@ void QGesture::setStartPos(const QPoint &point) /*! \property QGesture::lastPos - \brief The last recorded position of the pointer. + \brief The last recorded position of the gesture (if relevant). */ QPoint QGesture::lastPos() const { @@ -254,7 +230,7 @@ void QGesture::setLastPos(const QPoint &point) /*! \property QGesture::pos - \brief The current position of the pointer. + \brief The current position of the gesture (if relevant). */ QPoint QGesture::pos() const { @@ -266,66 +242,48 @@ void QGesture::setPos(const QPoint &point) d_func()->pos = point; } -/*! \fn void QGesture::setAccepted(bool accepted) - Marks the gesture with the value of \a accepted. - */ - -/*! \fn bool QGesture::isAccepted() const - Returns true if the gesture is marked accepted. - */ - -/*! \fn void QGesture::accept() - Marks the gesture accepted. -*/ - -/*! \fn void QGesture::ignore() - Marks the gesture ignored. -*/ - /*! - \class QPanningGesture - \since 4.6 + Sets the \a graphicsItem the gesture is filtering events for. - \brief The QPanningGesture class represents a Pan gesture, - providing additional information related to panning. + The gesture will install an event filter to the \a graphicsItem and + redirect them to the filterEvent() function. - This class is provided for convenience, panning direction - information is also contained in the QGesture object in it's - properties. + \sa graphicsItem() */ - -/*! \internal -*/ -QPanningGesture::QPanningGesture(QObject *parent) - : QGesture(*new QPanningGesturePrivate, parent, - qt_getStandardGestureTypeName(Qt::PanGesture)) -{ -} - -/*! \internal -*/ -QPanningGesture::~QPanningGesture() +void QGesture::setGraphicsItem(QGraphicsItem *graphicsItem) { + Q_D(QGesture); + if (d->graphicsItem && d->eventFilterProxyGraphicsItem) + d->graphicsItem->removeSceneEventFilter(d->eventFilterProxyGraphicsItem); + d->graphicsItem = graphicsItem; + if (!d->eventFilterProxyGraphicsItem) + d->eventFilterProxyGraphicsItem = new QEventFilterProxyGraphicsItem(this); + if (graphicsItem) + graphicsItem->installSceneEventFilter(d->eventFilterProxyGraphicsItem); } /*! - \property QPanningGesture::lastDirection + Returns the graphics item the gesture is filtering events for. - \brief The last recorded direction of panning. + \sa setGraphicsItem() */ -Qt::DirectionType QPanningGesture::lastDirection() const +QGraphicsItem* QGesture::graphicsItem() const { - return d_func()->lastDirection; + return d_func()->graphicsItem; } -/*! - \property QPanningGesture::direction +/*! \fn void QGesture::reset() - \brief The current direction of panning. + Resets the internal state of the gesture. This function might be called by + the filterEvent() implementation in a derived class, or by the user to + cancel a gesture. The base class implementation emits the cancelled() + signal if the state() of the gesture wasn't empty. */ -Qt::DirectionType QPanningGesture::direction() const +void QGesture::reset() { - return d_func()->direction; + if (state() != Qt::NoGesture) + emit cancelled(); + setState(Qt::NoGesture); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index f3c95cc..b5abdd2 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -55,50 +55,32 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) +class QGraphicsItem; class QGesturePrivate; class Q_GUI_EXPORT QGesture : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QGesture) - Q_PROPERTY(QString type READ type) Q_PROPERTY(Qt::GestureState state READ state) - Q_PROPERTY(QDateTime startTime READ startTime) - Q_PROPERTY(uint duration READ duration) - - Q_PROPERTY(QRect rect READ rect WRITE setRect) - Q_PROPERTY(QPoint hotSpot READ hotSpot WRITE setHotSpot) Q_PROPERTY(QPoint startPos READ startPos WRITE setStartPos) Q_PROPERTY(QPoint lastPos READ lastPos WRITE setLastPos) Q_PROPERTY(QPoint pos READ pos WRITE setPos) public: - QGesture(QObject *parent, const QString &type, - Qt::GestureState state = Qt::GestureStarted); - QGesture(QObject *parent, - const QString &type, const QPoint &startPos, - const QPoint &lastPos, const QPoint &pos, const QRect &rect, - const QPoint &hotSpot, const QDateTime &startTime, - uint duration, Qt::GestureState state); - virtual ~QGesture(); - - inline void setAccepted(bool accepted) { m_accept = accepted; } - inline bool isAccepted() const { return m_accept; } - - inline void accept() { m_accept = true; } - inline void ignore() { m_accept = false; } - - QString type() const; - Qt::GestureState state() const; + explicit QGesture(QObject *parent = 0); + ~QGesture(); + + virtual bool filterEvent(QEvent *event) = 0; + + void setGraphicsItem(QGraphicsItem *); + QGraphicsItem *graphicsItem() const; - QDateTime startTime() const; - uint duration() const; + virtual void reset(); - QRect rect() const; - void setRect(const QRect &rect); - QPoint hotSpot() const; - void setHotSpot(const QPoint &point); + Qt::GestureState state() const; + void setState(Qt::GestureState state); QPoint startPos() const; void setStartPos(const QPoint &point); @@ -108,45 +90,19 @@ public: void setPos(const QPoint &point); protected: - QGesture(QGesturePrivate &dd, QObject *parent, const QString &type, - Qt::GestureState state = Qt::GestureStarted); - virtual void translate(const QPoint &offset); + QGesture(QGesturePrivate &dd, QObject *parent); + bool eventFilter(QObject*, QEvent*); -private: - ushort m_accept : 1; - - friend class QGestureManager; - friend class QApplication; - friend class QGraphicsScene; - friend class QGraphicsScenePrivate; - friend class QGestureRecognizerPan; - friend class QDoubleTapGestureRecognizer; - friend class QTapAndHoldGestureRecognizer; -}; - -class QPanningGesturePrivate; -class Q_GUI_EXPORT QPanningGesture : public QGesture -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QPanningGesture) - - Q_PROPERTY(Qt::DirectionType lastDirection READ lastDirection) - Q_PROPERTY(Qt::DirectionType direction READ direction) - -public: - Qt::DirectionType lastDirection() const; - Qt::DirectionType direction() const; +signals: + void started(); + void triggered(); + void finished(); + void cancelled(); private: - QPanningGesture(QObject *parent = 0); - ~QPanningGesture(); - - friend class QGestureRecognizerPan; + friend class QWidget; }; -Q_DECLARE_METATYPE(Qt::DirectionType) -Q_DECLARE_METATYPE(Qt::GestureState) - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index caf851e..99f572f 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -56,10 +56,12 @@ #include "qrect.h" #include "qpoint.h" #include "qdatetime.h" +#include "qgesture.h" #include "private/qobject_p.h" QT_BEGIN_NAMESPACE +class QObject; class QGraphicsItem; class QGesturePrivate : public QObjectPrivate { @@ -67,47 +69,28 @@ class QGesturePrivate : public QObjectPrivate public: QGesturePrivate() - : state(Qt::NoGesture), graphicsItem(0), singleshot(0), duration(0) { } + : graphicsItem(0), eventFilterProxyGraphicsItem(0), state(Qt::NoGesture) + { + } void init(const QPoint &startPos, const QPoint &lastPos, - const QPoint &pos, const QRect &rect, - const QPoint &hotSpot, const QDateTime &startTime, - uint duration) + const QPoint &pos) { - this->rect = rect; - this->hotSpot = hotSpot; - this->startTime = startTime; - this->duration = duration; this->startPos = startPos; this->lastPos = lastPos; this->pos = pos; } - QString type; - Qt::GestureState state; - - QPointer widget; QGraphicsItem *graphicsItem; - uint singleshot:1; + QGraphicsItem *eventFilterProxyGraphicsItem; + + Qt::GestureState state; - QRect rect; - QPoint hotSpot; - QDateTime startTime; - uint duration; QPoint startPos; QPoint lastPos; QPoint pos; }; -class QPanningGesturePrivate : public QGesturePrivate -{ - Q_DECLARE_PUBLIC(QPanningGesture) - -public: - Qt::DirectionType lastDirection; - Qt::DirectionType direction; -}; - QT_END_NAMESPACE #endif // QGESTURE_P_H diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp deleted file mode 100644 index 20abda9..0000000 --- a/src/gui/kernel/qgesturemanager.cpp +++ /dev/null @@ -1,644 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgesturemanager_p.h" -#include "qgesture.h" -#include "qgesture_p.h" -#include "qevent.h" - -#include "qapplication.h" -#include "qapplication_p.h" -#include "qwidget.h" -#include "qwidget_p.h" - -#include "qgesturestandardrecognizers_p.h" - -#include "qdebug.h" - -// #define GESTURE_DEBUG -#ifndef GESTURE_DEBUG -# define DEBUG if (0) qDebug -#else -# define DEBUG qDebug -#endif - -QT_BEGIN_NAMESPACE - -bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); - -static const unsigned int MaximumGestureRecognitionTimeout = 2000; - -QGestureManager::QGestureManager(QObject *parent) - : QObject(parent), eventDeliveryDelayTimeout(300), - delayedPressTimer(0), lastMousePressReceiver(0), lastMousePressEvent(QEvent::None, QPoint(), Qt::NoButton, 0, 0), - lastGestureId(0), state(NotGesture) -{ - qRegisterMetaType(); - qRegisterMetaType(); - - recognizers << new QDoubleTapGestureRecognizer(this); - recognizers << new QTapAndHoldGestureRecognizer(this); - recognizers << new QGestureRecognizerPan(this); - - foreach(QGestureRecognizer *r, recognizers) - connect(r, SIGNAL(stateChanged(QGestureRecognizer::Result)), - this, SLOT(recognizerStateChanged(QGestureRecognizer::Result))); -} - -void QGestureManager::addRecognizer(QGestureRecognizer *recognizer) -{ - recognizer->setParent(this); - recognizers << recognizer; -} - -void QGestureManager::removeRecognizer(QGestureRecognizer *recognizer) -{ - recognizers.remove(recognizer); -} - -bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) -{ - QPoint currentPos; - switch (event->type()) { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - case QEvent::MouseMove: - currentPos = static_cast(event)->pos(); break; - default: break; - } - - const QMap &grabbedGestures = qApp->d_func()->grabbedGestures; - - bool ret = false; - QSet startedGestures; - QSet finishedGestures; - QSet newMaybeGestures; - QSet cancelledGestures; - QSet notGestures; - if (state == NotGesture || state == MaybeGesture) { - DEBUG() << "QGestureManager: current event processing state: " - << (state == NotGesture ? "NotGesture" : "MaybeGesture"); - - QSet stillMaybeGestures; - // try other recognizers. - foreach(QGestureRecognizer *r, recognizers) { - if (grabbedGestures.value(r->gestureType(), 0) <= 0) - continue; - QGestureRecognizer::Result result = r->filterEvent(event); - if (result == QGestureRecognizer::GestureStarted) { - DEBUG() << "QGestureManager: gesture started: " << r; - startedGestures << r; - } else if (result == QGestureRecognizer::GestureFinished) { - DEBUG() << "QGestureManager: gesture finished: " << r; - finishedGestures << r; - } else if (result == QGestureRecognizer::MaybeGesture) { - DEBUG() << "QGestureManager: maybe gesture: " << r; - newMaybeGestures << r; - } else if (result == QGestureRecognizer::NotGesture) { - // if it was maybe gesture, but isn't a gesture anymore. - DEBUG() << "QGestureManager: not gesture: " << r; - notGestures << r; - } - } - Q_ASSERT(activeGestures.isEmpty()); - activeGestures += startedGestures; - for(QMap::iterator it = maybeGestures.begin(); - it != maybeGestures.end();) { - QGestureRecognizer *r = it.key(); - if (startedGestures.contains(r) || finishedGestures.contains(r) || - notGestures.contains(r)) { - killTimer(it.value()); - it = maybeGestures.erase(it); - } else { - ++it; - } - } - foreach(QGestureRecognizer *r, newMaybeGestures) { - if (!maybeGestures.contains(r)) { - int timerId = startTimer(MaximumGestureRecognitionTimeout); - if (!timerId) - qWarning("QGestureManager: couldn't start timer!"); - maybeGestures.insert(r, timerId); - } - } - if (!finishedGestures.isEmpty() || !startedGestures.isEmpty()) { - // gesture found! - ret = true; - QSet started; - foreach(QGestureRecognizer *r, finishedGestures) { - if (QGesture *gesture = r->getGesture()) { - started << gesture; - gesture->d_func()->singleshot = true; - } - } - foreach(QGestureRecognizer *r, startedGestures) { - if (QGesture *gesture = r->getGesture()) { - started << gesture; - gesture->d_func()->singleshot = false; - } - } - - if (!activeGestures.isEmpty()) { - DEBUG() << "QGestureManager: new state = Gesture"; - state = Gesture; - } else if (!maybeGestures.isEmpty()) { - DEBUG() << "QGestureManager: new state = Maybe"; - state = MaybeGesture; - } else { - DEBUG() << "QGestureManager: new state = NotGesture"; - state = NotGesture; - } - - Q_ASSERT(!started.isEmpty()); - ret = sendGestureEvent(receiver, started, QSet()); - } else if (!maybeGestures.isEmpty()) { - if (state != MaybeGesture) { - // We got a new set of events that look like a start - // of some gesture, so we switch to state MaybeGesture - // and wait for more events. - DEBUG() << "QGestureManager: new state = Maybe. Waiting for events"; - state = MaybeGesture; - // start gesture timer - } else { - // we still not sure if it is a gesture or not. - } - } else if (state == MaybeGesture) { - // last time we thought it looks like gesture, but now we - // know for sure that it isn't. - DEBUG() << "QGestureManager: new state = NotGesture"; - state = NotGesture; - } - foreach(QGestureRecognizer *r, finishedGestures) - r->reset(); - foreach(QGestureRecognizer *r, cancelledGestures) - r->reset(); - foreach(QGestureRecognizer *r, notGestures) - r->reset(); - } else if (state == Gesture) { - DEBUG() << "QGestureManager: current event processing state: Gesture"; - Q_ASSERT(!activeGestures.isEmpty()); - - foreach(QGestureRecognizer *r, recognizers) { - if (grabbedGestures.value(r->gestureType(), 0) <= 0) - continue; - QGestureRecognizer::Result result = r->filterEvent(event); - if (result == QGestureRecognizer::GestureStarted) { - DEBUG() << "QGestureManager: gesture started: " << r; - startedGestures << r; - } else if (result == QGestureRecognizer::GestureFinished) { - DEBUG() << "QGestureManager: gesture finished: " << r; - finishedGestures << r; - } else if (result == QGestureRecognizer::MaybeGesture) { - DEBUG() << "QGestureManager: maybe gesture: " << r; - newMaybeGestures << r; - } else if (result == QGestureRecognizer::NotGesture) { - // if it was an active gesture, but isn't a gesture anymore. - if (activeGestures.contains(r)) { - DEBUG() << "QGestureManager: cancelled gesture: " << r; - cancelledGestures << r; - } else { - DEBUG() << "QGestureManager: not gesture: " << r; - notGestures << r; - } - } - } - - for(QMap::iterator it = maybeGestures.begin(); - it != maybeGestures.end();) { - QGestureRecognizer *r = it.key(); - if (startedGestures.contains(r) || finishedGestures.contains(r) || - notGestures.contains(r)) { - killTimer(it.value()); - it = maybeGestures.erase(it); - } else { - ++it; - } - } - foreach(QGestureRecognizer *r, newMaybeGestures) { - if (!maybeGestures.contains(r)) { - int timerId = startTimer(MaximumGestureRecognitionTimeout); - if (!timerId) - qWarning("QGestureManager: couldn't start timer!"); - maybeGestures.insert(r, timerId); - } - } - QSet started, updated; - if (!finishedGestures.isEmpty() || !startedGestures.isEmpty()) { - // another gesture found! - ret = true; - foreach(QGestureRecognizer *r, finishedGestures) { - if (QGesture *gesture = r->getGesture()) { - gesture->d_func()->singleshot = !activeGestures.contains(r); - if (gesture->d_func()->singleshot) - started << gesture; - else - updated << gesture; - } - } - foreach(QGestureRecognizer *r, startedGestures) { - if (QGesture *gesture = r->getGesture()) { - gesture->d_func()->singleshot = !activeGestures.contains(r); - if (gesture->d_func()->singleshot) - started << gesture; - else - updated << gesture; - } - } - } - activeGestures -= newMaybeGestures; - activeGestures -= cancelledGestures; - activeGestures += startedGestures; - activeGestures -= finishedGestures; - QSet cancelledGestureNames; - foreach(QGestureRecognizer *r, cancelledGestures) - cancelledGestureNames << r->gestureType(); - ret = sendGestureEvent(receiver, started, updated, cancelledGestureNames); - - foreach(QGestureRecognizer *r, finishedGestures) - r->reset(); - foreach(QGestureRecognizer *r, cancelledGestures) - r->reset(); - foreach(QGestureRecognizer *r, notGestures) - r->reset(); - if (!activeGestures.isEmpty()) { - // nothing changed, we are still handling a gesture - } else if (!maybeGestures.isEmpty()) { - DEBUG() << "QGestureManager: new state = Maybe. Waiting for events: " << maybeGestures; - state = MaybeGesture; - } else { - DEBUG() << "QGestureManager: new state = NotGesture"; - state = NotGesture; - } - } - - if (delayedPressTimer && state == Gesture) { - DEBUG() << "QGestureManager: gesture started. Forgetting about postponed mouse press event"; - killTimer(delayedPressTimer); - delayedPressTimer = 0; - lastMousePressReceiver = 0; - } else if (delayedPressTimer && (state == NotGesture || - event->type() == QEvent::MouseButtonRelease)) { - // not a gesture or released button too fast, so replay press - // event back. - DEBUG() << "QGestureManager: replaying mouse press event"; - QMap::const_iterator it = maybeGestures.begin(), - e = maybeGestures.end();; - for (; it != e; ++it) { - it.key()->reset(); - killTimer(it.value()); - } - maybeGestures.clear(); - state = NotGesture; - - if (lastMousePressReceiver) { - QApplication::sendEvent(lastMousePressReceiver, &lastMousePressEvent); - if (event->type() == QEvent::MouseButtonRelease) { - QMouseEvent *me = static_cast(event); - QMouseEvent move(QEvent::MouseMove, me->pos(), me->globalPos(), me->button(), - me->buttons(), me->modifiers()); - QApplication::sendEvent(lastMousePressReceiver, &move); - ret = false; - } - lastMousePressReceiver = 0; - } - lastMousePressReceiver = 0; - killTimer(delayedPressTimer); - delayedPressTimer = 0; - } else if (state == MaybeGesture && event->type() == QEvent::MouseButtonPress - && eventDeliveryDelayTimeout) { - // postpone the press event delivery until we know for - // sure whether it is a gesture. - DEBUG() << "QGestureManager: postponing mouse press event"; - QMouseEvent *me = static_cast(event); - lastMousePressReceiver = receiver; - lastMousePressEvent = QMouseEvent(QEvent::MouseButtonPress, me->pos(), - me->globalPos(), me->button(), - me->buttons(), me->modifiers()); - Q_ASSERT(delayedPressTimer == 0); - delayedPressTimer = startTimer(eventDeliveryDelayTimeout); - if (!delayedPressTimer) - qWarning("QGestureManager: couldn't start delayed press timer!"); - ret = true; - } - if (delayedPressTimer && event->type() == QEvent::MouseMove) { - // if we have postponed a mouse press event, postpone all - // subsequent mouse move events as well. - ret = true; - } - - lastPos = currentPos; - return ret; -} - -void QGestureManager::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == delayedPressTimer) { - DEBUG() << "QGestureManager: replaying mouse press event due to timeout"; - // sanity checks - Q_ASSERT(state != Gesture); - - QMap::const_iterator it = maybeGestures.begin(), - e = maybeGestures.end();; - for (; it != e; ++it) { - it.key()->reset(); - killTimer(it.value()); - } - maybeGestures.clear(); - state = NotGesture; - - if (lastMousePressReceiver) { - // we neither received a mouse release event nor gesture - // started, so we replay stored mouse press event. - QApplication::sendEvent(lastMousePressReceiver, &lastMousePressEvent); - lastMousePressReceiver = 0; - } - - lastMousePressReceiver = 0; - killTimer(delayedPressTimer); - delayedPressTimer = 0; - } else { - // sanity checks, remove later - Q_ASSERT((state == Gesture && !activeGestures.isEmpty()) || (state != Gesture && activeGestures.isEmpty())); - - typedef QMap MaybeGestureMap; - for (MaybeGestureMap::iterator it = maybeGestures.begin(), e = maybeGestures.end(); - it != e; ++it) { - if (it.value() == event->timerId()) { - DEBUG() << "QGestureManager: gesture timeout."; - QGestureRecognizer *r = it.key(); - r->reset(); - maybeGestures.erase(it); - killTimer(event->timerId()); - break; - } - } - - if (state == MaybeGesture && maybeGestures.isEmpty()) { - DEBUG() << "QGestureManager: new state = NotGesture because of timeout"; - state = NotGesture; - } - } -} - -bool QGestureManager::inGestureMode() -{ - return state == Gesture; -} - -void QGestureManager::recognizerStateChanged(QGestureRecognizer::Result result) -{ - QGestureRecognizer *recognizer = qobject_cast(sender()); - if (!recognizer) - return; - if (qApp->d_func()->grabbedGestures.value(recognizer->gestureType(), 0) <= 0) { - recognizer->reset(); - return; - } - - switch (result) { - case QGestureRecognizer::GestureStarted: - case QGestureRecognizer::GestureFinished: { - if (result == QGestureRecognizer::GestureStarted) { - DEBUG() << "QGestureManager: gesture started: " << recognizer; - activeGestures << recognizer; - DEBUG() << "QGestureManager: new state = Gesture"; - state = Gesture; - } else { - DEBUG() << "QGestureManager: gesture finished: " << recognizer; - } - if (maybeGestures.contains(recognizer)) { - killTimer(maybeGestures.value(recognizer)); - maybeGestures.remove(recognizer); - } - QSet gestures; - if (QGesture *gesture = recognizer->getGesture()) - gestures << gesture; - if(!gestures.isEmpty()) { - //FIXME: sendGestureEvent(targetWidget, gestures); - } - if (result == QGestureRecognizer::GestureFinished) - recognizer->reset(); - } - break; - case QGestureRecognizer::MaybeGesture: { - DEBUG() << "QGestureManager: maybe gesture: " << recognizer; - if (activeGestures.contains(recognizer)) { - //FIXME: sendGestureEvent(targetWidget, QSet(), QSet() << recognizer->gestureType()); - } - if (!maybeGestures.contains(recognizer)) { - int timerId = startTimer(MaximumGestureRecognitionTimeout); - if (!timerId) - qWarning("QGestureManager: couldn't start timer!"); - maybeGestures.insert(recognizer, timerId); - } - } - break; - case QGestureRecognizer::NotGesture: - DEBUG() << "QGestureManager: not gesture: " << recognizer; - if (maybeGestures.contains(recognizer)) { - killTimer(maybeGestures.value(recognizer)); - maybeGestures.remove(recognizer); - } - recognizer->reset(); - break; - default: - Q_ASSERT(false); - } - - if (delayedPressTimer && state == Gesture) { - killTimer(delayedPressTimer); - delayedPressTimer = 0; - } -} - -bool QGestureManager::sendGestureEvent(QWidget *receiver, - const QSet &startedGestures, - const QSet &updatedGestures, - const QSet &cancelled) -{ - DEBUG() << "QGestureManager::sendGestureEvent: sending to" << receiver - << "gestures:" << startedGestures << "," << updatedGestures - << "cancelled:" << cancelled; - // grouping gesture objects by receiver widgets. - typedef QMap > WidgetGesturesMap; - WidgetGesturesMap widgetGestures; - for(QSet::const_iterator it = startedGestures.begin(), e = startedGestures.end(); - it != e; ++it) { - QGesture *g = *it; - QGesturePrivate *gd = g->d_func(); - if (receiver) { - // find the target widget - gd->widget = 0; - gd->graphicsItem = 0; - QWidget *w = receiver; - QPoint offset; - const QString gestureType = g->type(); - while (w) { - if (w->d_func()->hasGesture(gestureType)) - break; - if (w->isWindow()) { - w = 0; - break; - } - offset += w->pos(); - w = w->parentWidget(); - } - if (w && w != gd->widget) { - DEBUG() << "QGestureManager::sendGestureEvent:" << g << "propagating to widget" << w << "offset" << offset; - g->translate(offset); - } - gd->widget = w; - } - if (!gd->widget) { - DEBUG() << "QGestureManager: didn't find a widget to send gesture event (" - << g->type() << ") for tree:" << receiver; - // TODO: maybe we should reset gesture recognizers when nobody interested in its gestures. - continue; - } - widgetGestures[gd->widget].insert(g); - } - - QSet ignoredGestures; - bool ret = false; - for(WidgetGesturesMap::const_iterator it = widgetGestures.begin(), e = widgetGestures.end(); - it != e; ++it) { - QWidget *receiver = it.key(); - Q_ASSERT(receiver != 0 /*should be taken care above*/); - QSet gestures = it.value(); - // mark all gestures as ignored by default - for(QSet::iterator it = gestures.begin(), e = gestures.end(); it != e; ++it) - (*it)->ignore(); - // TODO: send cancelled gesture event to the widget that received the original gesture! - QGestureEvent event(gestures, cancelled); - DEBUG() << "QGestureManager::sendGestureEvent: sending now to" << receiver - << "gestures" << gestures; - bool processed = qt_sendSpontaneousEvent(receiver, &event); - QSet started = startedGestures & gestures; - DEBUG() << "QGestureManager::sendGestureEvent:" << - (event.isAccepted() ? "" : "not") << "all gestures were accepted"; - if (!started.isEmpty() && !(processed && event.isAccepted())) { - // there are started gestures events that weren't - // accepted, so propagating each gesture independently. - if (event.isAccepted()) { - foreach(QGesture *g, started) - g->accept(); - } - QSet::const_iterator it = started.begin(), - e = started.end(); - for(; it != e; ++it) { - QGesture *g = *it; - if (processed && g->isAccepted()) { - ret = true; - continue; - } - // if it wasn't accepted, find the first parent widget - // that is subscribed to the gesture. - QGesturePrivate *gd = g->d_func(); - QWidget *w = gd->widget; - gd->widget = 0; - - if (w && !w->isWindow()) { - g->translate(w->pos()); - w = w->parentWidget(); - QPoint offset; - const QString gestureType = g->type(); - while (w) { - if (w->d_func()->hasGesture(gestureType)) { - DEBUG() << "QGestureManager::sendGestureEvent:" << receiver - << "didn't accept gesture" << g << "propagating to" << w; - ignoredGestures.insert(g); - gd->widget = w; - break; - } - if (w->isWindow()) { - w = 0; - break; - } - offset += w->pos(); - w = w->parentWidget(); - } - if (w) { - g->translate(offset); - } else { - DEBUG() << "QGestureManager::sendGestureEvent:" << receiver - << "didn't accept gesture" << g << "and nobody wants it"; - } - } - } - } - } - if (ignoredGestures.isEmpty()) - return ret; - // try to send all gestures that were ignored to the next parent - return sendGestureEvent(0, ignoredGestures, QSet(), cancelled) || ret; -} - -int QGestureManager::eventDeliveryDelay() const -{ - return eventDeliveryDelayTimeout; -} - -void QGestureManager::setEventDeliveryDelay(int ms) -{ - eventDeliveryDelayTimeout = ms; -} - -int QGestureManager::makeGestureId(const QString &name) -{ - gestureIdMap[++lastGestureId] = name; - return lastGestureId; -} - -void QGestureManager::releaseGestureId(int gestureId) -{ - gestureIdMap.remove(gestureId); -} - -QString QGestureManager::gestureNameFromId(int gestureId) const -{ - return gestureIdMap.value(gestureId); -} - -QT_END_NAMESPACE - -#include "moc_qgesturemanager_p.cpp" - diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h deleted file mode 100644 index 8656590..0000000 --- a/src/gui/kernel/qgesturemanager_p.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGESTUREMANAGER_P_H -#define QGESTUREMANAGER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qlist.h" -#include "qset.h" -#include "qevent.h" -#include "qbasictimer.h" -#include "qpointer.h" - -#include "qgesturerecognizer.h" - -QT_BEGIN_NAMESPACE - -class QWidget; -class Q_AUTOTEST_EXPORT QGestureManager : public QObject -{ - Q_OBJECT -public: - QGestureManager(QObject *parent); - - int eventDeliveryDelay() const; - void setEventDeliveryDelay(int ms); - - void addRecognizer(QGestureRecognizer *recognizer); - void removeRecognizer(QGestureRecognizer *recognizer); - - bool filterEvent(QWidget *receiver, QEvent *event); - bool inGestureMode(); - - int makeGestureId(const QString &name); - void releaseGestureId(int gestureId); - QString gestureNameFromId(int gestureId) const; - - // declared in qapplication.cpp - static QGestureManager* instance(); - - bool sendGestureEvent(QWidget *receiver, - const QSet &startedGestures, - const QSet &updatedGestures, - const QSet &cancelled = QSet()); - -protected: - void timerEvent(QTimerEvent *event); - -private slots: - void recognizerStateChanged(QGestureRecognizer::Result); - -private: - QSet activeGestures; - QMap maybeGestures; - QSet recognizers; - - QPoint lastPos; - - int eventDeliveryDelayTimeout; - int delayedPressTimer; - QPointer lastMousePressReceiver; - QMouseEvent lastMousePressEvent; - - QMap gestureIdMap; - int lastGestureId; - - enum State { - Gesture, - NotGesture, - MaybeGesture // that mean timers are up and waiting for some - // more events, and input events are handled by - // gesture recognizer explicitely - } state; -}; - -QT_END_NAMESPACE - -#endif // QGESTUREMANAGER_P_H diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp deleted file mode 100644 index 30889d7..0000000 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgesturerecognizer.h" -#include "qgesture.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -QString qt_getStandardGestureTypeName(Qt::GestureType gestureType); - -/*! - \class QGestureRecognizer - \since 4.6 - - \brief The QGestureRecognizer class is the base class for - implementing custom gestures. - - This is a base class, to create a custom gesture type, you should - subclass it and implement its pure virtual functions. - - Usually gesture recognizer implements state machine, storing its - state internally in the recognizer object. The recognizer receives - input events through the \l{QGestureRecognizer::}{filterEvent()} - virtual function and decides whether the parsed event should - change the state of the recognizer - i.e. if the event starts or - ends a gesture or if it isn't related to gesture at all. -*/ - -/*! - \enum QGestureRecognizer::Result - \since 4.6 - - This enum type defines the state of the gesture recognizer. - - \value Ignore Gesture recognizer ignores the event. - - \value NotGesture Not a gesture. - - \value GestureStarted The continuous gesture has started. When the - recognizer is in this state, a \l{QGestureEvent}{gesture event} - containing QGesture objects returned by the - \l{QGestureRecognizer::}{getGesture()} will be sent to a widget. - - \value GestureFinished The gesture has ended. A - \l{QGestureEvent}{gesture event} will be sent to a widget. - - \value MaybeGesture Gesture recognizer hasn't decided yet if a - gesture has started, but it might start soon after the following - events are received by the recognizer. This means that gesture - manager shouldn't reset() the internal state of the gesture - recognizer. -*/ - -/*! \fn QGestureRecognizer::Result QGestureRecognizer::filterEvent(const QEvent *event) - - This is a pure virtual function that needs to be implemented in - subclasses. - - Parses input \a event and returns the result, which specifies - whether the event sequence is a gesture or not. -*/ - -/*! \fn QGesture* QGestureRecognizer::getGesture() - - Returns a gesture object that will be send to the widget. This - function is called when the gesture recognizer changed its state - to QGestureRecognizer::GestureStarted or - QGestureRecognizer::GestureFinished. - - The returned QGesture object must point to the same object in a - single gesture sequence. - - The gesture object is owned by the recognizer itself. -*/ - -/*! \fn void QGestureRecognizer::reset() - - Resets the internal state of the gesture recognizer. -*/ - -/*! \fn void QGestureRecognizer::stateChanged(QGestureRecognizer::Result result) - - The gesture recognizer might emit the stateChanged() signal when - the gesture state changes asynchronously, i.e. without any event - being filtered through filterEvent(). \a result specifies whether - the event sequence is a gesture or not. -*/ - -QGestureRecognizerPrivate::QGestureRecognizerPrivate() - : gestureType(Qt::UnknownGesture) -{ -} - -/*! - Creates a new gesture recognizer object that handles gestures of - the specific \a gestureType as a child of \a parent. - - \sa QApplication::addGestureRecognizer(), - QApplication::removeGestureRecognizer(), -*/ -QGestureRecognizer::QGestureRecognizer(const QString &gestureType, QObject *parent) - : QObject(*new QGestureRecognizerPrivate, parent) -{ - Q_D(QGestureRecognizer); - d->customGestureType = gestureType; -} - -/*! - Returns the name of the gesture that is handled by the recognizer. -*/ -QString QGestureRecognizer::gestureType() const -{ - Q_D(const QGestureRecognizer); - if (d->gestureType == Qt::UnknownGesture) - return d->customGestureType; - return qt_getStandardGestureTypeName(d->gestureType); -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h deleted file mode 100644 index 2c1c61b..0000000 --- a/src/gui/kernel/qgesturerecognizer.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGESTURERECOGNIZER_H -#define QGESTURERECOGNIZER_H - -#include "qevent.h" -#include "qlist.h" -#include "qset.h" - -QT_BEGIN_NAMESPACE - -class QGesture; -class QGestureRecognizerPrivate; -class Q_GUI_EXPORT QGestureRecognizer : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QGestureRecognizer) - -public: - enum Result - { - Ignore, - NotGesture, - GestureStarted, //TODO: rename to just Gesture? - GestureFinished, - MaybeGesture - }; - - explicit QGestureRecognizer(const QString &gestureType, QObject *parent = 0); - - QString gestureType() const; - - virtual QGestureRecognizer::Result filterEvent(const QEvent* event) = 0; - virtual QGesture* getGesture() = 0; - virtual void reset() = 0; - -signals: - void stateChanged(QGestureRecognizer::Result result); - -private: - friend class QDoubleTapGestureRecognizer; - friend class QTapAndHoldGestureRecognizer; - friend class QGestureRecognizerPan; -}; - -QT_END_NAMESPACE - -#endif // QGESTURERECOGNIZER_P_H diff --git a/src/gui/kernel/qgesturerecognizer_p.h b/src/gui/kernel/qgesturerecognizer_p.h deleted file mode 100644 index e250201..0000000 --- a/src/gui/kernel/qgesturerecognizer_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGESTURERECOGNIZER_P_H -#define QGESTURERECOGNIZER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QGestureRecognizerPrivate : public QObjectPrivate -{ -public: - QGestureRecognizerPrivate(); - -public: - Qt::GestureType gestureType; - QString customGestureType; -}; - -QT_END_NAMESPACE - -#endif // QGESTURERECOGNIZER_P_H diff --git a/src/gui/kernel/qgesturestandardrecognizers.cpp b/src/gui/kernel/qgesturestandardrecognizers.cpp deleted file mode 100644 index b108994..0000000 --- a/src/gui/kernel/qgesturestandardrecognizers.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgesturestandardrecognizers_p.h" -#include "qgesture_p.h" -#include "qgesturerecognizer_p.h" - -// #define GESTURE_RECOGNIZER_DEBUG -#ifndef GESTURE_RECOGNIZER_DEBUG -# define DEBUG if (0) qDebug -#else -# define DEBUG qDebug -#endif - -QT_BEGIN_NAMESPACE - -QString qt_getStandardGestureTypeName(Qt::GestureType gestureType) -{ - switch (gestureType) { - case Qt::TapGesture: - return QLatin1String("__QTapGesture"); - case Qt::DoubleTapGesture: - return QLatin1String("__QDoubleTapGesture"); - case Qt::TrippleTapGesture: - return QLatin1String("__QTrippleTapGesture"); - case Qt::TapAndHoldGesture: - return QLatin1String("__QTapAndHoldGesture"); - case Qt::PanGesture: - return QLatin1String("__QPanGesture"); - case Qt::PinchGesture: - return QLatin1String("__QPinchGesture"); - case Qt::UnknownGesture: - break; - } - qFatal("QGestureRecognizer::gestureType: got an unhandled gesture type."); - return QLatin1String("__unknown_gesture"); -} - -// -// QGestureRecognizerPan -// - -QGestureRecognizerPan::QGestureRecognizerPan(QObject *parent) - : QGestureRecognizer(QString(), parent), - mousePressed(false), gestureState(Qt::NoGesture), - lastDirection(Qt::NoDirection), currentDirection(Qt::NoDirection) -{ - Q_D(QGestureRecognizer); - d->gestureType = Qt::PanGesture; -} - -QGestureRecognizer::Result QGestureRecognizerPan::filterEvent(const QEvent *event) -{ - if (event->type() == QEvent::MouseButtonPress) { - const QMouseEvent *ev = static_cast(event); - if (currentDirection != Qt::NoDirection) { - DEBUG() << "Pan: MouseButtonPress: fail. another press during pan"; - reset(); - return QGestureRecognizer::NotGesture; - } - if (ev->button() != Qt::LeftButton) { - return QGestureRecognizer::NotGesture; - } - DEBUG() << "Pan: MouseButtonPress: maybe gesture started"; - mousePressed = true; - pressedPos = lastPos = currentPos = ev->pos(); - return QGestureRecognizer::MaybeGesture; - } else if (event->type() == QEvent::MouseButtonRelease) { - const QMouseEvent *ev = static_cast(event); - if (mousePressed && currentDirection != Qt::NoDirection - && ev->button() == Qt::LeftButton) { - DEBUG() << "Pan: MouseButtonRelease: pan detected"; - gestureState = Qt::GestureFinished; - currentPos = ev->pos(); - internalReset(); - return QGestureRecognizer::GestureFinished; - } - DEBUG() << "Pan: MouseButtonRelease: some weird release detected, ignoring"; - reset(); - return QGestureRecognizer::NotGesture; - } else if (event->type() == QEvent::MouseMove) { - if (!mousePressed) - return QGestureRecognizer::NotGesture; - const QMouseEvent *ev = static_cast(event); - lastPos = currentPos; - currentPos = ev->pos(); - Qt::DirectionType newDirection = - simpleRecognizer.addPosition(ev->pos()).direction; - DEBUG() << "Pan: MouseMove: simplerecognizer result = " << newDirection; - QGestureRecognizer::Result result = QGestureRecognizer::NotGesture; - if (currentDirection == Qt::NoDirection) { - if (newDirection == Qt::NoDirection) { - result = QGestureRecognizer::MaybeGesture; - } else { - result = QGestureRecognizer::GestureStarted; - gestureState = Qt::GestureStarted; - } - } else { - result = QGestureRecognizer::GestureStarted; - gestureState = Qt::GestureUpdated; - } - if (newDirection != Qt::NoDirection) { - if (currentDirection != newDirection) - lastDirection = currentDirection; - currentDirection = newDirection; - } - return result; - } - return QGestureRecognizer::Ignore; -} - -QGesture* QGestureRecognizerPan::getGesture() -{ - if (currentDirection == Qt::NoDirection) - return 0; - QPanningGesturePrivate *d = gesture.d_func(); - d->startPos = pressedPos; - d->lastPos = lastPos; - d->pos = currentPos; - d->hotSpot = pressedPos; - d->state = gestureState; - d->lastDirection = lastDirection; - d->direction = currentDirection; - - return &gesture; -} - -void QGestureRecognizerPan::reset() -{ - mousePressed = false; - lastDirection = Qt::NoDirection; - currentDirection = Qt::NoDirection; - gestureState = Qt::NoGesture; - diagonalRecognizer.reset(); - simpleRecognizer.reset(); -} - -void QGestureRecognizerPan::internalReset() -{ - mousePressed = false; - diagonalRecognizer.reset(); - simpleRecognizer.reset(); -} - - -// -// QDoubleTapGestureRecognizer -// -QDoubleTapGestureRecognizer::QDoubleTapGestureRecognizer(QObject *parent) - : QGestureRecognizer(QString(), parent), - gesture(0, qt_getStandardGestureTypeName(Qt::DoubleTapGesture)) -{ - Q_D(QGestureRecognizer); - d->gestureType = Qt::DoubleTapGesture; -} - -QGestureRecognizer::Result QDoubleTapGestureRecognizer::filterEvent(const QEvent *event) -{ - if (event->type() == QEvent::MouseButtonPress) { - const QMouseEvent *ev = static_cast(event); - if (pressedPosition.isNull()) { - pressedPosition = ev->pos(); - return QGestureRecognizer::MaybeGesture; - } else if ((pressedPosition - ev->pos()).manhattanLength() < 10) { - return QGestureRecognizer::GestureFinished; - } - return QGestureRecognizer::NotGesture; - } else if (event->type() == QEvent::MouseButtonRelease) { - const QMouseEvent *ev = static_cast(event); - if (!pressedPosition.isNull() && (pressedPosition - ev->pos()).manhattanLength() < 10) - return QGestureRecognizer::MaybeGesture; - return QGestureRecognizer::NotGesture; - } else if (event->type() == QEvent::MouseButtonDblClick) { - const QMouseEvent *ev = static_cast(event); - pressedPosition = ev->pos(); - return QGestureRecognizer::GestureFinished; - } - return QGestureRecognizer::NotGesture; -} - -QGesture* QDoubleTapGestureRecognizer::getGesture() -{ - QGesturePrivate *d = gesture.d_func(); - d->startPos = pressedPosition; - d->lastPos = pressedPosition; - d->pos = pressedPosition; - d->hotSpot = pressedPosition; - d->state = Qt::GestureFinished; - return &gesture; -} - -void QDoubleTapGestureRecognizer::reset() -{ - pressedPosition = QPoint(); -} - -// -// QTapAndHoldGestureRecognizer -// -const int QTapAndHoldGestureRecognizer::iterationCount = 40; -const int QTapAndHoldGestureRecognizer::iterationTimeout = 50; - -QTapAndHoldGestureRecognizer::QTapAndHoldGestureRecognizer(QObject *parent) - : QGestureRecognizer(QString(), parent), - gesture(0, qt_getStandardGestureTypeName(Qt::TapAndHoldGesture)), - iteration(0) -{ - Q_D(QGestureRecognizer); - d->gestureType = Qt::TapAndHoldGesture; -} - -QGestureRecognizer::Result QTapAndHoldGestureRecognizer::filterEvent(const QEvent *event) -{ - if (event->type() == QEvent::MouseButtonPress) { - const QMouseEvent *ev = static_cast(event); - if (timer.isActive()) - timer.stop(); - timer.start(QTapAndHoldGestureRecognizer::iterationTimeout, this); - pressedPosition = ev->pos(); - return QGestureRecognizer::MaybeGesture; - } else if (event->type() == QEvent::MouseMove) { - const QMouseEvent *ev = static_cast(event); - if ((pressedPosition - ev->pos()).manhattanLength() < 15) - return QGestureRecognizer::GestureStarted; - else - return QGestureRecognizer::NotGesture; - } else if (event->type() == QEvent::MouseButtonRelease) { - timer.stop(); - return QGestureRecognizer::NotGesture; - } - return QGestureRecognizer::Ignore; -} - -void QTapAndHoldGestureRecognizer::timerEvent(QTimerEvent *event) -{ - if (event->timerId() != timer.timerId()) - return; - if (iteration == QTapAndHoldGestureRecognizer::iterationCount) { - timer.stop(); - emit stateChanged(QGestureRecognizer::GestureFinished); - } else { - emit stateChanged(QGestureRecognizer::GestureStarted); - } - ++iteration; -} - -QGesture* QTapAndHoldGestureRecognizer::getGesture() -{ - QGesturePrivate *d = gesture.d_func(); - d->startPos = pressedPosition; - d->lastPos = pressedPosition; - d->pos = pressedPosition; - d->hotSpot = pressedPosition; - if (iteration >= QTapAndHoldGestureRecognizer::iterationCount) - d->state = Qt::GestureFinished; - else - d->state = iteration == 0 ? Qt::GestureStarted : Qt::GestureUpdated; - return &gesture; -} - -void QTapAndHoldGestureRecognizer::reset() -{ - pressedPosition = QPoint(); - timer.stop(); - iteration = 0; -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturestandardrecognizers_p.h b/src/gui/kernel/qgesturestandardrecognizers_p.h deleted file mode 100644 index 8abc1fb..0000000 --- a/src/gui/kernel/qgesturestandardrecognizers_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGESTURESTANDARDRECOGNIZERS_P_H -#define QGESTURESTANDARDRECOGNIZERS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qevent.h" -#include "qbasictimer.h" -#include "qdebug.h" - -#include "qgesture.h" -#include "qgesturerecognizer.h" -#include "private/qdirectionrecognizer_p.h" - -QT_BEGIN_NAMESPACE - -class QGestureRecognizerPan : public QGestureRecognizer -{ - Q_OBJECT -public: - QGestureRecognizerPan(QObject *parent); - - QGestureRecognizer::Result filterEvent(const QEvent *event); - QGesture* getGesture(); - void reset(); - -private: - void internalReset(); - - QPanningGesture gesture; - - QPoint pressedPos; - QPoint lastPos; - QPoint currentPos; - bool mousePressed; - Qt::GestureState gestureState; - Qt::DirectionType lastDirection; - Qt::DirectionType currentDirection; - QDirectionDiagonalRecognizer diagonalRecognizer; - QDirectionSimpleRecognizer simpleRecognizer; -}; - -class QDoubleTapGestureRecognizer : public QGestureRecognizer -{ - Q_OBJECT -public: - QDoubleTapGestureRecognizer(QObject *parent); - - QGestureRecognizer::Result filterEvent(const QEvent *event); - QGesture* getGesture(); - void reset(); - -private: - QGesture gesture; - QPoint pressedPosition; -}; - -class QTapAndHoldGestureRecognizer : public QGestureRecognizer -{ - Q_OBJECT -public: - QTapAndHoldGestureRecognizer(QObject *parent); - - QGestureRecognizer::Result filterEvent(const QEvent *event); - QGesture* getGesture(); - void reset(); - -protected: - void timerEvent(QTimerEvent *event); - -private: - QGesture gesture; - QPoint pressedPosition; - QBasicTimer timer; - int iteration; - static const int iterationCount; - static const int iterationTimeout; -}; - -QT_END_NAMESPACE - -#endif // QGESTURESTANDARDRECOGNIZERS_P_H diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp new file mode 100644 index 0000000..c8b11c5 --- /dev/null +++ b/src/gui/kernel/qstandardgestures.cpp @@ -0,0 +1,254 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qstandardgestures.h" +#include "qstandardgestures_p.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QPanGesture + \since 4.6 + + \brief The QPanGesture class represents a Pan gesture, + providing additional information related to panning. +*/ + +/*! + Creates a new Pan gesture handler object and marks it as a child of \a + parent. + + On some platform like Windows it's necessary to provide a non-null widget + as \a parent to get native gesture support. +*/ +QPanGesture::QPanGesture(QWidget *parent) + : QGesture(*new QPanGesturePrivate, parent) +{ +#ifdef Q_WS_WIN + if (parent) { + QApplicationPrivate* getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + qAppPriv->widgetGestures[parent].pan = this; + } +#endif +} + +/*! \internal */ +bool QPanGesture::event(QEvent *event) +{ +#ifdef Q_WS_WIN + QApplicationPrivate* getQApplicationPrivateInternal(); + switch (event->type()) { + case QEvent::ParentAboutToChange: + if (QWidget *w = qobject_cast(parent())) + getQApplicationPrivateInternal()->widgetGestures[w].pan = 0; + break; + case QEvent::ParentChange: + if (QWidget *w = qobject_cast(parent())) + getQApplicationPrivateInternal()->widgetGestures[w].pan = this; + break; + default: + break; + } +#endif + return QObject::event(event); +} + +/*! \internal */ +bool QPanGesture::filterEvent(QEvent *event) +{ + Q_D(QPanGesture); + if (!event->spontaneous()) + return false; + const QTouchEvent *ev = static_cast(event); + if (event->type() == QEvent::TouchBegin) { + d->touchPoints = ev->touchPoints(); + const QPoint p = ev->touchPoints().at(0).pos().toPoint(); + setStartPos(p); + setLastPos(p); + setPos(p); + return false; + } else if (event->type() == QEvent::TouchEnd) { + if (state() != Qt::NoGesture) { + setState(Qt::GestureFinished); + setLastPos(pos()); + setPos(ev->touchPoints().at(0).pos().toPoint()); + emit triggered(); + emit finished(); + } + setState(Qt::NoGesture); + reset(); + } else if (event->type() == QEvent::TouchUpdate) { + d->touchPoints = ev->touchPoints(); + QPointF pt = d->touchPoints.at(0).pos() - d->touchPoints.at(0).startPos(); + setLastPos(pos()); + setPos(ev->touchPoints().at(0).pos().toPoint()); + if (pt.x() > 10 || pt.y() > 10 || pt.x() < -10 || pt.y() < -10) { + if (state() == Qt::NoGesture) + setState(Qt::GestureStarted); + else + setState(Qt::GestureUpdated); + emit triggered(); + } + } + return false; +} + +/*! \internal */ +void QPanGesture::reset() +{ + Q_D(QPanGesture); + d->touchPoints.clear(); +} + +/*! + \property QPanGesture::totalOffset + + Specifies a total pan offset since the start of the gesture. +*/ +QSize QPanGesture::totalOffset() const +{ + QPoint pt = pos() - startPos(); + return QSize(pt.x(), pt.y()); +} + +/*! + \property QPanGesture::lastOffset + + Specifies a pan offset since the last time the gesture was + triggered. +*/ +QSize QPanGesture::lastOffset() const +{ + QPoint pt = pos() - lastPos(); + return QSize(pt.x(), pt.y()); +} + +/*! + \class QTapAndHoldGesture + \since 4.6 + + \brief The QTapAndHoldGesture class represents a Tap-and-Hold gesture, + providing additional information. +*/ + +const int QTapAndHoldGesturePrivate::iterationCount = 40; +const int QTapAndHoldGesturePrivate::iterationTimeout = 50; + +/*! + Creates a new Tap and Hold gesture handler object and marks it as a child + of \a parent. + + On some platforms like Windows there is a system-wide tap and hold gesture + that cannot be overriden, hence the gesture might never trigger and default + context menu will be shown instead. +*/ +QTapAndHoldGesture::QTapAndHoldGesture(QWidget *parent) + : QGesture(*new QTapAndHoldGesturePrivate, parent) +{ +} + +/*! \internal */ +bool QTapAndHoldGesture::filterEvent(QEvent *event) +{ + Q_D(QTapAndHoldGesture); + if (!event->spontaneous()) + return false; + const QTouchEvent *ev = static_cast(event); + switch (event->type()) { + case QEvent::TouchBegin: { + if (d->timer.isActive()) + d->timer.stop(); + d->timer.start(QTapAndHoldGesturePrivate::iterationTimeout, this); + const QPoint p = ev->touchPoints().at(0).pos().toPoint(); + setStartPos(p); + setLastPos(p); + setPos(p); + break; + } + case QEvent::TouchUpdate: + if (ev->touchPoints().size() != 1) + reset(); + else if ((startPos() - ev->touchPoints().at(0).pos().toPoint()).manhattanLength() > 15) + reset(); + break; + case QEvent::TouchEnd: + reset(); + break; + default: + break; + } + return false; +} + +/*! \internal */ +void QTapAndHoldGesture::timerEvent(QTimerEvent *event) +{ + Q_D(QTapAndHoldGesture); + if (event->timerId() != d->timer.timerId()) + return; + if (d->iteration == QTapAndHoldGesturePrivate::iterationCount) { + d->timer.stop(); + setState(Qt::GestureFinished); + emit triggered(); + } else { + setState(Qt::GestureStarted); + emit triggered(); + } + ++d->iteration; +} + +/*! \internal */ +void QTapAndHoldGesture::reset() +{ + Q_D(QTapAndHoldGesture); + if (state() != Qt::NoGesture) + emit cancelled(); + setState(Qt::NoGesture); + d->timer.stop(); + d->iteration = 0; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h new file mode 100644 index 0000000..db96ef6 --- /dev/null +++ b/src/gui/kernel/qstandardgestures.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTANDARDGESTURES_H +#define QSTANDARDGESTURES_H + +#include "qevent.h" +#include "qbasictimer.h" +#include "qdebug.h" + +#include "qgesture.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPanGesturePrivate; +class Q_GUI_EXPORT QPanGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QPanGesture) + + Q_PROPERTY(QSize totalOffset READ totalOffset) + Q_PROPERTY(QSize lastOffset READ lastOffset) + +public: + QPanGesture(QWidget *parent); + + bool filterEvent(QEvent *event); + void reset(); + + QSize totalOffset() const; + QSize lastOffset() const; + +protected: + bool event(QEvent *event); + +private: + friend class QWidget; +}; + +class QTapAndHoldGesturePrivate; +class Q_GUI_EXPORT QTapAndHoldGesture : public QGesture +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTapAndHoldGesture) + +public: + QTapAndHoldGesture(QWidget *parent); + + bool filterEvent(QEvent *event); + void reset(); + +protected: + void timerEvent(QTimerEvent *event); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTANDARDGESTURES_H diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h new file mode 100644 index 0000000..bb11c9f --- /dev/null +++ b/src/gui/kernel/qstandardgestures_p.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTANDARDGESTURES_P_H +#define QSTANDARDGESTURES_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qevent.h" +#include "qbasictimer.h" +#include "qdebug.h" + +#include "qgesture.h" +#include "qgesture_p.h" + +QT_BEGIN_NAMESPACE + +class QPanGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QPanGesture) + +public: + QPanGesturePrivate() { } + + QList touchPoints; +}; + +class QTapAndHoldGesturePrivate : public QGesturePrivate +{ + Q_DECLARE_PUBLIC(QTapAndHoldGesture) + +public: + QTapAndHoldGesturePrivate() + : iteration(0) { } + + QBasicTimer timer; + int iteration; + static const int iterationCount; + static const int iterationTimeout; +}; + +QT_END_NAMESPACE + +#endif // QSTANDARDGESTURES_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9a834aa..611cb44 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -82,6 +82,8 @@ #include "private/qstyle_p.h" #include "private/qinputcontext_p.h" #include "qfileinfo.h" +#include "qstandardgestures.h" +#include "qstandardgestures_p.h" #if defined (Q_WS_WIN) # include @@ -107,9 +109,9 @@ #include "private/qgraphicsproxywidget_p.h" #include "QtGui/qabstractscrollarea.h" #include "private/qabstractscrollarea_p.h" +#include "private/qevent_p.h" #include "private/qgraphicssystem_p.h" -#include "private/qgesturemanager_p.h" // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG @@ -128,8 +130,6 @@ Q_GUI_EXPORT void qt_x11_set_global_double_buffer(bool enable) } #endif -QString qt_getStandardGestureTypeName(Qt::GestureType); - static inline bool qRectIntersects(const QRect &r1, const QRect &r2) { return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) && @@ -7484,8 +7484,6 @@ bool QWidget::event(QEvent *event) #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: #endif - case QEvent::Gesture: - return false; default: break; } @@ -7880,9 +7878,6 @@ bool QWidget::event(QEvent *event) d->needWindowChange = false; break; #endif - case QEvent::Gesture: - event->ignore(); - break; case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: @@ -7920,6 +7915,59 @@ bool QWidget::event(QEvent *event) (void) QApplication::sendEvent(this, &mouseEvent); break; } +#ifdef Q_WS_WIN + case QEvent::WinGesture: { + QWinGestureEvent *ev = static_cast(event); + QApplicationPrivate *qAppPriv = qApp->d_func(); + QApplicationPrivate::WidgetStandardGesturesMap::iterator it; + it = qAppPriv->widgetGestures.find(this); + if (it != qAppPriv->widgetGestures.end()) { + Qt::GestureState state = Qt::GestureUpdated; + if (qAppPriv->lastGestureId == 0) + state = Qt::GestureStarted; + QWinGestureEvent::Type type = ev->gestureType; + if (ev->gestureType == QWinGestureEvent::GestureEnd) { + type = (QWinGestureEvent::Type)qAppPriv->lastGestureId; + state = Qt::GestureFinished; + } + + QGesture *gesture = 0; + switch (type) { + case QWinGestureEvent::Pan: { + QPanGesture *pan = it.value().pan; + gesture = pan; + if (state == Qt::GestureStarted) { + gesture->setStartPos(ev->position); + gesture->setLastPos(ev->position); + } else { + gesture->setLastPos(gesture->pos()); + } + gesture->setPos(ev->position); + break; + } + case QWinGestureEvent::Pinch: + break; + default: + break; + } + if (gesture) { + gesture->setState(state); + if (state == Qt::GestureStarted) + emit gesture->started(); + emit gesture->triggered(); + if (state == Qt::GestureFinished) + emit gesture->finished(); + event->accept(); + } + if (ev->gestureType == QWinGestureEvent::GestureEnd) { + qAppPriv->lastGestureId = 0; + } else { + qAppPriv->lastGestureId = type; + } + } + break; + } +#endif #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: { const QByteArray &propName = static_cast(event)->propertyName(); @@ -11016,105 +11064,6 @@ QWindowSurface *QWidget::windowSurface() const return bs ? bs->windowSurface : 0; } -/*! - \since 4.6 - - Subscribes the widget to the specified \a gesture type. - - Returns the id of the gesture. - - \sa releaseGesture(), setGestureEnabled() -*/ -int QWidget::grabGesture(const QString &gesture) -{ - Q_D(QWidget); - int id = d->grabGesture(QGestureManager::instance()->makeGestureId(gesture)); - if (d->extra && d->extra->proxyWidget) - d->extra->proxyWidget->QGraphicsItem::d_ptr->grabGesture(id); - return id; -} - -int QWidgetPrivate::grabGesture(int gestureId) -{ - gestures << gestureId; - ++qApp->d_func()->grabbedGestures[QGestureManager::instance()->gestureNameFromId(gestureId)]; - return gestureId; -} - -bool QWidgetPrivate::releaseGesture(int gestureId) -{ - QApplicationPrivate *qAppPriv = qApp->d_func(); - if (gestures.contains(gestureId)) { - QString name = QGestureManager::instance()->gestureNameFromId(gestureId); - Q_ASSERT(qAppPriv->grabbedGestures[name] > 0); - --qAppPriv->grabbedGestures[name]; - gestures.remove(gestureId); - return true; - } - return false; -} - -bool QWidgetPrivate::hasGesture(const QString &name) const -{ - QGestureManager *gm = QGestureManager::instance(); - QSet::const_iterator it = gestures.begin(), - e = gestures.end(); - for (; it != e; ++it) { - if (gm->gestureNameFromId(*it) == name) - return true; - } - return false; -} - -/*! - \since 4.6 - - Subscribes the widget to the specified \a gesture type. - - Returns the id of the gesture. - - \sa releaseGesture(), setGestureEnabled() -*/ -int QWidget::grabGesture(Qt::GestureType gesture) -{ - return grabGesture(qt_getStandardGestureTypeName(gesture)); -} - -/*! - \since 4.6 - - Unsubscribes the widget from a gesture, which is specified by the - \a gestureId. - - \sa grabGesture(), setGestureEnabled() -*/ -void QWidget::releaseGesture(int gestureId) -{ - Q_D(QWidget); - if (d->releaseGesture(gestureId)) { - if (d->extra && d->extra->proxyWidget) - d->extra->proxyWidget->QGraphicsItem::d_ptr->releaseGesture(gestureId); - QGestureManager::instance()->releaseGestureId(gestureId); - } -} - -/*! - \since 4.6 - - If \a enable is true, the gesture with the given \a gestureId is - enabled; otherwise the gesture is disabled. - - The id of the gesture is returned by the grabGesture(). - - \sa grabGesture(), releaseGesture() -*/ -void QWidget::setGestureEnabled(int gestureId, bool enable) -{ - Q_UNUSED(gestureId); - Q_UNUSED(enable); - //### -} - void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const { if (left) diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 1667275..bc9952c 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -90,7 +90,6 @@ class QDragLeaveEvent; class QDropEvent; class QShowEvent; class QHideEvent; -class QGestureEvent; class QInputContext; class QIcon; class QWindowSurface; @@ -612,11 +611,6 @@ public: void setWindowSurface(QWindowSurface *surface); QWindowSurface *windowSurface() const; - int grabGesture(const QString &gesture); - int grabGesture(Qt::GestureType gesture); - void releaseGesture(int gestureId); - void setGestureEnabled(int gestureId, bool enable = true); - Q_SIGNALS: void customContextMenuRequested(const QPoint &pos); @@ -752,7 +746,6 @@ private: friend bool isWidgetOpaque(const QWidget *); friend class QGLWidgetPrivate; #endif - friend class QGestureManager; #ifdef Q_WS_X11 friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp); friend void qt_net_remove_user_time(QWidget *tlw); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 7385e83..626950e 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -523,11 +523,6 @@ public: QList actions; #endif - QSet gestures; - int grabGesture(int gestureId); - bool releaseGesture(int gestureId); - bool hasGesture(const QString &type) const; - // Bit fields. uint high_attributes[3]; // the low ones are in QWidget::widget_attributes QPalette::ColorRole fg_role : 8; diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index e1beb98..66572b8 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -51,10 +51,13 @@ #include "qdebug.h" #include "qboxlayout.h" #include "qpainter.h" +#include "qstandardgestures.h" #include "qabstractscrollarea_p.h" #include +#include + #ifdef Q_WS_MAC #include #include @@ -157,6 +160,9 @@ QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), xoffset(0), yoffset(0), viewportFilter(0) +#ifdef Q_WS_WIN + , singleFingerPanEnabled(false) +#endif { } @@ -290,6 +296,31 @@ void QAbstractScrollAreaPrivate::init() layoutChildren(); } +void QAbstractScrollAreaPrivate::setupGestures() +{ +#ifdef Q_OS_WIN + if (!viewport) + return; + QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn + || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); + + bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn + || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); + if (qAppPriv->SetGestureConfig && (needh || needv)) { + GESTURECONFIG gc[1]; + gc[0].dwID = GID_PAN; + gc[0].dwWant = GC_PAN; + gc[0].dwBlock = 0; + if (needv && singleFingerPanEnabled) + gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; + if (needh && singleFingerPanEnabled) + gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; + qAppPriv->SetGestureConfig(viewport->winId(), 0, 1, gc, sizeof(gc)); + } +#endif // Q_OS_WIN +} + void QAbstractScrollAreaPrivate::layoutChildren() { Q_Q(QAbstractScrollArea); @@ -909,8 +940,6 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::DragMove: case QEvent::DragLeave: #endif - case QEvent::Gesture: - return false; case QEvent::StyleChange: case QEvent::LayoutDirectionChange: case QEvent::ApplicationLayoutDirectionChange: @@ -1239,6 +1268,7 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); + setupGestures(); } QPoint QAbstractScrollAreaPrivate::contentsOffset() const diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 71a83cc..5d3494b 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -99,6 +99,11 @@ public: inline bool viewportEvent(QEvent *event) { return q_func()->viewportEvent(event); } QObject *viewportFilter; + +#ifdef Q_WS_WIN + bool singleFingerPanEnabled; +#endif + void setupGestures(); }; class QAbstractScrollAreaFilter : public QObject diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index bab6b89..c9d1d6e 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -66,6 +66,8 @@ #include #include +#include + #include #ifndef QT_NO_TEXTEDIT @@ -726,6 +728,9 @@ QPlainTextEditPrivate::QPlainTextEditPrivate() backgroundVisible = false; centerOnScroll = false; inDrag = false; +#ifdef Q_WS_WIN + singleFingerPanEnabled = true; +#endif } @@ -781,6 +786,9 @@ void QPlainTextEditPrivate::init(const QString &txt) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif + originalOffsetY = 0; + panGesture = new QPanGesture(q); + QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); } void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -2899,6 +2907,30 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons (\a available is true) or unavailable (\a available is false). */ +void QPlainTextEditPrivate::_q_gestureTriggered() +{ + Q_Q(QPlainTextEdit); + QPanGesture *g = qobject_cast(q->sender()); + if (!g) + return; + QScrollBar *hBar = q->horizontalScrollBar(); + QScrollBar *vBar = q->verticalScrollBar(); + if (g->state() == Qt::GestureStarted) + originalOffsetY = vBar->value(); + QSize totalOffset = g->totalOffset(); + if (!totalOffset.isNull()) { + if (QApplication::isRightToLeft()) + totalOffset.rwidth() *= -1; + // QPlainTextEdit scrolls by lines only in vertical direction + QFontMetrics fm(q->document()->defaultFont()); + int lineHeight = fm.height(); + int newX = hBar->value() - g->lastOffset().width(); + int newY = originalOffsetY - totalOffset.height()/lineHeight; + hbar->setValue(newX); + vbar->setValue(newY); + } +} + QT_END_NAMESPACE #include "moc_qplaintextedit.cpp" diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h index dc0851b..35bbc37 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/gui/widgets/qplaintextedit.h @@ -269,6 +269,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) Q_PRIVATE_SLOT(d_func(), void _q_verticalScrollbarActionTriggered(int)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) friend class QPlainTextEditControl; }; diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h index 5075fc4..ae584e0 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/gui/widgets/qplaintextedit_p.h @@ -72,6 +72,7 @@ class QMimeData; class QPlainTextEdit; class ExtraArea; +class QPanGesture; class QPlainTextEditControl : public QTextControl { @@ -173,6 +174,10 @@ public: void _q_cursorPositionChanged(); void _q_modificationChanged(bool); + + void _q_gestureTriggered(); + int originalOffsetY; + QPanGesture *panGesture; }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index c8d8d04..e80df92 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -67,6 +67,8 @@ #include #include +#include + #include #endif @@ -111,6 +113,9 @@ QTextEditPrivate::QTextEditPrivate() preferRichText = false; showCursorOnInitialShow = true; inDrag = false; +#ifdef Q_WS_WIN + singleFingerPanEnabled = true; +#endif } void QTextEditPrivate::createAutoBulletList() @@ -178,6 +183,8 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif + panGesture = new QPanGesture(q); + QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -2610,6 +2617,25 @@ void QTextEdit::ensureCursorVisible() d->control->ensureCursorVisible(); } +void QTextEditPrivate::_q_gestureTriggered() +{ + Q_Q(QTextEdit); + QPanGesture *g = qobject_cast(q->sender()); + if (!g) + return; + QScrollBar *hBar = q->horizontalScrollBar(); + QScrollBar *vBar = q->verticalScrollBar(); + QPoint delta = g->pos() - (g->lastPos().isNull() ? g->pos() : g->lastPos()); + if (!delta.isNull()) { + if (QApplication::isRightToLeft()) + delta.rx() *= -1; + int newX = hBar->value() - delta.x(); + int newY = vBar->value() - delta.y(); + hbar->setValue(newX); + vbar->setValue(newY); + } +} + /*! \enum QTextEdit::KeyboardAction diff --git a/src/gui/widgets/qtextedit.h b/src/gui/widgets/qtextedit.h index 617822a..9e10e07 100644 --- a/src/gui/widgets/qtextedit.h +++ b/src/gui/widgets/qtextedit.h @@ -414,6 +414,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &)) Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &)) + Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) friend class QTextEditControl; friend class QTextDocument; friend class QTextControl; diff --git a/src/gui/widgets/qtextedit_p.h b/src/gui/widgets/qtextedit_p.h index e7609d6..249331e 100644 --- a/src/gui/widgets/qtextedit_p.h +++ b/src/gui/widgets/qtextedit_p.h @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTEDIT class QMimeData; - +class QPanGesture; class QTextEditPrivate : public QAbstractScrollAreaPrivate { Q_DECLARE_PUBLIC(QTextEdit) @@ -129,6 +129,9 @@ public: QString anchorToScrollToWhenVisible; + void _q_gestureTriggered(); + QPanGesture *panGesture; + #ifdef QT_KEYPAD_NAVIGATION QBasicTimer deleteAllTimer; #endif diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 6d3bc0a..d2ef64a 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -140,6 +140,13 @@ struct GestureState last.secondfinger.lastPoint = TouchPoint(); last.secondfinger.point = TouchPoint(); last.secondfinger.offset = QPoint(); + last.pan.delivered = false; + last.pan.startPoints[0] = TouchPoint(); + last.pan.startPoints[1] = TouchPoint(); + last.pan.lastPoints[0] = TouchPoint(); + last.pan.lastPoints[1] = TouchPoint(); + last.pan.points[0] = TouchPoint(); + last.pan.points[1] = TouchPoint(); last.cancelled.clear(); } }; @@ -760,7 +767,8 @@ void tst_Gestures::simpleGraphicsItem() scene.addItem(item); QApplication::processEvents(); - SingleshotEvent event(50, 80); + QPoint pt = view.mapFromScene(item->mapToScene(30, 30)); + SingleshotEvent event(pt.x(), pt.y()); sendSpontaneousEvent(&view, &event); QVERIFY(item->gesture.seenGestureEvent); QVERIFY(scene.gesture.seenGestureEvent); @@ -771,7 +779,9 @@ void tst_Gestures::simpleGraphicsItem() mainWidget->reset(); item->shouldAcceptSingleshotGesture = false; - SingleshotEvent event2(20, 40); + // outside of the graphicsitem + pt = view.mapFromScene(item->mapToScene(-10, -10)); + SingleshotEvent event2(pt.x(), pt.y()); sendSpontaneousEvent(&view, &event2); QVERIFY(!item->gesture.seenGestureEvent); QVERIFY(scene.gesture.seenGestureEvent); @@ -790,9 +800,11 @@ void tst_Gestures::overlappingGraphicsItems() scene.addItem(item); GraphicsItem *subitem1 = new GraphicsItem(50, 70); subitem1->setPos(70, 70); + subitem1->setZValue(1); scene.addItem(subitem1); GraphicsItem *subitem2 = new GraphicsItem(50, 70); subitem2->setPos(250, 70); + subitem2->setZValue(1); scene.addItem(subitem2); QApplication::processEvents(); @@ -802,13 +814,14 @@ void tst_Gestures::overlappingGraphicsItems() subitem1->grabSingleshotGesture(); subitem2->grabSecondFingerGesture(); - SingleshotEvent event(100, 100); + QPoint pt = view.mapFromScene(subitem1->mapToScene(20, 20)); + SingleshotEvent event(pt.x(), pt.y()); sendSpontaneousEvent(&view, &event); - QVERIFY(subitem1->gesture.seenGestureEvent); + QVERIFY(scene.gesture.seenGestureEvent); QVERIFY(!subitem2->gesture.seenGestureEvent); QVERIFY(!item->gesture.seenGestureEvent); - QVERIFY(scene.gesture.seenGestureEvent); QVERIFY(!mainWidget->gesture.seenGestureEvent); + QVERIFY(subitem1->gesture.seenGestureEvent); QVERIFY(subitem1->gesture.last.singleshot.delivered); item->reset(); @@ -818,12 +831,12 @@ void tst_Gestures::overlappingGraphicsItems() mainWidget->reset(); subitem1->shouldAcceptSingleshotGesture = false; - SingleshotEvent event2(100, 100); + SingleshotEvent event2(pt.x(), pt.y()); sendSpontaneousEvent(&view, &event2); - QVERIFY(subitem1->gesture.seenGestureEvent); + QVERIFY(scene.gesture.seenGestureEvent); QVERIFY(!subitem2->gesture.seenGestureEvent); + QVERIFY(subitem1->gesture.seenGestureEvent); QVERIFY(item->gesture.seenGestureEvent); - QVERIFY(scene.gesture.seenGestureEvent); QVERIFY(!mainWidget->gesture.seenGestureEvent); QVERIFY(subitem1->gesture.last.singleshot.delivered); QVERIFY(item->gesture.last.singleshot.delivered); -- cgit v0.12 From 69b4be80a445985bdb8632dab4104236fe9b054d Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 30 Jun 2009 11:42:02 +0200 Subject: Benchmark test for quaternion multiplication. Reviewed-by: Rhys Weatherley --- tests/benchmarks/qquaternion/qquaternion.pro | 6 ++ tests/benchmarks/qquaternion/tst_qquaternion.cpp | 124 +++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 tests/benchmarks/qquaternion/qquaternion.pro create mode 100644 tests/benchmarks/qquaternion/tst_qquaternion.cpp diff --git a/tests/benchmarks/qquaternion/qquaternion.pro b/tests/benchmarks/qquaternion/qquaternion.pro new file mode 100644 index 0000000..cd68423 --- /dev/null +++ b/tests/benchmarks/qquaternion/qquaternion.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qquaternion + +SOURCES += tst_qquaternion.cpp + diff --git a/tests/benchmarks/qquaternion/tst_qquaternion.cpp b/tests/benchmarks/qquaternion/tst_qquaternion.cpp new file mode 100644 index 0000000..eaacf74 --- /dev/null +++ b/tests/benchmarks/qquaternion/tst_qquaternion.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//TESTED_FILES= + +class tst_QQuaternion : public QObject +{ + Q_OBJECT + +public: + tst_QQuaternion(); + virtual ~tst_QQuaternion(); + +public slots: + void init(); + void cleanup(); + +private slots: + void multiply_data(); + void multiply(); +}; + +tst_QQuaternion::tst_QQuaternion() +{ +} + +tst_QQuaternion::~tst_QQuaternion() +{ +} + +void tst_QQuaternion::init() +{ +} + +void tst_QQuaternion::cleanup() +{ +} + +void tst_QQuaternion::multiply_data() +{ + QTest::addColumn("x1"); + QTest::addColumn("y1"); + QTest::addColumn("z1"); + QTest::addColumn("w1"); + QTest::addColumn("x2"); + QTest::addColumn("y2"); + QTest::addColumn("z2"); + QTest::addColumn("w2"); + + QTest::newRow("null") + << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f + << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f; + + QTest::newRow("unitvec") + << (qreal)1.0f << (qreal)0.0f << (qreal)0.0f << (qreal)1.0f + << (qreal)0.0f << (qreal)1.0f << (qreal)0.0f << (qreal)1.0f; + + QTest::newRow("complex") + << (qreal)1.0f << (qreal)2.0f << (qreal)3.0f << (qreal)7.0f + << (qreal)4.0f << (qreal)5.0f << (qreal)6.0f << (qreal)8.0f; +} + +void tst_QQuaternion::multiply() +{ + QFETCH(qreal, x1); + QFETCH(qreal, y1); + QFETCH(qreal, z1); + QFETCH(qreal, w1); + QFETCH(qreal, x2); + QFETCH(qreal, y2); + QFETCH(qreal, z2); + QFETCH(qreal, w2); + + QQuaternion q1(w1, x1, y1, z1); + QQuaternion q2(w2, x2, y2, z2); + + QBENCHMARK { + QQuaternion q3 = q1 * q2; + } +} + +QTEST_MAIN(tst_QQuaternion) +#include "tst_qquaternion.moc" -- cgit v0.12 From 1d651e82459c0480cb3e803a9d9452092ac9d502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 2 Jul 2009 18:01:33 +0200 Subject: More re-factoring of QGraphicsSceneIndex. New method: QGraphicsSceneIndex::estimateTopLevelItems. QGraphicsSceneIndex::estimateItems returns *all* items within the rect, but we are only interested in the top-levels (those that are within the rect themselves or have descendants within the rect) when doing recursive drawing/item-lookup. All auto-tests pass. Demos/examples/manualtests run fine. --- src/gui/graphicsview/qgraphicsscene.cpp | 46 +++++--------- src/gui/graphicsview/qgraphicsscene_bsp.cpp | 8 ++- src/gui/graphicsview/qgraphicsscene_bsp_p.h | 4 +- src/gui/graphicsview/qgraphicsscene_p.h | 17 +---- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 72 ++++++++++++++-------- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 8 ++- src/gui/graphicsview/qgraphicssceneindex.cpp | 21 +++++-- src/gui/graphicsview/qgraphicssceneindex_p.h | 10 +-- src/gui/graphicsview/qgraphicsscenelinearindex.cpp | 5 +- src/gui/graphicsview/qgraphicsscenelinearindex_p.h | 3 +- 10 files changed, 98 insertions(+), 96 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 3b1c8ad..85d05e9 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1085,36 +1085,6 @@ QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item) return 0; } -QList QGraphicsScenePrivate::topLevelItemsInStackingOrder(const QTransform *const viewTransform, - const QRectF &sceneRect) -{ - if (indexMethod == QGraphicsScene::NoIndex || sceneRect.isNull()) { - ensureSortedTopLevelItems(); - return topLevelItems; - } - - const QList tmp = index->estimateItems(sceneRect, Qt::SortOrder(-1), - viewTransform ? *viewTransform : QTransform()); - // estimateItems returns a list of *all* items, but we are only interested - // in the top-levels (those that are within the rect themselves and those that - // have descendants within the rect). - // ### Look into how we can add this feature to the BSP. - QList tli; - for (int i = 0; i < tmp.size(); ++i) { - QGraphicsItem *topLevelItem = tmp.at(i)->topLevelItem(); - if (!topLevelItem->d_ptr->itemDiscovered) { - tli << topLevelItem; - topLevelItem->d_ptr->itemDiscovered = 1; - } - } - // Reset discovered bit. - for (int i = 0; i < tli.size(); ++i) - tli.at(i)->d_ptr->itemDiscovered = 0; - - qSort(tli.begin(), tli.end(), qt_notclosestLeaf); - return tli; -} - /*! \internal @@ -1759,7 +1729,7 @@ QList QGraphicsScene::collidingItems(const QGraphicsItem *item, // Does not support ItemIgnoresTransformations. QList tmp; - foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder, QTransform())) { + foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder)) { if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode)) tmp << itemInVicinity; } @@ -4209,6 +4179,20 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte } } +void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const viewTransform, + QRegion *exposedRegion, QWidget *widget) +{ + QRectF exposedSceneRect; + if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) { + exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); + if (viewTransform) + exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); + } + const QList tli = index->estimateTopLevelItems(exposedSceneRect, Qt::DescendingOrder); + for (int i = 0; i < tli.size(); ++i) + drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); +} + void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform, QRegion *exposedRegion, QWidget *widget, diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp index 7d30749..fb4b9a4 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp +++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp @@ -70,12 +70,15 @@ class QGraphicsSceneFindItemBspTreeVisitor : public QGraphicsSceneBspTreeVisitor { public: QList *foundItems; + bool onlyTopLevelItems; void visit(QList *items) { for (int i = 0; i < items->size(); ++i) { QGraphicsItem *item = items->at(i); - if (!item->d_func()->itemDiscovered && item->isVisible()) { + if (onlyTopLevelItems && item->d_ptr->parent) + item = item->topLevelItem(); + if (!item->d_func()->itemDiscovered && item->d_ptr->visible) { item->d_func()->itemDiscovered = 1; foundItems->prepend(item); } @@ -143,10 +146,11 @@ void QGraphicsSceneBspTree::removeItems(const QSet &items) } } -QList QGraphicsSceneBspTree::items(const QRectF &rect) const +QList QGraphicsSceneBspTree::items(const QRectF &rect, bool onlyTopLevelItems) const { QList tmp; findVisitor->foundItems = &tmp; + findVisitor->onlyTopLevelItems = onlyTopLevelItems; climbTree(findVisitor, rect); // Reset discovery bits. for (int i = 0; i < tmp.size(); ++i) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/gui/graphicsview/qgraphicsscene_bsp_p.h index 24b926c..4cac64a 100644 --- a/src/gui/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/gui/graphicsview/qgraphicsscene_bsp_p.h @@ -92,7 +92,7 @@ public: void removeItem(QGraphicsItem *item, const QRectF &rect); void removeItems(const QSet &items); - QList items(const QRectF &rect) const; + QList items(const QRectF &rect, bool onlyTopLevelItems = false) const; int leafCount() const; inline int firstChildIndex(int index) const @@ -106,8 +106,6 @@ public: private: void initialize(const QRectF &rect, int depth, int index); void climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index = 0) const; - - void findItems(QList *foundItems, const QRectF &rect, int index); QRectF rectForIndex(int index) const; QVector nodes; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 23b0dd5..245380f 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -191,26 +191,13 @@ public: QGraphicsWidget *windowForItem(const QGraphicsItem *item) const; bool sortCacheEnabled; // for compatibility - QList topLevelItemsInStackingOrder(const QTransform *const, const QRectF&); void drawItemHelper(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget, bool painterStateProtection); - inline void drawItems(QPainter *painter, const QTransform *const viewTransform, - QRegion *exposedRegion, QWidget *widget) - { - QRectF exposedSceneRect; - if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) { - exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1); - if (viewTransform) - exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); - } - const QList tli = topLevelItemsInStackingOrder(viewTransform, exposedSceneRect); - for (int i = 0; i < tli.size(); ++i) - drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); - return; - } + void drawItems(QPainter *painter, const QTransform *const viewTransform, + QRegion *exposedRegion, QWidget *widget); void drawSubtreeRecursive(QGraphicsItem *item, QPainter *painter, const QTransform *const, QRegion *exposedRegion, QWidget *widget, qreal parentOpacity = qreal(1.0)); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 0688cb1..a7b4828 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -372,6 +372,32 @@ void QGraphicsSceneBspTreeIndexPrivate::removeItem(QGraphicsItem *item, bool rec } } +QList QGraphicsSceneBspTreeIndexPrivate::estimateItems(const QRectF &rect, Qt::SortOrder order, + bool onlyTopLevelItems) +{ + Q_Q(QGraphicsSceneBspTreeIndex); + if (onlyTopLevelItems && rect.isNull()) + return q->QGraphicsSceneIndex::estimateTopLevelItems(rect, order); + + purgeRemovedItems(); + _q_updateSortCache(); + Q_ASSERT(unindexedItems.isEmpty()); + + QList rectItems = bsp.items(rect, onlyTopLevelItems); + if (onlyTopLevelItems) { + for (int i = 0; i < untransformableItems.size(); ++i) { + QGraphicsItem *item = untransformableItems.at(i); + if (!item->d_ptr->parent) + rectItems << item; + } + } else { + rectItems += untransformableItems; + } + + sortItems(&rectItems, order, sortCacheEnabled, onlyTopLevelItems); + return rectItems; +} + /*! Returns true if \a item1 is on top of \a item2. @@ -442,8 +468,19 @@ bool QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withoutCache(const QGrap \internal */ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemList, Qt::SortOrder order, - bool sortCacheEnabled) + bool sortCacheEnabled, bool onlyTopLevelItems) { + if (order == Qt::SortOrder(-1)) + return; + + if (onlyTopLevelItems) { + if (order == Qt::AscendingOrder) + qSort(itemList->begin(), itemList->end(), qt_closestLeaf); + else if (order == Qt::DescendingOrder) + qSort(itemList->begin(), itemList->end(), qt_notclosestLeaf); + return; + } + if (sortCacheEnabled) { if (order == Qt::AscendingOrder) { qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); @@ -548,36 +585,17 @@ void QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(const QGraphicsItem * \a deviceTransform is the transformation apply to the view. */ -QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, - const QTransform &deviceTransform) const +QList QGraphicsSceneBspTreeIndex::estimateItems(const QRectF &rect, Qt::SortOrder order) const { Q_D(const QGraphicsSceneBspTreeIndex); - const_cast(d)->purgeRemovedItems(); - const_cast(d)->_q_updateSortCache(); - - // ### Handle items that ignore transformations - Q_UNUSED(deviceTransform); - - QList rectItems = d->bsp.items(rect); - - // Fill in with any unindexed items - for (int i = 0; i < d->unindexedItems.size(); ++i) { - if (QGraphicsItem *item = d->unindexedItems.at(i)) { - if (item->d_ptr->visible - && !(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { - QRectF boundingRect = item->sceneBoundingRect(); - if (QRectF_intersects(boundingRect, rect)) - rectItems << item; - } - } - } - - rectItems += d->untransformableItems; - d->sortItems(&rectItems, order, d->sortCacheEnabled); - - return rectItems; + return const_cast(d)->estimateItems(rect, order); } +QList QGraphicsSceneBspTreeIndex::estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const +{ + Q_D(const QGraphicsSceneBspTreeIndex); + return const_cast(d)->estimateItems(rect, order, /*onlyTopLevels=*/true); +} /*! \fn QList QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const; diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 437b17d..3ac922b 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -82,8 +82,8 @@ public: QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0); ~QGraphicsSceneBspTreeIndex(); - QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; - + QList estimateItems(const QRectF &rect, Qt::SortOrder order) const; + QList estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const; QList items(Qt::SortOrder order = Qt::AscendingOrder) const; int bspTreeDepth(); @@ -145,6 +145,7 @@ public: void invalidateSortCache(); void addItem(QGraphicsItem *item, bool recursive = false); void removeItem(QGraphicsItem *item, bool recursive = false, bool moveToUnindexedItems = false); + QList estimateItems(const QRectF &, Qt::SortOrder, bool b = false); static void climbTree(QGraphicsItem *item, int *stackingOrder); static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); @@ -159,7 +160,8 @@ public: return item1->d_ptr->globalStackingOrder >= item2->d_ptr->globalStackingOrder; } - static void sortItems(QList *itemList, Qt::SortOrder order, bool cached); + static void sortItems(QList *itemList, Qt::SortOrder order, + bool cached, bool onlyTopLevelItems = false); }; diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index d6281e2..5626051 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -482,12 +482,25 @@ QList QGraphicsSceneIndex::items(const QPainterPath &path, Qt:: /*! This virtual function return an estimation of items at position \a point. This method return a list sorted using \a order. - \a deviceTransform is the transformation apply to the view. */ -QList QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order, - const QTransform &deviceTransform) const +QList QGraphicsSceneIndex::estimateItems(const QPointF &point, Qt::SortOrder order) const +{ + return estimateItems(QRectF(point, QSize(1, 1)), order); +} + +QList QGraphicsSceneIndex::estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const { - return estimateItems(QRectF(point, QSize(1,1)), order, deviceTransform); + Q_D(const QGraphicsSceneIndex); + Q_UNUSED(rect); + QGraphicsScenePrivate *scened = d->scene->d_func(); + scened->ensureSortedTopLevelItems(); + if (order == Qt::AscendingOrder) { + QList sorted; + for (int i = scened->topLevelItems.size() - 1; i >= 0; --i) + sorted << scened->topLevelItems.at(i); + return sorted; + } + return scened->topLevelItems; } /*! diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index aabfa79..6521765 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -97,10 +97,9 @@ public: Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; virtual QList items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - virtual QList estimateItems(const QPointF &point, - Qt::SortOrder order, const QTransform &deviceTransform) const; - virtual QList estimateItems(const QRectF &rect, - Qt::SortOrder order, const QTransform &deviceTransform) const = 0; + virtual QList estimateItems(const QPointF &point, Qt::SortOrder order) const; + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order) const = 0; + virtual QList estimateTopLevelItems(const QRectF &, Qt::SortOrder order) const; protected Q_SLOTS: virtual void updateSceneRect(const QRectF &rect); @@ -154,7 +153,8 @@ inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphi QList *items, const QTransform &viewTransform, Qt::ItemSelectionMode mode, Qt::SortOrder order) const { - const QList tli = scene->d_func()->topLevelItemsInStackingOrder(&viewTransform, rect); + Q_Q(const QGraphicsSceneIndex); + const QList tli = q->estimateTopLevelItems(rect, Qt::DescendingOrder); const QTransform identity; for (int i = 0; i < tli.size(); ++i) recursive_items_helper(tli.at(i), rect, intersector, items, identity, viewTransform, mode, order); diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp index bc401f2..5e6ac30 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp @@ -30,13 +30,10 @@ /*! - \fn virtual QList QGraphicsSceneLinearIndex::estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const; + \fn virtual QList QGraphicsSceneLinearIndex::estimateItems(const QRectF &rect, Qt::SortOrder order) const; Returns an estimation visible items that are either inside or intersect with the specified \a rect and return a list sorted using \a order. - - \a deviceTransform is the transformation apply to the view. - */ /*! diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h index 9463487..56dde3a 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -79,11 +79,10 @@ public: QList items(Qt::SortOrder order = Qt::AscendingOrder) const { Q_UNUSED(order); return m_items; } - virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const + virtual QList estimateItems(const QRectF &rect, Qt::SortOrder order) const { Q_UNUSED(rect); Q_UNUSED(order); - Q_UNUSED(deviceTransform); return m_items; } -- cgit v0.12 From 8f7ed011e38021f19f50b22d8a5c00d8ccd366ed Mon Sep 17 00:00:00 2001 From: mae Date: Thu, 2 Jul 2009 15:55:19 +0200 Subject: QPlainTextEdit pixel dust redrawing problem on clear() With document margins, the mapping from content-coordinates to visual coordinates went wrong. --- src/gui/widgets/qplaintextedit.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index c9d1d6e..82026d4 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -252,7 +252,7 @@ QPlainTextDocumentLayoutPrivate *QPlainTextDocumentLayout::priv() const */ void QPlainTextDocumentLayout::requestUpdate() { - emit update(QRectF(0., -4., 1000000000., 1000000000.)); + emit update(QRectF(0., -document()->documentMargin(), 1000000000., 1000000000.)); } @@ -347,8 +347,7 @@ void QPlainTextDocumentLayout::documentChanged(int from, int /*charsRemoved*/, i } if (!d->blockUpdate) - emit update(); // optimization potential - + emit update(QRectF(0., -doc->documentMargin(), 1000000000., 1000000000.)); // optimization potential } -- cgit v0.12 From 9c64e8f7a5e19e241deaa7e426534dc6761a6890 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 2 Jul 2009 11:47:10 -0700 Subject: Better debug output for QDirectFBPaintEngine Add unsupportedCompositionMode to the output. Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index e4ce230..df341fb 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -81,7 +81,7 @@ template <> inline const bool* ptr(const bool &) { return 0; } template static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, int scale, bool matrixRotShear, bool simplePen, - bool dfbHandledClip, + bool dfbHandledClip, bool unsupportedCompositionMode, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, const char *nameThree, const T3 &three) @@ -98,7 +98,8 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << "scale" << scale << "matrixRotShear" << matrixRotShear << "simplePen" << simplePen - << "dfbHandledClip" << dfbHandledClip; + << "dfbHandledClip" << dfbHandledClip + << "unsupportedCompositionMode" << unsupportedCompositionMode; const T1 *t1 = ptr(one); const T2 *t2 = ptr(two); @@ -124,6 +125,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * __FUNCTION__, state()->painter->device(), \ d_func()->scale, d_func()->matrixRotShear, \ d_func()->simplePen, d_func()->dfbCanHandleClip(), \ + d_func()->unsupportedCompositionMode, \ #one, one, #two, two, #three, three); \ if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \ return; @@ -138,6 +140,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * __FUNCTION__, state()->painter->device(), \ d_func()->scale, d_func()->matrixRotShear, \ d_func()->simplePen, d_func()->dfbCanHandleClip(), \ + d_func()->unsupportedCompositionMode, \ #one, one, #two, two, #three, three); #else #define RASTERFALLBACK(op, one, two, three) -- cgit v0.12 From b0f18119b4559a2b425222c2d63671422c014783 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 2 Jul 2009 18:25:03 -0700 Subject: QDirectFBPaintEngine return if destRect is null Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index df341fb..947cc76 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -1062,6 +1062,8 @@ void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, { const QRect sr = src.toRect(); const QRect dr = transform.mapRect(dest).toRect(); + if (dr.isEmpty()) + return; const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; DFBResult result; -- cgit v0.12 From 1866485e46039d51ea78a6d672b678aa02f68eef Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 3 Jul 2009 11:51:49 +1000 Subject: Fixed compile of QtCore with some exotic GNU toolchains. Fixes: corelib/kernel/qcore_unix_p.h:127: error: `O_CLOEXEC' undeclared Some toolchains claim to provide glibc >= 2.4 but do not define O_CLOEXEC. An alternative fix might be to define O_CLOEXEC ourselves as we do with some of the system call numbers. --- src/corelib/kernel/qcore_unix_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 1f3fe39..61d8401 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -71,7 +71,7 @@ struct sockaddr; QT_BEGIN_NAMESPACE -#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204 +#if defined(Q_OS_LINUX) && defined(O_CLOEXEC) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204 // Linux supports thread-safe FD_CLOEXEC # define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 1 -- cgit v0.12 From 5b701c1bbbbf4993117bd0311717b73fafae02fd Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 3 Jul 2009 13:08:17 +1000 Subject: Fixes invalid length for numeric fields in oracle. When the precisionpolicy is high, and the field is numeric, it was getting confused as a string field and pulling the wrong length value. --- src/sql/drivers/oci/qsql_oci.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 8d34dd8..1ffd999 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -611,7 +611,7 @@ static QSqlField qFromOraInf(const OraFieldInfo &ofi) QSqlField f(ofi.name, ofi.type); f.setRequired(ofi.oraIsNull == 0); - if (ofi.type == QVariant::String) + if (ofi.type == QVariant::String && ofi.oraType != SQLT_NUM && ofi.oraType != SQLT_VNU) f.setLength(ofi.oraFieldLength); else f.setLength(ofi.oraPrecision == 0 ? 38 : int(ofi.oraPrecision)); -- cgit v0.12 From e0912dad8095adb8da4bd27128a5baacfda59eb5 Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 3 Jul 2009 15:31:54 +1000 Subject: Fixes ::record for dialect 3 named tables in interbase/firebird. The comparison was mistakenly only uppercasing one side, so mixed case table names were reporting back as if they weren't found for both QSqlDatabase::record() and QSqlDatabase::primaryIndex() --- src/sql/drivers/ibase/qsql_ibase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 0033418..5e94c81 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1583,7 +1583,7 @@ QSqlRecord QIBaseDriver::record(const QString& tablename) const "b.RDB$FIELD_SCALE, b.RDB$FIELD_PRECISION, a.RDB$NULL_FLAG " "FROM RDB$RELATION_FIELDS a, RDB$FIELDS b " "WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE " - "AND a.RDB$RELATION_NAME = '") + tablename.toUpper() + QLatin1String("' " + "AND UPPER(a.RDB$RELATION_NAME) = '") + tablename.toUpper() + QLatin1String("' " "ORDER BY a.RDB$FIELD_POSITION")); while (q.next()) { @@ -1616,7 +1616,7 @@ QSqlIndex QIBaseDriver::primaryIndex(const QString &table) const q.exec(QLatin1String("SELECT a.RDB$INDEX_NAME, b.RDB$FIELD_NAME, d.RDB$FIELD_TYPE, d.RDB$FIELD_SCALE " "FROM RDB$RELATION_CONSTRAINTS a, RDB$INDEX_SEGMENTS b, RDB$RELATION_FIELDS c, RDB$FIELDS d " "WHERE a.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' " - "AND a.RDB$RELATION_NAME = '") + table.toUpper() + + "AND UPPER(a.RDB$RELATION_NAME) = '") + table.toUpper() + QLatin1String(" 'AND a.RDB$INDEX_NAME = b.RDB$INDEX_NAME " "AND c.RDB$RELATION_NAME = a.RDB$RELATION_NAME " "AND c.RDB$FIELD_NAME = b.RDB$FIELD_NAME " -- cgit v0.12 From 238c5e3025d8f48dd73f1c4060d08701444eac0d Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 3 Jul 2009 15:34:44 +1000 Subject: Fix up two more qsqldatabase autotests. --- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 28a2191..21064c3 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -188,7 +188,7 @@ private slots: void oci_fieldLength_data() { generic_data("QOCI"); } void oci_fieldLength(); - void sqlite_bindAndFetchUInt_data() { generic_data("QSQLITE3"); } + void sqlite_bindAndFetchUInt_data() { generic_data("QSQLITE"); } void sqlite_bindAndFetchUInt(); void sqlStatementUseIsNull_189093_data() { generic_data(); } @@ -1526,6 +1526,7 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() QString field1Name = QString("fIeLdNaMe"); QString field2Name = QString("ZuLu"); + q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName)); QString createSchema = QString("CREATE SCHEMA \"%1\"").arg(schemaName); QVERIFY_SQL(q, exec(createSchema)); QString createTable = QString("CREATE TABLE \"%1\".\"%2\" (\"%3\" int PRIMARY KEY, \"%4\" varchar(20))").arg(schemaName).arg(tableName).arg(field1Name).arg(field2Name); @@ -1681,6 +1682,8 @@ void tst_QSqlDatabase::precisionPolicy() q.setNumericalPrecisionPolicy(QSql::LowPrecisionInt32); QVERIFY_SQL(q, exec(query)); + if(db.driverName().startsWith("QOCI")) + QEXPECT_FAIL("", "Oracle fails to move to next when data columns are oversize", Abort); QVERIFY_SQL(q, next()); QCOMPARE(q.value(0).type(), QVariant::Invalid); } @@ -2262,6 +2265,10 @@ void tst_QSqlDatabase::sqlite_bindAndFetchUInt() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + if (db.driverName().startsWith("QSQLITE2")) { + QSKIP("SQLite3 specific test", SkipSingle); + return; + } QSqlQuery q(db); QString tableName = qTableName("uint_test"); -- cgit v0.12 From 1752e03a97cc16dd653d68d5a4bcf24024c59980 Mon Sep 17 00:00:00 2001 From: Keith Isdale Date: Fri, 3 Jul 2009 16:46:54 +1000 Subject: Do not specify the output file when generating Visual Studio Project Files files with qmake. The correct file extension for generated file is best left to qmake to decide. --- doc/src/snippets/code/doc_src_qmake-manual.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index edb66bc..82c710d 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -689,7 +689,7 @@ qmake -o Makefile hello.pro //! [115] -qmake -tp vc -o hello.dsp hello.pro +qmake -tp vc hello.pro //! [115] -- cgit v0.12 From 012d133b2093e0949872263297c23277d0ce30d9 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 3 Jul 2009 16:47:56 +1000 Subject: Fixed dead code possibly leading to crash. Looks like this `&&' was meant to be `||'. QNetworkProxy::FtpCachingProxy is 5 so it's clearly impossible for type to be less than 0 and greater than QNetworkProxy::FtpCachingProxy. Reviewed-by: Aaron Kennedy --- src/network/kernel/qnetworkproxy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index c2743ef..103b948 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -366,7 +366,7 @@ static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::Pro int(QNetworkProxy::HostNameLookupCapability)), }; - if (int(type) < 0 && int(type) > int(QNetworkProxy::FtpCachingProxy)) + if (int(type) < 0 || int(type) > int(QNetworkProxy::FtpCachingProxy)) type = QNetworkProxy::DefaultProxy; return QNetworkProxy::Capabilities(defaults[int(type)]); } -- cgit v0.12 From 17f814ce07a4d82563012a15a46dfe6acb2edcc5 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 3 Jul 2009 09:41:00 +0200 Subject: Add a specialization for QByteArray It tries to keep the semantics of QString::append(QByteArray) as much as possible. --- src/corelib/tools/qstringbuilder.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 4d6b64b..127c183 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -202,6 +202,18 @@ template <> struct QConcatenable *out++ = QLatin1Char(*a++); } }; + +template <> struct QConcatenable +{ + typedef QByteArray type; + static int size(const QByteArray &ba) { qstrnlen(ba.constData(), ba.size()); } + static inline void appendTo(const QByteArray &ba, QChar *&out) + { + const char *data = ba.constData(); + while (*data) + *out++ = *data++; + } +}; #endif template -- cgit v0.12 From 95e4c95d28be9bc9d94685f7a13e36cbf57bf74e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 3 Jul 2009 10:08:25 +0200 Subject: doc: Corrected several qdoc warnings. --- doc/src/qmake-manual.qdoc | 5 +++-- src/corelib/tools/qsharedpointer.cpp | 6 +++--- src/dbus/qdbuserror.cpp | 10 +++++++++- src/gui/kernel/qgesture.cpp | 7 +++++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index 42921db..5b261ab 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -1037,8 +1037,9 @@ (see \l{LibDepend}{Library Dependencies} for more info). \endtable - Please note that \c create_prl is required when \i {building} a static library, - while \c link_prl is required when \i {using} a static library. + Please note that \c create_prl is required when \e {building} a + static library, while \c link_prl is required when \e {using} a + static library. On Windows (or if Qt is configured with \c{-debug_and_release}, adding the \c build_all option to the \c CONFIG variable makes this rule the default diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 71bf318..fe3d9e0 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -342,7 +342,7 @@ /*! \fn QSharedPointer QSharedPointer::objectCast() const - Performs a \ref qobject_cast from this pointer's type to \tt X and + Performs a \l qobject_cast() from this pointer's type to \tt X and returns a QSharedPointer that shares the reference. If this function is used to up-cast, then QSharedPointer will perform a \tt qobject_cast, which means that if the object being pointed by this @@ -739,7 +739,7 @@ \relates QSharedPointer Returns a shared pointer to the pointer held by \a other, using a - \ref qobject_cast to type \tt X to obtain an internal pointer of the + \l qobject_cast() to type \tt X to obtain an internal pointer of the appropriate type. If the \tt qobject_cast fails, the object returned will be null. @@ -756,7 +756,7 @@ \relates QWeakPointer Returns a shared pointer to the pointer held by \a other, using a - \ref qobject_cast to type \tt X to obtain an internal pointer of the + \l qobject_cast() to type \tt X to obtain an internal pointer of the appropriate type. If the \tt qobject_cast fails, the object returned will be null. diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp index b2d21ec..caa2437 100644 --- a/src/dbus/qdbuserror.cpp +++ b/src/dbus/qdbuserror.cpp @@ -225,8 +225,16 @@ static inline QDBusError::ErrorType get(const char *name) \value UnknownInterface The interface is not known \value InternalError An internal error occurred (\c com.trolltech.QtDBus.Error.InternalError) - \value UnknownObject The remote object could not be found. + \value InvalidObjectPath The object path provided is invalid. + + \value InvalidService The service requested is invalid. + + \value InvalidMember The member is invalid. + + \value InvalidInterface The interface is invalid. + + \value UnknownObject The remote object could not be found. */ /*! diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 32a219c..d53b419 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -187,11 +187,18 @@ bool QGesture::eventFilter(QObject *receiver, QEvent *event) \brief The current state of the gesture. */ + +/*! + Returns the gesture recognition state. + */ Qt::GestureState QGesture::state() const { return d_func()->state; } +/*! + Sets this gesture's recognition state to \a state. + */ void QGesture::setState(Qt::GestureState state) { d_func()->state = state; -- cgit v0.12 From 8a0b05f71d2a9481a21143d1b87e2b18d427d1d5 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 3 Jul 2009 10:08:52 +0200 Subject: fix the test _and_ the class :) --- src/corelib/tools/qstringbuilder.h | 2 +- tests/auto/qstringbuilder/tst_qstringbuilder.cpp | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 127c183..97f13ee 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -206,7 +206,7 @@ template <> struct QConcatenable template <> struct QConcatenable { typedef QByteArray type; - static int size(const QByteArray &ba) { qstrnlen(ba.constData(), ba.size()); } + static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); } static inline void appendTo(const QByteArray &ba, QChar *&out) { const char *data = ba.constData(); diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp index fdbaf21..72889bc 100644 --- a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp +++ b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp @@ -85,28 +85,18 @@ #undef QT_NO_CAST_TO_ASCII #endif - #include //TESTED_CLASS=QStringBuilder //TESTED_FILES=qstringbuilder.cpp -#include - #define LITERAL "some literal" class tst_QStringBuilder : public QObject { Q_OBJECT -public: - tst_QStringBuilder() {} - ~tst_QStringBuilder() {} - -public slots: - void init() {} - void cleanup() {} - +private slots: void scenario(); }; @@ -119,6 +109,7 @@ void tst_QStringBuilder::scenario() QLatin1Char achar('c'); QString r2(QLatin1String(LITERAL LITERAL)); QString r; + QByteArray ba(LITERAL); r = l1literal P l1literal; QCOMPARE(r, r2); @@ -139,6 +130,10 @@ void tst_QStringBuilder::scenario() QCOMPARE(r, r2); r = LITERAL P string; QCOMPARE(r, r2); + r = ba P string; + QCOMPARE(r, r2); + r = string P ba; + QCOMPARE(r, r2); #endif } -- cgit v0.12 From d64d961c7242d22a4d71b376e9dcbbb3a7061a9e Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 3 Jul 2009 11:21:58 +0200 Subject: QToolBar: avoid repaints when entering/leaving a toolbar HoverEnter/Leave now do nothing. Task-number: 256103 --- src/gui/widgets/qtoolbar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index 3414b4f..b249915 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -1145,6 +1145,10 @@ bool QToolBar::event(QEvent *event) if (d->mouseReleaseEvent(static_cast(event))) return true; break; + case QEvent::HoverEnter: + case QEvent::HoverLeave: + // there's nothing special to do here and we don't want to update the whole widget + return true; case QEvent::HoverMove: { #ifndef QT_NO_CURSOR QHoverEvent *e = static_cast(event); -- cgit v0.12 From 88a0857ac76c803d4f88204fe74448e140bbf300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Riku=20Palom=C3=A4ki?= Date: Fri, 3 Jul 2009 11:28:07 +0200 Subject: Fix QX11Embed* with x86_64 by reading prop_return as long. Even though the _XEMBED_INFO property uses 32 bit values, prop_return has 64-bit padded values in 64-bit applications, see man XChangeProperty. Without this fix the XEMBED client will read XEMBED_MAPPED wrong and unmap (hide) itself. Merge-request: 797 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qx11embed_x11.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 3ddde1b..659331f 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -826,7 +826,7 @@ bool QX11EmbedWidget::x11Event(XEvent *event) &actual_format_return, &nitems_return, &bytes_after_return, &prop_return) == Success) { if (nitems_return > 1) { - if (((int * )prop_return)[1] & XEMBED_MAPPED) { + if (((long * )prop_return)[1] & XEMBED_MAPPED) { XMapWindow(x11Info().display(), internalWinId()); } else { XUnmapWindow(x11Info().display(), internalWinId()); @@ -1670,9 +1670,9 @@ void QX11EmbedContainerPrivate::acceptClient(WId window) // Clients with the _XEMBED_INFO property are XEMBED clients. clientIsXEmbed = true; - unsigned int *p = (unsigned int *)prop_return; + long *p = (long *)prop_return; if (nitems_return >= 2) - clientversion = p[0]; + clientversion = (unsigned int)p[0]; } XFree(prop_return); -- cgit v0.12 From 9b4234d567804e8f503951e8d0c96e95f5dbec48 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 3 Jul 2009 13:45:49 +0200 Subject: Enabled double buffering of window surfaces on Windows. Without this, QWindowSurface::flush() doesn't work. Reviewed-by: Samuel --- src/opengl/qwindowsurface_gl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 3a7a07e..eec725e 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -171,7 +171,7 @@ QGLGraphicsSystem::QGLGraphicsSystem() } } #elif defined(Q_WS_WIN) - QGLWindowSurface::surfaceFormat.setDoubleBuffer(false); + QGLWindowSurface::surfaceFormat.setDoubleBuffer(true); qt_win_owndc_required = true; #endif -- cgit v0.12 From 460e204c5b96cb67244bd9463ca0dfa56ad02564 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Fri, 3 Jul 2009 13:29:43 +0200 Subject: Replace usage of the old, obsolete PrintDlg with PrintDlgEx. Since we don't support Windows versions < Win 2000, we can just go ahead and replace usage of the old compat dialog. Task-number: 222417 Reviewed-by: Prasanth --- src/gui/dialogs/qprintdialog_win.cpp | 79 +++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index 6022a66..115cd8d 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -77,14 +77,10 @@ public: QWin32PrintEnginePrivate *ep; }; -static PRINTDLG* qt_win_make_PRINTDLG(QWidget *parent, - QPrintDialog *pdlg, - QPrintDialogPrivate *d, HGLOBAL *tempDevNames) +static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, + QPrintDialog *pdlg, + QPrintDialogPrivate *d, HGLOBAL *tempDevNames) { - PRINTDLG *pd = new PRINTDLG; - memset(pd, 0, sizeof(PRINTDLG)); - pd->lStructSize = sizeof(PRINTDLG); - DEVMODE *devMode = d->ep->devMode; if (devMode) { @@ -125,31 +121,31 @@ static PRINTDLG* qt_win_make_PRINTDLG(QWidget *parent, if (pd->nMinPage==0 && pd->nMaxPage==0) pd->Flags |= PD_NOPAGENUMS; + // we don't have a 'current page' notion in the QPrinter API yet. + // Neither do we support more than one page range, so limit those + // options + pd->Flags |= PD_NOCURRENTPAGE; + pd->nStartPage = START_PAGE_GENERAL; + pd->nPageRanges = 1; + pd->nMaxPageRanges = 1; + if (d->ep->printToFile) pd->Flags |= PD_PRINTTOFILE; Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); pd->hwndOwner = parent ? parent->winId() : 0; - pd->nFromPage = qMax(pdlg->fromPage(), pdlg->minPage()); - pd->nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1; + pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage()); + pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1; pd->nCopies = d->ep->num_copies; - - return pd; -} - -static void qt_win_clean_up_PRINTDLG(PRINTDLG **pd) -{ - delete *pd; - *pd = 0; } -static void qt_win_read_back_PRINTDLG(PRINTDLG *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) +static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) { if (pd->Flags & PD_SELECTION) { pdlg->setPrintRange(QPrintDialog::Selection); pdlg->setFromTo(0, 0); } else if (pd->Flags & PD_PAGENUMS) { pdlg->setPrintRange(QPrintDialog::PageRange); - pdlg->setFromTo(pd->nFromPage, pd->nToPage); + pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); } else { pdlg->setPrintRange(QPrintDialog::AllPages); pdlg->setFromTo(0, 0); @@ -223,19 +219,35 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() HGLOBAL *tempDevNames = ep->createDevNames(); - bool result; bool done; - PRINTDLG *pd = qt_win_make_PRINTDLG(parent, q, this, tempDevNames); + bool result; + bool doPrinting; + + PRINTPAGERANGE pageRange; + PRINTDLGEX pd; + memset(&pd, 0, sizeof(PRINTDLGEX)); + pd.lStructSize = sizeof(PRINTDLGEX); + pd.lpPageRanges = &pageRange; + qt_win_setup_PRINTDLGEX(&pd, parent, q, this, tempDevNames); do { done = true; - result = PrintDlg(pd); - if ((pd->Flags & PD_PAGENUMS) && (pd->nFromPage > pd->nToPage)) - done = false; - if (result && pd->hDC == 0) - result = false; - else if (!result) - done = true; + doPrinting = false; + result = (PrintDlgEx(&pd) == S_OK); + if (result && (pd.dwResultAction == PD_RESULT_PRINT + || pd.dwResultAction == PD_RESULT_APPLY)) + { + doPrinting = (pd.dwResultAction == PD_RESULT_PRINT); + if ((pd.Flags & PD_PAGENUMS) + && (pd.lpPageRanges[0].nFromPage > pd.lpPageRanges[0].nToPage)) + { + pd.lpPageRanges[0].nFromPage = 1; + pd.lpPageRanges[0].nToPage = 1; + done = false; + } + if (pd.hDC == 0) + result = false; + } if (!done) { QMessageBox::warning(0, QPrintDialog::tr("Print"), @@ -249,9 +261,10 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() qt_win_eatMouseMove(); // write values back... - if (result) { - qt_win_read_back_PRINTDLG(pd, q, this); - qt_win_clean_up_PRINTDLG(&pd); + if (result && (pd.dwResultAction == PD_RESULT_PRINT + || pd.dwResultAction == PD_RESULT_APPLY)) + { + qt_win_read_back_PRINTDLGEX(&pd, q, this); // update printer validity printer->d_func()->validPrinter = !ep->name.isEmpty(); } @@ -259,9 +272,9 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() // Cleanup... GlobalFree(tempDevNames); - q->done(result); + q->done(result && doPrinting); - return result; + return result && doPrinting; } void QPrintDialog::setVisible(bool visible) -- cgit v0.12 From b43cbebc5353b7e6b2a3812046a23f327a12c4dc Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Fri, 3 Jul 2009 13:46:22 +0200 Subject: Drag leave event is delivered, after re-entering the widget. This happens only for widgets with focus frames. Since the mouse location at the time of this event will be outside of the focus frame, we cannot use it to identify the widget. Instead, use the QDragManager's currentTarget() to deliver the drag leave event. Task-number: 252088 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qdnd_mac.mm | 4 ++-- src/gui/kernel/qwidget_mac.mm | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qdnd_mac.mm b/src/gui/kernel/qdnd_mac.mm index b244d84..99399da 100644 --- a/src/gui/kernel/qdnd_mac.mm +++ b/src/gui/kernel/qdnd_mac.mm @@ -405,12 +405,12 @@ bool QWidgetPrivate::qt_mac_dnd_event(uint kind, DragRef dragRef) SetDragDropAction(dragRef, qt_mac_dnd_map_qt_actions(qDEEvent.dropAction())); if (!qDEEvent.isAccepted()) - // The widget is simply not interrested in this + // The widget is simply not interested in this // drag. So tell carbon this by returning 'false'. We will then // not receive any further move, drop or leave events for this widget. return false; else { - // Documentation states that a drag move event is sendt immidiatly after + // Documentation states that a drag move event is sent immediately after // a drag enter event. So we do that. This will honor widgets overriding // 'dragMoveEvent' only, and not 'dragEnterEvent' QDragMoveEvent qDMEvent(q->mapFromGlobal(QPoint(mouse.h, mouse.v)), qtAllowed, dropdata, diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 250cc35..d1e4230 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -1369,6 +1369,14 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event, // Set dropWidget to zero, so qt_mac_dnd_event // doesn't get called a second time below: dropWidget = 0; + } else if (ekind == kEventControlDragLeave) { + dropWidget = QDragManager::self()->currentTarget(); + if (dropWidget) { + dropWidget->d_func()->qt_mac_dnd_event(kEventControlDragLeave, drag); + } + // Set dropWidget to zero, so qt_mac_dnd_event + // doesn't get called a second time below: + dropWidget = 0; } } } -- cgit v0.12 From 468bbd8fd5c40e29b50e6c38b3f2c3450aad2e67 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 3 Jul 2009 15:18:16 +0200 Subject: signals -> Q_SIGNALS --- src/gui/kernel/qgesture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index b5abdd2..cc46916 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -93,7 +93,7 @@ protected: QGesture(QGesturePrivate &dd, QObject *parent); bool eventFilter(QObject*, QEvent*); -signals: +Q_SIGNALS: void started(); void triggered(); void finished(); -- cgit v0.12 From 7bc98d7bd7aabc6086e5cd27a167769d7aa71d83 Mon Sep 17 00:00:00 2001 From: jasplin Date: Fri, 3 Jul 2009 15:40:20 +0200 Subject: Improved the support for input methods in Graphics View. This patch improves the graphics view support for input methods in several ways: * A new ItemAcceptsInputMethod flag is introduced to serve the same purpose for graphics items as WA_InputMethodEnabled does for widgets: Input method support can be controlled individually for each item. * The input method sensitivity of a view (i.e. the value of the WA_InputMethodEnabled flag) is updated dynamically whenever the input method support of the current focus item may change. * Input contexts are reset whenever an item that supports input methods loses focus. Reviewed-by: janarve Task-number: 254492 --- src/gui/graphicsview/qgraphicsitem.cpp | 13 +++ src/gui/graphicsview/qgraphicsitem.h | 3 +- src/gui/graphicsview/qgraphicsitem_p.h | 4 +- src/gui/graphicsview/qgraphicsproxywidget.cpp | 22 +++- src/gui/graphicsview/qgraphicsproxywidget_p.h | 2 + src/gui/graphicsview/qgraphicsscene.cpp | 33 +++++- src/gui/graphicsview/qgraphicsscene_p.h | 2 + src/gui/graphicsview/qgraphicsview.cpp | 20 ++++ src/gui/graphicsview/qgraphicsview_p.h | 1 + .../tst_qgraphicsproxywidget.cpp | 46 +++++++- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 58 ++++++++++ tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 118 +++++++++++++++++++++ 12 files changed, 310 insertions(+), 12 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index c82c2e5..a5ee7e6 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -323,6 +323,10 @@ performance reasons, these notifications are disabled by default. You must enable this flag to receive notifications for position and transform changes. This flag was introduced in Qt 4.6. + + \value ItemAcceptsInputMethod The item supports input methods typically + used for Asian languages. + This flag was introduced in Qt 4.6. */ /*! @@ -1486,6 +1490,12 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) d_ptr->scene->d_func()->needSortTopLevelItems = 1; } + if ((flags & ItemAcceptsInputMethod) != (oldFlags & ItemAcceptsInputMethod)) { + // Update input method sensitivity in any views. + if (d_ptr->scene) + d_ptr->scene->d_func()->updateInputMethodSensitivityInViews(); + } + if (d_ptr->scene) { d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, @@ -9840,6 +9850,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemSendsGeometryChanges: str = "ItemSendsGeometryChanges"; break; + case QGraphicsItem::ItemAcceptsInputMethod: + str = "ItemAcceptsInputMethod"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index b0571c2..d26110a 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -98,7 +98,8 @@ public: ItemStacksBehindParent = 0x100, ItemUsesExtendedStyleOption = 0x200, ItemHasNoContents = 0x400, - ItemSendsGeometryChanges = 0x800 + ItemSendsGeometryChanges = 0x800, + ItemAcceptsInputMethod = 0x1000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index a977e1e..46ec6fe 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -415,7 +415,7 @@ public: quint32 fullUpdatePending : 1; // New 32 bits - quint32 flags : 12; + quint32 flags : 13; quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; @@ -426,7 +426,7 @@ public: quint32 ignoreOpacity : 1; quint32 acceptTouchEvents : 1; quint32 acceptedTouchBeginEvent : 1; - quint32 unused : 10; // feel free to use + quint32 unused : 9; // feel free to use // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 0b421ad..5fac6cf 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -451,6 +451,22 @@ void QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget() /*! \internal +*/ +void QGraphicsProxyWidgetPrivate::updateProxyInputMethodAcceptanceFromWidget() +{ + Q_Q(QGraphicsProxyWidget); + if (!widget) + return; + + QWidget *focusWidget = widget->focusWidget(); + if (!focusWidget) + focusWidget = widget; + q->setFlag(QGraphicsItem::ItemAcceptsInputMethod, + focusWidget->testAttribute(Qt::WA_InputMethodEnabled)); +} + +/*! + \internal Embeds \a subWin as a subwindow of this proxy widget. \a subWin must be a top-level widget and a descendant of the widget managed by this proxy. A separate subproxy @@ -690,6 +706,8 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto updateProxyGeometryFromWidget(); + updateProxyInputMethodAcceptanceFromWidget(); + // Hook up the event filter to keep the state up to date. newWidget->installEventFilter(q); QObject::connect(newWidget, SIGNAL(destroyed()), q, SLOT(_q_removeWidgetSlot())); @@ -1303,8 +1321,8 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event) if (d->widget && d->widget->focusWidget()) { d->widget->focusWidget()->setFocus(event->reason()); return; - } - break; + } + break; } } diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/gui/graphicsview/qgraphicsproxywidget_p.h index ec5400a..fbc9f6c 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget_p.h +++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h @@ -102,6 +102,8 @@ public: void updateWidgetGeometryFromProxy(); void updateProxyGeometryFromWidget(); + void updateProxyInputMethodAcceptanceFromWidget(); + QPointF mapToReceiver(const QPointF &pos, const QWidget *receiver) const; enum ChangeMode { diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index c3f72e6..0c3abd4 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -242,6 +242,7 @@ #include #include #include +#include #include #include #ifdef Q_WS_X11 @@ -3175,6 +3176,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Deliver post-change notification item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); + + d->updateInputMethodSensitivityInViews(); } /*! @@ -3450,6 +3453,8 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) // Deliver post-change notification item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); + + d->updateInputMethodSensitivityInViews(); } /*! @@ -3504,6 +3509,17 @@ void QGraphicsScene::setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReas d->lastFocusItem = d->focusItem; d->focusItem = 0; d->sendEvent(d->lastFocusItem, &event); + + if (d->lastFocusItem + && (d->lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { + // Reset any visible preedit text + QInputMethodEvent imEvent; + d->sendEvent(d->lastFocusItem, &imEvent); + + // Close any external input method panel + for (int i = 0; i < d->views.size(); ++i) + d->views.at(i)->inputContext()->reset(); + } } if (item) { @@ -3516,6 +3532,8 @@ void QGraphicsScene::setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReas QFocusEvent event(QEvent::FocusIn, focusReason); d->sendEvent(item, &event); } + + d->updateInputMethodSensitivityInViews(); } /*! @@ -3699,7 +3717,7 @@ void QGraphicsScene::setForegroundBrush(const QBrush &brush) QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const { Q_D(const QGraphicsScene); - if (!d->focusItem) + if (!d->focusItem || !(d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) return QVariant(); const QTransform matrix = d->focusItem->sceneTransform(); QVariant value = d->focusItem->inputMethodQuery(query); @@ -4662,16 +4680,16 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) subclass to receive input method events for the scene. The default implementation forwards the event to the focusItem(). - If no item currently has focus, this function does nothing. + If no item currently has focus or the current focus item does not + accept input methods, this function does nothing. \sa QGraphicsItem::inputMethodEvent() */ void QGraphicsScene::inputMethodEvent(QInputMethodEvent *event) { Q_D(QGraphicsScene); - if (!d->focusItem) - return; - d->sendEvent(d->focusItem, event); + if (d->focusItem && (d->focusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) + d->sendEvent(d->focusItem, event); } /*! @@ -6128,6 +6146,11 @@ void QGraphicsScenePrivate::enableTouchEventsOnViews() view->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, true); } +void QGraphicsScenePrivate::updateInputMethodSensitivityInViews() +{ + for (int i = 0; i < views.size(); ++i) + views.at(i)->d_func()->updateInputMethodSensitivity(); +} QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index d2d603a..dc720a7 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -316,6 +316,8 @@ public: bool sendTouchBeginEvent(QGraphicsItem *item, QTouchEvent *touchEvent); bool allItemsIgnoreTouchEvents; void enableTouchEventsOnViews(); + + void updateInputMethodSensitivityInViews(); }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 56a69f7..3b29552 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -280,6 +280,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < #include #include #include +#include #ifdef Q_WS_X11 #include #endif @@ -1017,6 +1018,22 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg } /*! + \internal + + Enables input methods for the view if and only if the current focus item of + the scene accepts input methods. Call function whenever that condition has + potentially changed. +*/ +void QGraphicsViewPrivate::updateInputMethodSensitivity() +{ + Q_Q(QGraphicsView); + q->setAttribute( + Qt::WA_InputMethodEnabled, + scene && scene->focusItem() + && scene->focusItem()->flags() & QGraphicsItem::ItemAcceptsInputMethod); +} + +/*! Constructs a QGraphicsView. \a parent is passed to QWidget's constructor. */ QGraphicsView::QGraphicsView(QWidget *parent) @@ -1538,6 +1555,8 @@ void QGraphicsView::setScene(QGraphicsScene *scene) } else { d->recalculateContentSize(); } + + d->updateInputMethodSensitivity(); } /*! @@ -2929,6 +2948,7 @@ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event) void QGraphicsView::focusInEvent(QFocusEvent *event) { Q_D(QGraphicsView); + d->updateInputMethodSensitivity(); QAbstractScrollArea::focusInEvent(event); if (d->scene) QApplication::sendEvent(d->scene, event); diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 8c62f73..09d842d 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -181,6 +181,7 @@ public: QPointF mapToScene(const QPointF &point) const; QRectF mapToScene(const QRectF &rect) const; static void translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent); + void updateInputMethodSensitivity(); }; QT_END_NAMESPACE diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 0b1d5cf..dbc4339 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -178,6 +178,7 @@ private slots: void windowFlags_data(); void windowFlags(); void comboboxWindowFlags(); + void inputMethod(); }; // Subclass that exposes the protected functions. @@ -1572,7 +1573,7 @@ void tst_QGraphicsProxyWidget::resize_simple() QGraphicsProxyWidget proxy; QWidget *widget = new QWidget; - widget->setGeometry(0, 0, size.width(), size.height()); + widget->setGeometry(0, 0, (int)size.width(), (int)size.height()); proxy.setWidget(widget); widget->show(); QCOMPARE(widget->pos(), QPoint()); @@ -3217,10 +3218,51 @@ void tst_QGraphicsProxyWidget::comboboxWindowFlags() QVERIFY((static_cast(popupProxy)->windowFlags() & Qt::Popup) == Qt::Popup); } +class InputMethod_LineEdit : public QLineEdit +{ + bool event(QEvent *e) + { + if (e->type() == QEvent::InputMethod) + ++inputMethodEvents; + return QLineEdit::event(e); + } +public: + int inputMethodEvents; +}; + +void tst_QGraphicsProxyWidget::inputMethod() +{ + QGraphicsScene scene; + + // check that the proxy is initialized with the correct input method sensitivity + for (int i = 0; i < 2; ++i) + { + QLineEdit *lineEdit = new QLineEdit; + lineEdit->setAttribute(Qt::WA_InputMethodEnabled, !!i); + QGraphicsProxyWidget *proxy = scene.addWidget(lineEdit); + QCOMPARE(!!(proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod), !!i); + } + + // check that input method events are only forwarded to widgets with focus + for (int i = 0; i < 2; ++i) + { + InputMethod_LineEdit *lineEdit = new InputMethod_LineEdit; + lineEdit->setAttribute(Qt::WA_InputMethodEnabled, true); + QGraphicsProxyWidget *proxy = scene.addWidget(lineEdit); + + if (i) + lineEdit->setFocus(); + + lineEdit->inputMethodEvents = 0; + QInputMethodEvent event; + qApp->sendEvent(proxy, &event); + QCOMPARE(lineEdit->inputMethodEvents, i); + } +} + QTEST_MAIN(tst_QGraphicsProxyWidget) #include "tst_qgraphicsproxywidget.moc" #else // QT_NO_STYLE_CLEANLOOKS QTEST_NOOP_MAIN #endif - diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 4247cca..d325f0f 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -252,6 +252,8 @@ private slots: void stickyFocus_data(); void stickyFocus(); void sendEvent(); + void inputMethod_data(); + void inputMethod(); // task specific tests below me void task139710_bspTreeCrash(); @@ -3614,5 +3616,61 @@ void tst_QGraphicsScene::sendEvent() QCOMPARE(spy->count(), 1); } +void tst_QGraphicsScene::inputMethod_data() +{ + QTest::addColumn("flags"); + QTest::addColumn("callFocusItem"); + QTest::newRow("0") << 0 << false; + QTest::newRow("1") << (int)QGraphicsItem::ItemAcceptsInputMethod << false; + QTest::newRow("2") << (int)QGraphicsItem::ItemIsFocusable << false; + QTest::newRow("3") << + (int)(QGraphicsItem::ItemAcceptsInputMethod|QGraphicsItem::ItemIsFocusable) << true; +} + +class InputMethodTester : public QGraphicsRectItem +{ + void inputMethodEvent(QInputMethodEvent *) { ++eventCalls; } + QVariant inputMethodQuery(Qt::InputMethodQuery) const { ++queryCalls; return QVariant(); } +public: + int eventCalls; + mutable int queryCalls; +}; + +void tst_QGraphicsScene::inputMethod() +{ + QFETCH(int, flags); + QFETCH(bool, callFocusItem); + + InputMethodTester *item = new InputMethodTester; + item->setFlags((QGraphicsItem::GraphicsItemFlags)flags); + + QGraphicsScene scene; + scene.addItem(item); + QInputMethodEvent event; + + scene.setFocusItem(item); + QCOMPARE(!!(item->flags() & QGraphicsItem::ItemIsFocusable), scene.focusItem() == item); + + item->eventCalls = 0; + qApp->sendEvent(&scene, &event); + QCOMPARE(item->eventCalls, callFocusItem ? 1 : 0); + + item->queryCalls = 0; + scene.inputMethodQuery((Qt::InputMethodQuery)0); + QCOMPARE(item->queryCalls, callFocusItem ? 1 : 0); + + scene.setFocusItem(0); + QCOMPARE(item->eventCalls, callFocusItem ? 2 : 0); // verify correct delivery of "reset" event + QCOMPARE(item->queryCalls, callFocusItem ? 1 : 0); // verify that value is unaffected + + item->eventCalls = 0; + qApp->sendEvent(&scene, &event); + QCOMPARE(item->eventCalls, 0); + + item->queryCalls = 0; + scene.inputMethodQuery((Qt::InputMethodQuery)0); + QCOMPARE(item->queryCalls, 0); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index d24e437..8b4ca4c 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -63,6 +63,7 @@ #include #include #include +#include //TESTED_CLASS= //TESTED_FILES= @@ -195,6 +196,8 @@ private slots: void mouseTracking2(); void render(); void exposeRegion(); + void inputMethodSensitivity(); + void inputContextReset(); // task specific tests below me void task172231_untransformableItems(); @@ -3357,6 +3360,121 @@ void tst_QGraphicsView::exposeRegion() QCOMPARE(item->paints, 0); } +void tst_QGraphicsView::inputMethodSensitivity() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + QGraphicsRectItem *item = new QGraphicsRectItem; + + view.setAttribute(Qt::WA_InputMethodEnabled, true); + + scene.addItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + scene.removeItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + item->setFlag(QGraphicsItem::ItemAcceptsInputMethod); + scene.addItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + scene.removeItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + scene.addItem(item); + scene.setFocusItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + scene.removeItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + item->setFlag(QGraphicsItem::ItemIsFocusable); + scene.addItem(item); + scene.setFocusItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + + item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, true); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + + // introduce another item that is focusable but does not accept input methods + QGraphicsRectItem *item2 = new QGraphicsRectItem; + item2->setFlag(QGraphicsItem::ItemIsFocusable); + scene.addItem(item2); + scene.setFocusItem(item2); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + scene.setFocusItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + + view.setScene(0); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + view.setScene(&scene); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + + scene.setFocusItem(item2); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + view.setScene(0); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + scene.setFocusItem(item); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + + view.setScene(&scene); + QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); +} + +class InputContextTester : public QInputContext +{ + QString identifierName() { return QString(); } + bool isComposing() const { return false; } + QString language() { return QString(); } + void reset() { ++resets; } +public: + int resets; +}; + +void tst_QGraphicsView::inputContextReset() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + InputContextTester inputContext; + view.setInputContext(&inputContext); + + QGraphicsItem *item1 = new QGraphicsRectItem; + item1->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod); + + inputContext.resets = 0; + scene.addItem(item1); + QCOMPARE(inputContext.resets, 0); + + inputContext.resets = 0; + scene.setFocusItem(item1); + QCOMPARE(inputContext.resets, 0); + + inputContext.resets = 0; + scene.setFocusItem(0); + QCOMPARE(inputContext.resets, 1); + + // introduce another item that is focusable but does not accept input methods + QGraphicsItem *item2 = new QGraphicsRectItem; + item1->setFlags(QGraphicsItem::ItemIsFocusable); + + inputContext.resets = 0; + scene.setFocusItem(item2); + QCOMPARE(inputContext.resets, 0); + + inputContext.resets = 0; + scene.setFocusItem(item1); + QCOMPARE(inputContext.resets, 0); +} + void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() { QGraphicsView view; -- cgit v0.12 From 208bba0abd8a417cf8fdfd61295682738df3bc67 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 3 Jul 2009 16:40:32 +0200 Subject: QHeaderView: fixed the sizeHint with hidden sections We used to check the 100 first sections and 100 last sections Now we make sure we check 100 visible sections Task-number: 255574 --- src/gui/itemviews/qheaderview.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index aea288b..a73f85a 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -528,20 +528,24 @@ QSize QHeaderView::sizeHint() const return d->cachedSizeHint; int width = 0; int height = 0; + d->executePostedLayout(); + // get size hint for the first n sections - int c = qMin(count(), 100); - for (int i = 0; i < c; ++i) { + int i = 0; + for (int checked = 0; checked < 100 && i < d->sectionCount; ++i) { if (isSectionHidden(i)) continue; + checked++; QSize hint = sectionSizeFromContents(i); width = qMax(hint.width(), width); height = qMax(hint.height(), height); } // get size hint for the last n sections - c = qMax(count() - 100, c); - for (int j = count() - 1; j >= c; --j) { + i = qMax(i, d->sectionCount - 100 ); + for (int j = d->sectionCount - 1, checked = 0; j > i && checked < 100; --j) { if (isSectionHidden(j)) continue; + checked++; QSize hint = sectionSizeFromContents(j); width = qMax(hint.width(), width); height = qMax(hint.height(), height); -- cgit v0.12 From 108f549a446e13a3be7ee6753be9eb74260547d7 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 3 Jul 2009 16:44:51 +0200 Subject: QHeaderView: code cleanup in sizehint calculation --- src/gui/itemviews/qheaderview.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index a73f85a..57e44c7 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -522,12 +522,9 @@ int QHeaderView::length() const QSize QHeaderView::sizeHint() const { Q_D(const QHeaderView); - if (count() < 1) - return QSize(0, 0); if (d->cachedSizeHint.isValid()) return d->cachedSizeHint; - int width = 0; - int height = 0; + d->cachedSizeHint = QSize(0, 0); d->executePostedLayout(); // get size hint for the first n sections @@ -537,8 +534,7 @@ QSize QHeaderView::sizeHint() const continue; checked++; QSize hint = sectionSizeFromContents(i); - width = qMax(hint.width(), width); - height = qMax(hint.height(), height); + d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); } // get size hint for the last n sections i = qMax(i, d->sectionCount - 100 ); @@ -547,10 +543,8 @@ QSize QHeaderView::sizeHint() const continue; checked++; QSize hint = sectionSizeFromContents(j); - width = qMax(hint.width(), width); - height = qMax(hint.height(), height); + d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); } - d->cachedSizeHint = QSize(width, height); return d->cachedSizeHint; } -- cgit v0.12 From 84bbac2a4d7b663e57b74094cbebf8fca16e0ed8 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 3 Jul 2009 17:25:40 +0200 Subject: Moved uniform enum to QGLEngineShaderManager. Simplified caching of uniform locations. Reviewed-by: Samuel --- .../gl2paintengineex/qglengineshadermanager.cpp | 40 ++++++++------ .../gl2paintengineex/qglengineshadermanager_p.h | 26 +++++++-- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 61 ++++++++-------------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 25 +-------- 4 files changed, 69 insertions(+), 83 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 4b73ca9..27636f4 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -190,27 +190,33 @@ QGLEngineShaderManager::~QGLEngineShaderManager() //### } - -uint QGLEngineShaderManager::getUniformIdentifier(const char *uniformName) -{ - uniformIdentifiers << uniformName; - return uniformIdentifiers.size() - 1; -} - -uint QGLEngineShaderManager::getUniformLocation(uint id) +uint QGLEngineShaderManager::getUniformLocation(Uniform id) { QVector &uniformLocations = currentShaderProg->uniformLocations; - uint oldSize = uniformLocations.size(); - if (oldSize <= id) { - uint newSize = id + 1; - uniformLocations.resize(newSize); - - for (uint i = oldSize; i < newSize; ++i) - uniformLocations[i] = GLuint(-1); - } + if (uniformLocations.isEmpty()) + uniformLocations.fill(GLuint(-1), NumUniforms); + + static const char *uniformNames[] = { + "imageTexture", + "patternColor", + "globalOpacity", + "depth", + "pmvMatrix", + "maskTexture", + "fragmentColor", + "linearData", + "angle", + "halfViewportSize", + "fmp", + "fmp2_m_radius2", + "inverse_2_fmp2_m_radius2", + "invertedTextureSize", + "brushTransform", + "brushTexture" + }; if (uniformLocations.at(id) == GLuint(-1)) - uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformIdentifiers.at(id)); + uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]); return uniformLocations.at(id); } diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 34f0768..442edfe 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -274,6 +274,26 @@ public: TextureSrcWithPattern = Qt::TexturePattern+4 }; + enum Uniform { + ImageTexture, + PatternColor, + GlobalOpacity, + Depth, + PmvMatrix, + MaskTexture, + FragmentColor, + LinearData, + Angle, + HalfViewportSize, + Fmp, + Fmp2MRadius2, + Inverse2Fmp2MRadius2, + InvertedTextureSize, + BrushTransform, + BrushTexture, + NumUniforms + }; + // There are optimisations we can do, depending on the brush transform: // 1) May not have to apply perspective-correction // 2) Can use lower precision for matrix @@ -285,8 +305,7 @@ public: void setMaskType(MaskType); void setCompositionMode(QPainter::CompositionMode); - uint getUniformIdentifier(const char *uniformName); - uint getUniformLocation(uint id); + uint getUniformLocation(Uniform id); void setDirty(); // someone has manually changed the current shader program bool useCorrectShaderProg(); // returns true if the shader program needed to be changed @@ -352,6 +371,7 @@ public: TotalShaderCount, InvalidShaderName }; + /* // These allow the ShaderName enum to be used as a cache key const int mainVertexOffset = 0; @@ -391,8 +411,6 @@ private: void compileNamedShader(QGLEngineShaderManager::ShaderName name, QGLShader::ShaderType type); static const char* qglEngineShaderSourceCode[TotalShaderCount]; - - QVector uniformIdentifiers; }; QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index f261ca2..bcff29b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -393,7 +393,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() if (style == Qt::SolidPattern) { QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity); - shaderManager->currentProgram()->setUniformValue(location(FragmentColor), col); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::FragmentColor), col); } else { // All other brushes have a transform and thus need the translation point: @@ -404,10 +404,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity); - shaderManager->currentProgram()->setUniformValue(location(PatternColor), col); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); QVector2D halfViewportSize(width*0.5, height*0.5); - shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); } else if (style == Qt::LinearGradientPattern) { const QLinearGradient *g = static_cast(currentBrush->gradient()); @@ -424,10 +424,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() 1.0f / (l.x() * l.x() + l.y() * l.y()) ); - shaderManager->currentProgram()->setUniformValue(location(LinearData), linearData); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::LinearData), linearData); QVector2D halfViewportSize(width*0.5, height*0.5); - shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); } else if (style == Qt::ConicalGradientPattern) { const QConicalGradient *g = static_cast(currentBrush->gradient()); @@ -435,10 +435,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0; - shaderManager->currentProgram()->setUniformValue(location(Angle), angle); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Angle), angle); QVector2D halfViewportSize(width*0.5, height*0.5); - shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); } else if (style == Qt::RadialGradientPattern) { const QRadialGradient *g = static_cast(currentBrush->gradient()); @@ -448,15 +448,15 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() translationPoint = realFocal; QPointF fmp = realCenter - realFocal; - shaderManager->currentProgram()->setUniformValue(location(Fmp), fmp); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp), fmp); GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius; - shaderManager->currentProgram()->setUniformValue(location(Fmp2MRadius2), fmp2_m_radius2); - shaderManager->currentProgram()->setUniformValue(location(Inverse2Fmp2MRadius2), + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Inverse2Fmp2MRadius2), GLfloat(1.0 / (2.0*fmp2_m_radius2))); QVector2D halfViewportSize(width*0.5, height*0.5); - shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); } else if (style == Qt::TexturePattern) { translationPoint = q->state()->brushOrigin; @@ -465,14 +465,14 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() if (qHasPixmapTexture(*currentBrush) && currentBrush->texture().isQBitmap()) { QColor col = premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity); - shaderManager->currentProgram()->setUniformValue(location(PatternColor), col); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } QSizeF invertedTextureSize( 1.0 / texPixmap.width(), 1.0 / texPixmap.height() ); - shaderManager->currentProgram()->setUniformValue(location(InvertedTextureSize), invertedTextureSize); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); QVector2D halfViewportSize(width*0.5, height*0.5); - shaderManager->currentProgram()->setUniformValue(location(HalfViewportSize), halfViewportSize); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); } else qWarning("QGL2PaintEngineEx: Unimplemented fill style"); @@ -481,8 +481,8 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() QTransform gl_to_qt(1, 0, 0, -1, 0, height); QTransform inv_matrix = gl_to_qt * (brushQTransform * q->state()->matrix).inverted() * translate; - shaderManager->currentProgram()->setUniformValue(location(BrushTransform), inv_matrix); - shaderManager->currentProgram()->setUniformValue(location(BrushTexture), QT_BRUSH_TEXTURE_UNIT); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTransform), inv_matrix); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BrushTexture), QT_BRUSH_TEXTURE_UNIT); } brushUniformsDirty = false; } @@ -620,11 +620,11 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc); shaderManager->setTextureCoordsEnabled(true); if (prepareForDraw(opaque)) - shaderManager->currentProgram()->setUniformValue(location(ImageTexture), QT_IMAGE_TEXTURE_UNIT); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); if (pattern) { QColor col = premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); - shaderManager->currentProgram()->setUniformValue(location(PatternColor), col); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } GLfloat dx = 1.0 / textureSize.width(); @@ -873,17 +873,17 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) updateBrushUniforms(); if (shaderMatrixUniformDirty) { - shaderManager->currentProgram()->setUniformValue(location(PmvMatrix), pmvMatrix); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PmvMatrix), pmvMatrix); shaderMatrixUniformDirty = false; } if (depthUniformDirty) { - shaderManager->currentProgram()->setUniformValue(location(Depth), (GLfloat)q->state()->currentDepth); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), (GLfloat)q->state()->currentDepth); depthUniformDirty = false; } if (useGlobalOpacityUniform && opacityUniformDirty) { - shaderManager->currentProgram()->setUniformValue(location(GlobalOpacity), (GLfloat)q->state()->opacity); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity); opacityUniformDirty = false; } @@ -1166,7 +1166,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte prepareForDraw(false); // Text always causes src pixels to be transparent - shaderManager->currentProgram()->setUniformValue(location(MaskTexture), QT_MASK_TEXTURE_UNIT); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT); if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr) glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); @@ -1210,23 +1210,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->shaderManager->setDirty(); } else { d->shaderManager = new QGLEngineShaderManager(d->ctx); - - d->uniformIdentifiers[QGL2PaintEngineExPrivate::ImageTexture] = d->shaderManager->getUniformIdentifier("imageTexture"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::PatternColor] = d->shaderManager->getUniformIdentifier("patternColor"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::GlobalOpacity] = d->shaderManager->getUniformIdentifier("globalOpacity"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::Depth] = d->shaderManager->getUniformIdentifier("depth"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::PmvMatrix] = d->shaderManager->getUniformIdentifier("pmvMatrix"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::MaskTexture] = d->shaderManager->getUniformIdentifier("maskTexture"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::FragmentColor] = d->shaderManager->getUniformIdentifier("fragmentColor"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::LinearData] = d->shaderManager->getUniformIdentifier("linearData"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::Angle] = d->shaderManager->getUniformIdentifier("angle"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::HalfViewportSize] = d->shaderManager->getUniformIdentifier("halfViewportSize"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::Fmp] = d->shaderManager->getUniformIdentifier("fmp"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::Fmp2MRadius2] = d->shaderManager->getUniformIdentifier("fmp2_m_radius2"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::Inverse2Fmp2MRadius2] = d->shaderManager->getUniformIdentifier("inverse_2_fmp2_m_radius2"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::InvertedTextureSize] = d->shaderManager->getUniformIdentifier("invertedTextureSize"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::BrushTransform] = d->shaderManager->getUniformIdentifier("brushTransform"); - d->uniformIdentifiers[QGL2PaintEngineExPrivate::BrushTexture] = d->shaderManager->getUniformIdentifier("brushTexture"); } glViewport(0, 0, d->width, d->height); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 0d28a49..ec447a3 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -221,32 +221,11 @@ public: void systemStateChanged(); uint use_system_clip : 1; - enum Uniform { - ImageTexture, - PatternColor, - GlobalOpacity, - Depth, - PmvMatrix, - MaskTexture, - FragmentColor, - LinearData, - Angle, - HalfViewportSize, - Fmp, - Fmp2MRadius2, - Inverse2Fmp2MRadius2, - InvertedTextureSize, - BrushTransform, - BrushTexture, - NumUniforms - }; - - uint location(Uniform uniform) + uint location(QGLEngineShaderManager::Uniform uniform) { - return shaderManager->getUniformLocation(uniformIdentifiers[uniform]); + return shaderManager->getUniformLocation(uniform); } - uint uniformIdentifiers[NumUniforms]; GLuint lastTexture; bool needsSync; -- cgit v0.12 From d228015c67614051df8ae0b2f0483572fd667b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 3 Jul 2009 17:38:38 +0200 Subject: Simplify QGraphicsScenePrivate::processDirtyItemsRecursive. This version is easier to read and is slightly faster than the old one. All auto-tests pass. --- src/gui/graphicsview/qgraphicsscene.cpp | 135 +++++++++++++++++--------------- src/gui/graphicsview/qgraphicsscene_p.h | 8 +- 2 files changed, 81 insertions(+), 62 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 85d05e9..bae1afd 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -414,9 +414,22 @@ void QGraphicsScenePrivate::_q_processDirtyItems() { processDirtyItemsEmitted = false; + if (updateAll) { + Q_ASSERT(calledEmitUpdated); + // No need for further processing (except resetting the dirty states). + // The growingItemsBoundingRect is updated in _q_emitUpdated. + for (int i = 0; i < topLevelItems.size(); ++i) + resetDirtyItem(topLevelItems.at(i), /*recursive=*/true); + return; + } + const bool wasPendingSceneUpdate = calledEmitUpdated; const QRectF oldGrowingItemsBoundingRect = growingItemsBoundingRect; - processDirtyItemsRecursive(0); + + // Process items recursively. + for (int i = 0; i < topLevelItems.size(); ++i) + processDirtyItemsRecursive(topLevelItems.at(i)); + dirtyGrowingItemsBoundingRect = false; if (!hasSceneRect && oldGrowingItemsBoundingRect != growingItemsBoundingRect) emit q_func()->sceneRectChanged(growingItemsBoundingRect); @@ -4416,48 +4429,67 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool qreal parentOpacity) { Q_Q(QGraphicsScene); + Q_ASSERT(item); + Q_ASSERT(!updateAll); - bool wasDirtyParentViewBoundingRects = false; - bool wasDirtyParentSceneTransform = false; - qreal opacity = parentOpacity; + if (!item->d_ptr->dirty && !item->d_ptr->dirtyChildren) { + resetDirtyItem(item); + return; + } - if (item) { - wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint; - opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); - const bool itemIsHidden = !item->d_ptr->ignoreVisible && !item->d_ptr->visible; - const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity && opacity == 0.0; - - if (item->d_ptr->dirtySceneTransform && !itemIsHidden && !item->d_ptr->itemIsUntransformable() - && !(itemIsFullyTransparent && item->d_ptr->childrenCombineOpacity())) { - // Calculate the full scene transform for this item. - item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform - : QTransform(); - item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform); - item->d_ptr->dirtySceneTransform = 0; - wasDirtyParentSceneTransform = true; - } + const bool itemIsHidden = !item->d_ptr->ignoreVisible && !item->d_ptr->visible; + if (itemIsHidden) { + resetDirtyItem(item, /*recursive=*/true); + return; + } - if (itemIsHidden || itemIsFullyTransparent || (item->d_ptr->flags & QGraphicsItem::ItemHasNoContents)) { - // Make sure we don't process invisible items or items with no content. - item->d_ptr->dirty = 0; + const bool itemHasContents = !(item->d_ptr->flags & QGraphicsItem::ItemHasNoContents); + const bool itemHasChildren = !item->d_ptr->children.isEmpty(); + if (!itemHasContents && !itemHasChildren) { + resetDirtyItem(item); + return; // Item has neither contents nor children!(?) + } + + const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); + const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity && opacity < 0.0001; + if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) { + resetDirtyItem(item, /*recursive=*/itemHasChildren); + return; + } + + bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform; + const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); + if (wasDirtyParentSceneTransform && !itemIsUntransformable) { + // Calculate the full scene transform for this item. + item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform + : QTransform(); + item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform); + item->d_ptr->dirtySceneTransform = 0; + } + + const bool wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint; + if (itemIsFullyTransparent || !itemHasContents || dirtyAncestorContainsChildren) { + // Make sure we don't process invisible items or items with no content. + item->d_ptr->dirty = 0; + item->d_ptr->fullUpdatePending = 0; + // Might have a dirty view bounding rect otherwise. + if (itemIsFullyTransparent || !itemHasContents) item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; - } + } - if (item->d_ptr->geometryChanged) { - // Update growingItemsBoundingRect. - if (!hasSceneRect && !itemIsHidden) - growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); - item->d_ptr->geometryChanged = 0; - } + if (item->d_ptr->geometryChanged) { + // Update growingItemsBoundingRect. + if (!hasSceneRect) + growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); + item->d_ptr->geometryChanged = 0; } // Process item. - if (item && (item->d_ptr->dirty || item->d_ptr->paintedViewBoundingRectsNeedRepaint)) { + if (item->d_ptr->dirty || item->d_ptr->paintedViewBoundingRectsNeedRepaint) { const bool useCompatUpdate = views.isEmpty() || (connectedSignals & changedSignalMask); - const bool untransformableItem = item->d_ptr->itemIsUntransformable(); const QRectF itemBoundingRect = adjustedItemBoundingRect(item); - if (useCompatUpdate && !untransformableItem && qFuzzyIsNull(item->boundingRegionGranularity())) { + if (useCompatUpdate && !itemIsUntransformable && qFuzzyIsNull(item->boundingRegionGranularity())) { // This block of code is kept for compatibility. Since 4.5, by default // QGraphicsView does not connect the signal and we use the below // method of delivering updates. @@ -4484,7 +4516,6 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport]; if (item->d_ptr->paintedViewBoundingRectsNeedRepaint) { - wasDirtyParentViewBoundingRects = true; paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset); if (!viewPrivate->updateRect(paintedViewBoundingRect)) paintedViewBoundingRect = QRect(); @@ -4506,7 +4537,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool continue; // Discard updates outside the bounding rect. bool valid = false; - if (untransformableItem) { + if (itemIsUntransformable) { valid = updateHelper(viewPrivate, item->d_ptr, dirtyRect, item->deviceTransform(view->viewportTransform())); } else if (!view->isTransformed()) { @@ -4522,18 +4553,17 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool } } - // Process root items / children. - if (!item || item->d_ptr->dirtyChildren) { - QList *children = item ? &item->d_ptr->children : &topLevelItems; - const bool allChildrenDirty = item && item->d_ptr->allChildrenDirty; + // Process children. + if (itemHasChildren && item->d_ptr->dirtyChildren) { if (!dirtyAncestorContainsChildren) { - dirtyAncestorContainsChildren = item && item->d_ptr->fullUpdatePending + dirtyAncestorContainsChildren = item->d_ptr->fullUpdatePending && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); } - const bool parentIgnoresVisible = item && item->d_ptr->ignoreVisible; - const bool parentIgnoresOpacity = item && item->d_ptr->ignoreOpacity; - for (int i = 0; i < children->size(); ++i) { - QGraphicsItem *child = children->at(i); + const bool allChildrenDirty = item->d_ptr->allChildrenDirty; + const bool parentIgnoresVisible = item->d_ptr->ignoreVisible; + const bool parentIgnoresOpacity = item->d_ptr->ignoreOpacity; + for (int i = 0; i < item->d_ptr->children.size(); ++i) { + QGraphicsItem *child = item->d_ptr->children.at(i); if (wasDirtyParentSceneTransform) child->d_ptr->dirtySceneTransform = 1; if (wasDirtyParentViewBoundingRects) @@ -4542,36 +4572,19 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool child->d_ptr->ignoreVisible = 1; if (parentIgnoresOpacity) child->d_ptr->ignoreOpacity = 1; - if (allChildrenDirty) { child->d_ptr->dirty = 1; child->d_ptr->fullUpdatePending = 1; child->d_ptr->dirtyChildren = 1; child->d_ptr->allChildrenDirty = 1; - } else if (!child->d_ptr->dirty && !child->d_ptr->dirtyChildren) { - resetDirtyItem(child); - continue; } - - if (dirtyAncestorContainsChildren || updateAll) { - // No need to process this child's dirty rect, hence reset the dirty state. - // However, we have to continue the recursion because it might have a dirty - // view bounding rect that needs repaint. We also have to reset the dirty - // state of its descendants. - child->d_ptr->dirty = 0; - child->d_ptr->fullUpdatePending = 0; - if (updateAll) - child->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; - } - processDirtyItemsRecursive(child, dirtyAncestorContainsChildren, opacity); } } else if (wasDirtyParentSceneTransform) { item->d_ptr->invalidateChildrenSceneTransform(); } - if (item) - resetDirtyItem(item); + resetDirtyItem(item); } /*! diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 245380f..bd72a71 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -207,18 +207,24 @@ public: void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren = false, qreal parentOpacity = qreal(1.0)); - inline void resetDirtyItem(QGraphicsItem *item) + inline void resetDirtyItem(QGraphicsItem *item, bool recursive = false) { Q_ASSERT(item); item->d_ptr->dirty = 0; item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; item->d_ptr->geometryChanged = 0; + if (!item->d_ptr->dirtyChildren) + recursive = false; item->d_ptr->dirtyChildren = 0; item->d_ptr->needsRepaint = QRectF(); item->d_ptr->allChildrenDirty = 0; item->d_ptr->fullUpdatePending = 0; item->d_ptr->ignoreVisible = 0; item->d_ptr->ignoreOpacity = 0; + if (recursive) { + for (int i = 0; i < item->d_ptr->children.size(); ++i) + resetDirtyItem(item->d_ptr->children.at(i), recursive); + } } inline void ensureSortedTopLevelItems() -- cgit v0.12 From 8fa9744b1b18f97b98fc434b8b8057434118e3db Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 6 Jul 2009 12:30:32 +1000 Subject: Fix precision autotest for SqlServer Sql Server can't count. Reduce the expected length of string when we're on sql server. --- tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 91533dd..812c862 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -155,11 +155,9 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) } if (tst_Databases::isMSAccess(db)) { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 number)")); - } else if (db.driverName().startsWith("QIBASE")) { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 numeric(15, 14))")); + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 number)")); } else { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 numeric(15, 14))")); + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 numeric(15, 14))")); } } @@ -555,7 +553,7 @@ void tst_Q3SqlCursor::unicode() void tst_Q3SqlCursor::precision() { - static const QString precStr = "1.23456789012345"; + static const QString precStr = QLatin1String("1.23456789012345"); static const double precDbl = 2.23456789012345; QFETCH( QString, dbName ); @@ -574,7 +572,10 @@ void tst_Q3SqlCursor::precision() QVERIFY_SQL(cur, select()); QVERIFY( cur.next() ); - QCOMPARE( cur.value( 0 ).asString(), QString( precStr ) ); + if(!tst_Databases::isSqlServer(db)) + QCOMPARE( cur.value( 0 ).asString(), precStr ); + else + QCOMPARE( cur.value( 0 ).asString(), precStr.left(precStr.size()-1) ); QVERIFY( cur.next() ); QCOMPARE( cur.value( 0 ).asDouble(), precDbl ); } -- cgit v0.12 From 8915977e56b58c4631dfb2b8616585b664e55f38 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 6 Jul 2009 15:57:41 +1000 Subject: Fix more sql autotest failures. Sql server fails at numeric field calculations. (Confirmed by running against MySql via odbc). Also, quote fields properly. The drivers know how to do it correctly, so let them handle it. --- tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 812c862..360c3b7 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -575,7 +575,7 @@ void tst_Q3SqlCursor::precision() if(!tst_Databases::isSqlServer(db)) QCOMPARE( cur.value( 0 ).asString(), precStr ); else - QCOMPARE( cur.value( 0 ).asString(), precStr.left(precStr.size()-1) ); + QCOMPARE( cur.value( 0 ).asString(), precStr.left(precStr.size()-1) ); // Sql server fails at counting. QVERIFY( cur.next() ); QCOMPARE( cur.value( 0 ).asDouble(), precDbl ); } @@ -759,8 +759,9 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() { QSqlQuery q(db); q.exec(QString("DROP TABLE %1").arg(tableName)); - QString query = QString("CREATE TABLE %1 (id int, \"first Name\" varchar(20), " - "lastName varchar(20))"); + QString query = "CREATE TABLE %1 (id int, " + + db.driver()->escapeIdentifier("first Name", QSqlDriver::FieldName) + + " varchar(20), lastName varchar(20))"; QVERIFY_SQL(q, exec(query.arg(tableName))); Q3SqlCursor cur(QString("%1").arg(tableName), true, db); -- cgit v0.12 From d3de6acd72b42ebe99bba104c83cfbfda538cc33 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jul 2009 09:15:15 +0200 Subject: qdoc: Added missing CR to help message. --- tools/qdoc3/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 5a98275..6425765 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -128,7 +128,7 @@ static void printHelp() " -D " "Define as a macro while parsing sources\n" " -slow " - "Turn on features that slow down qdoc" + "Turn on features that slow down qdoc\n" " -showinternal " "Include stuff marked internal") ); } -- cgit v0.12 From bf5112c6673d32cbaad33c388d38690264adf107 Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 6 Jul 2009 10:20:02 +0200 Subject: Fixed race condition in search module. Task-number: 257441 Reviewed-by: kh --- tools/assistant/lib/qhelpsearchengine.cpp | 10 ++++------ .../lib/qhelpsearchindexreader_clucene.cpp | 21 +++++++++++++++------ .../lib/qhelpsearchindexreader_clucene_p.h | 5 ++--- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp index 9faafe0..15f7f9e 100644 --- a/tools/assistant/lib/qhelpsearchengine.cpp +++ b/tools/assistant/lib/qhelpsearchengine.cpp @@ -96,6 +96,7 @@ private: delete indexWriter; } + int hitsCount() const { int count = 0; @@ -107,12 +108,9 @@ private: QList hits(int start, int end) const { - QList returnValue; - if (indexReader) { - for (int i = start; i < end && i < hitsCount(); ++i) - returnValue.append(indexReader->hit(i)); - } - return returnValue; + return indexReader ? + indexReader->hits(start, end) : + QList(); } void updateIndex(bool reindex = false) diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp index 227e558..867e060 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp @@ -86,8 +86,8 @@ void QHelpSearchIndexReader::cancelSearching() void QHelpSearchIndexReader::search(const QString &collectionFile, const QString &indexFilesFolder, const QList &queryList) { - QMutexLocker lock(&mutex); - + wait(); + this->hitList.clear(); this->m_cancel = false; this->m_query = queryList; @@ -99,12 +99,18 @@ void QHelpSearchIndexReader::search(const QString &collectionFile, const QString int QHelpSearchIndexReader::hitsCount() const { + QMutexLocker lock(&mutex); return hitList.count(); } -QHelpSearchEngine::SearchHit QHelpSearchIndexReader::hit(int index) const +QList QHelpSearchIndexReader::hits(int start, + int end) const { - return hitList.at(index); + QList hits; + QMutexLocker lock(&mutex); + for (int i = start; i < end && i < hitList.count(); ++i) + hits.append(hitList.at(i)); + return hits; } void QHelpSearchIndexReader::run() @@ -135,7 +141,7 @@ void QHelpSearchIndexReader::run() if(QCLuceneIndexReader::indexExists(indexPath)) { mutex.lock(); if (m_cancel) { - mutex.unlock(); + mutex.unlock(); return; } mutex.unlock(); @@ -213,7 +219,9 @@ void QHelpSearchIndexReader::run() #if !defined(QT_NO_EXCEPTIONS) } catch(...) { + mutex.lock(); hitList.clear(); + mutex.unlock(); emit searchingFinished(0); } #endif @@ -416,8 +424,9 @@ void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine, boostedList.append(it.value()); } while (it != hitMap.constBegin()); boostedList += hitList.mid(count, hitList.count()); - + mutex.lock(); hitList = boostedList; + mutex.unlock(); } } diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h index 47af43f..e7ac0eb 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h @@ -85,9 +85,8 @@ public: void search(const QString &collectionFile, const QString &indexFilesFolder, const QList &queryList); - int hitsCount() const; - QHelpSearchEngine::SearchHit hit(int index) const; + QList hits(int start, int end) const; signals: void searchingStarted(); @@ -105,7 +104,7 @@ private: const QList &queryList); private: - QMutex mutex; + mutable QMutex mutex; QList hitList; QWaitCondition waitCondition; -- cgit v0.12 From 18a717b3f2e6a19a5ad631b68b26d09ba934bece Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 6 Jul 2009 10:24:37 +0200 Subject: Removed superfluous code in assistant's search module. Reviewed-by: kh --- tools/assistant/lib/qhelpsearchengine.cpp | 19 ++++++------------- .../assistant/lib/qhelpsearchindexreader_clucene.cpp | 1 - .../assistant/lib/qhelpsearchindexreader_clucene_p.h | 2 -- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp index 15f7f9e..2a41d04 100644 --- a/tools/assistant/lib/qhelpsearchengine.cpp +++ b/tools/assistant/lib/qhelpsearchengine.cpp @@ -84,14 +84,12 @@ private: , resultWidget(0) , helpEngine(helpEngine) { - hitList.clear(); indexReader = 0; indexWriter = 0; } ~QHelpSearchEnginePrivate() { - hitList.clear(); delete indexReader; delete indexWriter; } @@ -129,11 +127,9 @@ private: connect(indexWriter, SIGNAL(indexingFinished()), this, SLOT(optimizeIndex())); } - if (indexWriter) { - indexWriter->cancelIndexing(); - indexWriter->updateIndex(helpEngine->collectionFile(), - indexFilesFolder(), reindex); - } + indexWriter->cancelIndexing(); + indexWriter->updateIndex(helpEngine->collectionFile(), + indexFilesFolder(), reindex); } void cancelIndexing() @@ -157,11 +153,9 @@ private: connect(indexReader, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int))); } - if (indexReader) { - m_queryList = queryList; - indexReader->cancelSearching(); - indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList); - } + m_queryList = queryList; + indexReader->cancelSearching(); + indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList); } void cancelSearching() @@ -202,7 +196,6 @@ private: QHelpSearchIndexWriter *indexWriter; QPointer helpEngine; - QList hitList; QList m_queryList; }; diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp index 867e060..89d6040 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp @@ -70,7 +70,6 @@ QHelpSearchIndexReader::~QHelpSearchIndexReader() { mutex.lock(); this->m_cancel = true; - waitCondition.wakeOne(); mutex.unlock(); wait(); diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h index e7ac0eb..8876d80 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h @@ -106,8 +106,6 @@ private: private: mutable QMutex mutex; QList hitList; - QWaitCondition waitCondition; - bool m_cancel; QString m_collectionFile; QList m_query; -- cgit v0.12 From cb78e8165bd9e210b336a59065f710d24cae5dd2 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jul 2009 10:34:16 +0200 Subject: doc: Added note about qmake not building to two targets simultaneously Task-number: 256486 --- doc/src/qmake-manual.qdoc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index 5b261ab..049f30c 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -829,6 +829,29 @@ Note that, if a project is later moved on the disk, \c qmake must be run again to process the project file and create a new Xcode project file. + \section2 On supporting two build targets simultaneously + + Implementing this is currently not feasible, because the XCode + concept of Active Build Configurations is conceptually different + from the qmake idea of build targets. + + The XCode Active Build Configurations settings are for modifying + xcode configurations, compiler flags and similar build + options. Unlike Visual Studio, XCode does not allow for the + selection of specific library files based on whether debug or + release build configurations are selected. The qmake debug and + release settings control which library files are linked to the + executable. + + It is currently not possible to set files in XCode configuration + settings from the qmake generated xcode project file. The way the + libraries are linked in the "Frameworks & Libraries" phase in the + XCode build system. + + Furthermore, The selected "Active Build Configuration" is stored + in a .pbxuser file, which is generated by xcode on first load, not + created by qmake. + \section1 Windows Features specific to this platform include support for creating Visual -- cgit v0.12 From 1737e24412ba3becd9b4a86bff3656281767564c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jul 2009 10:48:04 +0200 Subject: doc: Removed specific reference to Mac OS X. Task-number: 256452 --- src/gui/dialogs/qfiledialog.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index f6a8602..849f4b3 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -209,25 +209,30 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook /*! \enum QFileDialog::Option - \value ShowDirsOnly Only show directories in the file dialog. By default both files and - directories are shown. (Valid only in the \l Directory file mode.) - \value DontResolveSymlinks Don't resolve symlinks in the file dialog. By default symlinks - are resolved. - \value DontConfirmOverwrite Don't ask for confirmation if an existing file is selected. - By default confirmation is requested. - \value DontUseNativeDialog Don't use the native file dialog. By default on Mac OS X, - the native file dialog is used unless you use a subclass of QFileDialog that contains the - Q_OBJECT macro. + \value ShowDirsOnly Only show directories in the file dialog. By + default both files and directories are shown. (Valid only in the + \l Directory file mode.) + + \value DontResolveSymlinks Don't resolve symlinks in the file + dialog. By default symlinks are resolved. + + \value DontConfirmOverwrite Don't ask for confirmation if an + existing file is selected. By default confirmation is requested. + + \value DontUseNativeDialog Don't use the native file dialog. By + default, the native file dialog is used unless you use a subclass + of QFileDialog that contains the Q_OBJECT macro. + \value ReadOnly Indicates that the model is readonly. - \value HideNameFilterDetails Indicates if the is hidden or not. + \value HideNameFilterDetails Indicates if the is hidden or not. This value is obsolete and does nothing since Qt 4.5: - \value DontUseSheet In previous versions of Qt, the static functions would - create a sheet by default if the static function was given a parent. This - is no longer supported in Qt 4.5, The static functions will always be an - application modal dialog. If you want to use sheets, use - QFileDialog::open() instead. + \value DontUseSheet In previous versions of Qt, the static + functions would create a sheet by default if the static function + was given a parent. This is no longer supported in Qt 4.5, The + static functions will always be an application modal dialog. If + you want to use sheets, use QFileDialog::open() instead. */ -- cgit v0.12 From 423d40c56f090f3619c8df5667dcfcb0c0a0dc32 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jul 2009 11:24:21 +0200 Subject: doc: Added not about Mac OS X. On Mac OS X, QMenuBar::clear() does not remove menu items that have been merged into the system menu bar. Task-number: 255222 --- src/gui/widgets/qmenubar.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index e1d41de..caacc58 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -956,6 +956,13 @@ void QMenuBar::setActiveAction(QAction *act) /*! Removes all the actions from the menu bar. + \note On Mac OS X, menu items that have been merged to the system + menu bar are not removed by this function. One way to handle this + would be to remove the extra actions yourself. You can set the + \l{QAction::MenuRole}{menu role} on the different menus, so that + you know ahead of time which menu items get merged and which do + not. Then decide what to recreate or remove yourself. + \sa removeAction() */ void QMenuBar::clear() -- cgit v0.12 From c4b7fab9e8296915fff700704db26161bac8df0c Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 6 Jul 2009 10:19:01 +0200 Subject: Fix to paint big widgets in a scroll area If a big widget is inside a scroll area, and this widget is in the limits of XCOORD_MAX, its child might not be inside the limits. The child is then limited to wrect, but wrect might not be on the screen because the parent is scrolled. To avoid this problem, the widgets position should not influence whether wrect is used or not. Task-number: 144779 Reviewed-by: nrc --- src/gui/kernel/qwidget_mac.mm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index d1e4230..b0531ec 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3823,7 +3823,6 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) Qt coordinate system for parent X coordinate system for parent (relative to parent's wrect). */ - QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX); QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX); QRect wrect; //xrect is the X geometry of my X widget. (starts out in parent's Qt coord sys, and ends up in parent's X coord sys) @@ -3901,7 +3900,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) } } - if (!validRange.contains(xrect)) { + if (xrect.height() > XCOORD_MAX || xrect.width() > XCOORD_MAX) { // we are too big, and must clip xrect &=wrectRange; wrect = xrect; @@ -3949,10 +3948,9 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) qt_mac_update_widget_posisiton(q, oldRect, xrect); - if (jump) { - updateSystemBackground(); + if (jump) q->update(); - } + if (mapWindow && !dontShow) { q->setAttribute(Qt::WA_Mapped); #ifndef QT_MAC_USE_COCOA -- cgit v0.12 From f0cd15365d683ad1998a32aab305cbcf69c3140e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jul 2009 13:11:42 +0200 Subject: doc: Corrected comment about effect of deleting a QObject from a thread. Task-number: 151180 --- doc/src/threads.qdoc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/doc/src/threads.qdoc b/doc/src/threads.qdoc index c9d0904..9f7f857 100644 --- a/doc/src/threads.qdoc +++ b/doc/src/threads.qdoc @@ -428,20 +428,22 @@ an object and its children (the object cannot be moved if it has a parent). - Calling \c delete on a QObject from another thread than the - thread where it is created (or accessing the object in other - ways) is unsafe unless you can guarantee that the object isn't - processing events at the same moment. Use QObject::deleteLater() - instead; it will post a - \l{QEvent::DeferredDelete}{DeferredDelete} event, which the - event loop of the object's thread will eventually pick up. + Calling \c delete on a QObject from a thread other than the one + that \e owns the object (or accessing the object in other ways) is + unsafe, unless you guarantee that the object isn't processing + events at that moment. Use QObject::deleteLater() instead, and a + \l{QEvent::DeferredDelete}{DeferredDelete} event will be posted, + which the event loop of the object's thread will eventually pick + up. By default, the thread that \e owns a QObject is the thread + that \e creates the QObject, but not after QObject::moveToThread() + has been called. If no event loop is running, events won't be delivered to the - object. For example, if you create a QTimer object in a thread - but never call \l{QThread::exec()}{exec()}, the QTimer will never emit its - \l{QTimer::timeout()}{timeout()} signal. Calling - \l{QObject::deleteLater()}{deleteLater()} won't work either. (These - restrictions apply to the main thread as well.) + object. For example, if you create a QTimer object in a thread but + never call \l{QThread::exec()}{exec()}, the QTimer will never emit + its \l{QTimer::timeout()}{timeout()} signal. Calling + \l{QObject::deleteLater()}{deleteLater()} won't work + either. (These restrictions apply to the main thread as well.) You can manually post events to any object in any thread at any time using the thread-safe function -- cgit v0.12 From e446729d99bebaf7fac0110fcf22fc867d7229cb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 3 Jul 2009 11:55:06 +0200 Subject: remove arbitrary string length limits --- tools/linguist/lupdate/cpp.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index b1d2d01..35b41d4 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -58,10 +58,6 @@ QT_BEGIN_NAMESPACE static const char MagicComment[] = "TRANSLATOR "; -static const int yyIdentMaxLen = 128; -static const int yyCommentMaxLen = 65536; -static const int yyStringMaxLen = 65536; - #define STRINGIFY_INTERNAL(x) #x #define STRINGIFY(x) STRINGIFY_INTERNAL(x) #define STRING(s) static QString str##s(QLatin1String(STRINGIFY(s))) @@ -668,14 +664,9 @@ uint CppParser::getToken() yyCh = getChar(); if (yyCh == EOF || yyCh == '\n') break; - if (yyString.size() < yyStringMaxLen) { - yyString.append(QLatin1Char('\\')); - yyString.append(yyCh); - } - } else { - if (yyString.size() < yyStringMaxLen) - yyString.append(yyCh); + yyString.append(QLatin1Char('\\')); } + yyString.append(yyCh); yyCh = getChar(); } -- cgit v0.12 From 20d73ef1bf23569b09ca862f6c5e5971098613d6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 3 Jul 2009 13:28:16 +0200 Subject: support for id-based translations unlike in an earlier attempt, ids are textual this time. the developer is able to provide a template for the string. when lupdate and lrelease are integrated into the build process, this makes it possible to avoid a round-trip to a dedicated string designer during the early development stage. Requirement-id: QT-435 --- .../snippets/code/src_corelib_global_qglobal.cpp | 24 ++++++++ src/corelib/global/qglobal.cpp | 56 +++++++++++++++++ src/corelib/global/qglobal.h | 12 ++++ src/corelib/kernel/qcoreapplication.cpp | 6 ++ tests/auto/linguist/lrelease/tst_lrelease.cpp | 13 ++++ .../lupdate/testdata/good/parsecpp/main.cpp | 12 ++++ .../testdata/good/parsecpp/project.ts.result | 18 ++++++ tools/linguist/lrelease/main.cpp | 19 ++++-- tools/linguist/lupdate/cpp.cpp | 70 +++++++++++++++++++++- tools/linguist/shared/qm.cpp | 52 ++++++++++++---- tools/linguist/shared/translator.h | 2 + 11 files changed, 267 insertions(+), 17 deletions(-) diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp index 287181a..50052c3 100644 --- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp +++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp @@ -358,6 +358,30 @@ QString global_greeting(int type) //! [36] +//! [qttrid] + //% "%n fooish bar(s) found.\n" + //% "Do you want to continue?" + QString text = qtTrId("qtn_foo_bar", n); +//! [qttrid] + + +//! [qttrid_noop] +static const char * const ids[] = { + //% "This is the first text." + QT_TRID_NOOP("qtn_1st_text"), + //% "This is the second text." + QT_TRID_NOOP("qtn_2nd_text"), + 0 +}; + +void TheClass::addLabels() +{ + for (int i = 0; ids[i]; ++i) + new QLabel(qtTrId(ids[i]), this); +} +//! [qttrid_noop] + + //! [37] qWarning("%s: %s", qPrintable(key), qPrintable(value)); //! [37] diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f7a97e1..ad4868d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2459,6 +2459,62 @@ int qrand() */ /*! + \fn QString qtTrId(const char *id, int n = -1) + \relates + \reentrant + \since 4.6 + + Returns a translated string identified by \a id. + If no matching string is found, the id itself is returned. This + should not happen under normal conditions. + + If \a n >= 0, all occurrences of \c %n in the resulting string + are replaced with a decimal representation of \a n. In addition, + depending on \a n's value, the translation text may vary. + + Meta data and comments can be passed as documented for QObject::tr(). + In addition, it is possible to supply a source string template like that: + + \tt{//% } + + or + + \tt{\begincomment% \endcomment} + + Example: + + \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid + + Creating QM files suitable for use with this function requires passing + the \c -idbased option to the \c lrelease tool. + + \warning This method is reentrant only if all translators are + installed \e before calling this method. Installing or removing + translators while performing translations is not supported. Doing + so will probably result in crashes or other undesirable behavior. + + \sa QObject::tr(), QCoreApplication::translate(), {Internationalization with Qt} +*/ + +/*! + \macro QT_TRID_NOOP(id) + \relates + \since 4.6 + + Marks \a id for dynamic translation. + The only purpose of this macro is to provide an anchor for attaching + meta data like to qtTrId(). + + The macro expands to \a id. + + Example: + + \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid_noop + + \sa qtTrId(), {Internationalization with Qt} +*/ + +/*! \macro QT_POINTER_SIZE \relates diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index a522bcf..a139a55 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2198,6 +2198,18 @@ inline const QForeachContainer *qForeachContainer(const QForeachContainerBase #define QT_TRANSLATE_NOOP_UTF8(scope, x) (x) #define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment} #define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment} + +#ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above + +// Defined in qcoreapplication.cpp +// The better name qTrId() is reserved for an upcoming function which would +// return a much more powerful QStringFormatter instead of a QString. +Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); + +#define QT_TRID_NOOP(id) id + +#endif // QT_NO_TRANSLATION + #define QDOC_PROPERTY(text) /* diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e2708c3..054be70 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1675,6 +1675,12 @@ QString QCoreApplication::translate(const char *context, const char *sourceText, return result; } +// Declared in qglobal.h +QString qtTrId(const char *id, int n) +{ + return QCoreApplication::translate(0, id, 0, QCoreApplication::UnicodeUTF8, n); +} + bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator) { return QCoreApplication::self diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 512987d..ff90b3c 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -55,6 +55,7 @@ private slots: void translate(); void mixedcodecs(); void compressed(); + void idbased(); void dupes(); private: @@ -191,6 +192,18 @@ void tst_lrelease::compressed() } +void tst_lrelease::idbased() +{ + QVERIFY(!QProcess::execute("lrelease -idbased testdata/idbased.ts")); + + QTranslator translator; + QVERIFY(translator.load("testdata/idbased.qm")); + qApp->installTranslator(&translator); + + QCOMPARE(qtTrId("test_id"), QString::fromAscii("This is a test string.")); + QCOMPARE(qtTrId("untranslated_id"), QString::fromAscii("This has no translation.")); +} + void tst_lrelease::dupes() { QProcess proc; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index 9fb43fe..735e4cd 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -175,3 +175,15 @@ class TestingTake17 : QObject { tr("even more cool"); } }; + + + + +//: again an extra comment, this time for id-based NOOP +//% "This is supposed\tto be quoted \" newline\n" +//% "backslashed \\ stuff." +QT_TRID_NOOP("this_a_id") + +//~ some thing +//% "This needs to be here. Really." +QString test = qtTrId("this_another_id", n); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 5bd7525..97d3bce 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -2,6 +2,24 @@ + + + + This is supposed to be quoted " newline +backslashed \ stuff. + again an extra comment, this time for id-based NOOP + + + + + This needs to be here. Really. + + + + thing + + + Dialog2 diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 86b7866..5fbecac 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -70,6 +70,8 @@ static void printUsage() "format into the 'compiled' .qm format used by QTranslator objects.\n\n" "Options:\n" " -help Display this information and exit\n" + " -idbased\n" + " Use IDs instead of source strings for message keying\n" " -compress\n" " Compress the .qm files\n" " -nounfinished\n" @@ -99,7 +101,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo static bool releaseTranslator(Translator &tor, const QString &qmFileName, bool verbose, bool ignoreUnfinished, - bool removeIdentical, TranslatorSaveMode mode) + bool removeIdentical, bool idBased, TranslatorSaveMode mode) { Translator::reportDuplicates(tor.resolveDuplicates(), qmFileName, verbose); @@ -121,6 +123,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, ConversionData cd; cd.m_verbose = verbose; cd.m_ignoreUnfinished = ignoreUnfinished; + cd.m_idBased = idBased; cd.m_saveMode = mode; bool ok = tor.release(&file, cd); file.close(); @@ -136,7 +139,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, } static bool releaseTsFile(const QString& tsFileName, bool verbose, - bool ignoreUnfinished, bool removeIdentical, TranslatorSaveMode mode) + bool ignoreUnfinished, bool removeIdentical, bool idBased, TranslatorSaveMode mode) { Translator tor; if (!loadTsFile(tor, tsFileName, verbose)) @@ -151,7 +154,7 @@ static bool releaseTsFile(const QString& tsFileName, bool verbose, } qmFileName += QLatin1String(".qm"); - return releaseTranslator(tor, qmFileName, verbose, ignoreUnfinished, removeIdentical, mode); + return releaseTranslator(tor, qmFileName, verbose, ignoreUnfinished, removeIdentical, idBased, mode); } int main(int argc, char **argv) @@ -164,6 +167,7 @@ int main(int argc, char **argv) bool verbose = true; // the default is true starting with Qt 4.2 bool ignoreUnfinished = false; + bool idBased = false; // the default mode is SaveEverything starting with Qt 4.2 TranslatorSaveMode mode = SaveEverything; bool removeIdentical = false; @@ -175,6 +179,9 @@ int main(int argc, char **argv) if (args[i] == QLatin1String("-compress")) { mode = SaveStripped; continue; + } else if (args[i] == QLatin1String("-idbased")) { + idBased = true; + continue; } else if (args[i] == QLatin1String("-nocompress")) { mode = SaveEverything; continue; @@ -232,7 +239,7 @@ int main(int argc, char **argv) qPrintable(args[i])); } else { foreach (const QString &trans, translations) - if (!releaseTsFile(trans, verbose, ignoreUnfinished, removeIdentical, mode)) + if (!releaseTsFile(trans, verbose, ignoreUnfinished, removeIdentical, idBased, mode)) return 1; } } else { @@ -243,7 +250,7 @@ int main(int argc, char **argv) } } else { if (outputFile.isEmpty()) { - if (!releaseTsFile(args[i], verbose, ignoreUnfinished, removeIdentical, mode)) + if (!releaseTsFile(args[i], verbose, ignoreUnfinished, removeIdentical, idBased, mode)) return 1; } else { if (!loadTsFile(tor, args[i], verbose)) @@ -254,7 +261,7 @@ int main(int argc, char **argv) if (!outputFile.isEmpty()) return releaseTranslator(tor, outputFile, verbose, ignoreUnfinished, - removeIdentical, mode) ? 0 : 1; + removeIdentical, idBased, mode) ? 0 : 1; return 0; } diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 35b41d4..58e094b 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -199,7 +199,7 @@ private: enum { Tok_Eof, Tok_class, Tok_friend, Tok_namespace, Tok_using, Tok_return, - Tok_tr = 10, Tok_trUtf8, Tok_translate, Tok_translateUtf8, + Tok_tr = 10, Tok_trUtf8, Tok_translate, Tok_translateUtf8, Tok_trid, Tok_Q_OBJECT = 20, Tok_Q_DECLARE_TR_FUNCTIONS, Tok_Ident, Tok_Comment, Tok_String, Tok_Arrow, Tok_Colon, Tok_ColonColon, Tok_Equals, @@ -553,6 +553,8 @@ uint CppParser::getToken() return Tok_Q_DECLARE_TR_FUNCTIONS; if (yyIdent == QLatin1String("QT_TR_NOOP")) return Tok_tr; + if (yyIdent == QLatin1String("QT_TRID_NOOP")) + return Tok_trid; if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP")) return Tok_translate; if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP3")) @@ -588,6 +590,10 @@ uint CppParser::getToken() if (yyIdent == QLatin1String("namespace")) return Tok_namespace; break; + case 'q': + if (yyIdent == QLatin1String("qtTrId")) + return Tok_trid; + break; case 'r': if (yyIdent == QLatin1String("return")) return Tok_return; @@ -1328,6 +1334,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) QString comment; QString extracomment; QString msgid; + QString sourcetext; TranslatorMessage::ExtraData extra; QString prefix; #ifdef DIAGNOSE_RETRANSLATABILITY @@ -1514,6 +1521,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) case Tok_trUtf8: if (!results->tor) goto case_default; + if (!sourcetext.isEmpty()) + qWarning("%s:%d: //%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n", + qPrintable(yyFileName), yyLineNo); utf8 = (yyTok == Tok_trUtf8); line = yyLineNo; yyTok = getToken(); @@ -1611,6 +1621,9 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) case Tok_translate: if (!results->tor) goto case_default; + if (!sourcetext.isEmpty()) + qWarning("%s:%d: //%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n", + qPrintable(yyFileName), yyLineNo); utf8 = (yyTok == Tok_translateUtf8); line = yyLineNo; yyTok = getToken(); @@ -1660,6 +1673,27 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) msgid.clear(); extra.clear(); break; + case Tok_trid: + if (!results->tor) + goto case_default; + if (!sourcetext.isEmpty()) { + if (!msgid.isEmpty()) + qWarning("%s:%d: //= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n", + qPrintable(yyFileName), yyLineNo); + //utf8 = false; // Maybe use //%% or something like that + line = yyLineNo; + yyTok = getToken(); + if (match(Tok_LeftParen) && matchString(&msgid) && !msgid.isEmpty()) { + bool plural = match(Tok_Comma); + recordMessage(line, QString(), sourcetext, QString(), extracomment, + msgid, extra, false, plural); + } + sourcetext.clear(); + } + extracomment.clear(); + msgid.clear(); + extra.clear(); + break; case Tok_Q_DECLARE_TR_FUNCTIONS: case Tok_Q_OBJECT: namespaces.last()->hasTrFunctions = true; @@ -1689,6 +1723,40 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) int k = yyComment.indexOf(QLatin1Char(' ')); if (k > -1) extra.insert(yyComment.left(k), yyComment.mid(k + 1).trimmed()); + } else if (yyComment.startsWith(QLatin1Char('%'))) { + int p = 1, c; + forever { + if (p >= yyComment.length()) + break; + c = yyComment.unicode()[p++].unicode(); + if (isspace(c)) + continue; + if (c != '"') { + qWarning("%s:%d: Unexpected character in meta string\n", + qPrintable(yyFileName), yyLineNo); + break; + } + forever { + if (p >= yyComment.length()) { + whoops: + qWarning("%s:%d: Unterminated meta string\n", + qPrintable(yyFileName), yyLineNo); + break; + } + c = yyComment.unicode()[p++].unicode(); + if (c == '"') + break; + if (c == '\\') { + if (p >= yyComment.length()) + goto whoops; + c = yyComment.unicode()[p++].unicode(); + if (c == '\n') + goto whoops; + sourcetext.append(QLatin1Char('\\')); + } + sourcetext.append(c); + } + } } else { comment = yyComment.simplified(); if (comment.startsWith(QLatin1String(MagicComment))) { diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index ec61cb6..05d8e12 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -173,6 +173,7 @@ public: bool save(QIODevice *iod); void insert(const TranslatorMessage &msg, bool forceComment); + void insertIdBased(const TranslatorMessage &message); void squeeze(TranslatorSaveMode mode); @@ -436,6 +437,16 @@ void Releaser::insert(const TranslatorMessage &message, bool forceComment) insertInternal(message, forceComment, false); } +void Releaser::insertIdBased(const TranslatorMessage &message) +{ + QStringList tlns = message.translations(); + for (int i = 0; i < tlns.size(); ++i) + if (tlns.at(i).isEmpty()) + tlns[i] = message.sourceText(); + ByteTranslatorMessage bmsg("", originalBytes(message.id(), false), "", tlns); + m_messages.insert(bmsg, 0); +} + void Releaser::setNumerusRules(const QByteArray &rules) { m_numerusRules = rules; @@ -689,11 +700,17 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData int finished = 0; int unfinished = 0; int untranslated = 0; + int missingIds = 0; + int droppedData = 0; for (int i = 0; i != translator.messageCount(); ++i) { const TranslatorMessage &msg = translator.message(i); TranslatorMessage::Type typ = msg.type(); if (typ != TranslatorMessage::Obsolete) { + if (cd.m_idBased && msg.id().isEmpty()) { + ++missingIds; + continue; + } if (typ == TranslatorMessage::Unfinished) { if (msg.translation().isEmpty()) { ++untranslated; @@ -706,19 +723,34 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData } else { ++finished; } - // Drop the comment in (context, sourceText, comment), - // unless the context is empty, - // unless (context, sourceText, "") already exists or - // unless we already dropped the comment of (context, - // sourceText, comment0). - bool forceComment = - msg.comment().isEmpty() - || msg.context().isEmpty() - || translator.contains(msg.context(), msg.sourceText(), QString()); - releaser.insert(msg, forceComment); + if (cd.m_idBased) { + if (!msg.context().isEmpty() || !msg.comment().isEmpty()) + ++droppedData; + releaser.insertIdBased(msg); + } else { + // Drop the comment in (context, sourceText, comment), + // unless the context is empty, + // unless (context, sourceText, "") already exists or + // unless we already dropped the comment of (context, + // sourceText, comment0). + bool forceComment = + msg.comment().isEmpty() + || msg.context().isEmpty() + || translator.contains(msg.context(), msg.sourceText(), QString()); + releaser.insert(msg, forceComment); + } } } + if (missingIds) + cd.appendError(QCoreApplication::translate("LRelease", + "Dropped %n message(s) which had no ID.", 0, + QCoreApplication::CodecForTr, missingIds)); + if (droppedData) + cd.appendError(QCoreApplication::translate("LRelease", + "Excess context/disambiguation dropped from %n message(s).", 0, + QCoreApplication::CodecForTr, droppedData)); + releaser.squeeze(cd.m_saveMode); bool saved = releaser.save(&dev); if (saved && cd.isVerbose()) { diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index ac824f3..fb17fd1 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -65,6 +65,7 @@ public: m_ignoreUnfinished(false), m_sortContexts(false), m_noUiLines(false), + m_idBased(false), m_saveMode(SaveEverything) {} @@ -97,6 +98,7 @@ public: bool m_ignoreUnfinished; bool m_sortContexts; bool m_noUiLines; + bool m_idBased; TranslatorSaveMode m_saveMode; }; -- cgit v0.12 From a59fbee567571827c3a1505b125b9dfb3788c79e Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Mon, 6 Jul 2009 13:45:28 +0200 Subject: update German translation - unification - typos Merge-request: 823 Reviewed-by: Oswald Buddenhagen --- translations/assistant_de.ts | 100 +++++++++++----------- translations/linguist_de.ts | 194 +++++++++++++++++++++---------------------- 2 files changed, 150 insertions(+), 144 deletions(-) diff --git a/translations/assistant_de.ts b/translations/assistant_de.ts index 72b24b6..f702465 100644 --- a/translations/assistant_de.ts +++ b/translations/assistant_de.ts @@ -14,7 +14,7 @@ Warning - Warnung + Achtung @@ -68,12 +68,12 @@ Delete Folder - Verzeichnis löschen + Ordner löschen Rename Folder - Verzeichnis umbenennen + Ordner umbenennen @@ -91,7 +91,7 @@ You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? - Wenn Sie dieses Verzeichnis löschen, wird auch<br>dessen kompletter Inhalt gelöscht! Fortfahren? + Wenn Sie diesen Ordner löschen, wird auch<br>dessen kompletter Inhalt gelöscht. Möchten Sie wirklich fortfahren? @@ -123,12 +123,12 @@ Delete Folder - Verzeichnis löschen + Ordner löschen Rename Folder - Verzeichnis umbenennen + Ordner umbenennen @@ -201,7 +201,7 @@ Add Bookmark for this Page... - Lesezeichen für diese Seite hinzufügen... + Lesezeichen für diese Seite hinzufügen ... @@ -236,7 +236,7 @@ Filter Name: - Filter Name: + Filtername: @@ -244,22 +244,22 @@ Previous - Vorherige + Zurück Next - Nächste + Weiter Case Sensitive - Gross/ Kleinschreibung beachten + Groß-/Kleinschreibung beachten Whole words - Gesamte Worte + Ganze Wörter @@ -316,12 +316,12 @@ <title>Error 404...</title><div align="center"><br><br><h1>The page could not be found</h1><br><h3>'%1'</h3></div> - <title>Fehler 404...</title><div align="center"><br><br><h1>Die Seite konnte nicht gefunden werden!</h1><br><h3>'%1'</h3></div> + <title>Fehler 404 ...</title><div align="center"><br><br><h1>Die Seite kann nicht gefunden werden.</h1><br><h3>'%1'</h3></div> Copy &Link Location - &Link Adresse kopieren + &Link-Adresse kopieren @@ -346,7 +346,7 @@ &Look for: - Suche &nach: + Suchen &nach: @@ -370,7 +370,7 @@ Downloading documentation info... - Dokumentationsinformation herunterladen... + Dokumentationsinformation herunterladen ... @@ -387,12 +387,12 @@ The file %1 already exists. Do you want to overwrite it? - Die Datei %1 existiert bereits. Ãœberschreiben? + Die Datei %1 existiert bereits. Möchten Sie sie überschreiben? Unable to save the file %1: %2. - Die Datei %1 konnte nicht gespeichert werden! Ursache: %2 + Die Datei %1 kann nicht gespeichert werden: %2. @@ -404,7 +404,7 @@ Download failed: %1. - Herunterladen fehlgeschlagen: %1 + Herunterladen fehlgeschlagen: %1. @@ -431,7 +431,7 @@ Available Documentation: - Verfügbare Dokumentationen: + Verfügbare Dokumentation: @@ -451,7 +451,7 @@ Installation Path: - Installationsverzeichnis: + Installationsordner: @@ -504,17 +504,17 @@ Page Set&up... - S&eite einrichten... + S&eite einrichten ... Print Preview... - Druckvorschau... + Druckvorschau ... &Print... - &Drucken... + &Drucken ... CTRL+P @@ -523,7 +523,7 @@ New &Tab - Neue &Seite + Neuer &Tab CTRL+T @@ -532,7 +532,7 @@ &Close Tab - &Seite schließen + Tab &schließen CTRL+W @@ -555,7 +555,7 @@ &Copy selected Text - &Kopieren + Ausgewählten Text &kopieren Ctrl+C @@ -564,7 +564,7 @@ &Find in Text... - &Textsuche... + &Textsuche ... Ctrl+F @@ -591,7 +591,7 @@ Preferences... - Einstellungen... + Einstellungen ... View @@ -656,7 +656,7 @@ Ctrl+Home - Strg+Pos1 + Ctrl+Home @@ -671,7 +671,7 @@ Sync with Table of Contents - Seite mit Inhalt Tab syncronisieren + Seite mit Inhalt-Tab abgleichen @@ -696,7 +696,7 @@ Add Bookmark... - Lesezeichen hinzufügen... + Lesezeichen hinzufügen ... CTRL+B @@ -709,7 +709,7 @@ About... - Ãœber... + Ãœber ... @@ -775,7 +775,7 @@ Looking for Qt Documentation... - Suche nach Qt-Dokumentation... + Suche nach Qt-Dokumentation ... @@ -790,7 +790,7 @@ Ctrl+M - CTRL+M + Ctrl+M @@ -823,7 +823,7 @@ &Go - &Gehe + &Gehe zu @@ -869,12 +869,12 @@ Qt Compressed Help Files (*.qch) - Komprimierte Hilfe-Dateien (*.qch) + Komprimierte Hilfedateien (*.qch) The specified file is not a valid Qt Help File! - Die angegebene Datei ist keine Qt-Hilfe-Datei. + Die angegebene Datei ist keine Qt-Hilfedatei. @@ -889,7 +889,7 @@ Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents. - Einige der gegenwärtig geöffneten Dokumente stammen aus der Dokumentation, die Sie gerade zu löschen versuchen. Sie werden beim Löschen geschlossen. + Einige der derzeit geöffneten Dokumente stammen aus der Dokumentation, die Sie gerade zu löschen versuchen. Sie werden beim Löschen geschlossen. @@ -904,7 +904,7 @@ Use custom settings - Benutze erweiterte Einstellungen + Benutzerdefinierte Einstellungen verwenden @@ -972,12 +972,12 @@ Registered Documentation: - Registrierte Dokumentationen: + Registrierte Dokumentation: Add... - Hinzufügen... + Hinzufügen ... Network @@ -1008,7 +1008,7 @@ Restore to default - Vorgabe wiederherstellen + Voreinstellung wiederherstellen @@ -1035,7 +1035,7 @@ Invalid URL! - Unbekannte URL. + Ungültige URL. @@ -1091,7 +1091,10 @@ Reason: %2 - Could not register documentation file%1Reason:%2 + Dokumentationsdatei %1 kann nicht registriert werden + +Grund: +%2 @@ -1105,7 +1108,10 @@ Reason: Reason: %2 - Could not unregister documentation file%1Reason:%2 + Registrierung der Dokumentationsdatei %1 kann nicht aufgehoben werden + +Grund: +%2 @@ -1152,7 +1158,7 @@ Reason: Copy &Link Location - &Link Adresse kopieren + &Link-Adresse kopieren diff --git a/translations/linguist_de.ts b/translations/linguist_de.ts index 5e9712c..48f1f2e 100644 --- a/translations/linguist_de.ts +++ b/translations/linguist_de.ts @@ -34,7 +34,7 @@ Searching, please wait... - Suche, bitte warten... + Suche, bitte warten ... @@ -67,7 +67,7 @@ Set translated entries to finished - Markiere Ãœbersetzung als erledigt + Ãœbersetzung als erledigt markieren @@ -77,7 +77,7 @@ Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked. - Beachten Sie, dass die geänderten Einträge in den Status 'unerledigt' zurückgesetzt werden, wenn 'Markiere Ãœbersetzung als erledigt' deaktiviert ist. + Beachten Sie, dass die geänderten Einträge in den Status 'unerledigt' zurückgesetzt werden, wenn 'Ãœbersetzung als erledigt markieren' deaktiviert ist. @@ -215,17 +215,17 @@ Es wird mit einer einfachen Universalform gearbeitet. Accelerator possibly superfluous in translation. - Zusätzliche Kurztaste im Ãœbersetzungstext. + Möglicherweise überflüssiger Kurzbefehl im Ãœbersetzungstext. Accelerator possibly missing in translation. - Kurztaste fehlt im Ãœbersetzungstext. + Kurzbefehl fehlt im Ãœbersetzungstext. Translation does not end with the same punctuation as the source text. - Interpunktion am Ende des Ãœbersetzungstextes unterscheidet sich von Interpunktion im Quelltext. + Interpunktion am Ende des Ãœbersetzungstextes unterscheidet sich von Interpunktion des Ursprungstextes. @@ -235,7 +235,7 @@ Es wird mit einer einfachen Universalform gearbeitet. Translation does not refer to the same place markers as in the source text. - Platzhalter im Ãœbersetzungstext und Quelltext unterscheiden sich. + Platzhalter im Ãœbersetzungstext und Ursprungstext unterscheiden sich. @@ -276,7 +276,7 @@ Es wird mit einer einfachen Universalform gearbeitet. Source texts are searched when checked. - Wenn aktiviert, wird in dem Ursprungstexten gesucht. + Wenn aktiviert, wird in den Ursprungstexten gesucht. Source texts @@ -322,7 +322,7 @@ Es wird mit einer einfachen Universalform gearbeitet. &Source texts - &Quelltexte + &Ursprungstexte @@ -347,7 +347,7 @@ Es wird mit einer einfachen Universalform gearbeitet. Click here to find the next occurrence of the text you typed in. - Hier klicken für das nächste Vorkommen des Suchtextes. + Klicken Sie hier, um zum nächsten Vorkommen des Suchtextes zu springen. @@ -357,7 +357,7 @@ Es wird mit einer einfachen Universalform gearbeitet. Click here to close this window. - Klicken Sie hier um das Fenster zu schließen. + Klicken Sie hier, um das Fenster zu schließen. @@ -510,12 +510,12 @@ p, li { white-space: pre-wrap; } &Edit Phrase Book - Wörterbuch &Editieren + Wörterbuch &bearbeiten &Print Phrase Book - Wörterbuch &Drucken + Wörterbuch &drucken @@ -572,7 +572,7 @@ p, li { white-space: pre-wrap; } &Open... - Ö&ffnen... + Ö&ffnen ... @@ -613,7 +613,7 @@ p, li { white-space: pre-wrap; } Previous unfinished item. - Vorherige Unerledigte + Vorheriger unerledigter Eintrag. @@ -623,7 +623,7 @@ p, li { white-space: pre-wrap; } Next unfinished item. - Nächste Unerledigte + Nächster unerledigter Eintrag. @@ -663,7 +663,7 @@ p, li { white-space: pre-wrap; } Copy from source text - &Ursprungstext übernehmen + Ursprungstext übernehmen @@ -698,17 +698,17 @@ p, li { white-space: pre-wrap; } Toggle the validity check of place markers, i.e. whether %1, %2, ... are used consistently in the source text and translation text. If the check fails, a message is shown in the warnings window. - Die Prüfung der Platzhalter, das heißt, ob %1, %2 usw. in Quelltext und Ãœbersetzung übereinstimmend verwendet werden, ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. + Die Prüfung der Platzhalter, das heißt, ob %1, %2 usw. in Ursprungstext und Ãœbersetzung übereinstimmend verwendet werden, ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. Open Read-O&nly... - Schr&eibgeschützt öffnen... + Schr&eibgeschützt öffnen ... &Save All - &Alles speichern + &Alle speichern @@ -725,7 +725,7 @@ p, li { white-space: pre-wrap; } Save As... - Speichern unter... + Speichern unter ... @@ -745,7 +745,7 @@ p, li { white-space: pre-wrap; } &Print... - &Drucken... + &Drucken ... Print a list of all the phrases in the current Qt translation source file. @@ -853,7 +853,7 @@ p, li { white-space: pre-wrap; } Select &All - Alle &markieren + Alles &markieren @@ -868,12 +868,12 @@ p, li { white-space: pre-wrap; } &Find... - &Suchen... + &Suchen ... Search for some text in the translation source file. - Suche einen Text in der Ãœbersetzungsdatei. + In der Ãœbersetzungsdatei nach Text suchen. @@ -888,7 +888,7 @@ p, li { white-space: pre-wrap; } Continue the search where it was left. - Setze die Suche fort. + Die Suche fortsetzen. @@ -898,7 +898,7 @@ p, li { white-space: pre-wrap; } &Prev Unfinished - &Vorherige Unerledigte + &Vorheriger Unerledigter @@ -913,7 +913,7 @@ p, li { white-space: pre-wrap; } Ctrl+W - + Ctrl+W Moves to the previous unfinished item. @@ -927,7 +927,7 @@ p, li { white-space: pre-wrap; } &Next Unfinished - &Nächste Unerledigte + &Nächster Unerledigter Moves to the next unfinished item. @@ -940,7 +940,7 @@ p, li { white-space: pre-wrap; } P&rev - V&orherige + V&orheriger Moves to the previous item. @@ -954,7 +954,7 @@ p, li { white-space: pre-wrap; } Ne&xt - Nä&chste + Nä&chster Moves to the next item. @@ -967,7 +967,7 @@ p, li { white-space: pre-wrap; } &Done and Next - &Fertig und Nächste + &Fertig und Nächster Marks this item as done and moves to the next unfinished item. @@ -980,7 +980,7 @@ p, li { white-space: pre-wrap; } Copies the source text into the translation field. - Kopiere den Ursprungstext in das Ãœbersetzungsfeld. + Kopiert den Ursprungstext in das Ãœbersetzungsfeld. @@ -990,7 +990,7 @@ p, li { white-space: pre-wrap; } &Accelerators - &Kurztasten + &Kurzbefehle Toggle validity checks of accelerators. @@ -1013,7 +1013,7 @@ p, li { white-space: pre-wrap; } Toggle checking that phrase suggestions are used. - Aktiviere/Deaktiviere Ãœberprüfung, ob Wörterbucheinträge benutzt wurden. + Ãœberprüfung, ob Wörterbucheinträge benutzt werden, aktivieren/deaktivieren. @@ -1027,12 +1027,12 @@ p, li { white-space: pre-wrap; } &New Phrase Book... - &Neues Wörterbuch... + &Neues Wörterbuch ... Create a new phrase book. - Erzeuge ein neues Wörterbuch. + Ein neues Wörterbuch erzeugen. @@ -1042,12 +1042,12 @@ p, li { white-space: pre-wrap; } &Open Phrase Book... - &Wörterbuch Öffnen... + &Wörterbuch öffnen ... Open a phrase book to assist translation. - Öffne ein Wörterbuch als Unterstützung bei der Ãœbersetzung. + Ein Wörterbuch zur Unterstützung bei der Ãœbersetzung öffnen. @@ -1062,17 +1062,17 @@ p, li { white-space: pre-wrap; } Sort the items back in the same order as in the message file. - Sortiere die Einträge in der gleichen Reihenfolge wie in der ursprünglichen Ãœbersetzungsdatei. + Die Einträge in der gleichen Reihenfolge wie in der ursprünglichen Ãœbersetzungsdatei sortieren. &Display guesses - &Vorschläge + &Vorschläge anzeigen Set whether or not to display translation guesses. - Aktiviere/Deaktivere Darstellung von Ãœbersetzungsvorschlägen. + Darstellung von Ãœbersetzungsvorschlägen aktivieren/deaktivieren. @@ -1107,7 +1107,7 @@ p, li { white-space: pre-wrap; } Display information about the Qt toolkit by Trolltech. - Informationen über das Qt-Toolkit von Trolltech an. + Informationen über das Qt-Toolkit von Trolltech anzeigen. @@ -1132,18 +1132,18 @@ p, li { white-space: pre-wrap; } &Search And Translate... - Suchen und &Ãœbersetzen... + Suchen und &übersetzen ... Replace the translation on all entries that matches the search source text. - Ersetze die Ãœbersetzung von allen Einträgen, die dem Suchtext entsprechen. + Die Ãœbersetzung aller Einträge ersetzen, die dem Suchtext entsprechen. &Batch Translation... - &Automatische Ãœbersetzung... + &Automatische Ãœbersetzung ... @@ -1160,7 +1160,7 @@ p, li { white-space: pre-wrap; } Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the .ts file. - Eine Qt-Nachrichtendatei aus der aktuellen Ãœbersetzungsdatei erzeugen. Der Dateiname wird automatisch aus dem Namen der .ts-Datei abgeleitet. + Eine Qt-Nachrichtendatei aus der aktuellen Ãœbersetzungsdatei erzeugen. Der Dateiname wird automatisch aus dem Namen der TS-Datei abgeleitet. @@ -1224,7 +1224,7 @@ p, li { white-space: pre-wrap; } Loading... - Lade... + Lade ... @@ -1298,7 +1298,7 @@ Alle Dateien (*) Printing... - Drucke... + Drucke ... @@ -1324,7 +1324,7 @@ Alle Dateien (*) Printing... (page %1) - Drucke... (Seite %1) + Drucke ... (Seite %1) @@ -1355,7 +1355,7 @@ Alle Dateien (*) Qt Linguist - + Qt Linguist @@ -1393,7 +1393,7 @@ Alle Dateien (*) No more occurrences of '%1'. Start over? - Keine weiteren Fundstellen von '%1'. Von vorne beginnen? + Keine weiteren Vorkommen von '%1'. Von vorne beginnen? @@ -1440,7 +1440,7 @@ Alle Dateien (*) No appropriate phrasebook found. - Es wurde kein geeignetes Wörterbuch gefunden. + Es kann kein geeignetes Wörterbuch gefunden werden. @@ -1484,12 +1484,12 @@ Alle Dateien (*) Qt Linguist[*] - + Qt Linguist[*] %1[*] - Qt Linguist - + %1[*] - Qt Linguist @@ -1510,27 +1510,27 @@ Alle Dateien (*) Ctrl+M - + Ctrl+M Display the manual for %1. - Zeige Handbuch für %1 an. + Handbuch zu %1 anzeigen. Display information about %1. - Zeige Informationen über %1 an. + Informationen über %1 anzeigen. &Save '%1' - '%1' &Speichern + '%1' &speichern Save '%1' &As... - Speichere '%1' &unter... + '%1' speichern &unter ... @@ -1540,12 +1540,12 @@ Alle Dateien (*) Release '%1' As... - Gebe '%1'frei unter ... + '%1' freigeben unter ... &Close '%1' - '%1' &Schließen + '%1' &schließen @@ -1572,22 +1572,22 @@ Alle Dateien (*) Translation File &Settings for '%1'... - Einstellungen der Ãœbersetzungs&datei für '%1'... + Einstellungen der Ãœbersetzungs&datei für '%1' ... &Batch Translation of '%1'... - &Automatische Ãœbersetzung von '%1'... + &Automatische Ãœbersetzung von '%1' ... Search And &Translate in '%1'... - Suchen und &Ãœbersetzen in '%1'... + Suchen und &übersetzen in '%1' ... Search And &Translate... - Suchen und &Ãœbersetzen... + Suchen und &übersetzen ... @@ -1622,27 +1622,27 @@ Alle Dateien (*) Cannot read from phrase book '%1'. - Kann Wörterbuch '%1' nicht lesen. + Wörterbuch '%1' kann nicht gelesen werden. Close this phrase book. - Schließe dieses Wörterbuch. + Dieses Wörterbuch schließen. Enables you to add, modify, or delete entries in this phrase book. - Erlaubt das Hinzufügen, Ändern und Entfernen von Einträgen aus dem Wörterbuch. + Erlaubt das Hinzufügen, Ändern und Entfernen von Wörterbuch-Einträgen. Print the entries in this phrase book. - Drucke die Einträge des Wörterbuchs. + Die Einträge des Wörterbuchs drucken. Cannot create phrase book '%1'. - Kann Wörterbuch '%1' nicht erzeugen. + Wörterbuch '%1' kann nicht erzeugt werden. @@ -1657,7 +1657,7 @@ Alle Dateien (*) Open/Refresh Form &Preview - Öffne/Aktualisiere die &Vorschau + Die &Vorschau öffnen/&aktualisieren @@ -1673,7 +1673,7 @@ Alle Dateien (*) Translation File &Settings... - E&instellungen... + E&instellungen ... Other &Languages... @@ -1686,7 +1686,7 @@ Alle Dateien (*) &Add to Phrase Book - &Füge zum Wörterbuch hinzu + Zum Wörterbuch &hinzufügen @@ -1696,12 +1696,12 @@ Alle Dateien (*) Ctrl+J - + Ctrl+J Ctrl+Shift+J - + Ctrl+Shift+J @@ -1893,7 +1893,7 @@ Zeile: %2 %1[*] - Qt Linguist - + %1[*] - Qt Linguist @@ -1903,12 +1903,12 @@ Zeile: %2 Cannot save phrase book '%1'. - Kann Wörterbuch '%1' nicht speichern. + Wörterbuch '%1' kann nicht gespeichert werden. Edit Phrase Book - Ändere Wörterbuch + Wörterbuch bearbeiten This window allows you to add, modify, or delete phrases in a phrase book. @@ -1917,7 +1917,7 @@ Zeile: %2 This window allows you to add, modify, or delete entries in a phrase book. - Dieses Fenster erlaubt das Hinzufügen, Ändern und Entfernen von Einträgen aus dem Wörterbuch. + Dieses Fenster erlaubt das Hinzufügen, Ändern und Entfernen von Wörterbuch-Einträgen. @@ -1927,7 +1927,7 @@ Zeile: %2 This is the phrase in the target language corresponding to the source phrase. - Dies ist der Text, die in der Zielsprache dem Ursprungstext entspricht. + Dies ist der Text, der in der Zielsprache dem Ursprungstext entspricht. @@ -1952,7 +1952,7 @@ Zeile: %2 Click here to add the phrase to the phrase book. - Füge eine neuen Eintrag ins Wörterbuch hinzu. + Einen neuen Eintrag ins Wörterbuch einfügen. @@ -1962,17 +1962,17 @@ Zeile: %2 Click here to remove the entry from the phrase book. - Entferne den Eintrag aus dem Wörterbuch. + Den Eintrag aus dem Wörterbuch entfernen. &Remove Entry - &Entferne Eintrag + &Eintrag entfernen Settin&gs... - &Einstellungen... + &Einstellungen ... &New Phrase @@ -1989,7 +1989,7 @@ Zeile: %2 Click here to save the changes made. - Speichere Änderungen. + Änderungen speichern. @@ -1999,7 +1999,7 @@ Zeile: %2 Click here to close this window. - Klicken Sie hier um das Fenster zu schließen. + Klicken Sie hier, um das Fenster zu schließen. @@ -2053,7 +2053,7 @@ Zeile: %2 Compiled Qt translations - + Kompilierte Qt-Ãœbersetzungen @@ -2079,7 +2079,7 @@ Zeile: %2 C++ source files - C++-Quelltextdateien' + C++-Quelltextdateien @@ -2089,7 +2089,7 @@ Zeile: %2 GNU Gettext localization files - GNU-Gettext Ãœbersetzungsdateien + GNU-Gettext-Ãœbersetzungsdateien @@ -2109,7 +2109,7 @@ Zeile: %2 Qt translation sources (latest format) - Qt Ãœbersetzungsdateien (aktuelles Format) + Qt-Ãœbersetzungsdateien (aktuelles Format) @@ -2213,7 +2213,7 @@ Zeile: %2 Words: - Worte: + Wörter: @@ -2654,7 +2654,7 @@ Alle Dateien (*) Search options - Suchoptionen + Sucheinstellungen @@ -2669,12 +2669,12 @@ Alle Dateien (*) Mark new translation as &finished - Markiere neue Ãœbersetzung als &erledigt + Neue Ãœbersetzung als &erledigt markieren Click here to find the next occurrence of the text you typed in. - Hier klicken für das nächste Vorkommen des Suchtextes. + Klicken Sie hier, um zum nächsten Vorkommen des Suchtextes zu springen. @@ -2689,12 +2689,12 @@ Alle Dateien (*) Translate All - Alle Ãœbersetzen + Alle übersetzen Click here to close this window. - Klicken Sie hier um das Fenster zu schließen. + Klicken Sie hier, um das Fenster zu schließen. -- cgit v0.12 From 33604fb02fa463f36fa78e515bb42a34a746f0f2 Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Mon, 6 Jul 2009 13:47:01 +0200 Subject: general wording change for some file type names - .ts file -> TS file - .qm file -> QM file - .ui file -> UI file + a handfull of typos I stumbled over Merge-request: 802 Reviewed-by: Oswald Buddenhagen --- doc/src/designer-manual.qdoc | 40 +++++++-------- doc/src/dnd.qdoc | 2 +- doc/src/examples/arrowpad.qdoc | 8 +-- doc/src/examples/calculatorform.qdoc | 6 +-- doc/src/examples/helloscript.qdoc | 12 ++--- doc/src/examples/hellotr.qdoc | 26 +++++----- doc/src/examples/multipleinheritance.qdoc | 2 +- doc/src/examples/qtscripttetrix.qdoc | 2 +- doc/src/examples/svggenerator.qdoc | 4 +- doc/src/examples/textfinder.qdoc | 4 +- doc/src/examples/worldtimeclockbuilder.qdoc | 2 +- doc/src/i18n.qdoc | 18 +++---- doc/src/linguist-manual.qdoc | 59 +++++++++++----------- doc/src/porting4-canvas.qdoc | 2 +- doc/src/porting4-designer.qdoc | 40 +++++++-------- doc/src/porting4-overview.qdoc | 4 +- doc/src/porting4.qdoc | 12 ++--- doc/src/qmake-manual.qdoc | 18 +++---- doc/src/qmsdev.qdoc | 2 +- doc/src/qt3to4.qdoc | 2 +- doc/src/qt4-intro.qdoc | 2 +- doc/src/qtdesigner.qdoc | 8 +-- doc/src/qthelp.qdoc | 2 +- doc/src/qtscript.qdoc | 24 ++++----- doc/src/qtuiloader.qdoc | 2 +- doc/src/signalsandslots.qdoc | 2 +- doc/src/snippets/code/doc_src_linguist-manual.qdoc | 6 +-- doc/src/templates.qdoc | 2 +- examples/uitools/textfinder/forms/input.txt | 2 +- mkspecs/features/uic.prf | 2 +- src/corelib/kernel/qobject.cpp | 2 +- src/corelib/kernel/qtranslator.cpp | 2 +- src/tools/uic/uic.cpp | 4 +- src/tools/uic3/main.cpp | 6 +-- src/tools/uic3/uic.cpp | 4 +- src/xmlpatterns/data/qresourceloader_p.h | 2 +- .../testdata/good/mergeui/project.ts.before | 2 +- .../good/mergeui_obsolete/project.ts.result | 2 +- .../testdata/good/mergeui_obsolete/project.ui | 2 +- .../testdata/good/textsimilarity/project.ts.result | 2 +- .../testdata/good/textsimilarity/project.ui | 2 +- tools/designer/data/generate_shared.xsl | 4 +- .../components/formeditor/qdesigner_resource.cpp | 6 +-- tools/designer/src/designer/mainwindow.cpp | 2 +- .../designer/src/designer/qdesigner_workbench.cpp | 2 +- tools/designer/src/lib/sdk/abstractformwindow.cpp | 14 ++--- tools/designer/src/lib/sdk/script.cpp | 6 +-- .../designer/src/lib/uilib/abstractformbuilder.cpp | 14 ++--- tools/designer/src/lib/uilib/formbuilder.cpp | 4 +- tools/designer/src/uitools/quiloader.cpp | 8 +-- tools/linguist/lconvert/main.cpp | 8 +-- tools/linguist/linguist/mainwindow.ui | 2 +- tools/linguist/lrelease/lrelease.1 | 12 ++--- tools/linguist/lrelease/main.cpp | 10 ++-- tools/linguist/lupdate/lupdate.1 | 14 ++--- tools/linguist/lupdate/main.cpp | 6 +-- tools/linguist/shared/qm.cpp | 2 +- tools/linguist/shared/ts.dtd | 8 +-- tools/qtconfig/paletteeditoradvanced.cpp | 2 +- 59 files changed, 235 insertions(+), 236 deletions(-) diff --git a/doc/src/designer-manual.qdoc b/doc/src/designer-manual.qdoc index 67114b9..25e7455 100644 --- a/doc/src/designer-manual.qdoc +++ b/doc/src/designer-manual.qdoc @@ -86,7 +86,7 @@ \o \l{Creating Main Windows in Qt Designer} \o \l{Editing Resources with Qt Designer} \o \l{Using Stylesheets with Qt Designer} - \o \l{Using a Designer .ui File in Your Application} + \o \l{Using a Designer UI File in Your Application} \endlist For advanced usage of \QD, you can refer to these links: @@ -158,7 +158,7 @@ has been introduced to aid translators in the case of two source texts being the same but used for different purposes. For example, a dialog could have two \gui{Add} buttons for two different - reasons. \note To maintain compatibility, comments in \c{.ui} files + reasons. \note To maintain compatibility, comments in UI files created prior to Qt 4.5 will be listed in the \gui{Disambiguation} field. \endlist @@ -620,7 +620,7 @@ \key{Ctrl+O}. At any point, you can save your form by selecting the \gui{Save From As...} - option from the \gui File menu. The \c{.ui} files saved by \QD contain + option from the \gui File menu. The UI files saved by \QD contain information about the objects used, and any details of signal and slot connections between them. @@ -953,7 +953,7 @@ \image designer-form-layout.png - The \c{.ui} file above results in the previews shown below. + The UI file above results in the previews shown below. \table \header @@ -1226,7 +1226,7 @@ The whole connection can be selected by clicking on any of its path segments. Once selected, a connection can be deleted with the - \key Delete key, ensuring that it will not be set up in the \c{.ui} + \key Delete key, ensuring that it will not be set up in the UI file. \endtable */ @@ -1795,7 +1795,7 @@ pixmap property in the property editor. \page designer-stylesheet.html \contentspage {Qt Designer Manual}{Contents} \previouspage Editing Resources with Qt Designer - \nextpage Using a Designer .ui File in Your Application + \nextpage Using a Designer UI File in Your Application \title Using Stylesheets with Qt Designer @@ -1824,7 +1824,7 @@ pixmap property in the property editor. \contentspage {Qt Designer Manual}{Contents} \nextpage Using Custom Widgets with Qt Designer - \title Using a Designer .ui File in Your Application + \title Using a Designer UI File in Your Application With Qt's integrated build tools, \l{qmake Manual}{qmake} and \l uic, the code for user interface components created with \QD is automatically @@ -1855,11 +1855,11 @@ pixmap property in the property editor. \section2 The Direct Approach - To demonstrate how to use user interface (\c{.ui}) files straight from + To demonstrate how to use user interface (UI) files straight from \QD, we create a simple Calculator Form application. This is based on the original \l{Calculator Form Example}{Calculator Form} example. - The application consists of one source file, \c main.cpp and a \c{.ui} + The application consists of one source file, \c main.cpp and a UI file. The \c{calculatorform.ui} file designed with \QD is shown below: @@ -1882,7 +1882,7 @@ pixmap property in the property editor. \snippet doc/src/snippets/uitools/calculatorform/main.cpp 0 This include is an additional check to ensure that we do not generate code - for \c .ui files that are not used. + for UI files that are not used. The \c main function creates the calculator widget by constructing a standard QWidget that we use to host the user interface described by the @@ -2003,7 +2003,7 @@ pixmap property in the property editor. \section2 The UiTools Approach - A resource file containing a \c{.ui} file is required to process forms at + A resource file containing a UI file is required to process forms at run time. Also, the application needs to be configured to use the QtUiTools module. This is done by including the following declaration in a \c qmake project file, ensuring that the application is compiled and linked @@ -2034,7 +2034,7 @@ pixmap property in the property editor. \snippet examples/uitools/textfinder/textfinder.cpp 1 Processing forms at run-time gives the developer the freedom to change a - program's user interface, just by changing the \c{.ui} file. This is useful + program's user interface, just by changing the UI file. This is useful when customizing programs to suit various user needs, such as extra large icons or a different colour scheme for accessibility support. @@ -2130,12 +2130,12 @@ pixmap property in the property editor. \image designer-form-settings.png - When saving a form in \QD, it is stored as an \c .ui file. Several form + When saving a form in \QD, it is stored as a UI file. Several form settings, for example the grid settings or the margin and spacing for the default layout, are stored along with the form's components. These settings are used when the \l uic generates the form's C++ code. For more information on how to use forms in your application, see the - \l{Using a Designer .ui File in Your Application} section. + \l{Using a Designer UI File in Your Application} section. \section1 Modifying the Form Settings @@ -2168,7 +2168,7 @@ pixmap property in the property editor. You can also specify the form's \gui{Include Hints}; i.e., provide a list of the header files which will then be included in the form window's - associated \c .ui file. Header files may be local, i.e., relative to the + associated UI file. Header files may be local, i.e., relative to the project's directory, \c "mywidget.h", or global, i.e. part of Qt or the compilers standard libraries: \c . @@ -2331,7 +2331,7 @@ pixmap property in the property editor. \row \o \c includeFile() \o The header file that must be included in applications that use - this widget. This information is stored in .ui files and will + this widget. This information is stored in UI files and will be used by \c uic to create a suitable \c{#includes} statement in the code it generates for the form containing the custom widget. @@ -2379,12 +2379,12 @@ pixmap property in the property editor. \section2 Notes on the \c{domXml()} Function - The \c{domXml()} function returns a \c{.ui} file snippet that is used by + The \c{domXml()} function returns a UI file snippet that is used by \QD's widget factory to create a custom widget and its applicable properties. - Since Qt 4.4, \QD's widget box allows for a complete \c{.ui} file to - describe \bold one custom widget. The \c{.ui} file can be loaded using the + Since Qt 4.4, \QD's widget box allows for a complete UI file to + describe \bold one custom widget. The UI file can be loaded using the \c{} tag. Specifying the tag allows for adding the element that contains additional information for custom widgets. The \c{} tag is sufficient if no additional information is required @@ -2800,7 +2800,7 @@ pixmap property in the property editor. \title Qt Designer's UI File Format - The \c .ui file format used by \QD is described by the + The \c UI file format used by \QD is described by the \l{http://www.w3.org/XML/Schema}{XML schema} presented below, which we include for your convenience. Be aware that the format may change in future Qt releases. diff --git a/doc/src/dnd.qdoc b/doc/src/dnd.qdoc index 8d3d79d..b5039f6 100644 --- a/doc/src/dnd.qdoc +++ b/doc/src/dnd.qdoc @@ -435,7 +435,7 @@ \title Porting to Qt 4 - Drag and Drop \contentspage {Porting Guides}{Contents} \previouspage Porting to Qt 4 - Virtual Functions - \nextpage Porting .ui Files to Qt 4 + \nextpage Porting UI Files to Qt 4 \ingroup porting \brief An overview of the porting process for applications that use drag and drop. diff --git a/doc/src/examples/arrowpad.qdoc b/doc/src/examples/arrowpad.qdoc index 9e9268c..fa19fbb 100644 --- a/doc/src/examples/arrowpad.qdoc +++ b/doc/src/examples/arrowpad.qdoc @@ -140,10 +140,10 @@ QLocale::system() can be influenced by setting the \c LANG environment variable, for example. Notice that the use of a naming convention that incorporates the locale for \c .qm message files, - (and \c .ts files), makes it easy to implement choosing the + (and TS files), makes it easy to implement choosing the translation file according to locale. - If there is no \c .qm message file for the locale chosen the original + If there is no QM message file for the locale chosen the original source text will be used and no error raised. \section1 Translating to French and Dutch @@ -194,9 +194,9 @@ \endlist We have to convert the \c tt1_fr.ts and \c tt1_nl.ts translation source - files into \c .qm files. We could use \e {Qt Linguist} as we've done + files into QM files. We could use \e {Qt Linguist} as we've done before; however using the command line tool \c lrelease ensures that - \e all the \c .qm files for the application are created without us + \e all the QM files for the application are created without us having to remember to load and \gui File|Release each one individually from \e {Qt Linguist}. diff --git a/doc/src/examples/calculatorform.qdoc b/doc/src/examples/calculatorform.qdoc index 7cbf2ac..90eef3b 100644 --- a/doc/src/examples/calculatorform.qdoc +++ b/doc/src/examples/calculatorform.qdoc @@ -45,8 +45,8 @@ The Calculator Form Example shows how to use a form created with \QD in an application by using the user interface information from - a QWidget subclass. We use \l{Using a Designer .ui File in Your Application} - {uic's auto-connection} feature to automatically connect signals + a QWidget subclass. We use \l{Using a Designer UI File in Your Application} + {uic's auto-connection} feature to automatically connect signals from widgets on the form to slots in our code. \image calculatorform-example.png Screenshot of the Calculator Form example @@ -59,7 +59,7 @@ \section1 Preparation The user interface for this example is designed completely using \QD. The - result is a .ui file describing the form, the widgets used, any signal-slot + result is a UI file describing the form, the widgets used, any signal-slot connections between them, and other standard user interface properties. To ensure that the example can use this file, we need to include a \c FORMS diff --git a/doc/src/examples/helloscript.qdoc b/doc/src/examples/helloscript.qdoc index a18e4ad..1b0f43c 100644 --- a/doc/src/examples/helloscript.qdoc +++ b/doc/src/examples/helloscript.qdoc @@ -121,7 +121,7 @@ window). Don't forget the exclamation mark! Click the \gui Done checkbox and choose \gui File|Save from the - menu bar. The \c .ts file will no longer contain + menu bar. The TS file will no longer contain \snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 3 @@ -129,11 +129,11 @@ \snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 4 - To see the application running in Latin, we have to generate a \c .qm - file from the \c .ts file. Generating a \c .qm file can be achieved - either from within \e {Qt Linguist} (for a single \c .ts file), or - by using the command line program \c lrelease which will produce one \c - .qm file for each of the \c .ts files listed in the project file. + To see the application running in Latin, we have to generate a QM + file from the TS file. Generating a QM file can be achieved + either from within \e {Qt Linguist} (for a single TS file), or + by using the command line program \c lrelease which will produce one + QM file for each of the TS files listed in the project file. Generate \c hellotr_la.qm from \c hellotr_la.ts by choosing \gui File|Release from \e {Qt Linguist}'s menu bar and pressing \gui Save in the file save dialog that pops up. Now run the \c helloscript diff --git a/doc/src/examples/hellotr.qdoc b/doc/src/examples/hellotr.qdoc index bb38737..18e0715 100644 --- a/doc/src/examples/hellotr.qdoc +++ b/doc/src/examples/hellotr.qdoc @@ -108,12 +108,12 @@ Note that the file extension is \c .ts, not \c .qm. The \c .ts translation source format is designed for use during the application's development. Programmers or release managers run - the \c lupdate program to generate and update \c .ts files with + the \c lupdate program to generate and update TS files with the source text that is extracted from the source code. - Translators read and update the \c .ts files using \e {Qt + Translators read and update the TS files using \e {Qt Linguist} adding and editing their translations. - The \c .ts format is human-readable XML that can be emailed directly + The TS format is human-readable XML that can be emailed directly and is easy to put under version control. If you edit this file manually, be aware that the default encoding for XML is UTF-8, not Latin1 (ISO 8859-1). One way to type in a Latin1 character such as @@ -121,8 +121,8 @@ "\ø". This will work for any Unicode 4.0 character. Once the translations are complete the \c lrelease program is used to - convert the \c .ts files into the \c .qm Qt message file format. The - \c .qm format is a compact binary format designed to deliver very + convert the TS files into the QM Qt message file format. The + QM format is a compact binary format designed to deliver very fast lookup performance. Both \c lupdate and \c lrelease read all the project's source and header files (as specified in the HEADERS and SOURCES lines of the project file) and extract the strings that @@ -131,7 +131,7 @@ \c lupdate is used to create and update the message files (\c hellotr_la.ts in this case) to keep them in sync with the source code. It is safe to run \c lupdate at any time, as \c lupdate does not remove any - information. For example, you can put it in the makefile, so the \c .ts + information. For example, you can put it in the makefile, so the TS files are updated whenever the source changes. Try running \c lupdate right now, like this: @@ -151,7 +151,7 @@ We will use \e {Qt Linguist} to provide the translation, although you can use any XML or plain text editor to enter a translation into a - \c .ts file. + TS file. To start \e {Qt Linguist}, type @@ -163,7 +163,7 @@ window). Don't forget the exclamation mark! Click the \gui Done checkbox and choose \gui File|Save from the - menu bar. The \c .ts file will no longer contain + menu bar. The TS file will no longer contain \snippet doc/src/snippets/code/doc_src_examples_hellotr.qdoc 3 @@ -173,11 +173,11 @@ \section1 Running the Application in Latin - To see the application running in Latin, we have to generate a \c .qm - file from the \c .ts file. Generating a \c .qm file can be achieved - either from within \e {Qt Linguist} (for a single \c .ts file), or - by using the command line program \c lrelease which will produce one \c - .qm file for each of the \c .ts files listed in the project file. + To see the application running in Latin, we have to generate a QM + file from the TS file. Generating a QM file can be achieved + either from within \e {Qt Linguist} (for a single TS file), or + by using the command line program \c lrelease which will produce one + QM file for each of the TS files listed in the project file. Generate \c hellotr_la.qm from \c hellotr_la.ts by choosing \gui File|Release from \e {Qt Linguist}'s menu bar and pressing \gui Save in the file save dialog that pops up. Now run the \c hellotr diff --git a/doc/src/examples/multipleinheritance.qdoc b/doc/src/examples/multipleinheritance.qdoc index 5a77275..1622fb0 100644 --- a/doc/src/examples/multipleinheritance.qdoc +++ b/doc/src/examples/multipleinheritance.qdoc @@ -103,6 +103,6 @@ There are various approaches to include forms into applications. The Multiple Inheritance approach is just one of them. See - \l{Using a Designer .ui File in Your Application} for more information on + \l{Using a Designer UI File in Your Application} for more information on the other approaches available. */ diff --git a/doc/src/examples/qtscripttetrix.qdoc b/doc/src/examples/qtscripttetrix.qdoc index c94697a..fb2d537 100644 --- a/doc/src/examples/qtscripttetrix.qdoc +++ b/doc/src/examples/qtscripttetrix.qdoc @@ -57,7 +57,7 @@ \section1 Setting up the GUI - The graphical user interface is defined in a \c{.ui} file, creating + The graphical user interface is defined in a UI file, created using Qt Designer, and is set up in the example's C++ \c{main.cpp} file. \snippet examples/script/qstetrix/main.cpp 0 diff --git a/doc/src/examples/svggenerator.qdoc b/doc/src/examples/svggenerator.qdoc index 09fe6e1..dd7459a 100644 --- a/doc/src/examples/svggenerator.qdoc +++ b/doc/src/examples/svggenerator.qdoc @@ -55,8 +55,8 @@ The example consists of two classes: \c Window and \c DisplayWidget. The \c Window class contains the application logic and constructs the user - interface from a Qt Designer \c{.ui} file as described in the - \l{Using a Designer .ui File in Your Application#The Multiple Inheritance Approach}{Qt Designer manual}. + interface from a Qt Designer UI file as described in the + \l{Using a Designer UI File in Your Application#The Multiple Inheritance Approach}{Qt Designer manual}. It also contains the code to write an SVG file. The \c DisplayWidget class performs all the work of painting a picture on diff --git a/doc/src/examples/textfinder.qdoc b/doc/src/examples/textfinder.qdoc index adbbd0d..acfbd0f 100644 --- a/doc/src/examples/textfinder.qdoc +++ b/doc/src/examples/textfinder.qdoc @@ -45,7 +45,7 @@ The Text Finder example demonstrates how to dynamically process forms using the QtUiTools module. Dynamic form processing enables a form to - be processed at run-time only by changing the .ui file for the project. + be processed at run-time only by changing the UI file for the project. The program allows the user to look up a particular word within the contents of a text file. This text file is included in the project's resource and is loaded into the display at startup. @@ -95,7 +95,7 @@ \snippet examples/uitools/textfinder/textfinder.h 0 The slot \c{on_find_Button_clicked()} is a slot named according to the - \l{Using a Designer .ui File in Your Application#Automatic Connections} + \l{Using a Designer UI File in Your Application#Automatic Connections} {Automatic Connection} naming convention required by \c uic. diff --git a/doc/src/examples/worldtimeclockbuilder.qdoc b/doc/src/examples/worldtimeclockbuilder.qdoc index 55246e9..f38062a 100644 --- a/doc/src/examples/worldtimeclockbuilder.qdoc +++ b/doc/src/examples/worldtimeclockbuilder.qdoc @@ -66,7 +66,7 @@ generate a dependency on the \c libQtUiTools library containing the QtUiTools classes. - Note that we do not inform \c qmake about any .ui files, and so none will + Note that we do not inform \c qmake about any UI files, and so none will be processed and built into the application. The resource file contains an entry for the particular form that we wish to use: diff --git a/doc/src/i18n.qdoc b/doc/src/i18n.qdoc index 4109b62..5964926 100644 --- a/doc/src/i18n.qdoc +++ b/doc/src/i18n.qdoc @@ -266,19 +266,19 @@ \o Run \c lupdate to extract translatable text from the C++ source code of the Qt application, resulting in a message file - for translators (a \c .ts file). The utility recognizes the tr() + for translators (a TS file). The utility recognizes the tr() construct and the \c{QT_TR*_NOOP()} macros described above and - produces \c .ts files (usually one per language). + produces TS files (usually one per language). - \o Provide translations for the source texts in the \c .ts file, using - \e{Qt Linguist}. Since \c .ts files are in XML format, you can also + \o Provide translations for the source texts in the TS file, using + \e{Qt Linguist}. Since TS files are in XML format, you can also edit them by hand. - \o Run \c lrelease to obtain a light-weight message file (a \c .qm - file) from the \c .ts file, suitable only for end use. Think of the \c - .ts files as "source files", and \c .qm files as "object files". The - translator edits the \c .ts files, but the users of your application - only need the \c .qm files. Both kinds of files are platform and + \o Run \c lrelease to obtain a light-weight message file (a QM + file) from the TS file, suitable only for end use. Think of the TS + files as "source files", and QM files as "object files". The + translator edits the TS files, but the users of your application + only need the QM files. Both kinds of files are platform and locale independent. \endlist diff --git a/doc/src/linguist-manual.qdoc b/doc/src/linguist-manual.qdoc index ee59fdc..fd062bb 100644 --- a/doc/src/linguist-manual.qdoc +++ b/doc/src/linguist-manual.qdoc @@ -247,10 +247,10 @@ subsequent \l lupdate runs would probably take place during the final beta phase. - The \c .ts file format is a simple human-readable XML format that + The TS file format is a simple human-readable XML format that can be used with version control systems if required. \c lupdate can also process Localization Interchange File Format (XLIFF) - format files; file in this format typically have file names that + format files; files in this format typically have file names that end with the \c .xlf suffix. Pass the \c -help option to \c lupdate to obtain the list of @@ -266,19 +266,19 @@ Usage: \c {lrelease myproject.pro} - \l lrelease is a command line tool that produces \c .qm files out - of \c .ts files. The \c .qm file format is a compact binary format + \l lrelease is a command line tool that produces QM files out + of TS files. The QM file format is a compact binary format that is used by the localized application. It provides extremely - fast lookups for translations. The \c .ts files \l lrelease + fast lookups for translations. The TS files \l lrelease processes can be specified at the command line, or given indirectly by a Qt \c .pro project file. This tool is run whenever a release of the application is to be made, from initial test version through to final release - version. If the \c .qm files are not created, e.g. because an + version. If the QM files are not created, e.g. because an alpha release is required before any translation has been undertaken, the application will run perfectly well using the text - the programmers placed in the source files. Once the \c .qm files + the programmers placed in the source files. Once the QM files are available the application will detect them and use them automatically. @@ -293,7 +293,7 @@ \section1 Missing Translations - Both \l lupdate and \l lrelease may be used with \c .ts + Both \l lupdate and \l lrelease may be used with TS translation source files which are incomplete. Missing translations will be replaced with the native language phrases at runtime. @@ -317,8 +317,8 @@ from the taskbar menu, or by double clicking the desktop icon, or by entering the command \c {linguist} at the command line. Once \QL has started, choose \menu{File|Open} from the \l{menubar} - {menu bar} and select a translation source (\c{.ts} file) to - load. If you don't have a \c{.ts} file, see the \l {Qt Linguist + {menu bar} and select a translation source (TS file) to + load. If you do not have a TS file, see the \l {Qt Linguist Manual: Release Manager} {release manager manual} to learn how to generate one. @@ -928,12 +928,12 @@ \image linguist-previewtool.png - Forms created by \e{Qt Designer} are stored in special \c .ui files. - \QL can make use of these \c .ui files to show the translations - done so far on the form itself. This of course requires access to the \c .ui + Forms created by \e{Qt Designer} are stored in special UI files. + \QL can make use of these UI files to show the translations + done so far on the form itself. This of course requires access to the UI files during the translation process. Activate \menu{Tools|Open/Refresh Form Preview} to open the window shown above. - The list of \c .ui files \QL has detected are displayed in the Forms + The list of UI files \QL has detected are displayed in the Forms List on the left hand. If the path to the files has changed, you can load the files manually via \menu{File|Open Form...}. Double-click on an entry in the Forms List to display the Form File. Select \e{} from @@ -947,15 +947,15 @@ \QL makes use of four kinds of files: \list - \o \c .ts \e {translation source files} \BR are human-readable XML + \o TS \e {translation source files} \BR are human-readable XML files containing source phrases and their translations. These files are usually created and updated by \l lupdate and are specific to an application. \o \c .xlf \e {XLIFF files} \BR are human-readable XML files that adhere to the international XML Localization Interchange File Format. \QL can be used to edit XLIFF files generated by other programs. For standard - Qt projects, however, only the \c .ts file format is used. - \o \c .qm \e {Qt message files} \BR are binary files that contain + Qt projects, however, only the TS file format is used. + \o QM \e {Qt message files} \BR are binary files that contain translations used by an application at runtime. These files are generated by \l lrelease, but can also be generated by \QL. \o \c .qph \e {Qt phrase book files} \BR are human-readable XML @@ -974,18 +974,18 @@ \list \o \gui {Open... Ctrl+O} \BR pops up an open file dialog from which a translation source \c .ts or \c .xlf file can be chosen. - \o \gui {Recently opened files} \BR shows the \c .ts files that + \o \gui {Recently opened files} \BR shows the TS files that have been opened recently, click one to open it. \o \gui {Save Ctrl+S} \BR saves the current translation source file. \o \gui {Save As...} \BR pops up a save as file dialog so that the current translation source file may be saved with a different name, format and/or put in a different location. - \o \gui {Release} \BR create a Qt message \c .qm file with the same base + \o \gui {Release} \BR create a Qt message QM file with the same base name as the current translation source file. The release manager's command line tool \l lrelease performs the same function on \e all of an application's translation source files. \o \gui {Release As...} \BR pops up a save as file dialog. The - filename entered will be a Qt message \c .qm file of the translation + filename entered will be a Qt message QM file of the translation based on the current translation source file. The release manager's command line tool \l lrelease performs the same function on \e all of an application's translation source files. @@ -1136,16 +1136,15 @@ \list \o \inlineimage linguist-fileopen.png \BR - Pops up the open file dialog to open a new translation source \c .ts - file. + Pops up the open file dialog to open a new translation source TS file. \o \inlineimage linguist-filesave.png \BR - Saves the current translation source \c .ts file. + Saves the current translation source TS file. \o \inlineimage linguist-fileprint.png \BR - Prints the current translation source \c .ts file. + Prints the current translation source TS file. \o \inlineimage linguist-phrasebookopen.png \BR @@ -1263,10 +1262,10 @@ Translation files are created as follows: \list 1 - \o Run \l lupdate initially to generate the first set of \c .ts + \o Run \l lupdate initially to generate the first set of TS translation source files with all the user-visible text but no translations. - \o The \c .ts files are given to the translator who adds translations + \o The TS files are given to the translator who adds translations using \QL. \QL takes care of any changed or deleted source text. \o Run \l lupdate to incorporate any new text added to the @@ -1274,7 +1273,7 @@ application with the translations; it does not destroy any data. \o Steps 2 and 3 are repeated as often as necessary. \o When a release of the application is needed \l lrelease is run to - read the \c .ts files and produce the \c .qm files used by the + read the TS files and produce the QM files used by the application at runtime. \endlist @@ -1319,7 +1318,7 @@ In production applications a more flexible approach, for example, loading translations according to locale, might be more appropriate. If - the \c .ts files are all named according to a convention such as + the TS files are all named according to a convention such as \e appname_locale, e.g. \c tt2_fr, \c tt2_de etc, then the code above will load the current locale's translation at runtime. @@ -1413,7 +1412,7 @@ To handle plural forms in the native language, you need to load a translation file for this language, too. \l lupdate has the \c -pluralonly command line option, which allows the creation of - \c .ts files containing only entries with plural forms. + TS files containing only entries with plural forms. See the \l{http://doc.trolltech.com/qq/}{Qt Quarterly} Article \l{http://doc.trolltech.com/qq/qq19-plurals.html}{Plural Forms in Translations} @@ -1503,7 +1502,7 @@ \contentspage {Qt Linguist Manual}{Contents} \previouspage Qt Linguist Manual: Programmers - The \c .ts file format used by \QL is described by the + The TS file format used by \QL is described by the \l{http://www.w3.org/TR/1998/REC-xml-19980210}{DTD} presented below, which we include for your convenience. Be aware that the format may change in future Qt releases. diff --git a/doc/src/porting4-canvas.qdoc b/doc/src/porting4-canvas.qdoc index fa0bc6b..d1221cf 100644 --- a/doc/src/porting4-canvas.qdoc +++ b/doc/src/porting4-canvas.qdoc @@ -43,7 +43,7 @@ \page graphicsview-porting.html \title Porting to Graphics View \contentspage {Porting Guides}{Contents} - \previouspage Porting .ui Files to Qt 4 + \previouspage Porting UI Files to Qt 4 \nextpage qt3to4 - The Qt 3 to 4 Porting Tool \ingroup porting \ingroup multimedia diff --git a/doc/src/porting4-designer.qdoc b/doc/src/porting4-designer.qdoc index 916894b..7de1d43 100644 --- a/doc/src/porting4-designer.qdoc +++ b/doc/src/porting4-designer.qdoc @@ -41,12 +41,12 @@ /*! \page porting4-designer.html - \title Porting .ui Files to Qt 4 + \title Porting UI Files to Qt 4 \contentspage {Porting Guides}{Contents} \previouspage Porting to Qt 4 - Drag and Drop \nextpage Porting to Graphics View \ingroup porting - \brief Information about changes to the .ui file format in Qt 4. + \brief Information about changes to the UI file format in Qt 4. Qt Designer has changed significantly in the Qt 4 release. We have moved away from viewing Qt Designer as an IDE and @@ -57,20 +57,20 @@ IDEs. The most important changes in Qt Designer 4 which affect porting - for \c .ui files are summarized below: + for UI files are summarized below: \list \o \bold{Removed project manager.} - Qt Designer now only reads and edits \c .ui - files. It has no notion of a project (\c .pro file). + Qt Designer now only reads and edits UI + files. It has no notion of a project file (\c .pro). \o \bold{Removed code editor.} Qt Designer can no longer be used to edit source files. - \o \bold{Changed format of \c .ui files.} + \o \bold{Changed format of UI files.} Qt Designer 4 cannot read files created by Qt Designer 3 and vice versa. However, we provide the tool \c uic3 to generate Qt - 4 code out of Qt 3 \c .ui files, and to convert old \c .ui files + 4 code out of Qt 3 UI files, and to convert old UI files into a format readable by Qt Designer 4. \o \bold{Changed structure of the code generated by \c uic.} @@ -80,7 +80,7 @@ \c Ui::MyForm. \o \bold{New resource file system.} Icon data is no longer - stored in the \c .ui file. Instead, icons are put into resource + stored in the UI file. Instead, icons are put into resource files (\c .qrc). \endlist @@ -146,9 +146,9 @@ therefore has an interface identical to that of a class generated by \c uic in Qt 3. - Creating POD classes from \c .ui files is more flexible and + Creating POD classes from UI files is more flexible and generic than the old approach of creating widgets. Qt Designer - doesn't need to know anything about the main container apart from + does not need to know anything about the main container apart from the base widget class it inherits. Indeed, \c Ui::HelloWorld can be used to populate any container that inherits QWidget. Conversely, all non-GUI aspects of the main container may be @@ -163,10 +163,10 @@ \list 1 \o To generate headers and source code for a widget to implement any custom signals and slots added using Qt Designer 3. - \o To generate a new \c .ui file that can be used with Qt Designer 4. + \o To generate a new UI file that can be used with Qt Designer 4. \endlist - You can use both these methods in combination to obtain \c{.ui}, header + You can use both these methods in combination to obtain UI, header and source files that you can use as a starting point when porting your user interface to Qt 4. @@ -179,7 +179,7 @@ The resulting files \c myform.h and \c myform.cpp implement the form in Qt 4 using a QWidget that will include custom signals, - slots and connections specified in the \c .ui file. However, + slots and connections specified in the UI file. However, see below for the \l{#Limitations of uic3}{limitations} of this method. @@ -190,7 +190,7 @@ The resulting file \c myform4.ui can be edited in Qt Designer 4. The header file for the form is generated by Qt 4's \c uic. See the - \l{Using a Designer .ui File in Your Application} chapter of the + \l{Using a Designer UI File in Your Application} chapter of the \l{Qt Designer Manual} for information about the preferred ways to use forms created with Qt Designer 4. @@ -218,7 +218,7 @@ \section1 Limitations of uic3 - Converting Qt 3 \c .ui files to Qt 4 has some limitations. The + Converting Qt 3 UI files to Qt 4 has some limitations. The most noticeable limitation is the fact that since \c uic no longer generates a QObject, it's not possible to define custom signals or slots for the form. Instead, the programmer must @@ -231,9 +231,9 @@ A quick and dirty way to port forms containing custom signals and slots is to generate the code using \c uic3, rather than \c uic. Since \c uic3 does generate a QWidget, it will populate it with custom - signals, slots and connections specified in the \c .ui file. - However, \c uic3 can only generate code from Qt 3 \c .ui files, which - implies that the \c .ui files never get translated and need to be + signals, slots and connections specified in the UI file. + However, \c uic3 can only generate code from Qt 3 UI files, which + implies that the UI files never get translated and need to be edited using Qt Designer 3. Note also that it is possible to create implicit connections @@ -256,7 +256,7 @@ \section1 Icons In Qt 3, the binary data for the icons used by a form was stored - in the \c .ui file. In Qt 4 icons and any other external files + in the UI file. In Qt 4 icons and any other external files can be compiled into the application by listing them in a \l{The Qt Resource System}{resource file} (\c .qrc). This file is translated into a C++ source file using Qt's resource compiler @@ -306,7 +306,7 @@ the following steps: \list 1 - \o Use \c{uic3 -convert} to obtain a \c .ui file understood by + \o Use \c{uic3 -convert} to obtain a UI file understood by Qt Designer 4. \o Create a \c .qrc file with a list of all the icon files. diff --git a/doc/src/porting4-overview.qdoc b/doc/src/porting4-overview.qdoc index d91729d..3494c6d 100644 --- a/doc/src/porting4-overview.qdoc +++ b/doc/src/porting4-overview.qdoc @@ -115,13 +115,13 @@ support these project-level features. We recommend using one of the - \l{Using a Designer .ui File in Your Application}{form subclassing approaches} + \l{Using a Designer UI File in Your Application}{form subclassing approaches} with forms created using Qt Designer. This avoids the need to use \c{.ui.h} files and special purpose code editors. Existing Qt 3 forms created using Qt Designer can be gradually ported to Qt 4 by following the advice in the - \l{Porting .ui Files to Qt 4} guide. However, some extra effort + \l{Porting UI Files to Qt 4} guide. However, some extra effort will be required to move application logic from \c{.ui.h} files into the main body of a Qt 4 application. diff --git a/doc/src/porting4.qdoc b/doc/src/porting4.qdoc index 7ce2969..2414c4d 100644 --- a/doc/src/porting4.qdoc +++ b/doc/src/porting4.qdoc @@ -97,7 +97,7 @@ to developers porting from Qt 3 to Qt 4. \o \l{Porting to Qt 4 - Drag and Drop} \mdash covers differences in the way drag and drop is handled between Qt 3 and Qt 4. - \o \l{Porting .ui Files to Qt 4} \mdash describes the new format used to + \o \l{Porting UI Files to Qt 4} \mdash describes the new format used to describe forms created with \QD. \o \l{Porting to Graphics View} \mdash provides a class-by-class overview of the differences between Qt 3's canvas API and Qt 4's Graphics @@ -135,7 +135,7 @@ \o Run the \l qt3to4 porting tool. The tool will go through your source code and adapt it to Qt 4. - \o Follow the instructions in the \l{Porting .ui Files to Qt 4} + \o Follow the instructions in the \l{Porting UI Files to Qt 4} page to port Qt Designer files. \o Recompile with Qt 4. For each error, search below for related @@ -347,7 +347,7 @@ macro, removing the need for a \c Q_OVERRIDE() macro. The table below lists the Qt properties that have been renamed in - Qt 4. Occurrences of these in \e{Qt Designer} \c .ui files are + Qt 4. Occurrences of these in \e{Qt Designer} UI files are automatically converted to the new name by \c uic. \table @@ -406,11 +406,11 @@ Some properties have been removed from Qt 4, but the associated access functions are provided if \c QT3_SUPPORT is defined to help - porting to Qt 4. When converting Qt 3 \c .ui files to Qt 4, \c uic + porting to Qt 4. When converting Qt 3 UI files to Qt 4, \c uic generates calls to the Qt 3 compatibility functions. Note that this only applies to the properties of the Qt3Support library, i.e. \c QT3_SUPPORT properties of the other libraries must be - ported manually when converting Qt 3 .ui files to Qt 4. + ported manually when converting Qt 3 UI files to Qt 4. The table below lists these properties with the read and write functions that you can use instead. The documentation for the @@ -518,7 +518,7 @@ (Notice the \c & in the parameter declaration.) \omit - \section1 Qt Designer .ui Files + \section1 Qt Designer UI Files ### \endomit diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index 049f30c..0921ae7 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -235,7 +235,7 @@ \row \o CONFIG \o General project configuration options. \row \o DESTDIR \o The directory in which the executable or binary file will be placed. - \row \o FORMS \o A list of .ui files to be processed by \c uic. + \row \o FORMS \o A list of UI files to be processed by \c uic. \row \o HEADERS \o A list of filenames of header (.h) files used when building the project. \row \o QT \o Qt-specific configuration options. @@ -701,8 +701,8 @@ If a directory is specified, it will be included in the \c DEPENDPATH variable, and relevant code from there will be included in the generated project file. If a file is given, it will be appended to the correct - variable, depending on its extension; for example, .ui files are added - to \c FORMS, and .cpp files are added to \c SOURCES. + variable, depending on its extension; for example, UI files are added + to \c FORMS, and C++ files are added to \c SOURCES. You may also pass assignments on the command line in this mode. When doing so, these assignments will be placed last in the generated project file. @@ -1304,10 +1304,10 @@ \target FORMS \section1 FORMS - This variable specifies the .ui files (see \link + This variable specifies the UI files (see \link designer-manual.html Qt Designer \endlink) to be processed through \c uic before compiling. All dependencies, headers and source files required - to build these .ui files will automatically be added to the project. + to build these UI files will automatically be added to the project. For example: @@ -1320,10 +1320,10 @@ \target FORMS3 \section1 FORMS3 - This variable specifies the old style .ui files to be processed + This variable specifies the old style UI files to be processed through \c uic3 before compiling, when \c CONFIG contains uic3. All dependencies, headers and source files required to build these - .ui files will automatically be added to the project. + UI files will automatically be added to the project. For example: @@ -4151,7 +4151,7 @@ \list \o HEADERS - A list of all the header files for the application. \o SOURCES - A list of all the source files for the application. - \o FORMS - A list of all the .ui files (created using \c{Qt Designer}) + \o FORMS - A list of all the UI files (created using \c{Qt Designer}) for the application. \o LEXSOURCES - A list of all the lex source files for the application. \o YACCSOURCES - A list of all the yacc source files for the application. @@ -4169,7 +4169,7 @@ \endlist You only need to use the system variables that you have values for, - for instance, if you don't have any extra INCLUDEPATHs then you don't + for instance, if you do not have any extra INCLUDEPATHs then you do not need to specify any, \c qmake will add in the default ones needed. For instance, an example project file might look like this: diff --git a/doc/src/qmsdev.qdoc b/doc/src/qmsdev.qdoc index b8d8f85..127b514 100644 --- a/doc/src/qmsdev.qdoc +++ b/doc/src/qmsdev.qdoc @@ -87,7 +87,7 @@ the existing project. If you want to add an existing dialog to your project, then just select the - relevant \c .ui file. This will then add it to your existing project and add + relevant UI file. This will then add it to your existing project and add the relevant steps to create the generated code. \section2 Using the 'Qt Designer' button diff --git a/doc/src/qt3to4.qdoc b/doc/src/qt3to4.qdoc index 9ffd52e..47e85b4 100644 --- a/doc/src/qt3to4.qdoc +++ b/doc/src/qt3to4.qdoc @@ -50,7 +50,7 @@ to Qt 4. It is designed to automate the most tedious part of the porting effort. - See \l{Porting to Qt 4} and \l{Porting .ui Files to Qt 4} for + See \l{Porting to Qt 4} and \l{Porting UI Files to Qt 4} for more information about porting Qt 3 applications to Qt 4. \section1 Usage diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 2fda7cf..6f59cae 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -235,7 +235,7 @@ for your project (using "DEFINES +=") on to moc, which has its own built-in C++ preprocessor. - To compile code that uses .ui files, you will also need this line in + To compile code that uses UI files, you will also need this line in the .pro file: \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 2 diff --git a/doc/src/qtdesigner.qdoc b/doc/src/qtdesigner.qdoc index 2117b27..d913b32 100644 --- a/doc/src/qtdesigner.qdoc +++ b/doc/src/qtdesigner.qdoc @@ -52,7 +52,7 @@ that enable you to access Qt Designer's components. In addition, the QFormBuilder class provides the possibility of - constructing user interfaces from \c .ui files at run-time. + constructing user interfaces from UI files at run-time. To include the definitions of the module's classes, use the following directive: @@ -155,7 +155,7 @@ The \c QtDesigner module contains the QFormBuilder class that provides a mechanism for dynamically creating user interfaces at - run-time, based on \c .ui files created with \QD. This class is + run-time, based on UI files created with \QD. This class is typically used by custom components and applications that embed \QD. Standalone applications that need to dynamically generate user interfaces at run-time use the QUiLoader class, found in @@ -1427,7 +1427,7 @@ \fn bool QDesignerPropertySheetExtension::isAttribute(int index) const Returns true if the property at the given \a index is an attribute, - which will be \e excluded from the .ui file, otherwise false. + which will be \e excluded from the UI file, otherwise false. \sa indexOf(), setAttribute() */ @@ -1436,7 +1436,7 @@ \fn void QDesignerPropertySheetExtension::setAttribute(int index, bool attribute) If \a attribute is true, the property at the given \a index is - made an attribute which will be \e excluded from the .ui file; + made an attribute which will be \e excluded from the UI file; otherwise it will be included. \sa indexOf(), isAttribute() diff --git a/doc/src/qthelp.qdoc b/doc/src/qthelp.qdoc index 7260b6e..b5395c9 100644 --- a/doc/src/qthelp.qdoc +++ b/doc/src/qthelp.qdoc @@ -279,7 +279,7 @@ \section1 Qt Help Project File Format - The file format is XML based. For a better understanding of + The file format is XML-based. For a better understanding of the format we'll discuss the following example: \snippet doc/src/snippets/code/doc_src_qthelp.qdoc 7 diff --git a/doc/src/qtscript.qdoc b/doc/src/qtscript.qdoc index f2ac6c9..6b8f639 100644 --- a/doc/src/qtscript.qdoc +++ b/doc/src/qtscript.qdoc @@ -1782,20 +1782,20 @@ \list 1 \o Run \c lupdate to extract translatable text from the script source code - of the Qt application, resulting in a message file for translators (a \c - .ts file). The utility recognizes qsTr(), qsTranslate() and the - \c{QT_TR*_NOOP()} functions described above and produces \c .ts files + of the Qt application, resulting in a message file for translators (a TS + file). The utility recognizes qsTr(), qsTranslate() and the + \c{QT_TR*_NOOP()} functions described above and produces TS files (usually one per language). - \o Provide translations for the source texts in the \c .ts file, using - \e{Qt Linguist}. Since \c .ts files are in XML format, you can also + \o Provide translations for the source texts in the TS file, using + \e{Qt Linguist}. Since TS files are in XML format, you can also edit them by hand. - \o Run \c lrelease to obtain a light-weight message file (a \c .qm - file) from the \c .ts file, suitable only for end use. Think of the \c - .ts files as "source files", and \c .qm files as "object files". The - translator edits the \c .ts files, but the users of your application - only need the \c .qm files. Both kinds of files are platform and + \o Run \c lrelease to obtain a light-weight message file (a QM + file) from the TS file, suitable only for end use. Think of the TS + files as "source files", and QM files as "object files". The + translator edits the TS files, but the users of your application + only need the QM files. Both kinds of files are platform and locale independent. \endlist @@ -1805,7 +1805,7 @@ translations from previous releases. When running \c lupdate, you must specify the location of the script(s), - and the name of the \c{.ts} file to produce. Examples: + and the name of the TS file to produce. Examples: \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 87 @@ -1823,7 +1823,7 @@ \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 89 - When running \c lrelease, you must specify the name of the \c{.ts} input + When running \c lrelease, you must specify the name of the TS input file; or, if you are using a qmake project file to manage script translations, you specify the name of that file. \c lrelease will create \c myscript_la.qm, the binary representation of the translation. diff --git a/doc/src/qtuiloader.qdoc b/doc/src/qtuiloader.qdoc index 137cfeb..0a23366 100644 --- a/doc/src/qtuiloader.qdoc +++ b/doc/src/qtuiloader.qdoc @@ -53,7 +53,7 @@ These forms are processed at run-time to produce dynamically-generated user interfaces. In order to generate a form at run-time, a resource - file containing a \c{.ui} file is needed. Applications that use the + file containing a UI file is needed. Applications that use the form handling classes need to be configured to be built against the QtUiTools module. This is done by including the following declaration in a \c qmake project file to ensure that the application is compiled diff --git a/doc/src/signalsandslots.qdoc b/doc/src/signalsandslots.qdoc index 356db33..09eb0a6 100644 --- a/doc/src/signalsandslots.qdoc +++ b/doc/src/signalsandslots.qdoc @@ -190,7 +190,7 @@ know any information about each other. To enable this, the objects only need to be connected together, and this can be achieved with some simple QObject::connect() function calls, or with \c{uic}'s - \l{Using a Designer .ui File in Your Application#Automatic Connections} + \l{Using a Designer UI File in Your Application#Automatic Connections} {automatic connections} feature. \section1 Building the Example diff --git a/doc/src/snippets/code/doc_src_linguist-manual.qdoc b/doc/src/snippets/code/doc_src_linguist-manual.qdoc index ce3b997..5697300 100644 --- a/doc/src/snippets/code/doc_src_linguist-manual.qdoc +++ b/doc/src/snippets/code/doc_src_linguist-manual.qdoc @@ -42,7 +42,7 @@ Options: -pluralonly Only include plural form messages. -silent - Don't explain what is being done. + Do not explain what is being done. -version Display the version of lupdate and exit. //! [4] @@ -55,14 +55,14 @@ Usage: Options: -help Display this information and exit -compress - Compress the .qm files + Compress the QM files -nounfinished Do not include unfinished translations -removeidentical If the translated text is the same as the source text, do not include the message -silent - Don't explain what is being done + Do not explain what is being done -version Display the version of lrelease and exit //! [5] diff --git a/doc/src/templates.qdoc b/doc/src/templates.qdoc index 5a8acf7..8cfb851 100644 --- a/doc/src/templates.qdoc +++ b/doc/src/templates.qdoc @@ -162,7 +162,7 @@ without having to know the exact types of the objects we are connecting. This is impossible with a template based solution. This kind of runtime introspection opens up new possibilities, for example GUIs that are - generated and connected from Qt Designer's XML \c{ui} files. + generated and connected from Qt Designer's XML UI files. \section1 Calling Performance is Not Everything diff --git a/examples/uitools/textfinder/forms/input.txt b/examples/uitools/textfinder/forms/input.txt index fae542f..29dfe5d 100644 --- a/examples/uitools/textfinder/forms/input.txt +++ b/examples/uitools/textfinder/forms/input.txt @@ -1,5 +1,5 @@ These forms are processed at run-time to produce dynamically-generated user interfaces. -In order to generate a form at run-time, a resource file containing a .ui file is needed. +In order to generate a form at run-time, a resource file containing a UI file is needed. Applications that use the form handling classes need to be configured to be built against the QtUiTools module. This is done by including the following declaration in a qmake project file to ensure that the application is compiled and linked appropriately. A form loader object, diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf index d2985f9..e768d0f 100644 --- a/mkspecs/features/uic.prf +++ b/mkspecs/features/uic.prf @@ -51,7 +51,7 @@ equals(UI_DIR, .) { uic3 { isEmpty(FORMS3) { UIC3_FORMS = FORMS - !build_pass:message("Project contains CONFIG+=uic3, but no files in FORMS3; .ui files in FORMS treated as UIC3 form files.") + !build_pass:message("Project contains CONFIG+=uic3, but no files in FORMS3; UI files in FORMS treated as UIC3 form files.") } else { UIC3_FORMS = FORMS3 } diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 9e87b3b..eb1bd0b 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -565,7 +565,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) \l uic generates code that invokes this function to enable auto-connection to be performed between widgets on forms created with \QD. More information about using auto-connection with \QD is - given in the \l{Using a Designer .ui File in Your Application} section of + given in the \l{Using a Designer UI File in Your Application} section of the \QD manual. \section2 Dynamic Properties diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 4aed2b2..dc1b530 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -503,7 +503,7 @@ bool QTranslator::load(const QString & filename, const QString & directory, \overload load() \fn bool QTranslator::load(const uchar *data, int len) - Loads the .qm file data \a data of length \a len into the + Loads the QM file data \a data of length \a len into the translator. The data is not copied. The caller must be able to guarantee that \a data diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index 1c6e3a5..bbb3af7 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -137,12 +137,12 @@ void Uic::writeCopyrightHeader(DomUI *ui) out << "/*\n" << comment << "\n*/\n\n"; out << "/********************************************************************************\n"; - out << "** Form generated from reading ui file '" << QFileInfo(opt.inputFile).fileName() << "'\n"; + out << "** Form generated from reading UI file '" << QFileInfo(opt.inputFile).fileName() << "'\n"; out << "**\n"; out << "** Created: " << QDateTime::currentDateTime().toString() << "\n"; out << "** " << QString::fromLatin1("by: Qt User Interface Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR)); out << "**\n"; - out << "** WARNING! All changes made in this file will be lost when recompiling ui file!\n"; + out << "** WARNING! All changes made in this file will be lost when recompiling UI file!\n"; out << "********************************************************************************/\n\n"; } diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp index 38afc60..f4a9cba 100644 --- a/src/tools/uic3/main.cpp +++ b/src/tools/uic3/main.cpp @@ -114,7 +114,7 @@ int runUic3(int argc, char * argv[]) wrap = true; if (opt == "wrap" || opt[1] == '\0') { if (!(n < argc-1)) { - error = "Missing name of converted ui file"; + error = "Missing name of converted UI file"; break; } convertedUiFile = argv[++n]; @@ -230,7 +230,7 @@ int runUic3(int argc, char * argv[]) " %s [options] -decl \n" "\t name of the data file\n" " %s [options] -wrap \n" - "\t name of the converted ui file\n" + "\t name of the converted UI file\n" "Generate implementation:\n" " %s [options] -impl \n" "\t name of the declaration file\n" @@ -254,7 +254,7 @@ int runUic3(int argc, char * argv[]) "\t-pch file Add #include \"file\" as the first statement in implementation\n" "\t-nofwd Omit forward declarations of custom classes\n" "\t-no-implicit-includes Do not generate #include-directives for custom classes\n" - "\t-nounload Don't unload plugins after processing\n" + "\t-nounload Do not unload plugins after processing\n" "\t-tr func Use func() instead of tr() for i18n\n" "\t-L path Additional plugin search path\n" "\t-version Display version of uic\n" diff --git a/src/tools/uic3/uic.cpp b/src/tools/uic3/uic.cpp index e911844..16b2754 100644 --- a/src/tools/uic3/uic.cpp +++ b/src/tools/uic3/uic.cpp @@ -144,12 +144,12 @@ void Uic::writeCopyrightHeader(DomUI *ui) out << "/*\n" << comment << "\n*/\n\n"; out << "/********************************************************************************\n"; - out << "** Form generated from reading ui file '" << QFileInfo(opt.inputFile).fileName() << "'\n"; + out << "** Form generated from reading UI file '" << QFileInfo(opt.inputFile).fileName() << "'\n"; out << "**\n"; out << "** Created: " << QDateTime::currentDateTime().toString() << "\n"; out << "** " << QString::fromLatin1("by: Qt User Interface Compiler version %1\n").arg(QLatin1String(QT_VERSION_STR)); out << "**\n"; - out << "** WARNING! All changes made in this file will be lost when recompiling ui file!\n"; + out << "** WARNING! All changes made in this file will be lost when recompiling UI file!\n"; out << "********************************************************************************/\n\n"; } diff --git a/src/xmlpatterns/data/qresourceloader_p.h b/src/xmlpatterns/data/qresourceloader_p.h index 8cb174d..0ebc885 100644 --- a/src/xmlpatterns/data/qresourceloader_p.h +++ b/src/xmlpatterns/data/qresourceloader_p.h @@ -114,7 +114,7 @@ namespace QPatternist * * Typically this hint is given when the URI is available at * compile-time, but it is used inside a conditional statement - * whose branching can't be determined at compile time. + * whose branching cannot be determined at compile time. */ MayUse, diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before index e297784..076520a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before @@ -5,7 +5,7 @@ Qt Assistant - Find text - + Qt Assistant - Finn tekst diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result index d65110a..6bc565c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result @@ -9,7 +9,7 @@ - This should not be considered to be more or less equal to the corresponding one in the ts file. + This should not be considered to be more or less equal to the corresponding one in the TS file. diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui index 0d0defd..a5f8e9f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ui @@ -17,7 +17,7 @@ - This should not be considered to be more or less equal to the corresponding one in the ts file. + This should not be considered to be more or less equal to the corresponding one in the TS file. Here, similarity should kick in! diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result index d65110a..6bc565c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result @@ -9,7 +9,7 @@ - This should not be considered to be more or less equal to the corresponding one in the ts file. + This should not be considered to be more or less equal to the corresponding one in the TS file. diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui index 0d0defd..a5f8e9f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ui @@ -17,7 +17,7 @@ - This should not be considered to be more or less equal to the corresponding one in the ts file. + This should not be considered to be more or less equal to the corresponding one in the TS file. Here, similarity should kick in! diff --git a/tools/designer/data/generate_shared.xsl b/tools/designer/data/generate_shared.xsl index f7859cd..ec95fe2 100644 --- a/tools/designer/data/generate_shared.xsl +++ b/tools/designer/data/generate_shared.xsl @@ -6,8 +6,8 @@ xmlns:xs="http://www.w3.org/2001/XMLSchema"> diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp index de4b57b..ac03909 100644 --- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp @@ -631,13 +631,13 @@ static bool readUiAttributes(QIODevice *dev, QString *errorMessage, *language = attributes.value(languageAttribute).toString(); return true; } else { - *errorMessage = QCoreApplication::translate("Designer", "Invalid ui file: The root element is missing."); + *errorMessage = QCoreApplication::translate("Designer", "Invalid UI file: The root element is missing."); return false; } } } - *errorMessage = QCoreApplication::translate("Designer", "An error has occurred while reading the ui file at line %1, column %2: %3") + *errorMessage = QCoreApplication::translate("Designer", "An error has occurred while reading the UI file at line %1, column %2: %3") .arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString()); return false; } @@ -756,7 +756,7 @@ void QDesignerResource::setSaveRelative(bool relative) QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget) { // Load extra info extension. This is used by Jambi for preventing - // C++ ui files from being loaded + // C++ UI files from being loaded if (QDesignerExtraInfoExtension *extra = qt_extension(core()->extensionManager(), core())) { if (!extra->loadUiExtraInfo(ui)) { const QString errorMessage = QApplication::translate("Designer", "This file cannot be read because the extra info extension failed to load."); diff --git a/tools/designer/src/designer/mainwindow.cpp b/tools/designer/src/designer/mainwindow.cpp index b72a790..a3ca234 100644 --- a/tools/designer/src/designer/mainwindow.cpp +++ b/tools/designer/src/designer/mainwindow.cpp @@ -155,7 +155,7 @@ DockedMdiArea::DockedMdiArea(const QString &extension, QWidget *parent) : QStringList DockedMdiArea::uiFiles(const QMimeData *d) const { - // Extract dropped ui files from Mime data. + // Extract dropped UI files from Mime data. QStringList rc; if (!d->hasFormat(QLatin1String(uriListMimeFormatC))) return rc; diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp index 923687a2..f21da8c 100644 --- a/tools/designer/src/designer/qdesigner_workbench.cpp +++ b/tools/designer/src/designer/qdesigner_workbench.cpp @@ -960,7 +960,7 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName, removeFormWindow(formWindow); formWindowManager->removeFormWindow(editor); m_core->metaDataBase()->remove(editor); - *errorMessage = tr("The file %1 is not a valid Designer ui file.").arg(file.fileName()); + *errorMessage = tr("The file %1 is not a valid Designer UI file.").arg(file.fileName()); return 0; } *uic3Converted = editor->fileName().isEmpty(); diff --git a/tools/designer/src/lib/sdk/abstractformwindow.cpp b/tools/designer/src/lib/sdk/abstractformwindow.cpp index 89c1015..313b324 100644 --- a/tools/designer/src/lib/sdk/abstractformwindow.cpp +++ b/tools/designer/src/lib/sdk/abstractformwindow.cpp @@ -247,7 +247,7 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje /*! \fn virtual QString QDesignerFormWindowInterface::fileName() const - Returns the file name of the .ui file that describes the form + Returns the file name of the UI file that describes the form currently being shown. \sa setFileName() @@ -399,11 +399,11 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje \fn virtual QStringList QDesignerFormWindowInterface::includeHints() const Returns a list of the header files that will be included in the - form window's associated \c .ui file. + form window's associated UI file. Header files may be local, i.e. relative to the project's - directory,\c "mywidget.h", or global, i.e. part of Qt or the - compilers standard libraries:\c . + directory, \c "mywidget.h", or global, i.e. part of Qt or the + compilers standard libraries: \c . \sa setIncludeHints() */ @@ -412,11 +412,11 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje \fn virtual void QDesignerFormWindowInterface::setIncludeHints(const QStringList &includeHints) Sets the header files that will be included in the form window's - associated \c .ui file to the specified \a includeHints. + associated UI file to the specified \a includeHints. Header files may be local, i.e. relative to the project's - directory,\c "mywidget.h", or global, i.e. part of Qt or the - compilers standard libraries:\c . + directory, \c "mywidget.h", or global, i.e. part of Qt or the + compilers standard libraries: \c . \sa includeHints() */ diff --git a/tools/designer/src/lib/sdk/script.cpp b/tools/designer/src/lib/sdk/script.cpp index 90b4c73..2eda3d1 100644 --- a/tools/designer/src/lib/sdk/script.cpp +++ b/tools/designer/src/lib/sdk/script.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE \since 4.3 On saving the form, the extension is queried for a script snippet - to be associated with the widget while saving the \c .ui file. + to be associated with the widget while saving the UI file. This script is then run after creating the widget by \l uic or QUiLoader. @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE for which an editor is provided by the QDesignerTaskMenuExtension. While saving the form, the state is serialized as a QVariantMap of - \QD-supported properties, which is stored in the \c .ui file. This is + \QD-supported properties, which is stored in the UI file. This is handled by data() and setData(). For item view contents, there might be for example a key that determines @@ -97,7 +97,7 @@ QDesignerScriptExtension::~QDesignerScriptExtension() \fn virtual QVariantMap QDesignerScriptExtension::data() const Returns a map of variants describing the internal state to be - stored in the \c .ui file. + stored in the UI file. */ /*! diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp index 65ea375..05e05c1 100644 --- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp @@ -135,7 +135,7 @@ public: QAbstractFormBuilder provides a standard interface and a default implementation for constructing forms from user interface files. It is not intended to be instantiated directly. Use the - QFormBuilder class to create user interfaces from \c{.ui} files at + QFormBuilder class to create user interfaces from UI files at run-time. For example: \snippet doc/src/snippets/code/tools_designer_src_lib_uilib_abstractformbuilder.cpp 0 @@ -145,10 +145,10 @@ public: functions: \list - \o load() handles reading of \c{.ui} format files from arbitrary + \o load() handles reading of UI format files from arbitrary QIODevices, and construction of widgets from the XML data that they contain. - \o save() handles saving of widget details in \c{.ui} format to + \o save() handles saving of widget details in UI format to arbitrary QIODevices. \o workingDirectory() and setWorkingDirectory() control the directory in which forms are held. The form builder looks for @@ -208,13 +208,13 @@ QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget) } } if (reader.hasError()) { - uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the ui file at line %1, column %2: %3") + uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "An error has occurred while reading the UI file at line %1, column %2: %3") .arg(reader.lineNumber()).arg(reader.columnNumber()) .arg(reader.errorString())); return 0; } if (!initialized) { - uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid ui file: The root element is missing.")); + uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid UI file: The root element is missing.")); return 0; } @@ -657,7 +657,7 @@ void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int spac = p->elementNumber(); #ifdef Q_OS_MAC - // here we recognize ui file < 4.3 (no we don't store margin property) + // here we recognize UI file < 4.3 (no we don't store margin property) if (mar != INT_MIN) { const int defaultMargin = parent->inherits("QLayoutWidget") ? 0 : 9; if (mar == defaultMargin) @@ -1202,7 +1202,7 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt \fn void QAbstractFormBuilder::save(QIODevice *device, QWidget *widget) Saves an XML representation of the given \a widget to the - specified \a device in the standard \c{.ui} file format. + specified \a device in the standard UI file format. \sa load()*/ void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget) diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp index 043991e..f737311 100644 --- a/tools/designer/src/lib/uilib/formbuilder.cpp +++ b/tools/designer/src/lib/uilib/formbuilder.cpp @@ -57,12 +57,12 @@ namespace QFormInternal { \class QFormBuilder \brief The QFormBuilder class is used to dynamically construct - user interfaces from .ui files at run-time. + user interfaces from UI files at run-time. \inmodule QtDesigner The QFormBuilder class provides a mechanism for dynamically - creating user interfaces at run-time, based on \c{.ui} files + creating user interfaces at run-time, based on UI files created with \QD. For example: \snippet doc/src/snippets/code/tools_designer_src_lib_uilib_formbuilder.cpp 0 diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp index 5387c2d..1c7d1cc 100644 --- a/tools/designer/src/uitools/quiloader.cpp +++ b/tools/designer/src/uitools/quiloader.cpp @@ -574,20 +574,20 @@ void QUiLoaderPrivate::setupWidgetMap() const \brief The QUiLoader class enables standalone applications to dynamically create user interfaces at run-time using the - information stored in .ui files or specified in plugin paths. + information stored in UI files or specified in plugin paths. In addition, you can customize or create your own user interface by deriving your own loader class. If you have a custom component or an application that embeds \QD, you can also use the QFormBuilder class provided by the QtDesigner module to create - user interfaces from \c{.ui} files. + user interfaces from UI files. The QUiLoader class provides a collection of functions allowing you to - create widgets based on the information stored in \c .ui files (created + create widgets based on the information stored in UI files (created with \QD) or available in the specified plugin paths. The specified plugin paths can be retrieved using the pluginPaths() function. Similarly, the - contents of a \c{.ui} file can be retrieved using the load() function. For + contents of a UI file can be retrieved using the load() function. For example: \snippet doc/src/snippets/quiloader/mywidget.cpp 0 diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 534bc11..4bed02f 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -81,10 +81,10 @@ static int usage(const QStringList &args) " --output-format \n" " Specify output format. See -if.\n\n" " --input-codec \n" - " Specify encoding for .qm input files. Default is 'Latin1'.\n" + " Specify encoding for QM input files. Default is 'Latin1'.\n" " UTF-8 is always tried as well, corresponding to the trUtf8() function.\n\n" " --drop-tags \n" - " Drop named extra tags when writing 'ts' or 'xlf' files.\n" + " Drop named extra tags when writing TS or XLIFF files.\n" " May be specified repeatedly.\n\n" " --drop-translations\n" " Drop existing translations and reset the status to 'unfinished'.\n" @@ -101,10 +101,10 @@ static int usage(const QStringList &args) " --no-finished\n" " Drop finished messages.\n\n" " --locations {absolute|relative|none}\n" - " Override how source code references are saved in ts files.\n" + " Override how source code references are saved in TS files.\n" " Default is absolute.\n\n" " --no-ui-lines\n" - " Drop line numbers from references to .ui files.\n\n" + " Drop line numbers from references to UI files.\n\n" " --verbose\n" " be a bit more verbose\n\n" "Long options can be specified with only one leading dash, too.\n\n" diff --git a/tools/linguist/linguist/mainwindow.ui b/tools/linguist/linguist/mainwindow.ui index 4f66f31..613241b 100644 --- a/tools/linguist/linguist/mainwindow.ui +++ b/tools/linguist/linguist/mainwindow.ui @@ -747,7 +747,7 @@ Release As... - Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the .ts file. + Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the TS file. diff --git a/tools/linguist/lrelease/lrelease.1 b/tools/linguist/lrelease/lrelease.1 index 9e77504..8dd14b2 100644 --- a/tools/linguist/lrelease/lrelease.1 +++ b/tools/linguist/lrelease/lrelease.1 @@ -51,10 +51,10 @@ This page documents the tool for the Qt GUI toolkit. .B Lrelease reads a qmake/tmake project file (.pro file) and converts the -translation files (.ts files) specified in it into Qt message files -(.qm files) used by the application to translate. +translation files (TS files) specified in it into Qt message files +(QM files) used by the application to translate. .PP -The .qm file format is a compact binary format that provides +The QM file format is a compact binary format that provides extremely fast lookups for translations and that is used by Qt. .SH OPTIONS .TP @@ -62,7 +62,7 @@ extremely fast lookups for translations and that is used by Qt. Display the usage and exit. .TP .I "-compress" -Compress the .qm files. +Compress the QM files. .TP .I "-nounfinished" Do not include unfinished translations. @@ -72,7 +72,7 @@ If the translated text is the same as the source text, do not include the message. .TP .I "-silent" -Don't explain what is being done. +Do not explain what is being done. .TP .I "-version" Display the version of @@ -105,7 +105,7 @@ generated from gnomovision_dk.ts, gnomovision_fi.ts, gnomovision_no.ts and gnomovision_se.ts, respectively. .PP .B Lrelease -can also be invoked with a list of .ts files to convert: +can also be invoked with a list of TS files to convert: .PP .in +4 .nf diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 5fbecac..aeed1f2 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -66,21 +66,21 @@ static void printUsage() " lrelease [options] project-file\n" " lrelease [options] ts-files [-qm qm-file]\n\n" "lrelease is part of Qt's Linguist tool chain. It can be used as a\n" - "stand-alone tool to convert XML based translations files in the .ts\n" - "format into the 'compiled' .qm format used by QTranslator objects.\n\n" + "stand-alone tool to convert XML-based translations files in the TS\n" + "format into the 'compiled' QM format used by QTranslator objects.\n\n" "Options:\n" " -help Display this information and exit\n" " -idbased\n" " Use IDs instead of source strings for message keying\n" " -compress\n" - " Compress the .qm files\n" + " Compress the QM files\n" " -nounfinished\n" " Do not include unfinished translations\n" " -removeidentical\n" " If the translated text is the same as\n" " the source text, do not include the message\n" " -silent\n" - " Don't explain what is being done\n" + " Do not explain what is being done\n" " -version\n" " Display the version of lrelease and exit\n" )); @@ -244,7 +244,7 @@ int main(int argc, char **argv) } } else { qWarning("error: lrelease encountered project file functionality that is currently not supported.\n" - "You might want to consider using .ts files as input instead of a project file.\n" + "You might want to consider using TS files as input instead of a project file.\n" "Try the following syntax:\n" " lrelease [options] ts-files [-qm qm-file]\n"); } diff --git a/tools/linguist/lupdate/lupdate.1 b/tools/linguist/lupdate/lupdate.1 index 68958b9..b37e7b3 100644 --- a/tools/linguist/lupdate/lupdate.1 +++ b/tools/linguist/lupdate/lupdate.1 @@ -52,12 +52,12 @@ tool for the Qt GUI toolkit. .B Lupdate reads a qmake/tmake project file (.pro file), finds the translatable strings in the specified source, header and interface files, and -updates the translation files (.ts files) specified in it. The +updates the translation files (TS files) specified in it. The translation files are given to the translator who uses .B Qt Linguist to read the files and insert the translations. .PP -The .ts file format is a simple human-readable XML format that can be +The TS file format is a simple human-readable XML format that can be used with version control systems if required. .PP .SH OPTIONS @@ -74,7 +74,7 @@ Default: 'ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx'. Display the usage and exit. .TP .I "-locations {absolute|relative|none}" -Specify/override how source code references are saved in ts files. +Specify/override how source code references are saved in TS files. Default is absolute. .TP .I "-no-obsolete" @@ -84,7 +84,7 @@ Drop all obsolete strings. Do not recursively scan the following directories. .TP .I "-no-sort" -Do not sort contexts in .ts files. +Do not sort contexts in TS files. .TP .I "-pluralonly" Only include plural form messages. @@ -97,7 +97,7 @@ file syntax but different file suffix Recursively scan the following directories. .TP .I "-silent" -Don't explain what is being done. +Do not explain what is being done. .TP .I "-source-language [_]" Specify/override the language of the source strings. Defaults to @@ -139,8 +139,8 @@ translations will be reused as far as possible, and translated strings that have vanished from the source files are marked obsolete. .PP .B lupdate -can also be invoked with a list of C++ source files, .ui files -and .ts files: +can also be invoked with a list of C++ source files, UI files +and TS files: .PP .in +4 .nf diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 18c8932..c9250c6 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -103,7 +103,7 @@ static void printUsage() " -silent\n" " Do not explain what is being done.\n" " -no-sort\n" - " Do not sort contexts in .ts files.\n" + " Do not sort contexts in TS files.\n" " -no-recursive\n" " Do not recursively scan the following directories.\n" " -recursive\n" @@ -112,10 +112,10 @@ static void printUsage() " Additional location to look for include files.\n" " May be specified multiple times.\n" " -locations {absolute|relative|none}\n" - " Specify/override how source code references are saved in ts files.\n" + " Specify/override how source code references are saved in TS files.\n" " Default is absolute.\n" " -no-ui-lines\n" - " Do not record line numbers in references to .ui files.\n" + " Do not record line numbers in references to UI files.\n" " -disable-heuristic {sametext|similartext|number}\n" " Disable the named merge heuristic. Can be specified multiple times.\n" " -pro \n" diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 05d8e12..9523fde 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -245,7 +245,7 @@ void Releaser::writeMessage(const ByteTranslatorMessage &msg, QDataStream &strea if (mode == SaveEverything) prefix = HashContextSourceTextComment; - // lrelease produces "wrong" .qm files for QByteArrays that are .isNull(). + // lrelease produces "wrong" QM files for QByteArrays that are .isNull(). switch (prefix) { default: case HashContextSourceTextComment: diff --git a/tools/linguist/shared/ts.dtd b/tools/linguist/shared/ts.dtd index ab77f64..4d2cdeb 100644 --- a/tools/linguist/shared/ts.dtd +++ b/tools/linguist/shared/ts.dtd @@ -34,7 +34,7 @@ version CDATA #IMPLIED sourcelanguage CDATA #IMPLIED language CDATA #IMPLIED> - + diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp index 45f6a45..36cbd89 100644 --- a/tools/qtconfig/paletteeditoradvanced.cpp +++ b/tools/qtconfig/paletteeditoradvanced.cpp @@ -55,7 +55,7 @@ PaletteEditorAdvanced::PaletteEditorAdvanced( QWidget * parent, const char * name, bool modal, Qt::WindowFlags f ) : PaletteEditorAdvancedBase( parent, name, modal, f ), selectedPalette(0) { - // work around buggy ui file + // work around buggy UI file comboEffect->setEnabled(false); buttonEffect->setEnabled(false); onToggleBuildEffects(true); -- cgit v0.12 From fd181167709283a2ceefa5285d6189fa7de23bb6 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Mon, 6 Jul 2009 14:08:41 +0200 Subject: Implement QApplication::setOverrideCursor to use pure Cocoa calls Seems this was a victim of our cursor fixing. Cocoa does a lot for us with setting cursors. This meant that we didn't need to do as much meddling and as a result qt_mac_set_cursor does nothing in Cocoa. Unfortunately, this broke setOverrideCursor. Luckily Cocoa has a stack that works exactly like Qt, so we can just use that. Task-number: 257507 Reviewed-by: Prasanth Ullattil --- src/gui/kernel/qapplication_mac.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 5ded153..0d86c8e 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1294,8 +1294,13 @@ void QApplication::setOverrideCursor(const QCursor &cursor) { qApp->d_func()->cursor_list.prepend(cursor); +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; + [static_cast(qt_mac_nsCursorForQCursor(cursor)) push]; +#else if (qApp && qApp->activeWindow()) qt_mac_set_cursor(&qApp->d_func()->cursor_list.first(), QCursor::pos()); +#endif } void QApplication::restoreOverrideCursor() @@ -1304,12 +1309,17 @@ void QApplication::restoreOverrideCursor() return; qApp->d_func()->cursor_list.removeFirst(); +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; + [NSCursor pop]; +#else if (qApp && qApp->activeWindow()) { const QCursor def(Qt::ArrowCursor); qt_mac_set_cursor(qApp->d_func()->cursor_list.isEmpty() ? &def : &qApp->d_func()->cursor_list.first(), QCursor::pos()); } -} #endif +} +#endif // QT_NO_CURSOR QWidget *QApplication::topLevelAt(const QPoint &p) { -- cgit v0.12 From 039c800f728054a56ae1584d269ee1ddadd1312f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 6 Jul 2009 11:04:27 +0200 Subject: QHeaderView::sizeHint: small bug fix and refactor --- src/gui/itemviews/qheaderview.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 57e44c7..2419c18 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -524,12 +524,12 @@ QSize QHeaderView::sizeHint() const Q_D(const QHeaderView); if (d->cachedSizeHint.isValid()) return d->cachedSizeHint; - d->cachedSizeHint = QSize(0, 0); - d->executePostedLayout(); + d->cachedSizeHint = QSize(0, 0); //reinitialize the cached size hint + const int sectionCount = count(); // get size hint for the first n sections int i = 0; - for (int checked = 0; checked < 100 && i < d->sectionCount; ++i) { + for (int checked = 0; checked < 100 && i < sectionCount; ++i) { if (isSectionHidden(i)) continue; checked++; @@ -537,8 +537,8 @@ QSize QHeaderView::sizeHint() const d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); } // get size hint for the last n sections - i = qMax(i, d->sectionCount - 100 ); - for (int j = d->sectionCount - 1, checked = 0; j > i && checked < 100; --j) { + i = qMax(i, sectionCount - 100 ); + for (int j = sectionCount - 1, checked = 0; j >= i && checked < 100; --j) { if (isSectionHidden(j)) continue; checked++; -- cgit v0.12 From 14ed83f4e65b26cea12b128043c1c67c5489832d Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 6 Jul 2009 12:21:00 +0200 Subject: Phonon: Some work done on binary size removing foreach seems to help on Windows --- src/3rdparty/phonon/ds9/iodevicereader.cpp | 10 +---- src/3rdparty/phonon/ds9/videorenderer_soft.cpp | 32 ++++++---------- src/3rdparty/phonon/ds9/volumeeffect.cpp | 12 +----- src/3rdparty/phonon/phonon/audiooutput.cpp | 14 ++++--- src/3rdparty/phonon/phonon/backendcapabilities.cpp | 14 +++---- src/3rdparty/phonon/phonon/effect.cpp | 6 ++- src/3rdparty/phonon/phonon/effectwidget.cpp | 10 +++-- src/3rdparty/phonon/phonon/factory.cpp | 43 +++++++++++----------- src/3rdparty/phonon/phonon/medianode.cpp | 4 +- src/3rdparty/phonon/phonon/mediaobject.cpp | 12 +++--- .../phonon/phonon/objectdescriptionmodel.cpp | 4 +- .../phonon/phonon/objectdescriptionmodel.h | 8 ++-- src/3rdparty/phonon/phonon/path.cpp | 24 +++++++----- 13 files changed, 88 insertions(+), 105 deletions(-) diff --git a/src/3rdparty/phonon/ds9/iodevicereader.cpp b/src/3rdparty/phonon/ds9/iodevicereader.cpp index ec10278..2dff1fe 100644 --- a/src/3rdparty/phonon/ds9/iodevicereader.cpp +++ b/src/3rdparty/phonon/ds9/iodevicereader.cpp @@ -36,15 +36,7 @@ namespace Phonon //these mediatypes define a stream, its type will be autodetected by DirectShow static QVector getMediaTypes() { - AM_MEDIA_TYPE mt; - mt.majortype = MEDIATYPE_Stream; - mt.bFixedSizeSamples = TRUE; - mt.bTemporalCompression = FALSE; - mt.lSampleSize = 1; - mt.formattype = GUID_NULL; - mt.pUnk = 0; - mt.cbFormat = 0; - mt.pbFormat = 0; + AM_MEDIA_TYPE mt = { MEDIATYPE_Stream, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; QVector ret; //normal auto-detect stream diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp index dd6e076..2112267 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp @@ -63,9 +63,9 @@ along with this library. If not, see . static const char yv12ToRgb[] = "!!ARBfp1.0" "PARAM c[5] = { program.local[0..1]," -" { 1.164, 0, 1.596, 0.5 }," -" { 0.0625, 1.164, -0.391, -0.81300002 }," -" { 1.164, 2.0179999, 0 } };" +"{ 1.164, 0, 1.596, 0.5 }," +"{ 0.0625, 1.164, -0.391, -0.81300002 }," +"{ 1.164, 2.0179999, 0 } };" "TEMP R0;" "TEX R0.x, fragment.texcoord[0], texture[1], 2D;" "ADD R0.y, R0.x, -c[2].w;" @@ -89,11 +89,11 @@ static const char yv12ToRgb[] = "END"; static const char yuy2ToRgb[] = - "!!ARBfp1.0" +"!!ARBfp1.0" "PARAM c[5] = { program.local[0..1]," -" { 0.5, 2, 1, 0.0625 }," -" { 1.164, 0, 1.596, 2.0179999 }," -" { 1.164, -0.391, -0.81300002 } };" +"{ 0.5, 2, 1, 0.0625 }," +"{ 1.164, 0, 1.596, 2.0179999 }," +"{ 1.164, -0.391, -0.81300002 } };" "TEMP R0;" "TEMP R1;" "TEMP R2;" @@ -149,24 +149,16 @@ namespace Phonon { static const QVector videoMediaTypes() { - AM_MEDIA_TYPE mt; - qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE)); - mt.majortype = MEDIATYPE_Video; - - //we accept any video format - mt.formattype = GUID_NULL; - mt.cbFormat = 0; - mt.pbFormat = 0; + AM_MEDIA_TYPE mt = { MEDIATYPE_Video, MEDIASUBTYPE_YV12, 0, 0, 0, GUID_NULL, 0, 0, 0 }; QVector ret; - //we support YUV (YV12 and YUY2) and RGB32 - mt.subtype = MEDIASUBTYPE_YV12; - ret << mt; + //we add all the subtypes we support + ret << mt; //YV12 mt.subtype = MEDIASUBTYPE_YUY2; - ret << mt; + ret << mt; //YUY2 mt.subtype = MEDIASUBTYPE_RGB32; - ret << mt; + ret << mt; //RGB32 return ret; } diff --git a/src/3rdparty/phonon/ds9/volumeeffect.cpp b/src/3rdparty/phonon/ds9/volumeeffect.cpp index 2fd1afc..b9a5fce 100644 --- a/src/3rdparty/phonon/ds9/volumeeffect.cpp +++ b/src/3rdparty/phonon/ds9/volumeeffect.cpp @@ -68,17 +68,7 @@ namespace Phonon static const QVector audioMediaType() { QVector ret; - - AM_MEDIA_TYPE mt; - mt.majortype = MEDIATYPE_Audio; - mt.subtype = MEDIASUBTYPE_PCM; - mt.bFixedSizeSamples = 1; - mt.bTemporalCompression = 0; - mt.pUnk = 0; - mt.lSampleSize = 1; - mt.cbFormat = 0; - mt.pbFormat = 0; - mt.formattype = GUID_NULL; + AM_MEDIA_TYPE mt = { MEDIATYPE_Audio, MEDIASUBTYPE_PCM, 1, 0, 1, GUID_NULL, 0, 0, 0}; ret << mt; return ret; } diff --git a/src/3rdparty/phonon/phonon/audiooutput.cpp b/src/3rdparty/phonon/phonon/audiooutput.cpp index 752580a..00b2ebd 100644 --- a/src/3rdparty/phonon/phonon/audiooutput.cpp +++ b/src/3rdparty/phonon/phonon/audiooutput.cpp @@ -264,8 +264,8 @@ void AudioOutputPrivate::setupBackendObject() if (deviceList.isEmpty()) { return; } - foreach (int devIndex, deviceList) { - const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(devIndex); + for (int i = 0; i < deviceList.count(); ++i) { + const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(deviceList.at(i)); if (callSetOutputDevice(this, dev)) { handleAutomaticDeviceChange(dev, AudioOutputPrivate::FallbackChange); return; // found one that works @@ -305,8 +305,9 @@ void AudioOutputPrivate::_k_audioDeviceFailed() pDebug() << Q_FUNC_INFO; // outputDeviceIndex identifies a failing device // fall back in the preference list of output devices - QList deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices); - foreach (int devIndex, deviceList) { + const QList deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices); + for (int i = 0; i < deviceList.count(); ++i) { + const int devIndex = deviceList.at(i); // if it's the same device as the one that failed, ignore it if (device.index() != devIndex) { const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex); @@ -326,9 +327,10 @@ void AudioOutputPrivate::_k_deviceListChanged() { pDebug() << Q_FUNC_INFO; // let's see if there's a usable device higher in the preference list - QList deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings); + const QList deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings); DeviceChangeType changeType = HigherPreferenceChange; - foreach (int devIndex, deviceList) { + for (int i = 0; i < deviceList.count(); ++i) { + const int devIndex = deviceList.at(i); const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex); if (!info.property("available").toBool()) { if (device.index() == devIndex) { diff --git a/src/3rdparty/phonon/phonon/backendcapabilities.cpp b/src/3rdparty/phonon/phonon/backendcapabilities.cpp index 5dee6a0..62c9cc9 100644 --- a/src/3rdparty/phonon/phonon/backendcapabilities.cpp +++ b/src/3rdparty/phonon/phonon/backendcapabilities.cpp @@ -76,8 +76,8 @@ QList BackendCapabilities::availableAudioOutputDevices() { QList ret; const QList deviceIndexes = GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory); - foreach (int i, deviceIndexes) { - ret.append(AudioOutputDevice::fromIndex(i)); + for (int i = 0; i < deviceIndexes.count(); ++i) { + ret.append(AudioOutputDevice::fromIndex(deviceIndexes.at(i))); } return ret; } @@ -88,8 +88,8 @@ QList BackendCapabilities::availableAudioCaptureDevices() { QList ret; const QList deviceIndexes = GlobalConfig().audioCaptureDeviceListFor(Phonon::NoCategory); - foreach (int i, deviceIndexes) { - ret.append(AudioCaptureDevice::fromIndex(i)); + for (int i = 0; i < deviceIndexes.count(); ++i) { + ret.append(AudioCaptureDevice::fromIndex(deviceIndexes.at(i))); } return ret; } @@ -101,9 +101,9 @@ QList BackendCapabilities::availableAudioEffects() BackendInterface *backendIface = qobject_cast(Factory::backend()); QList ret; if (backendIface) { - QList deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType); - foreach (int i, deviceIndexes) { - ret.append(EffectDescription::fromIndex(i)); + const QList deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType); + for (int i = 0; i < deviceIndexes.count(); ++i) { + ret.append(EffectDescription::fromIndex(deviceIndexes.at(i))); } } return ret; diff --git a/src/3rdparty/phonon/phonon/effect.cpp b/src/3rdparty/phonon/phonon/effect.cpp index c125232..98662a5 100644 --- a/src/3rdparty/phonon/phonon/effect.cpp +++ b/src/3rdparty/phonon/phonon/effect.cpp @@ -107,7 +107,8 @@ bool EffectPrivate::aboutToDeleteBackendObject() { if (m_backendObject) { const QList parameters = pINTERFACE_CALL(parameters()); - foreach (const EffectParameter &p, parameters) { + for (int i = 0; i < parameters.count(); ++i) { + const EffectParameter &p = parameters.at(i); parameterValues[p] = pINTERFACE_CALL(parameterValue(p)); } } @@ -120,7 +121,8 @@ void EffectPrivate::setupBackendObject() // set up attributes const QList parameters = pINTERFACE_CALL(parameters()); - foreach (const EffectParameter &p, parameters) { + for (int i = 0; i < parameters.count(); ++i) { + const EffectParameter &p = parameters.at(i); pINTERFACE_CALL(setParameterValue(p, parameterValues[p])); } } diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp index d5c6c81..99478f7 100644 --- a/src/3rdparty/phonon/phonon/effectwidget.cpp +++ b/src/3rdparty/phonon/phonon/effectwidget.cpp @@ -97,7 +97,8 @@ void EffectWidgetPrivate::autogenerateUi() Q_Q(EffectWidget); QVBoxLayout *mainLayout = new QVBoxLayout(q); mainLayout->setMargin(0); - foreach (const EffectParameter ¶, effect->parameters()) { + for (int i = 0; i < effect->parameters().count(); ++i) { + const EffectParameter ¶ = effect->parameters().at(i); QVariant value = effect->parameterValue(para); QHBoxLayout *pLayout = new QHBoxLayout; mainLayout->addLayout(pLayout); @@ -117,13 +118,14 @@ void EffectWidgetPrivate::autogenerateUi() control = cb; if (value.type() == QVariant::Int) { //value just defines the item index - foreach (const QVariant &item, para.possibleValues()) { - cb->addItem(item.toString()); + for (int i = 0; i < para.possibleValues().count(); ++i) { + cb->addItem(para.possibleValues().at(i).toString()); } cb->setCurrentIndex(value.toInt()); QObject::connect(cb, SIGNAL(currentIndexChanged(int)), q, SLOT(_k_setIntParameter(int))); } else { - foreach (const QVariant &item, para.possibleValues()) { + for (int i = 0; i < para.possibleValues().count(); ++i) { + const QVariant &item = para.possibleValues().at(i); cb->addItem(item.toString()); if (item == value) { cb->setCurrentIndex(cb->count() - 1); diff --git a/src/3rdparty/phonon/phonon/factory.cpp b/src/3rdparty/phonon/phonon/factory.cpp index 43c45ee..fef88f0 100644 --- a/src/3rdparty/phonon/phonon/factory.cpp +++ b/src/3rdparty/phonon/phonon/factory.cpp @@ -124,15 +124,18 @@ bool FactoryPrivate::createBackend() // could not load a backend through the platform plugin. Falling back to the default // (finding the first loadable backend). const QLatin1String suffix("/phonon_backend/"); - foreach (QString libPath, QCoreApplication::libraryPaths()) { - libPath += suffix; + const QStringList paths = QCoreApplication::libraryPaths(); + for (int i = 0; i < paths.count(); ++i) { + const QString libPath = paths.at(i) + suffix; const QDir dir(libPath); if (!dir.exists()) { pDebug() << Q_FUNC_INFO << dir.absolutePath() << "does not exist"; continue; } - foreach (const QString &pluginName, dir.entryList(QDir::Files)) { - QPluginLoader pluginLoader(libPath + pluginName); + + const QStringList files = dir.entryList(QDir::Files); + for (int i = 0; i < files.count(); ++i) { + QPluginLoader pluginLoader(libPath + files.at(i)); if (!pluginLoader.load()) { pDebug() << Q_FUNC_INFO << " load failed:" << pluginLoader.errorString(); @@ -183,14 +186,8 @@ FactoryPrivate::FactoryPrivate() FactoryPrivate::~FactoryPrivate() { - foreach (QObject *o, objects) { - MediaObject *m = qobject_cast(o); - if (m) { - m->stop(); - } - } - foreach (MediaNodePrivate *bp, mediaNodePrivateList) { - bp->deleteBackendObject(); + for (int i = 0; i < mediaNodePrivateList.count(); ++i) { + mediaNodePrivateList.at(i)->deleteBackendObject(); } if (objects.size() > 0) { pError() << "The backend objects are not deleted as was requested."; @@ -258,8 +255,8 @@ void Factory::deregisterFrontendObject(MediaNodePrivate *bp) void FactoryPrivate::phononBackendChanged() { if (m_backendObject) { - foreach (MediaNodePrivate *bp, mediaNodePrivateList) { - bp->deleteBackendObject(); + for (int i = 0; i < mediaNodePrivateList.count(); ++i) { + mediaNodePrivateList.at(i)->deleteBackendObject(); } if (objects.size() > 0) { pDebug() << "WARNING: we were asked to change the backend but the application did\n" @@ -268,8 +265,8 @@ void FactoryPrivate::phononBackendChanged() "backendswitching possible."; // in case there were objects deleted give 'em a chance to recreate // them now - foreach (MediaNodePrivate *bp, mediaNodePrivateList) { - bp->createBackendObject(); + for (int i = 0; i < mediaNodePrivateList.count(); ++i) { + mediaNodePrivateList.at(i)->createBackendObject(); } return; } @@ -277,8 +274,8 @@ void FactoryPrivate::phononBackendChanged() m_backendObject = 0; } createBackend(); - foreach (MediaNodePrivate *bp, mediaNodePrivateList) { - bp->createBackendObject(); + for (int i = 0; i < mediaNodePrivateList.count(); ++i) { + mediaNodePrivateList.at(i)->createBackendObject(); } emit backendChanged(); } @@ -362,15 +359,17 @@ PlatformPlugin *FactoryPrivate::platformPlugin() QStringList()) ); dir.setFilter(QDir::Files); + const QStringList libPaths = QCoreApplication::libraryPaths(); forever { - foreach (QString libPath, QCoreApplication::libraryPaths()) { - libPath += suffix; + for (int i = 0; i < libPaths.count(); ++i) { + const QString libPath = libPaths.at(i) + suffix; dir.setPath(libPath); if (!dir.exists()) { continue; } - foreach (const QString &pluginName, dir.entryList()) { - QPluginLoader pluginLoader(libPath + pluginName); + const QStringList files = dir.entryList(QDir::Files); + for (int i = 0; i < files.count(); ++i) { + QPluginLoader pluginLoader(libPath + files.at(i)); if (!pluginLoader.load()) { pDebug() << Q_FUNC_INFO << " platform plugin load failed:" << pluginLoader.errorString(); diff --git a/src/3rdparty/phonon/phonon/medianode.cpp b/src/3rdparty/phonon/phonon/medianode.cpp index 4693cb8..63fa2e3 100644 --- a/src/3rdparty/phonon/phonon/medianode.cpp +++ b/src/3rdparty/phonon/phonon/medianode.cpp @@ -67,8 +67,8 @@ bool MediaNode::isValid() const MediaNodePrivate::~MediaNodePrivate() { - foreach (MediaNodeDestructionHandler *handler, handlers) { - handler->phononObjectDestroyed(this); + for (int i = 0 ; i < handlers.count(); ++i) { + handlers.at(i)->phononObjectDestroyed(this); } Factory::deregisterFrontendObject(this); delete m_backendObject; diff --git a/src/3rdparty/phonon/phonon/mediaobject.cpp b/src/3rdparty/phonon/phonon/mediaobject.cpp index de5fbc8..10fefbd 100644 --- a/src/3rdparty/phonon/phonon/mediaobject.cpp +++ b/src/3rdparty/phonon/phonon/mediaobject.cpp @@ -300,15 +300,15 @@ void MediaObject::enqueue(const MediaSource &source) void MediaObject::enqueue(const QList &sources) { - foreach (const MediaSource &m, sources) { - enqueue(m); + for (int i = 0; i < sources.count(); ++i) { + enqueue(sources.at(i)); } } void MediaObject::enqueue(const QList &urls) { - foreach (const QUrl &url, urls) { - enqueue(url); + for (int i = 0; i < urls.count(); ++i) { + enqueue(urls.at(i)); } } @@ -502,8 +502,8 @@ void MediaObjectPrivate::setupBackendObject() } #ifndef QT_NO_PHONON_MEDIACONTROLLER - foreach (FrontendInterfacePrivate *f, interfaceList) { - f->_backendObjectChanged(); + for (int i = 0 ; i < interfaceList.count(); ++i) { + interfaceList.at(i)->_backendObjectChanged(); } #endif //QT_NO_PHONON_MEDIACONTROLLER diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp b/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp index e989d0c..b67344f 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.cpp @@ -321,8 +321,8 @@ bool ObjectDescriptionModelData::dropMimeData(ObjectDescriptionType type, const } } d->model->beginInsertRows(QModelIndex(), row, row + toInsert.size() - 1); - foreach (const QExplicitlySharedDataPointer &obj, toInsert) { - d->data.insert(row, obj); + for (int i = 0 ; i < toInsert.count(); ++i) { + d->data.insert(row, toInsert.at(i)); } d->model->endInsertRows(); return true; diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h index 84dc0bb..ba3cb42 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h @@ -292,8 +292,8 @@ namespace Phonon */ inline void setModelData(const QList > &data) { //krazy:exclude=inline QList > list; - Q_FOREACH (const ObjectDescription &desc, data) { - list << desc.d; + for (int i = 0; i < data.count(); ++i) { + list += data.at(i).d; } d->setModelData(list); } @@ -307,8 +307,8 @@ namespace Phonon inline QList > modelData() const { //krazy:exclude=inline QList > ret; QList > list = d->modelData(); - Q_FOREACH (const QExplicitlySharedDataPointer &data, list) { - ret << ObjectDescription(data); + for (int i = 0; i < list.count(); ++i) { + ret << ObjectDescription(list.at(i)); } return ret; } diff --git a/src/3rdparty/phonon/phonon/path.cpp b/src/3rdparty/phonon/phonon/path.cpp index b46d30a..aec8d05 100644 --- a/src/3rdparty/phonon/phonon/path.cpp +++ b/src/3rdparty/phonon/phonon/path.cpp @@ -58,8 +58,8 @@ class ConnectionTransaction PathPrivate::~PathPrivate() { #ifndef QT_NO_PHONON_EFFECT - foreach (Effect *e, effects) { - e->k_ptr->removeDestructionHandler(this); + for (int i = 0; i < effects.count(); ++i) { + effects.at(i)->k_ptr->removeDestructionHandler(this); } delete effectsParent; #endif @@ -233,8 +233,8 @@ bool Path::disconnect() if (d->sourceNode) list << d->sourceNode->k_ptr->backendObject(); #ifndef QT_NO_PHONON_EFFECT - foreach(Effect *e, d->effects) { - list << e->k_ptr->backendObject(); + for (int i = 0; i < d->effects.count(); ++i) { + list << d->effects.at(i)->k_ptr->backendObject(); } #endif if (d->sinkNode) { @@ -260,8 +260,8 @@ bool Path::disconnect() d->sourceNode = 0; #ifndef QT_NO_PHONON_EFFECT - foreach(Effect *e, d->effects) { - e->k_ptr->removeDestructionHandler(d.data()); + for (int i = 0; i < d->effects.count(); ++i) { + d->effects.at(i)->k_ptr->removeDestructionHandler(d.data()); } d->effects.clear(); #endif @@ -292,11 +292,13 @@ MediaNode *Path::sink() const bool PathPrivate::executeTransaction( const QList &disconnections, const QList &connections) { QSet nodesForTransaction; - foreach(const QObjectPair &pair, disconnections) { + for (int i = 0; i < disconnections.count(); ++i) { + const QObjectPair &pair = disconnections.at(i); nodesForTransaction << pair.first; nodesForTransaction << pair.second; } - foreach(const QObjectPair &pair, connections) { + for (int i = 0; i < connections.count(); ++i) { + const QObjectPair &pair = connections.at(i); nodesForTransaction << pair.first; nodesForTransaction << pair.second; } @@ -338,7 +340,8 @@ bool PathPrivate::executeTransaction( const QList &disconnections, } //and now let's reconnect the nodes that were disconnected: rollback - foreach(const QObjectPair &pair, disconnections) { + for (int i = 0; i < disconnections.count(); ++i) { + const QObjectPair &pair = disconnections.at(i); bool success = backend->connectNodes(pair.first, pair.second); Q_ASSERT(success); //a failure here means it is impossible to reestablish the connection Q_UNUSED(success); @@ -417,7 +420,8 @@ void PathPrivate::phononObjectDestroyed(MediaNodePrivate *mediaNodePrivate) sinkNode = 0; } else { #ifndef QT_NO_PHONON_EFFECT - foreach (Effect *e, effects) { + for (int i = 0; i < effects.count(); ++i) { + Effect *e = effects.at(i); if (e->k_ptr == mediaNodePrivate) { removeEffect(e); } -- cgit v0.12 From bf51ca62d4d5c5df5aa8d3c09007eb1c44d7d710 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 6 Jul 2009 14:17:04 +0200 Subject: Phonon: take advantage of more modern compiler to initialize struct This was not supported before by MSVC6 and MSVC2002 --- src/3rdparty/phonon/ds9/fakesource.cpp | 34 ++++----------------- src/3rdparty/phonon/ds9/iodevicereader.cpp | 1 - src/3rdparty/phonon/ds9/qaudiocdreader.cpp | 49 ++++++++++-------------------- src/3rdparty/phonon/ds9/qpin.cpp | 23 +++----------- 4 files changed, 27 insertions(+), 80 deletions(-) diff --git a/src/3rdparty/phonon/ds9/fakesource.cpp b/src/3rdparty/phonon/ds9/fakesource.cpp index 9a61a2e..a4d4640 100644 --- a/src/3rdparty/phonon/ds9/fakesource.cpp +++ b/src/3rdparty/phonon/ds9/fakesource.cpp @@ -29,8 +29,10 @@ namespace Phonon namespace DS9 { static WAVEFORMATEX g_defaultWaveFormat = {WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0}; - static BITMAPINFOHEADER g_defautBitmapHeader = { sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}; - static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, {sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0} }; + + static const AM_MEDIA_TYPE g_fakeAudioType = {MEDIATYPE_Audio, MEDIASUBTYPE_PCM, 0, 0, 2, FORMAT_WaveFormatEx, 0, sizeof(WAVEFORMATEX), reinterpret_cast(&g_defaultWaveFormat)}; + static const AM_MEDIA_TYPE g_fakeVideoType = {MEDIATYPE_Video, MEDIASUBTYPE_RGB32, TRUE, FALSE, 0, FORMAT_VideoInfo2, 0, sizeof(VIDEOINFOHEADER2), reinterpret_cast(&g_defaultVideoInfo)}; class FakePin : public QPin { @@ -128,36 +130,12 @@ namespace Phonon void FakeSource::createFakeAudioPin() { - AM_MEDIA_TYPE mt; - qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE)); - mt.majortype = MEDIATYPE_Audio; - mt.subtype = MEDIASUBTYPE_PCM; - mt.formattype = FORMAT_WaveFormatEx; - mt.lSampleSize = 2; - - //fake the format (stereo 44.1 khz stereo 16 bits) - mt.cbFormat = sizeof(WAVEFORMATEX); - mt.pbFormat = reinterpret_cast(&g_defaultWaveFormat); - - new FakePin(this, mt); + new FakePin(this, g_fakeAudioType); } void FakeSource::createFakeVideoPin() { - AM_MEDIA_TYPE mt; - qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE)); - mt.majortype = MEDIATYPE_Video; - mt.subtype = MEDIASUBTYPE_RGB32; - mt.formattype = FORMAT_VideoInfo2; - mt.bFixedSizeSamples = 1; - - g_defaultVideoInfo.bmiHeader = g_defautBitmapHeader; - - //fake the format - mt.cbFormat = sizeof(VIDEOINFOHEADER2); - mt.pbFormat = reinterpret_cast(&g_defaultVideoInfo); - - new FakePin(this, mt); + new FakePin(this, g_fakeVideoType); } } diff --git a/src/3rdparty/phonon/ds9/iodevicereader.cpp b/src/3rdparty/phonon/ds9/iodevicereader.cpp index 2dff1fe..38c983b 100644 --- a/src/3rdparty/phonon/ds9/iodevicereader.cpp +++ b/src/3rdparty/phonon/ds9/iodevicereader.cpp @@ -40,7 +40,6 @@ namespace Phonon QVector ret; //normal auto-detect stream - mt.subtype = MEDIASUBTYPE_NULL; ret << mt; //AVI stream mt.subtype = MEDIASUBTYPE_Avi; diff --git a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp index d5bdce2..6d0f335 100644 --- a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp +++ b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp @@ -103,8 +103,8 @@ namespace Phonon private: HANDLE m_cddrive; - CDROM_TOC *m_toc; - WaveStructure *m_waveHeader; + CDROM_TOC m_toc; + WaveStructure m_waveHeader; qint64 m_trackAddress; }; @@ -112,19 +112,8 @@ namespace Phonon #define SECTOR_SIZE 2352 #define NB_SECTORS_READ 20 - static AM_MEDIA_TYPE getAudioCDMediaType() - { - AM_MEDIA_TYPE mt; - qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE)); - mt.majortype = MEDIATYPE_Stream; - mt.subtype = MEDIASUBTYPE_WAVE; - mt.bFixedSizeSamples = TRUE; - mt.bTemporalCompression = FALSE; - mt.lSampleSize = 1; - mt.formattype = GUID_NULL; - return mt; - } - + static const AM_MEDIA_TYPE audioCDMediaType = { MEDIATYPE_Stream, MEDIASUBTYPE_WAVE, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; + int addressToSectors(UCHAR address[4]) { return ((address[0] * 60 + address[1]) * 60 + address[2]) * 75 + address[3] - 150; @@ -141,11 +130,8 @@ namespace Phonon } - QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector() << getAudioCDMediaType()) + QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector() << audioCDMediaType) { - m_toc = new CDROM_TOC; - m_waveHeader = new WaveStructure; - //now open the cd-drive QString path; if (drive.isNull()) { @@ -156,31 +142,28 @@ namespace Phonon m_cddrive = ::CreateFile((const wchar_t *)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - qMemSet(m_toc, 0, sizeof(CDROM_TOC)); + qMemSet(&m_toc, 0, sizeof(CDROM_TOC)); //read the TOC DWORD bytesRead = 0; - bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, m_toc, sizeof(CDROM_TOC), &bytesRead, 0); + bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, &m_toc, sizeof(CDROM_TOC), &bytesRead, 0); if (!tocRead) { qWarning("unable to load the TOC from the CD"); return; } - m_trackAddress = addressToSectors(m_toc->TrackData[0].Address); - const qint32 nbSectorsToRead = (addressToSectors(m_toc->TrackData[m_toc->LastTrack + 1 - m_toc->FirstTrack].Address) + m_trackAddress = addressToSectors(m_toc.TrackData[0].Address); + const qint32 nbSectorsToRead = (addressToSectors(m_toc.TrackData[m_toc.LastTrack + 1 - m_toc.FirstTrack].Address) - m_trackAddress); const qint32 dataLength = nbSectorsToRead * SECTOR_SIZE; - m_waveHeader->chunksize = 4 + (8 + m_waveHeader->chunksize2) + (8 + dataLength); - m_waveHeader->dataLength = dataLength; + m_waveHeader.chunksize = 4 + (8 + m_waveHeader.chunksize2) + (8 + dataLength); + m_waveHeader.dataLength = dataLength; } QAudioCDReader::~QAudioCDReader() { ::CloseHandle(m_cddrive); - delete m_toc; - delete m_waveHeader; - } STDMETHODIMP_(ULONG) QAudioCDReader::AddRef() @@ -196,7 +179,7 @@ namespace Phonon STDMETHODIMP QAudioCDReader::Length(LONGLONG *total,LONGLONG *available) { - const LONGLONG length = sizeof(WaveStructure) + m_waveHeader->dataLength; + const LONGLONG length = sizeof(WaveStructure) + m_waveHeader.dataLength; if (total) { *total = length; } @@ -235,11 +218,11 @@ namespace Phonon if (pos < sizeof(WaveStructure)) { //we first copy the content of the structure nbRead = qMin(LONG(sizeof(WaveStructure) - pos), length); - qMemCopy(buffer, reinterpret_cast(m_waveHeader) + pos, nbRead); + qMemCopy(buffer, reinterpret_cast(&m_waveHeader) + pos, nbRead); } const LONGLONG posInTrack = pos - sizeof(WaveStructure) + nbRead; - const int bytesLeft = qMin(m_waveHeader->dataLength - posInTrack, LONGLONG(length - nbRead)); + const int bytesLeft = qMin(m_waveHeader.dataLength - posInTrack, LONGLONG(length - nbRead)); if (bytesLeft > 0) { @@ -294,8 +277,8 @@ namespace Phonon { QList ret; ret << 0; - for(int i = m_toc->FirstTrack; i <= m_toc->LastTrack ; ++i) { - const uchar *address = m_toc->TrackData[i].Address; + for(int i = m_toc.FirstTrack; i <= m_toc.LastTrack ; ++i) { + const uchar *address = m_toc.TrackData[i].Address; ret << ((address[0] * 60 + address[1]) * 60 + address[2]) * 1000 + address[3]*1000/75 - 2000; } diff --git a/src/3rdparty/phonon/ds9/qpin.cpp b/src/3rdparty/phonon/ds9/qpin.cpp index 37fe48d..5f335ac 100644 --- a/src/3rdparty/phonon/ds9/qpin.cpp +++ b/src/3rdparty/phonon/ds9/qpin.cpp @@ -28,20 +28,7 @@ namespace Phonon namespace DS9 { - static const AM_MEDIA_TYPE defaultMediaType() - { - AM_MEDIA_TYPE ret; - ret.majortype = MEDIATYPE_NULL; - ret.subtype = MEDIASUBTYPE_NULL; - ret.bFixedSizeSamples = TRUE; - ret.bTemporalCompression = FALSE; - ret.lSampleSize = 1; - ret.formattype = GUID_NULL; - ret.pUnk = 0; - ret.cbFormat = 0; - ret.pbFormat = 0; - return ret; - } + static const AM_MEDIA_TYPE defaultMediaType = { MEDIATYPE_NULL, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; class QEnumMediaTypes : public IEnumMediaTypes { @@ -159,7 +146,7 @@ namespace Phonon QPin::QPin(QBaseFilter *parent, PIN_DIRECTION dir, const QVector &mt) : m_memAlloc(0), m_parent(parent), m_refCount(1), m_connected(0), - m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType()), + m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType), m_flushing(false) { Q_ASSERT(m_parent); @@ -273,7 +260,7 @@ namespace Phonon if (FAILED(hr)) { setConnected(0); - setConnectedType(defaultMediaType()); + setConnectedType(defaultMediaType); } else { ComPointer input(pin, IID_IMemInputPin); if (input) { @@ -315,7 +302,7 @@ namespace Phonon } setConnected(0); - setConnectedType(defaultMediaType()); + setConnectedType(defaultMediaType); if (m_direction == PINDIR_INPUT) { setMemoryAllocator(0); } @@ -470,7 +457,7 @@ namespace Phonon freeMediaType(type); return S_OK; } else { - setConnectedType(defaultMediaType()); + setConnectedType(defaultMediaType); freeMediaType(type); } } -- cgit v0.12 From 8a72074b0ab146942512b37439ffc8618e3f7d06 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jul 2009 15:13:07 +0200 Subject: doc: Included note about the effect of WA_NoMousePropagation. Task-number: 162945 --- src/gui/kernel/qevent.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index bef7ee1..4fc3643 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -114,6 +114,10 @@ QInputEvent::~QInputEvent() propagated up the parent widget chain until a widget accepts it with accept(), or an event filter consumes it. + \note If a mouse event is propagated to a \l{QWidget}{widget} for + which Qt::WA_NoMousePropagation has been set, that mouse event + will not be propagated further up the parent widget chain. + The state of the keyboard modifier keys can be found by calling the \l{QInputEvent::modifiers()}{modifiers()} function, inhertied from QInputEvent. -- cgit v0.12 From ba25bdcb9122d45ccdd06f281a5f49999eaff089 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Mon, 6 Jul 2009 15:33:10 +0200 Subject: Doc - beautified some of the existing sentences in Part 6 Reviewed-By: TrustMe --- doc/src/tutorials/addressbook.qdoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index 33832da..95394eb 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -876,7 +876,7 @@ \image addressbook-tutorial-part6-save.png - If \c fileName is not empty, we create a QFile object, \c file with + If \c fileName is not empty, we create a QFile object, \c file, with \c fileName. QFile works with QDataStream as QFile is a QIODevice. Next, we attempt to open the file in \l{QIODevice::}{WriteOnly} mode. @@ -906,18 +906,18 @@ \image addressbook-tutorial-part6-load.png If \c fileName is not empty, again, we use a QFile object, \c file, and - attempt to open it in \l{QIODevice::}{ReadOnly} mode. In a similar way - to our implementation of \c saveToFile(), if this attempt is unsuccessful, - we display a QMessageBox to inform the user. + attempt to open it in \l{QIODevice::}{ReadOnly} mode. Similar to our + implementation of \c saveToFile(), if this attempt is unsuccessful, we + display a QMessageBox to inform the user. \snippet tutorials/addressbook/part6/addressbook.cpp loadFromFile() function part2 Otherwise, we instantiate a QDataStream object, \c in, set its version as above and read the serialized data into the \c contacts data structure. - Note that we empty \c contacts before reading data into it to simplify the - file reading process. A more advanced method would be to read the contacts - into temporary QMap object, and copy only the contacts that do not already - exist in \c contacts. + The \c contacts object is emptied before data is read into it to simplify + the file reading process. A more advanced method would be to read the + contacts into a temporary QMap object, and copy over non-duplicate contacts + into \c contacts. \snippet tutorials/addressbook/part6/addressbook.cpp loadFromFile() function part3 -- cgit v0.12 From e07e95da3d35a2ea1ab2b325df6c91620f948497 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Mon, 6 Jul 2009 15:43:03 +0200 Subject: Fix issue where a mainwindow would show two size grips in Cocoa. OK. this is a bit strange. It seems the topdata->resizer value is used to control whether or not we should show a resize handle based on a count (0 no, non-zero yes). Since we somehow decided that this value will never be larger than 15, we made it 4-bits wide. There's a "Qt/Mac" API, QWidgetPrivate::qt_mac_update_sizer(QWidget *, int = 0) which would adjust this value by the int passed in.. We use that in several places, not excluding the QStatusBar where we would pass 1 if we want to show, and -1 if we didn't. Now if you subtract -1 from zero when you are 4 bits wide, well, bad things happen. Therefore protect that (since if it's at zero we have succeeded, we don't want to show the resizer). This seems to work well. The private API is certainly an interesting way of solving the problem, but is easy to abuse (for example, this code will break if resizer = 1 and we are passed -2 in the function. Task-number: 257485 Reviewed-by: Prasanth Ullattil --- src/gui/kernel/qwidget_mac.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index ec9a049..f96d061 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -1526,12 +1526,16 @@ void QWidgetPrivate::toggleDrawers(bool visible) *****************************************************************************/ bool QWidgetPrivate::qt_mac_update_sizer(QWidget *w, int up) { + // I'm not sure what "up" is if(!w || !w->isWindow()) return false; QTLWExtra *topData = w->d_func()->topData(); QWExtra *extraData = w->d_func()->extraData(); - topData->resizer += up; + // topData->resizer is only 4 bits, so subtracting -1 from zero causes bad stuff + // to happen, prevent that here (you really want the thing hidden). + if (up >= 0 || topData->resizer != 0) + topData->resizer += up; OSWindowRef windowRef = qt_mac_window_for(OSViewRef(w->winId())); { #ifndef QT_MAC_USE_COCOA @@ -1544,7 +1548,6 @@ bool QWidgetPrivate::qt_mac_update_sizer(QWidget *w, int up) bool remove_grip = (topData->resizer || (w->windowFlags() & Qt::FramelessWindowHint) || (extraData->maxw && extraData->maxh && extraData->maxw == extraData->minw && extraData->maxh == extraData->minh)); - #ifndef QT_MAC_USE_COCOA WindowAttributes attr; GetWindowAttributes(windowRef, &attr); -- cgit v0.12 From d000c29f9039dab6cd46bb3a12df828d5f9354a7 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 6 Jul 2009 16:12:36 +0200 Subject: QMenu: scrolling in menus was broken --- src/gui/widgets/qmenu.cpp | 34 +++++++++++++++++++++------------- src/gui/widgets/qmenu_p.h | 6 +++--- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index d3f5bc5..ef892d7 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -257,7 +257,6 @@ void QMenuPrivate::updateActionRects() const //let the style modify the above size.. QStyleOptionMenuItem opt; q->initStyleOption(&opt, action); - opt.rect = q->rect(); const QFontMetrics &fm = opt.fontMetrics; QSize sz; @@ -757,9 +756,19 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc } //actually update flags - scroll->scrollOffset = newOffset; - if (scroll->scrollOffset > 0) - scroll->scrollOffset = 0; + const int delta = qMin(0, newOffset) - scroll->scrollOffset; //make sure the new offset is always negative + if (!itemsDirty && delta) { + //we've scrolled so we need to update the action rects + for (int i = 0; i < actionRects.count(); ++i) { + QRect ¤t = actionRects[i]; + current.moveTop(current.top() + delta); + + //we need to update the widgets geometry + if (QWidget *w = widgetItems.at(i)) + w->setGeometry(current); + } + } + scroll->scrollOffset += delta; scroll->scrollFlags = newScrollFlags; if (active) setCurrentAction(action); @@ -875,12 +884,10 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) } } if (isScroll) { - if (!scroll->scrollTimer) - scroll->scrollTimer = new QBasicTimer; - scroll->scrollTimer->start(50, q); + scroll->scrollTimer.start(50, q); return true; - } else if (scroll->scrollTimer && scroll->scrollTimer->isActive()) { - scroll->scrollTimer->stop(); + } else { + scroll->scrollTimer.stop(); } } @@ -2054,6 +2061,8 @@ void QMenu::hideEvent(QHideEvent *) d->hasHadMouse = false; d->causedPopup.widget = 0; d->causedPopup.action = 0; + if (d->scroll) + d->scroll->scrollTimer.stop(); //make sure the timer stops } /*! @@ -2499,8 +2508,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) } if (nextAction) { if (d->scroll && scroll_loc != QMenuPrivate::QMenuScroller::ScrollStay) { - if (d->scroll->scrollTimer) - d->scroll->scrollTimer->stop(); + d->scroll->scrollTimer.stop(); d->scrollMenu(nextAction, scroll_loc); } d->setCurrentAction(nextAction, /*popup*/-1, QMenuPrivate::SelectedFromKeyboard); @@ -2761,10 +2769,10 @@ void QMenu::timerEvent(QTimerEvent *e) { Q_D(QMenu); - if (d->scroll && d->scroll->scrollTimer && d->scroll->scrollTimer->timerId() == e->timerId()) { + if (d->scroll && d->scroll->scrollTimer.timerId() == e->timerId()) { d->scrollMenu((QMenuPrivate::QMenuScroller::ScrollDirection)d->scroll->scrollDirection); if (d->scroll->scrollFlags == QMenuPrivate::QMenuScroller::ScrollNone) - d->scroll->scrollTimer->stop(); + d->scroll->scrollTimer.stop(); } else if(QMenuPrivate::menuDelayTimer.timerId() == e->timerId()) { QMenuPrivate::menuDelayTimer.stop(); internalDelayedPopup(); diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 50a9f2f..461d435 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -189,10 +189,10 @@ public: enum ScrollDirection { ScrollNone=0, ScrollUp=0x01, ScrollDown=0x02 }; uint scrollFlags : 2, scrollDirection : 2; int scrollOffset; - QBasicTimer *scrollTimer; + QBasicTimer scrollTimer; - QMenuScroller() : scrollFlags(ScrollNone), scrollDirection(ScrollNone), scrollOffset(0), scrollTimer(0) { } - ~QMenuScroller() { delete scrollTimer; } + QMenuScroller() : scrollFlags(ScrollNone), scrollDirection(ScrollNone), scrollOffset(0) { } + ~QMenuScroller() { } } *scroll; void scrollMenu(QMenuScroller::ScrollLocation location, bool active=false); void scrollMenu(QMenuScroller::ScrollDirection direction, bool page=false, bool active=false); -- cgit v0.12 From 134dad4c6a996045397098498eaf0afca889b6f9 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 6 Jul 2009 16:48:15 +0200 Subject: QMenu: the scroller now takes the qapp's global strut into account Task-number: 257118 --- src/gui/widgets/qmenu.cpp | 48 +++++++++++++++++++++++------------------------ src/gui/widgets/qmenu_p.h | 2 ++ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index ef892d7..af9ddf5 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -163,6 +163,12 @@ void QMenuPrivate::init() } } +int QMenuPrivate::scrollerHeight() const +{ + Q_Q(const QMenu); + return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q)); +} + //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { @@ -483,14 +489,13 @@ void QMenuPrivate::setFirstActionActive() { Q_Q(QMenu); updateActionRects(); - const int scrollerHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q); for(int i = 0, saccum = 0; i < actions.count(); i++) { const QRect &rect = actionRects.at(i); if (rect.isNull()) continue; if (scroll && scroll->scrollFlags & QMenuScroller::ScrollUp) { saccum -= rect.height(); - if (saccum > scroll->scrollOffset-scrollerHeight) + if (saccum > scroll->scrollOffset - scrollerHeight()) continue; } QAction *act = actions.at(i); @@ -668,16 +673,14 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc return; updateActionRects(); int newOffset = 0; - const int scrollHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q); - const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollHeight : 0; - const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollHeight : 0; + const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0; + const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0; const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q); const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q); if (location == QMenuScroller::ScrollTop) { for(int i = 0, saccum = 0; i < actions.count(); i++) { - QAction *act = actions.at(i); - if (act == action) { + if (actions.at(i) == action) { newOffset = topScroll - saccum; break; } @@ -685,9 +688,8 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc } } else { for(int i = 0, saccum = 0; i < actions.count(); i++) { - QAction *act = actions.at(i); saccum += actionRects.at(i).height(); - if (act == action) { + if (actions.at(i) == action) { if (location == QMenuScroller::ScrollCenter) newOffset = ((q->height() / 2) - botScroll) - (saccum - topScroll); else @@ -820,9 +822,8 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool pag if (!scroll || !(scroll->scrollFlags & direction)) //not really possible... return; updateActionRects(); - const int scrollHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q); - const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollHeight : 0; - const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollHeight : 0; + const int topScroll = (scroll->scrollFlags & QMenuScroller::ScrollUp) ? scrollerHeight() : 0; + const int botScroll = (scroll->scrollFlags & QMenuScroller::ScrollDown) ? scrollerHeight() : 0; const int vmargin = q->style()->pixelMetric(QStyle::PM_MenuVMargin, 0, q); const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q); const int offset = topScroll ? topScroll-vmargin : 0; @@ -869,13 +870,12 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) if (scroll && !activeMenu) { //let the scroller "steal" the event bool isScroll = false; if (pos.x() >= 0 && pos.x() < q->width()) { - const int scrollerHeight = q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q); for(int dir = QMenuScroller::ScrollUp; dir <= QMenuScroller::ScrollDown; dir = dir << 1) { if (scroll->scrollFlags & dir) { if (dir == QMenuScroller::ScrollUp) - isScroll = (pos.y() <= scrollerHeight); + isScroll = (pos.y() <= scrollerHeight()); else if (dir == QMenuScroller::ScrollDown) - isScroll = (pos.y() >= q->height()-scrollerHeight); + isScroll = (pos.y() >= q->height() - scrollerHeight()); if (isScroll) { scroll->scrollDirection = dir; break; @@ -894,7 +894,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) if (tearoff) { //let the tear off thingie "steal" the event.. QRect tearRect(0, 0, q->width(), q->style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q)); if (scroll && scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) - tearRect.translate(0, q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, q)); + tearRect.translate(0, scrollerHeight()); q->update(tearRect); if (tearRect.contains(pos) && hasMouseMoved(e->globalPos())) { setCurrentAction(0); @@ -2104,18 +2104,17 @@ void QMenu::paintEvent(QPaintEvent *e) const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); //draw the scroller regions.. if (d->scroll) { - const int scrollerHeight = style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this); menuOpt.menuItemType = QStyleOptionMenuItem::Scroller; menuOpt.state |= QStyle::State_Enabled; if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) { - menuOpt.rect.setRect(fw, fw, width() - (fw * 2), scrollerHeight); + menuOpt.rect.setRect(fw, fw, width() - (fw * 2), d->scrollerHeight()); emptyArea -= QRegion(menuOpt.rect); p.setClipRect(menuOpt.rect); style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p, this); } if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) { - menuOpt.rect.setRect(fw, height() - scrollerHeight - fw, width() - (fw * 2), - scrollerHeight); + menuOpt.rect.setRect(fw, height() - d->scrollerHeight() - fw, width() - (fw * 2), + d->scrollerHeight()); emptyArea -= QRegion(menuOpt.rect); menuOpt.state |= QStyle::State_DownArrow; p.setClipRect(menuOpt.rect); @@ -2128,7 +2127,7 @@ void QMenu::paintEvent(QPaintEvent *e) menuOpt.rect.setRect(fw, fw, width() - (fw * 2), style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this)); if (d->scroll && d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) - menuOpt.rect.translate(0, style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this)); + menuOpt.rect.translate(0, d->scrollerHeight()); emptyArea -= QRegion(menuOpt.rect); p.setClipRect(menuOpt.rect); menuOpt.state = QStyle::State_None; @@ -2458,7 +2457,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) continue; nextAction = next; if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp)) { - int topVisible = style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this); + int topVisible = d->scrollerHeight(); if (d->tearoff) topVisible += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this); if (((y + d->scroll->scrollOffset) - topVisible) <= d->actionRects.at(next_i).height()) @@ -2489,10 +2488,9 @@ void QMenu::keyPressEvent(QKeyEvent *e) continue; nextAction = next; if (d->scroll && (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown)) { - const int scrollerHeight = style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, this); - int bottomVisible = height()-scrollerHeight; + int bottomVisible = height() - d->scrollerHeight(); if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) - bottomVisible -= scrollerHeight; + bottomVisible -= d->scrollerHeight(); if (d->tearoff) bottomVisible -= style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this); if ((y + d->scroll->scrollOffset + d->actionRects.at(next_i).height()) > bottomVisible) diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 461d435..4e428fe 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -151,6 +151,8 @@ public: } void init(); + int scrollerHeight() const; + //item calculations mutable uint itemsDirty : 1; mutable uint maxIconWidth, tabWidth; -- cgit v0.12 From 1222ea208587ed039e436d58aa6d7ea6ea6c014e Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:07 +0200 Subject: Update Russian Qt phrase book Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- tools/linguist/phrasebooks/russian.qph | 52 +++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph index 629c60b..69af041 100644 --- a/tools/linguist/phrasebooks/russian.qph +++ b/tools/linguist/phrasebooks/russian.qph @@ -10,7 +10,7 @@ accessibility - удобÑтво + Ñпециальные возможноÑти action handle @@ -345,8 +345,8 @@ Ð°ÐºÑ‚Ð¸Ð²Ð½Ð°Ñ Ð·Ð¾Ð½Ð° - icon - пиктограмма + Icon + Значок inactive @@ -402,7 +402,7 @@ list view - древовидный ÑпиÑок + ÑпиÑок manual link @@ -901,10 +901,6 @@ панель инÑтрументов - tooltip - вÑÐ¿Ð»Ñ‹Ð²Ð°ÑŽÑ‰Ð°Ñ Ð¿Ð¾Ð´Ñказка - - tree view control древовидный ÑпиÑок @@ -1054,10 +1050,46 @@ Case Sensitive - РегиÑтрозавиÑимо + Учитывать региÑÑ‚Ñ€ Whole words - Слова полноÑтью + Слова целиком + + + Find Next + Ðайти Ñледующее + + + Find Previous + Ðайти предыдущее + + + Case Sensitive + Учитывать региÑÑ‚Ñ€ Ñимволов + + + Whole words only + Только Ñлова целиком + + + Subwindow + Дочернее окно + + + Next + Далее + + + tree view + древовидный ÑпиÑок + + + ToolTip + ПодÑказка + + + Checkable + Переключаемое -- cgit v0.12 From e1d2dffc8cfe4195210ce435c394d8af9b9823e8 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:08 +0200 Subject: Update Russian translation for Qt libraries. almost done; only few strings left untranslated. Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- translations/qt_ru.ts | 212 +++++++++++++++++++++++++------------------------- 1 file changed, 104 insertions(+), 108 deletions(-) diff --git a/translations/qt_ru.ts b/translations/qt_ru.ts index 1e6a4eb..9529c33 100644 --- a/translations/qt_ru.ts +++ b/translations/qt_ru.ts @@ -57,7 +57,7 @@ Accessibility - СредÑтва Ð´Ð»Ñ Ð»ÑŽÐ´ÐµÐ¹ Ñ Ð¾Ð³Ñ€Ð°Ð½Ð¸Ñ‡ÐµÐ½Ð½Ñ‹Ð¼Ð¸ возможноÑÑ‚Ñми + Специальные возможноÑти @@ -87,7 +87,7 @@ Check your Gstreamer installation and make sure you have libgstreamer-plugins-base installed. Ðевозможно начать воÑпроизведение. -Проверьте уÑтановку Gstreamer и убедитеÑÑŒ, +Проверьте уÑтановку Gstreamer и убедитеÑÑŒ, что пакет libgstreamer-plugins-base уÑтановлен.
    @@ -917,22 +917,22 @@ to QAxSelect - + Select ActiveX Control Выбор компоненты ActiveX - + OK Выбрать - + &Cancel &Отмена - + COM &Object: COM &Объект: @@ -1022,7 +1022,7 @@ to Открыть - + False Ðет @@ -1491,32 +1491,32 @@ Please verify the correct file name was given. Показать Ñкр&ытые файлы - - + + Back Ðазад - - + + Parent Directory РодительÑкий каталог - - + + List View СпиÑок - - + + Detail View Подробный вид - - + + Files of type: Типы файлов: @@ -1595,8 +1595,8 @@ Do you want to delete it anyway? Показать - - + + Forward Вперёд @@ -1628,14 +1628,14 @@ Do you want to delete it anyway? &Ð˜Ð¼Ñ Ñ„Ð°Ð¹Ð»Ð°: - - + + Look in: Перейти к: - - + + Create New Folder Создать папку @@ -1799,7 +1799,7 @@ Do you want to delete it anyway? Arabic - + ÐрабÑÐºÐ°Ñ @@ -1809,57 +1809,57 @@ Do you want to delete it anyway? Thaana - + Таана Devanagari - + Деванагири Bengali - + БенгальÑÐºÐ°Ñ Gurmukhi - + Гурмукхи Gujarati - + Гуджарати Oriya - + ÐžÑ€Ð¸Ñ Tamil - + ТамильÑÐºÐ°Ñ Telugu - + Телугу Kannada - + Каннада Malayalam - + МалайÑлам Sinhala - + СингальÑÐºÐ°Ñ @@ -1869,7 +1869,7 @@ Do you want to delete it anyway? Lao - + ЛаоÑÑÐºÐ°Ñ @@ -1879,7 +1879,7 @@ Do you want to delete it anyway? Myanmar - + МьÑнма @@ -1924,7 +1924,7 @@ Do you want to delete it anyway? Ogham - + ОгамичеÑÐºÐ°Ñ @@ -2210,7 +2210,7 @@ Do you want to delete it anyway? Ошибка запиÑи ответа на уÑтройÑтво - + Connection refused Отказано в Ñоединении @@ -2372,7 +2372,7 @@ Do you want to delete it anyway? QIBaseDriver - + Error opening database Ошибка Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ð±Ð°Ð·Ñ‹ данных @@ -2395,7 +2395,7 @@ Do you want to delete it anyway? QIBaseResult - + Unable to create BLOB Ðевозможно Ñоздать BLOB @@ -2441,7 +2441,7 @@ Do you want to delete it anyway? Ðевозможно выполнить транзакцию - + Could not allocate statement Ðе удалоÑÑŒ получить реÑурÑÑ‹ Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð²Ñ‹Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ @@ -2452,12 +2452,12 @@ Do you want to delete it anyway? - + Could not describe input statement Ðе удалоÑÑŒ опиÑать входÑщее выражение - + Could not describe statement Ðе удалоÑÑŒ опиÑать выражение @@ -3223,7 +3223,7 @@ Do you want to delete it anyway? Ошибка загрузки %1 - ответ Ñервера: %2 - + Protocol "%1" is unknown ÐеизвеÑтный протокол "%1" @@ -3231,7 +3231,7 @@ Do you want to delete it anyway? QNetworkReplyImpl - + Operation canceled ÐžÐ¿ÐµÑ€Ð°Ñ†Ð¸Ñ Ð¾Ñ‚Ð¼ÐµÐ½ÐµÐ½Ð° @@ -3240,7 +3240,7 @@ Do you want to delete it anyway? QOCIDriver - + Unable to logon Ðевозможно авторизоватьÑÑ @@ -3269,7 +3269,7 @@ Do you want to delete it anyway? QOCIResult - + Unable to bind column for batch execute @@ -3281,7 +3281,7 @@ Do you want to delete it anyway? Ðевозможно выполнить пакетное выражение - + Unable to goto next Ðевозможно перейти к Ñледующей Ñтроке @@ -3314,7 +3314,7 @@ Do you want to delete it anyway? QODBCDriver - + Unable to connect Ðевозможно ÑоединитьÑÑ @@ -3324,7 +3324,7 @@ Do you want to delete it anyway? Ðевозможно ÑоединитьÑÑ - Драйвер не поддерживает требуемый функционал - + Unable to disable autocommit Ðевозможно отключить автовыполнение транзакции @@ -3347,7 +3347,7 @@ Do you want to delete it anyway? QODBCResult - + QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration QODBCResult::reset: Ðевозможно уÑтановить 'SQL_CURSOR_STATIC' атрибутом выражение. Проверьте наÑтройки драйвера ODBC @@ -3376,12 +3376,12 @@ Do you want to delete it anyway? - + Unable to fetch last Ðевозможно получить поÑледнюю Ñтроку - + Unable to fetch Ðевозможно получить данные @@ -3471,7 +3471,7 @@ Do you want to delete it anyway? Ðе удалоÑÑŒ начать транзакцию - + Could not commit transaction Ðе удалоÑÑŒ выполнить транзакцию @@ -3494,7 +3494,7 @@ Do you want to delete it anyway? QPSQLResult - + Unable to create query Ðевозможно Ñоздать Ð·Ð°Ð¿Ñ€Ð¾Ñ @@ -3527,86 +3527,82 @@ Do you want to delete it anyway? Точки (pt) - + Form Форма - + Paper Бумага - + Page size: Размер Ñтраницы: - + Width: Ширина: - + Height: Ð’Ñ‹Ñота: - + Paper source: ИÑточник бумаги: - + Orientation ÐžÑ€Ð¸ÐµÐ½Ñ‚Ð°Ñ†Ð¸Ñ - + Portrait ÐšÐ½Ð¸Ð¶Ð½Ð°Ñ - + Landscape ÐÐ»ÑŒÐ±Ð¾Ð¼Ð½Ð°Ñ - + Reverse landscape ÐŸÐµÑ€ÐµÐ²Ñ‘Ñ€Ð½ÑƒÑ‚Ð°Ñ Ð°Ð»ÑŒÐ±Ð¾Ð¼Ð½Ð°Ñ - + Reverse portrait ÐŸÐµÑ€ÐµÐ²Ñ‘Ñ€Ð½ÑƒÑ‚Ð°Ñ ÐºÐ½Ð¸Ð¶Ð½Ð°Ñ - + Margins ÐŸÐ¾Ð»Ñ - - + top margin верхнее поле - - + left margin левое поле - - + right margin правое поле - - + bottom margin нижнее поле @@ -4165,17 +4161,17 @@ Please choose a different file name. QPrintPropertiesWidget - + Form Форма - + Page Страница - + Advanced Дополнительно @@ -4183,97 +4179,97 @@ Please choose a different file name. QPrintSettingsOutput - + Form Форма - + Copies Копии - + Print range Диапазон печати - + Print all Ð’Ñе - + Pages from Страницы от - + to до - + Selection Выделенный фрагмент - + Output Settings ÐаÑтройки вывода - + Copies: КоличеÑтво копий: - + Collate Разобрать про копиÑм - + Reverse Обратный порÑдок - + Options Параметры - + Color Mode Режим цвета - + Color Цвет - + Grayscale Оттенки Ñерого - + Duplex Printing ДвуÑтороннÑÑ Ð¿ÐµÑ‡Ð°Ñ‚ÑŒ - + None Ðет - + Long side По длинной Ñтороне - + Short side По короткой Ñтороне @@ -4281,47 +4277,47 @@ Please choose a different file name. QPrintWidget - + Form Форма - + Printer Принтер - + &Name: &Ðазвание: - + P&roperties С&войÑтва - + Location: РаÑположение: - + Preview ПроÑмотр - + Type: Тип: - + Output &file: Выходной &файл: - + ... ... @@ -6258,7 +6254,7 @@ Please choose a different file name. QWizard - + Go Back Ðазад -- cgit v0.12 From 16f03cce9fc898e751c04ef590e91e82e0c1f79d Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:09 +0200 Subject: Update Russian translation for Qt Linguist. typo fixes; clarify several strings; use 'own languages' hack Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- translations/linguist_ru.ts | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/translations/linguist_ru.ts b/translations/linguist_ru.ts index 058d86a..86c7434 100644 --- a/translations/linguist_ru.ts +++ b/translations/linguist_ru.ts @@ -42,7 +42,7 @@ Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked. - Имейте в виду, что изменённые запиÑи будут отмечены как незавершённые, еÑли не включен параметр "Помечать переведенные запиÑи как завершённые". + Имейте в виду, что изменённые запиÑи будут отмечены как незавершённые, еÑли не включён параметр "Помечать переведенные запиÑи как завершённые". @@ -289,7 +289,7 @@ Will assume a single universal form. LRelease - + Generated %n translation(s) (%1 finished and %2 unfinished) @@ -617,7 +617,7 @@ All files (*) <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>%2</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p> - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist - инÑтрумент Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿ÐµÑ€ÐµÐ²Ð¾Ð´Ð¾Ð² в Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð½Ð° оÑнове Qt.</p><p>%2</p><p>Copyright (C) 2009 ÐšÐ¾Ñ€Ð¿Ð¾Ñ€Ð°Ñ†Ð¸Ñ Nokia и/или её дочерние подразделениÑ.</p><p>Программа предоÑтавлÑетÑÑ "как еÑÑ‚ÑŒ" без гарантий любого рода, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ð³Ð°Ñ€Ð°Ð½Ñ‚Ð¸Ð¸ дизайна, коммерчеÑкой ценноÑти и пригодноÑти Ð´Ð»Ñ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»Ñ‘Ð½Ð½Ð¾Ð¹ цели.</p> + @@ -1250,7 +1250,7 @@ All files (*) Toggle checking that phrase suggestions are used. - Переключение проверки иÑÐ¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð¿Ñ€ÐµÐ´Ð»Ð¾Ð¶ÐµÐ½Ð¸Ð¹ Ð´Ð»Ñ Ñ„Ñ€Ð°Ð·. ЕÑли выÑвлено неÑовпадение, будет показано Ñообщение в окне предупреждений. + Переключение проверки иÑÐ¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð¿Ñ€ÐµÐ´Ð»Ð¾Ð¶ÐµÐ½Ð¸Ð¹ Ð´Ð»Ñ Ñ„Ñ€Ð°Ð·. @@ -1466,6 +1466,11 @@ All files (*) + Russian + РуÑÑкий + + + German Ðемецкий @@ -1517,7 +1522,7 @@ All files (*) Developer comments - Комментарии разработчика + Комментарий разработчика @@ -1547,7 +1552,7 @@ All files (*) %1 translator comments - Комментарий переводчика на %1 + %1 перевод: комментарий переводчика @@ -1583,10 +1588,11 @@ Line: %2 MsgEdit - + This is the right panel of the main window. - + ÐŸÑ€Ð°Ð²Ð°Ñ Ð¿Ð°Ð½ÐµÐ»ÑŒ главного окна + @@ -1800,17 +1806,17 @@ Line: %2 C++ source files - ИÑходные коды C++ + Файлы иÑходных кодов C++ Java source files - ИÑходные коды Java + Файлы иÑходных кодов Java Qt Script source files - ИÑходные коды Qt Script + Файлы иÑходных кодов Qt Script -- cgit v0.12 From bcc679a7a06f64459b942b001ae7df2d27b43746 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:09 +0200 Subject: Add Russian translation for qvfb Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- tools/qvfb/translations/translations.pro | 1 + translations/qvfb_ru.ts | 328 +++++++++++++++++++++++++++++++ 2 files changed, 329 insertions(+) create mode 100644 translations/qvfb_ru.ts diff --git a/tools/qvfb/translations/translations.pro b/tools/qvfb/translations/translations.pro index 736a72c..f667bb8 100644 --- a/tools/qvfb/translations/translations.pro +++ b/tools/qvfb/translations/translations.pro @@ -27,6 +27,7 @@ SOURCES = ../qvfb.cpp \ ../../shared/deviceskin/deviceskin.cpp TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/qvfb_pl.ts \ + $$[QT_INSTALL_TRANSLATIONS]/qvfb_ru.ts \ $$[QT_INSTALL_TRANSLATIONS]/qvfb_untranslated.ts \ $$[QT_INSTALL_TRANSLATIONS]/qvfb_zh_CN.ts \ $$[QT_INSTALL_TRANSLATIONS]/qvfb_zh_TW.ts diff --git a/translations/qvfb_ru.ts b/translations/qvfb_ru.ts new file mode 100644 index 0000000..b084380 --- /dev/null +++ b/translations/qvfb_ru.ts @@ -0,0 +1,328 @@ + + + + + AnimationSaveWidget + + + + Record + ЗапиÑать + + + + Reset + СброÑить + + + + Save + Сохранить + + + + Save in MPEG format (requires netpbm package installed) + Сохранить в формат MPEG (требуетÑÑ ÑƒÑтановленный пакет netpbm) + + + + + Click record to begin recording. + Ðажмите "ЗапиÑать" Ð´Ð»Ñ Ð½Ð°Ñ‡Ð°Ð»Ð° запиÑи. + + + + + Finished saving. + Сохранение завершено. + + + + Paused. Click record to resume, or save if done. + ПриоÑтановлено. Ðажмите "ЗапиÑать" Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð´Ð¾Ð»Ð¶ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ "Сохранить", еÑли готово. + + + + Pause + Пауза + + + + Recording... + Идёт запиÑÑŒ... + + + + Saving... + Сохранение... + + + + + Save animation... + Сохранение анимации... + + + + Save canceled. + Сохранение отменено. + + + + Save failed! + Сохранение не удалоÑÑŒ! + + + + Config + + + Configure + ÐаÑтройка + + + + Size + Размер + + + + 176x220 "SmartPhone" + + + + + 240x320 "PDA" + + + + + 320x240 "TV" / "QVGA" + + + + + 640x480 "VGA" + + + + + 800x600 + + + + + 1024x768 + + + + + Custom + ОÑобый + + + + Depth + Глубина + + + + 1 bit monochrome + 1 бит (монохромный) + + + + 4 bit grayscale + 4 бита (градации Ñерого) + + + + 8 bit + 8 бит + + + + 12 (16) bit + 12 (16) бит + + + + 15 bit + 15 бит + + + + 16 bit + 16 бит + + + + 18 bit + 18 бит + + + + 24 bit + 24 бита + + + + 32 bit + 32 бита + + + + 32 bit ARGB + 32 бита (ARGB) + + + + Skin + Обложка + + + + None + Ðет + + + + Emulate touch screen (no mouse move) + Эмулировать тачÑкрин (без Ð¿ÐµÑ€ÐµÐ¼ÐµÑ‰ÐµÐ½Ð¸Ñ Ð¼Ñ‹ÑˆÐ¸) + + + + Emulate LCD screen (Only with fixed zoom of 3.0 times magnification) + Эмулировать ж/к Ñкран (только Ñ 3-Ñ… кратным увеличением) + + + + <p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>. + <p>Имейте в виду, что Ð»ÑŽÐ±Ð°Ñ Ð¿Ñ€Ð¾Ð³Ñ€Ð°Ð¼Ð¼Ð° будет завершена, еÑли изменитÑÑ Ñ€Ð°Ð·Ð¼ÐµÑ€ или глубина Ñкрана. Параметр Гамма можно менÑÑ‚ÑŒ Ñвободно. + + + + Gamma + Гамма + + + + Blue + Синий + + + + + + + 1.0 + + + + + Green + Зеленый + + + + All + Ð’Ñе + + + + Red + КраÑный + + + + Set all to 1.0 + Ð’Ñ‹Ñтавить вÑе в 1.0 + + + + &OK + &Готово + + + + &Cancel + &Отмена + + + + DeviceSkin + + + The image file '%1' could not be loaded. + Ðе удалоÑÑŒ загрузить изображение '%1'. + + + + The skin directory '%1' does not contain a configuration file. + Каталог обложки '%1' не Ñодержит файла наÑтроек. + + + + The skin configuration file '%1' could not be opened. + Ðе удалоÑÑŒ открыть файл наÑтроек обложки '%1'. + + + + The skin configuration file '%1' could not be read: %2 + Ðе удалоÑÑŒ прочитать файл наÑтроек обложки '%1': %2 + + + + Syntax error: %1 + СинтакÑичеÑÐºÐ°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°: %1 + + + + The skin "up" image file '%1' does not exist. + Файл Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ "up" '%1' не ÑущеÑтвует. + + + + The skin "down" image file '%1' does not exist. + Файл Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ "down" '%1' не ÑущеÑтвует. + + + + The skin "closed" image file '%1' does not exist. + Файл Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ "closed" '%1' не ÑущеÑтвует. + + + + The skin cursor image file '%1' does not exist. + Файл Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ ÐºÑƒÑ€Ñора '%1' не ÑущеÑтвует. + + + + Syntax error in area definition: %1 + СинтакÑичеÑÐºÐ°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ° в определении облаÑти: %1 + + + + Mismatch in number of areas, expected %1, got %2. + ÐеÑовпадение количеÑтва зон: ожидаетÑÑ %1, указано %2. + + + + QVFb + + + Browse... + Обзор... + + + + Load Custom Skin... + Загрузить обложку пользователÑ... + + + + All QVFB Skins (*.skin) + Ð’Ñе обложки QVFB (*.skin) + + + -- cgit v0.12 From 962bdf2eb305c5dd01fc03dbe0c17afb4a42c8aa Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:10 +0200 Subject: Add basic Russian translation for qtconfig Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- tools/qtconfig/translations/translations.pro | 1 + translations/qtconfig_ru.ts | 906 +++++++++++++++++++++++++++ 2 files changed, 907 insertions(+) create mode 100644 translations/qtconfig_ru.ts diff --git a/tools/qtconfig/translations/translations.pro b/tools/qtconfig/translations/translations.pro index fbbdb2bba2..1f9f572 100644 --- a/tools/qtconfig/translations/translations.pro +++ b/tools/qtconfig/translations/translations.pro @@ -8,6 +8,7 @@ HEADERS += ../colorbutton.h ../previewframe.h ../previewwidget.h ../mainw FORMS = ../mainwindowbase.ui ../paletteeditoradvancedbase.ui ../previewwidgetbase.ui TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/qtconfig_pl.ts \ + $$[QT_INSTALL_TRANSLATIONS]/qtconfig_ru.ts \ $$[QT_INSTALL_TRANSLATIONS]/qtconfig_untranslated.ts \ $$[QT_INSTALL_TRANSLATIONS]/qtconfig_zh_CN.ts \ $$[QT_INSTALL_TRANSLATIONS]/qtconfig_zh_TW.ts diff --git a/translations/qtconfig_ru.ts b/translations/qtconfig_ru.ts new file mode 100644 index 0000000..b1965f2 --- /dev/null +++ b/translations/qtconfig_ru.ts @@ -0,0 +1,906 @@ + + + + + MainWindow + + + Desktop Settings (Default) + ÐаÑтройки рабочего Ñтола (по умолчанию) + + + + Choose style and palette based on your desktop settings. + Выбор ÑÑ‚Ð¸Ð»Ñ Ð¸ палитры на оÑнове наÑтроек рабочего Ñтола. + + + + On The Spot + + + + + + + + Auto (default) + ÐвтоматичеÑки (по умолчанию) + + + + Choose audio output automatically. + ÐвтоматичеÑкий выбор звукового выхода. + + + + + aRts + aRts + + + + Experimental aRts support for GStreamer. + ЭкÑÐ¿ÐµÑ€Ð¸Ð¼ÐµÐ½Ñ‚Ð°Ð»ÑŒÐ½Ð°Ñ Ð¿Ð¾Ð´Ð´ÐµÑ€Ð¶ÐºÐ° aRts в GStreamer. + + + + Phonon GStreamer backend not available. + Модуль Phonon поддержки GStreamer не доÑтупен. + + + + Choose render method automatically + ÐвтоматичеÑкий выбор метода отриÑовки + + + + + X11 + + + + + Use X11 Overlays + ИÑпользовать оверлеи X11 + + + + + OpenGL + + + + + Use OpenGL if avaiable + ИÑпользовать OpenGL, еÑли доÑтупен + + + + + Software + Программный + + + + Use simple software rendering + ИÑпользовать проÑтую программную отриÑовку + + + + No changes to be saved. + Ðет изменений Ð´Ð»Ñ ÑохранениÑ. + + + + Saving changes... + Сохранение изменений... + + + + Over The Spot + + + + + Off The Spot + + + + + Root + + + + + Select a Directory + Выбор каталога + + + + <h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.<br/> + + + + + + + Qt Configuration + ÐšÐ¾Ð½Ñ„Ð¸Ð³ÑƒÑ€Ð°Ñ†Ð¸Ñ Qt + + + + Save Changes + Сохранение изменений + + + + Save changes to settings? + Сохранить Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð½Ð°Ñтроек? + + + + &Yes + &Да + + + + &No + &Ðет + + + + &Cancel + &Отмена + + + + MainWindowBase + + + Qt Configuration + ÐšÐ¾Ð½Ñ„Ð¸Ð³ÑƒÑ€Ð°Ñ†Ð¸Ñ Qt + + + + Appearance + Внешний вид + + + + GUI Style + Стиль пользовательÑкого графичеÑкого интерфейÑа + + + + Select GUI &Style: + &Стиль интерфейÑа: + + + + Build Palette + Палитра + + + + &3-D Effects: + Эффекты &3-D: + + + + Window Back&ground: + &Фон окна: + + + + &Tune Palette... + &ÐаÑтроить палитру... + + + + Please use the KDE Control Center to set the palette. + ИÑпользуйте Центр ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ KDE Ð´Ð»Ñ Ð½Ð°Ñтройки цветов. + + + + Preview + ПредпроÑмотр + + + + Select &Palette: + Выбор &палитры: + + + + Active Palette + Палитра активных Ñлементов + + + + Inactive Palette + Палитра неактивных Ñлементов + + + + Disabled Palette + Палитра выключенных Ñлементов + + + + Fonts + Шрифты + + + + Default Font + Шрифт по умолчанию + + + + &Style: + &Стиль: + + + + &Point Size: + &Размер в точках: + + + + F&amily: + Семе&йÑтво: + + + + Sample Text + ТекÑÑ‚ Ð´Ð»Ñ Ð¿Ñ€Ð¸Ð¼ÐµÑ€Ð° (Sample Text) + + + + Font Substitution + ПодÑтановка шрифтов + + + + S&elect or Enter a Family: + &Выберите или введите ÑемейÑтво: + + + + Current Substitutions: + Текущие замены: + + + + + Up + Выше + + + + + Down + Ðиже + + + + + Remove + Удалить + + + + Select s&ubstitute Family: + Выберите п&одÑтавлÑемое ÑемейÑтво: + + + + + Add + Добавить + + + + Interface + Ð˜Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ + + + + Feel Settings + ÐаÑтройка ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»Ñ + + + + + ms + Ð¼Ñ + + + + &Double Click Interval: + &Интервал двойного щелчка: + + + + No blinking + Без Ð¼Ð¸Ð³Ð°Ð½Ð¸Ñ + + + + &Cursor Flash Time: + &Период Ð¼Ð¸Ð³Ð°Ð½Ð¸Ñ ÐºÑƒÑ€Ñора: + + + + lines + Ñтрок + + + + Wheel &Scroll Lines: + &Прокручивать Ñтрок при повороте колёÑика: + + + + Resolve symlinks in URLs + Разрешать Ñимвольные ÑÑылки в URL-ах + + + + GUI Effects + Эффекты пользовательÑкого интерфейÑа + + + + &Enable + &Включить + + + + Alt+E + Alt+D + + + + &Menu Effect: + Эффект &меню: + + + + C&omboBox Effect: + Эффект C&omboBox: + + + + &ToolTip Effect: + Эффект &ToolTip: + + + + Tool&Box Effect: + Эффект Tool&Box: + + + + + + + Disable + Выключен + + + + + + + Animate + ÐÐ½Ð¸Ð¼Ð°Ñ†Ð¸Ñ + + + + + Fade + Затухание + + + + Global Strut + Специальные возможноÑти + + + + Minimum &Width: + ÐœÐ¸Ð½Ð¸Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ &ширина: + + + + Minimum Hei&ght: + ÐœÐ¸Ð½Ð¸Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ Ð²&Ñ‹Ñота: + + + + + pixels + пикÑелей + + + + Enhanced support for languages written right-to-left + РаÑÑˆÐ¸Ñ€ÐµÐ½Ð½Ð°Ñ Ð¿Ð¾Ð´Ð´ÐµÑ€Ð¶ÐºÐ° пиÑьма Ñправа налево + + + + XIM Input Style: + Стиль ввода XIM: + + + + On The Spot + + + + + Over The Spot + + + + + Off The Spot + + + + + Root + + + + + Default Input Method: + Метод ввода по умолчанию: + + + + Printer + Принтер + + + + Enable Font embedding + Разрешить вÑтраивание шрифтов + + + + Font Paths + Пути к шрифтам + + + + Browse... + Обзор... + + + + Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list. + Ðажмите кнопку <b>Обзор...</b> или укажите каталог и нажмите Ввод Ð´Ð»Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ ÐµÐ³Ð¾ в ÑпиÑок. + + + + Phonon + Phonon + + + + About Phonon + О Phonon + + + + + Current Version: + Ð¢ÐµÐºÑƒÑ‰Ð°Ñ Ð²ÐµÑ€ÑиÑ: + + + + + Not available + ÐедоÑтупно + + + + + Website: + Ð’Ñб-Ñайт: + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org</span></a></p></body></html> + + + + + About GStreamer + О GStreamer + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html> + + + + + GStreamer backend settings + ÐаÑтройки Ð¼Ð¾Ð´ÑƒÐ»Ñ GStreamer + + + + Preferred audio sink: + Предпочитаемое звуковое уÑтройÑтво: + + + + Preferred render method: + Предпочитаемый метод отриÑовки: + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Внимание: Изменение данных наÑтроек может повлечь невозможноÑÑ‚ÑŒ корректного запуÑка приложений.</span></p></body></html> + + + + &File + &Файл + + + + &Help + &Справка + + + + &Save + &Сохранить + + + + Save + Сохранить + + + + Ctrl+S + + + + + E&xit + Ð’&ыход + + + + Exit + Выход + + + + &About + &О программе + + + + About + О программе + + + + About &Qt + О &Qt + + + + About Qt + О Qt + + + + PaletteEditorAdvancedBase + + + Tune Palette + ÐаÑтройка палитры + + + + <b>Edit Palette</b><p>Change the palette of the current widget or form.</p><p>Use a generated palette or select colors for each color group and each color role.</p><p>The palette can be tested with different widget layouts in the preview section.</p> + <b>Изменение палитры</b><p>Изменение палитры текущего виджета или формы.</p><p>ИÑпользуйте Ñформированную палитру или выберите цвета Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð¹ группы цветов и каждой их роли.</p><p>Палитру можно проверить на виджетах в разных режимах Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð² разделе предпроÑмотра.</p> + + + + Select &Palette: + Выбор &палитры: + + + + Active Palette + Палитра активных Ñлементов + + + + Inactive Palette + Палитра неактивных Ñлементов + + + + Disabled Palette + Палитра выключенных Ñлементов + + + + Auto + ÐвтоматичеÑки + + + + Build inactive palette from active + Создать неактивную палитру из активной + + + + Build disabled palette from active + Создать выключенную палитру из активной + + + + Central color &roles + Роли &цветов + + + + Choose central color role + Выберите роль цвета + + + + <b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p> + <b>Выбор роли цвета.</b><p>ДоÑтупны Ñледующие роли: <ul><li>Window - оÑновной цвет фона.</li> <li>WindowText - оÑновной цвет текÑта.</li> <li>Base - иÑпользуетÑÑ Ð² качеÑтве фона длÑ, например, виджетов Ñ Ñ‚ÐµÐºÑтовыми полÑми, обычно, белый или другой Ñветлый цвет.</li> <li>Text - цвет текÑта иÑпользуемый ÑовмеÑтно Ñ Base. Обычно, он Ñовпадает Ñ WindowText, так как в Ñтом Ñлучае получаетÑÑ Ð¼Ð°ÐºÑимальный контраÑÑ‚ и Ñ Window, и Ñ Base.</li> <li>Button - оÑновной цвет фона кнопки, которой требуетÑÑ Ñ†Ð²ÐµÑ‚ отличный от Window, например, в Ñтиле Macintosh.</li> <li>ButtonText - цвет текÑта иÑпользуемый ÑовмеÑтно Ñ Button.</li> <li>Highlight - цвет Ð´Ð»Ñ Ð¾Ð±Ð¾Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð²Ñ‹Ð±Ñ€Ð°Ð½Ð½Ð¾Ð³Ð¾ или выделенного Ñлемента.</li> <li>HighlightedText - цвет текÑта контраÑтирующий Ñ Highlight.</li> <li>BrightText - цвет текÑта, который отличаетÑÑ Ð¾Ñ‚ WindowText и хорошо контраÑтирует Ñ Ñ‡ÐµÑ€Ð½Ñ‹Ð¼.</li></ul></p> + + + + Window + + + + + WindowText + + + + + Button + + + + + Base + + + + + Text + + + + + BrightText + + + + + ButtonText + + + + + Highlight + + + + + HighlightedText + + + + + &Select Color: + &Выбор цвета: + + + + + Choose a color + Выберите цвет + + + + Choose a color for the selected central color role. + Выберите цвет Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹ роли. + + + + 3-D shadow &effects + Эффекты Ñ‚&рехмерной тени + + + + Build &from button color + Получ&ить из цвета кнопки + + + + Generate shadings + Создание полутонов + + + + Check to let 3D-effect colors be calculated from button-color. + Включите, чтобы цвета Ñффекта трёхмерноÑти были получены из цвета кнопки. + + + + Choose 3D-effect color role + Выбор роли цвета дÑл Ñффекта трёхмерноÑти + + + + <b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul> + <b>Выбор роли цвета.</b><p>ДоÑтупны Ñледующие роли: <ul> <li>Light - Ñветлее цвета Button. </li> <li>Midlight - Ñреднее между Light и Button. </li> <li>Mid - Ñреднее между Button и Dark. </li> <li>Dark - темнее цвета Button. </li> <li>Shadow - очень темный цвет. </li> </ul> + + + + Light + + + + + Midlight + + + + + Mid + + + + + Dark + + + + + Shadow + + + + + Select Co&lor: + Выбор &цвета: + + + + Choose a color for the selected effect color role. + Выбор цвета Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹ роли. + + + + OK + ПринÑÑ‚ÑŒ + + + + Close dialog and apply all changes. + Закрыть окно Ñ Ð¿Ñ€Ð¸Ð¼ÐµÐ½ÐµÐ½Ð¸ÐµÐ¼ изменений. + + + + Cancel + Отмена + + + + Close dialog and discard all changes. + Закрыть окно Ñ Ð¾Ñ‚Ð¼ÐµÐ½Ð¾Ð¹ изменений. + + + + PreviewFrame + + + Desktop settings will only take effect after an application restart. + ÐаÑтройки рабочего Ñтола применÑÑ‚ÑÑ Ð¿Ð¾Ñле перезапуÑка приложениÑ. + + + + PreviewWidgetBase + + + Preview Window + Окно предпроÑмотра + + + + ButtonGroup + + + + + RadioButton1 + + + + + RadioButton2 + + + + + RadioButton3 + + + + + ButtonGroup2 + + + + + CheckBox1 + + + + + CheckBox2 + + + + + LineEdit + + + + + ComboBox + + + + + PushButton + + + + + <p> +<a href="http://qtsoftware.com">http://qtsoftware.com</a> +</p> +<p> +<a href="http://www.kde.org">http://www.kde.org</a> +</p> + + + + -- cgit v0.12 From 4a5340fbe4d6ca3df4573fe4147103fb8379cb55 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:11 +0200 Subject: Update Russian translation for Qt Help Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- translations/qt_help_ru.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translations/qt_help_ru.ts b/translations/qt_help_ru.ts index 16748fb..c2dc041 100644 --- a/translations/qt_help_ru.ts +++ b/translations/qt_help_ru.ts @@ -6,17 +6,17 @@ Search Results - Результаты поиÑка + Результат поиÑка Note: - Замечание: + Примечание: The search results may not be complete since the documentation is still being indexed! - Могли быть показаны не вÑе результаты, так как Ð´Ð¾ÐºÑƒÐ¼ÐµÐ½Ñ‚Ð°Ñ†Ð¸Ñ ÐµÑ‰Ñ‘ индекÑируетÑÑ! + Результат поиÑка может быть неполным, так как Ð´Ð¾ÐºÑƒÐ¼ÐµÐ½Ñ‚Ð°Ñ†Ð¸Ñ ÐµÑ‰Ñ‘ индекÑируетÑÑ! @@ -45,7 +45,7 @@ Cannot open collection file: %1 - Ðе удалоÑÑŒ открыть файл набора: %1 + Ðе удалоÑÑŒ открыть файл набора: %1 @@ -168,12 +168,12 @@ Insert custom filters... - Ð’Ñтавка индивидуальных фильтров... + Добавление индивидуальных фильтров... Insert help data for filter section (%1 of %2)... - Ð’Ñтавка данных Ñправки Ð´Ð»Ñ Ñекции фильтра (%1 из %2)... + Добавление данных Ñправки Ð´Ð»Ñ Ñ€Ð°Ð·Ð´ÐµÐ»Ð° фильтра (%1 из %2)... @@ -198,7 +198,7 @@ Insert files... - Ð’Ñтавка файлов... + Добавление файлов... @@ -228,22 +228,22 @@ Insert indices... - Ð’Ñтавка указателей... + Добавление указателей... Insert contents... - Ð’Ñтавка оглавлениÑ... + Добавление ÑодержаниÑ... Cannot insert contents! - Ðе удаётÑÑ Ð²Ñтавить оглавление! + Ðе удалоÑÑŒ добавить Ñодержание! Cannot register contents! - Ðе удаётÑÑ Ð·Ð°Ñ€ÐµÐ³Ð¸Ñтрировать оглавление! + Ðе удалоÑÑŒ зарегиÑтрировать Ñодержание! @@ -271,12 +271,12 @@ <B>without</B> the words: - <B>не Ñодержит</B> Ñлова: + <B>не Ñодержит</B> Ñлов: with <B>exact phrase</B>: - Ñодержит <B>фразу полноÑтью</B>: + Ñодержит <B>точную фразу</B>: @@ -286,7 +286,7 @@ with <B>at least one</B> of the words: - Ñодержит <B> минимум одно</B> из Ñлов: + Ñодержит <B>Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ одно</B> из Ñлов: @@ -294,7 +294,7 @@ 0 - 0 of 0 Hits - 0 - 0 из 0 ÑоответÑтвий + 0 - 0 из 0 Ñовпадений @@ -302,7 +302,7 @@ %1 - %2 of %3 Hits - %1 - %2 из %3 ÑоответÑтвий + %1 - %2 из %3 Ñовпадений @@ -315,12 +315,12 @@ Unknown token. - ÐеизвеÑтный токен. + ÐеизвеÑтный идентификатор. Unknown token. Expected "QtHelpProject"! - ÐеизвеÑтный токен. ОжидаетÑÑ "QtHelpProject"! + ÐеизвеÑтный идентификатор. ОжидаетÑÑ "QtHelpProject"! -- cgit v0.12 From 034e15917bb81b65de7828466dbc15b2e2a84b47 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:12 +0200 Subject: Update Russian translation for Qt Assistant Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- translations/assistant_ru.ts | 80 ++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/translations/assistant_ru.ts b/translations/assistant_ru.ts index 32aa739..ecec0f8 100644 --- a/translations/assistant_ru.ts +++ b/translations/assistant_ru.ts @@ -57,16 +57,16 @@ ÐÐ¾Ð²Ð°Ñ Ð¿Ð°Ð¿ÐºÐ° - + - - - + + + Bookmarks Закладки - + Delete Folder Удалить папку @@ -79,12 +79,12 @@ BookmarkManager - + Bookmarks Закладки - + Remove Удалить @@ -94,7 +94,7 @@ Удаление папки приведёт к удалению её Ñодержимого.<br>Желаете продолжить? - + New Folder ÐÐ¾Ð²Ð°Ñ Ð¿Ð°Ð¿ÐºÐ° @@ -103,7 +103,7 @@ BookmarkWidget - + Delete Folder Удалить папку @@ -138,7 +138,7 @@ Фильтр: - + Add Добавить @@ -161,7 +161,7 @@ Закрыть текущую Ñтраницу - + Print Document Печать документа @@ -226,24 +226,24 @@ FindWidget - + Previous - Предыдущее Ñовпадение + Предыдущее Next - Следующее Ñовпадение + Следующее Case Sensitive - РегиÑтрозавиÑимо + Учитывать региÑÑ‚Ñ€ Whole words - Слова полноÑтью + Слова целиком @@ -441,31 +441,31 @@ MainWindow - + Index - Ð˜Ð½Ð´ÐµÐºÑ + Указатель - - + + Contents Содержание - - + + Bookmarks Закладки - - - + + + Qt Assistant Qt Assistant - + Unfiltered Без фильтрации @@ -473,10 +473,10 @@ Looking for Qt Documentation... - ПоиÑк по документации Qt... + ПоиÑк документации по Qt... - + &File &Файл @@ -656,7 +656,7 @@ Добавить закладку... - + CTRL+D @@ -723,12 +723,12 @@ Could not find the associated content item. - Ðе удалоÑÑŒ найти Ñлемент, ÑвÑзанный Ñ Ñодержанием. + Ðе удалоÑÑŒ найти Ñлемент, ÑвÑзанный Ñ Ñодержанием. About %1 - О %1 + О %1 @@ -767,7 +767,7 @@ Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents. - Ðекоторые открытые в Qt Assistant документы ÑÑылаютÑÑ Ð½Ð° документацию, которую вы пытаетеÑÑŒ удалить. Удаление данной документации приведёт к закрытию таких документов. + Ðекоторые открытые в Qt Assistant документы ÑÑылаютÑÑ Ð½Ð° документацию, которую вы пытаетеÑÑŒ удалить. Её удаление приведёт к закрытию Ñтих документов. @@ -830,7 +830,7 @@ 1 - + 1 @@ -876,18 +876,12 @@ Restore to default - ВоÑÑтановить по умолчанию + Страница по умолчанию QObject - - - Bookmark - Закладка - - The specified collection file does not exist! Указанный файл набора отÑутÑтвует! @@ -1037,17 +1031,17 @@ Reason: Choose a topic for <b>%1</b>: - Выберите Ñтатью Ð´Ð»Ñ <b>%1</b>: + Выберите раздел Ð´Ð»Ñ <b>%1</b>: Choose Topic - Выбор Ñтатьи + Выбор раздела &Topics - &Статьи + &Разделы -- cgit v0.12 From 283b1ba1cf6cd34d07d9f2b2bb0d40223e172339 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Mon, 6 Jul 2009 19:29:12 +0200 Subject: Update Russian translation for Qt Assistant adp Merge-request: 803 Reviewed-by: Oswald Buddenhagen --- translations/assistant_adp_ru.ts | 289 ++++++++++++++++++++++++++++++++------- 1 file changed, 243 insertions(+), 46 deletions(-) diff --git a/translations/assistant_adp_ru.ts b/translations/assistant_adp_ru.ts index a587a91..c47798b 100644 --- a/translations/assistant_adp_ru.ts +++ b/translations/assistant_adp_ru.ts @@ -4,10 +4,12 @@ AssistantServer + Failed to bind to port %1 Ðе удалоÑÑŒ открыть порт %1 + Qt Assistant Qt Assistant @@ -15,22 +17,27 @@ FontPanel + &Family Се&мейÑтво + &Style &Стиль + Font Шрифт + &Writing system СиÑтема &пиÑьма + &Point size &Размер в пикÑелÑÑ… @@ -38,22 +45,27 @@ FontSettingsDialog + Application Приложение + Browser Обозреватель + Font settings for: ÐаÑтройки шрифта длÑ: + Use custom settings ИÑпользование индивидуальных наÑтроек + Font Settings ÐаÑтройки шрифта @@ -61,202 +73,261 @@ HelpDialog + &Index &Указатель + &Look For: &ИÑкать: + &New - &Создать + &ÐÐ¾Ð²Ð°Ñ + + &Search &ПоиÑк + <b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p> - <b>Ввод Ñлова.</b><p>Ð’ ÑпиÑок попадет то, что лучше ÑоответÑтвует введенной Ñтроке.</p> + <b>Указание ключевого Ñлова.</b><p>СпиÑок заполнÑетÑÑ Ñлементами, лучше ÑоответÑтвующими указанному ключевому Ñлову.</p> + <b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p> - <b>Ввод одного или более Ñлов Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка.</b><p>Сюда Ñледует ввеÑти одно или неÑколько Ñлов, которые требуетÑÑ Ð½Ð°Ð¹Ñ‚Ð¸. Слова могут Ñодержкать Ñимволы-заменители (*). ЕÑли требуетÑÑ Ð½Ð°Ð¹Ñ‚Ð¸ ÑловоÑочетание, то его нужно заключить в кавычки.</p> + <b>Указание Ñлов Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка.</b><p>Введите одно или неÑколько Ñлов, по которым требуетÑÑ Ð¾ÑущеÑтвить поиÑк. Слова могут Ñодержкать Ñимволы-заменители (*). ЕÑли требуетÑÑ Ð½Ð°Ð¹Ñ‚Ð¸ Ñочетание Ñлов, заключите иÑкомую фразу в кавычки.</p> + <b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p> - <b>Ðайденные документы</b><p>Ð’ Ñтом ÑпиÑке предÑтавлены вÑе найденные при поÑледнем поиÑке документы. Документы упорÑдочены по релевантноÑти, Ñ‚.е. чем выше, тем чаще в нём вÑтречаютÑÑ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ñ‹Ðµ Ñлова.</p> + <b>Ðайденные документы</b><p>Ð’ данном ÑпиÑке предÑтавлены вÑе найденные при поÑледнем поиÑке документы. Документы упорÑдочены по релевантноÑти, Ñ‚.е. чем выше в ÑпиÑке, тем чаще в нём вÑтречаютÑÑ Ð¸Ñкомые Ñлова.</p> + <b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p> - <b>Статьи Ñправки раÑпределённые по разделам.</b><p>Дважды кликните по одному из пунктов, чтобы увидеть какие Ñтатьи ÑодержатÑÑ Ð² данном разделе. Ð”Ð»Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ñтатьи проÑто дважды щелкните на ней.</p> + <b>Разделы Ñправки, раÑпределённые по категориÑм.</b><p>Дважды щёлкните по одному из пунктов Ð´Ð»Ñ Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñ€Ð°Ð·Ð´ÐµÐ»Ð¾Ð² в данной категории. Ð”Ð»Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ñ€Ð°Ð·Ð´ÐµÐ»Ð° дважды щёлкните по нему.</p> + <b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p> - <b>Справка</b><p>Выберите необходимую Ñтатью Ñправки из ÑпиÑка разделов или воÑпользуйтеÑÑŒ поиÑком по предметному указателю.</p> + <b>Справка</b><p>Выберите раздел Ñправки из ÑÐ¾Ð´ÐµÑ€Ð¶Ð°Ð½Ð¸Ñ Ð¸Ð»Ð¸ воÑпользуйтеÑÑŒ поиÑком по предметному указателю.</p> + <b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p> - <b>СпиÑок доÑтупных Ñтатей Ñправки.</b><p>Дважды щёлкните на пункте Ð´Ð»Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ñтраницы помощи. ЕÑли найдено более одной, то потребуетÑÑ Ð²Ñ‹Ð±Ñ€Ð°Ñ‚ÑŒ желаемую Ñтраницу.</p> + <b>СпиÑок доÑтупных разделов Ñправки.</b><p>Дважды щёлкните по одному из пунктов Ð´Ð»Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ñтраницы Ñправки. ЕÑли найдено более одной Ñтраницы, выберите желаемую.</p> + Add new bookmark - Добавить новую закладку + Добавить закладку + Add the currently displayed page as a new bookmark. - Добавление текущей открытой Ñтраницы в закладки. + Добавить отображаемую Ñтраницу в закладки. + Cannot open the index file %1 Ðе удаётÑÑ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚ÑŒ файл индекÑа %1 + Con&tents Содер&жание + Delete bookmark Удалить закладку + Delete the selected bookmark. - Удаление выбранной закладки. + Удалить выбранную закладку. + Display the help page for the full text search. - Открытие Ñправки по полнотекÑтовому поиÑку. + Показать Ñправку по полнотекÑтовому поиÑку. + Display the help page. - Открыть Ñтраницу Ñправки. + Показать Ñтраницу Ñправки. + Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search. - ЗдеÑÑŒ отображаетÑÑ ÑпиÑок тем, раÑпределенных по разделам, указатель или закладки. ПоÑледнÑÑ Ð²ÐºÐ»Ð°Ð´ÐºÐ° Ñодержит полнотекÑтовый поиÑк. + Отображает ÑпиÑок разделов, раÑпредёленных по категориÑм, указатель или закладки. ПоÑледнÑÑ Ð²ÐºÐ»Ð°Ð´ÐºÐ° Ñодержит панель полнотекÑтового поиÑка. + Displays the list of bookmarks. Отображает ÑпиÑок закладок. + + Documentation file %1 does not exist! Skipping file. Файл документации %1 не ÑущеÑтвует! Пропущен. + Documentation file %1 is not compatible! Skipping file. - Файл документации %1 не ÑовмеÑтим! + ÐеÑовмеÑтимый файл документации %1! Пропущен. + + Done Готово + Enter keyword Введите ключевое Ñлово + Enter searchword(s). - Введите одно или более Ñлов Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка. + Введите одно или неÑколько Ñлов Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка. + Failed to load keyword index file Assistant will not work! Ðе удалоÑÑŒ загрузить файл индекÑа ключевых Ñлов -Assistant не будет работать! +Qt Assistant не будет работать! + Failed to save fulltext search index Assistant will not work! Ðе удалоÑÑŒ Ñохранить Ð¸Ð½Ð´ÐµÐºÑ Ð¿Ð¾Ð»Ð½Ð¾Ñ‚ÐµÐºÑтового поиÑка -Assistant не будет работать! +Qt Assistant не будет работать! + Found &Documents: Ðайденные &документы: + + Full Text Search ПолнотекÑтовый поиÑк + He&lp &Справка + Help Справка + Indexing files... ИндекÑирование файлов... + Open Link in New Tab Открыть ÑÑылку в новой вкладке + Open Link in New Window Открыть ÑÑылку в новом окне + + Parse Error Ошибка обработки + + Prepare... Подготовка... + Preparing... Подготовка... + Pressing this button starts the search. Ðажатие на Ñту кнопку запуÑтит процеÑÑ Ð¿Ð¾Ð¸Ñка. + + + Qt Assistant Qt Assistant + Reading dictionary... Чтение каталога... + Searching f&or: &ИÑкать: + Start searching. Ðачать поиÑк. + The closing quotation mark is missing. Пропущена Ð·Ð°ÐºÑ€Ñ‹Ð²Ð°ÑŽÑ‰Ð°Ñ ÐºÐ°Ð²Ñ‹Ñ‡ÐºÐ°. + Using a wildcard within phrases is not allowed. - ИÑпользование Ñимволов-заменителей внутри фраз не допуÑтимо. + ИÑпользование Ñимволов-заменителей внутри фраз недопуÑтимо. + + + Warning Предупреждение + + column 1 Ñтолбец 1 + Open Link in Current Tab Открыть ÑÑылку в текущей вкладке + %n document(s) found. Ðайден %n документ. @@ -265,10 +336,12 @@ Assistant не будет работать! + &Bookmarks &Закладки + &Delete &Удалить @@ -276,38 +349,47 @@ Assistant не будет работать! HelpWindow + <div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div> <div align="center"><h1>Страница не найдена</h1><br><h3>'%1'</h3></div> + Copy &Link Location Копировать &Ð°Ð´Ñ€ÐµÑ ÑÑылки + Error... Ошибка... + Failed to open link: '%1' Ðе удалоÑÑŒ открыть ÑÑылку: '%1' + Help Справка + OK Закрыть + Open Link in New Tab Открыть ÑÑылку в новой вкладке + Open Link in New Window Shift+LMB Открыть ÑÑылку в новом окне Shift+LMB + Unable to launch web browser. Ðевозможно запуÑтить вÑб-браузер. @@ -317,6 +399,7 @@ Assistant не будет работать! Index + Untitled Ðеозаглавлено @@ -324,354 +407,445 @@ Assistant не будет работать! MainWindow + + "What's This?" context sensitive help. - "Что Ñто?" - контекÑÑ‚Ð½Ð°Ñ Ñправка. + КонтекÑÑ‚Ð½Ð°Ñ Ñправка "Что Ñто?". + &Add Bookmark - &Добавление закладки + &Добавить закладку + &Close &Закрыть + &Copy &Копировать + &Edit &Правка + &File &Файл + &Find in Text... П&оиÑк по текÑту... + &Go &Перейти + &Help &Справка + &Home &Домой + &Next - &Вперёд + Сл&едующий + &Previous - &Ðазад + &Предыдущий + &Print... &Печать... + &View &Вид + &Window &Окно + ... ... + About Qt О Qt + About Qt Assistant О Qt Assistant + Add Tab Добавить вкладку + Add the currently displayed page as a new bookmark. - Добавление текущей открытой Ñтраницы в закладки. + Добавить отображаемую Ñтраницу в закладки. + Boo&kmarks &Закладки + Cannot open file for writing! - Ðе удаетÑÑ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚ÑŒ файл Ð´Ð»Ñ Ð·Ð°Ð¿Ð¸Ñи! + Ðе удалоÑÑŒ открыть файл Ð´Ð»Ñ Ð·Ð°Ð¿Ð¸Ñи! + Close Tab Закрыть вкладку + Close the current window. Закрыть текущее окно. + Display further information about Qt Assistant. Показать дополнительную информацию о Qt Assistant. + Displays the main page of a specific documentation set. - Открывает главную Ñтраницу выбранного набора документации. + Открывает Ñтартовую Ñтраницу выбранного набора документации. + E&xit - Ð’Ñ‹&ход + Ð’&ыход + Failed to open about application contents in file: '%1' Ðе удалоÑÑŒ получить информацию о приложении из файла: '%1' + Find &Next - Продолжить п&оиÑк + Ðайти &Ñледующее + Find &Previous Ðайти &предыдущее + Font Settings... ÐаÑтройки шрифта... + Go Перейти + Go to the home page. Qt Assistant's home page is the Qt Reference Documentation. Перейти на домашнюю Ñтраницу. Ð”Ð¾Ð¼Ð°ÑˆÐ½Ð°Ñ Ñтраница Qt Assistant - Ð¡Ð¿Ñ€Ð°Ð²Ð¾Ñ‡Ð½Ð°Ñ Ð´Ð¾ÐºÑƒÐ¼ÐµÐ½Ñ‚Ð°Ñ†Ð¸Ñ Ð¿Ð¾ Qt. + Go to the next page. Переход на Ñледующую Ñтраницу. + Initializing Qt Assistant... Ð˜Ð½Ð¸Ñ†Ð¸Ð°Ð»Ð¸Ð·Ð°Ñ†Ð¸Ñ Qt Assistant... + Minimize Свернуть + New Window Ðовое окно + Next Tab Ð¡Ð»ÐµÐ´ÑƒÑŽÑ‰Ð°Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ° + Open a new window. Открыть новое окно. + Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter. - Открыть окно поиÑка. Qt Assistant произведёт поиÑк введённого текÑта на текущей открытой Ñтранице. + Открыть окно поиÑка. Qt Assistant произведёт поиÑк введённого текÑта на отображаемой Ñтранице. + Previous Tab ÐŸÑ€ÐµÐ´Ñ‹Ð´ÑƒÑ‰Ð°Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ° + Print the currently displayed page. - Печать текущей открытой Ñтраницы. + Печатать отображаемую Ñтраницу. + + Qt Assistant Qt Assistant + Qt Assistant Manual РуководÑтво по Qt Assistant + Qt Assistant by Nokia Qt Assistant от Nokia + Quit Qt Assistant. Выйти из Qt Assistant. + + Save Page Сохранить Ñтраницу + Save Page As... Сохранить Ñтраницу как... + Select the page in contents tab. - Выбор Ñтраницы в оглавлении. + Выбрать Ñтраницу во вкладке ÑодержаниÑ. + Sidebar Ð‘Ð¾ÐºÐ¾Ð²Ð°Ñ Ð¿Ð°Ð½ÐµÐ»ÑŒ + Sync with Table of Contents - Синхронизировать Ñ Ð¾Ð³Ð»Ð°Ð²Ð»ÐµÐ½Ð¸ÐµÐ¼ + Синхронизировать Ñ Ñодержанием + Toolbar Панель инÑтрументов + Views Виды + What's This? Что Ñто? + Zoom &in У&величить + Zoom &out У&меньшить + Zoom in on the document, i.e. increase the font size. - Увеличение маÑштаба документа, Ñ‚.е. увеличение размера шрифта. + Увеличить размер шрифта. + Zoom out on the document, i.e. decrease the font size. - Уменьшение маÑштаба документа, Ñ‚.е. уменьшение размера шрифта. + Уменьшить размер шрифта. + Ctrl+M + SHIFT+CTRL+= + Ctrl+T + Ctrl+I + Ctrl+B + Ctrl+S + Ctrl+] + Ctrl+[ + Ctrl+P + Ctrl+Q + Copy the selected text to the clipboard. Скопировать выделенный текÑÑ‚ в буфер обмена. + Ctrl+C + Ctrl+F + F3 + Shift+F3 + Ctrl+Home + Go to the previous page. Переход на предыдущую Ñтраницу. + Alt+Left + Alt+Right + Ctrl++ + Ctrl+- + Ctrl+N + Ctrl+W + Shift+F1 + Ctrl+Alt+N + Ctrl+Alt+Right + Ctrl+Alt+Left + Ctrl+Alt+Q + F1 + Ctrl+Alt+S @@ -679,6 +853,7 @@ Assistant не будет работать! QObject + Qt Assistant by Nokia Qt Assistant от Nokia @@ -686,54 +861,67 @@ Assistant не будет работать! TabbedBrowser + ... ... + <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped <img src=":/trolltech/assistant/images/wrap.png">&nbsp;ПоиÑк Ñ Ð½Ð°Ñ‡Ð°Ð»Ð° + Add page - Добавить Ñтраницу + Добавить вкладку + Case Sensitive - РегиÑтрозавиÑимо + Учитывать региÑÑ‚Ñ€ + Close Other Tabs Закрыть оÑтальные вкладки + Close Tab Закрыть вкладку + Close page - Закрыть Ñтраницу + Закрыть вкладку + New Tab ÐÐ¾Ð²Ð°Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ° + Next - Следующий + Следующее + Previous - Предыдущий + Предыдущее + Untitled БезымÑнный + Whole words - Слова полноÑтью + Слова целиком + TabbedBrowser @@ -741,40 +929,49 @@ Assistant не будет работать! TopicChooser + &Close &Закрыть + &Display &Показать + &Topics - &Статьи + &Разделы + Choose Topic - Выбор Ñтатьи + Выбор раздела + Choose a topic for <b>%1</b> - Выберите Ñтатью Ð´Ð»Ñ <b>%1</b> + Выберите раздел Ð´Ð»Ñ <b>%1</b> + Close the Dialog. - Закрытие окна. + Закрыть диалог. + Displays a list of available help topics for the keyword. - Показывает ÑпиÑок доÑтупных Ñтатей Ñправки, ÑоответÑтвующих ключевому Ñлову. + Показывает ÑпиÑок доÑтупных разделов Ñправки, найденных по ключевому Ñлову. + Open the topic selected in the list. - Открытие выбранной в ÑпиÑке темы. + Открыть выбранный раздел. + Select a topic from the list and click the <b>Display</b>-button to open the online help. - Выберите Ñтатью из ÑпиÑка и нажмите на кнопку <b>Показать</b> Ð´Ð»Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ð¾Ð½Ð»Ð°Ð¹Ð½ Ñправки. + Выберите раздел из ÑпиÑка и нажмите на кнопку <b>Показать</b> Ð´Ð»Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ð¾Ð½Ð»Ð°Ð¹Ð½ Ñправки. -- cgit v0.12 From 3814b2adf50b5724e3375ea2048d13960c8aed82 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Tue, 7 Jul 2009 14:44:52 +1000 Subject: Handle all PostgreSQL notifications sitting in the queue Task-number: 257247 Reviewed-by: trustme --- src/sql/drivers/psql/qsql_psql.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 770df4c..69697da 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1248,15 +1248,15 @@ QStringList QPSQLDriver::subscribedToNotificationsImplementation() const void QPSQLDriver::_q_handleNotification(int) { PQconsumeInput(d->connection); - PGnotify *notify = PQnotifies(d->connection); - if (notify) { - QString name(QLatin1String(notify->relname)); + PGnotify *notify = 0; + while((notify = PQnotifies(d->connection)) != 0) { + QString name(QLatin1String(notify->relname)); if (d->seid.contains(name)) emit notification(name); else qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.", - qPrintable(name)); + qPrintable(name)); qPQfreemem(notify); } -- cgit v0.12 From 4e31ccad1cfb9df0d624d5c39d7906a75b4fc2d0 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 10:01:21 +0200 Subject: QFontComboBox: used to emit currentFontChanged twice when setting it. Setting the current font would change the current font and then it would try to select the right model index and get the font only from the text of the combobox. This was resetting the point size of the font, resulting in emitting the signal a second time. In the case of the user, it was also causing signals to be called in a loop. Task-number: 229731 --- src/gui/widgets/qfontcombobox.cpp | 2 +- tests/auto/qfontcombobox/tst_qfontcombobox.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp index 9660399..f87ccd3 100644 --- a/src/gui/widgets/qfontcombobox.cpp +++ b/src/gui/widgets/qfontcombobox.cpp @@ -263,7 +263,7 @@ void QFontComboBoxPrivate::_q_currentChanged(const QString &text) { Q_Q(QFontComboBox); QFont newFont(text); - if (currentFont != newFont) { + if (currentFont.family() != newFont.family()) { currentFont = newFont; emit q->currentFontChanged(currentFont); } diff --git a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp index 62bfdf7..e2515ae 100644 --- a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp @@ -122,7 +122,10 @@ void tst_QFontComboBox::currentFont_data() { QTest::addColumn("currentFont"); // Normalize the names - QTest::newRow("default") << QFont(QFontInfo(QFont()).family()); + QFont defaultFont; + QTest::newRow("default") << defaultFont; + defaultFont.setPointSize(defaultFont.pointSize() + 10); + QTest::newRow("default") << defaultFont; QFontDatabase db; QStringList list = db.families(); for (int i = 0; i < list.count(); ++i) { @@ -141,6 +144,7 @@ void tst_QFontComboBox::currentFont() QFont oldCurrentFont = box.currentFont(); box.setCurrentFont(currentFont); + QCOMPARE(box.currentFont(), currentFont); QString boxFontFamily = QFontInfo(box.currentFont()).family(); QRegExp foundry(" \\[.*\\]"); if (!currentFont.family().contains(foundry)) -- cgit v0.12 From 343e8b7e75c98a4fd1b692a230de8d1132988705 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 7 Jul 2009 10:05:02 +0200 Subject: Fix typo in color calculation. Argh! It's divide by 256 not 265. The worst part was that I used the same values in Cocoa as well, so they were both "damaged." It should be good now. Task-number: 257499 Reviewed-by: Prasanth Ullattil --- src/gui/kernel/qt_mac.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp index 27df5d1..0c3b707 100644 --- a/src/gui/kernel/qt_mac.cpp +++ b/src/gui/kernel/qt_mac.cpp @@ -134,7 +134,7 @@ QColor qcolorForThemeTextColor(ThemeTextColor themeColor) #ifdef Q_OS_MAC32 RGBColor c; GetThemeTextColor(themeColor, 32, true, &c); - QColor color = QColor(c.red / 265, c.green / 256, c.blue / 256); + QColor color = QColor(c.red / 256, c.green / 256, c.blue / 256); return color; #else // There is no equivalent to GetThemeTextColor in 64-bit and it was rather bad that @@ -156,13 +156,13 @@ QColor qcolorForThemeTextColor(ThemeTextColor themeColor) case kThemeTextColorAlertInactive: case kThemeTextColorDialogInactive: case kThemeTextColorPlacardInactive: - return QColor(67, 69, 69, 255); + return QColor(69, 69, 69, 255); case kThemeTextColorPopupButtonInactive: case kThemeTextColorPopupLabelInactive: case kThemeTextColorPushButtonInactive: case kThemeTextColorTabFrontInactive: case kThemeTextColorBevelButtonInactive: - return QColor(123, 127, 127, 255); + return QColor(127, 127, 127, 255); default: { QNativeImage nativeImage(16,16, QNativeImage::systemFormat()); CGRect cgrect = CGRectMake(0, 0, 16, 16); -- cgit v0.12 From 07ba75cb8031b844484901bef903fb055cc0b182 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 11:12:39 +0200 Subject: QToolBar: better management of positions when hiding/unhiding The toolbar that one would unhide could be packed at the right of the screen. This was because the last toolbar always has a size that fills the space. So if you unhide a toolbar situated after this one, it got "compressed". --- src/gui/widgets/qtoolbararealayout.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index 0c11700..b4a0ef0 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -156,21 +156,15 @@ void QToolBarAreaLayoutLine::fitLayout() if (item.skip()) continue; - QToolBarLayout *tblayout = qobject_cast(item.widgetItem->widget()->layout()); - if (tblayout) + if (QToolBarLayout *tblayout = qobject_cast(item.widgetItem->widget()->layout())) tblayout->checkUsePopupMenu(); - int itemMin = pick(o, item.minimumSize()); - int itemHint = pick(o, item.sizeHint()); - //we ensure the extraspace is not too low - item.size = qMax(item.size, itemHint); - if (item.preferredSize > 0) { - //preferredSize would be the default size - item.size = item.preferredSize; - } + const int itemMin = pick(o, item.minimumSize()); + //preferredSize is the default if it is set, otherwise, we take the sizehint + item.size = item.preferredSize > 0 ? item.preferredSize : pick(o, item.sizeHint()); //the extraspace is the space above the item minimum sizehint - int extraSpace = qMin(item.size - itemMin, extra); + const int extraSpace = qMin(item.size - itemMin, extra); item.size = itemMin + extraSpace; //that is the real size extra -= extraSpace; -- cgit v0.12 From a28dc778305cf67830f15119b29c5a77754a8c18 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 11:14:26 +0200 Subject: QMenu: with tearoff handle, it would reserve the space for it twice sizeHint is now fixed --- src/gui/widgets/qmenu.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index af9ddf5..35b68b4 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1355,8 +1355,7 @@ QMenu::~QMenu() if (d->eventLoop) d->eventLoop->exit(); - if (d->tornPopup) - d->tornPopup->close(); + hideTearOffMenu(); } /*! @@ -1567,8 +1566,8 @@ void QMenu::setTearOffEnabled(bool b) Q_D(QMenu); if (d->tearoff == b) return; - if (!b && d->tornPopup) - d->tornPopup->close(); + if (!b) + hideTearOffMenu(); d->tearoff = b; d->itemsDirty = true; @@ -1603,8 +1602,8 @@ bool QMenu::isTearOffMenuVisible() const */ void QMenu::hideTearOffMenu() { - if (d_func()->tornPopup) - d_func()->tornPopup->close(); + if (QWidget *w = d_func()->tornPopup) + w->close(); } @@ -1719,8 +1718,6 @@ QSize QMenu::sizeHint() const if (rect.right() >= s.width()) s.setWidth(rect.x() + rect.width()); } - if (d->tearoff) - s.rheight() += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, this); // Note that the action rects calculated above already include // the top and left margins, so we only need to add margins for // the bottom and right. -- cgit v0.12 From ac6fad8a677eb113839ff4ca79c8185e0aa8237b Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 7 Jul 2009 11:23:45 +0200 Subject: Added wildcard support for file lists in help projects. The qhelpgenerator auto test was also updated to test the new feature. Reviewed-by: kh --- tests/auto/qhelpgenerator/data/test.qhp | 7 +++---- tools/assistant/lib/qhelpprojectdata.cpp | 22 +++++++++++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tests/auto/qhelpgenerator/data/test.qhp b/tests/auto/qhelpgenerator/data/test.qhp index e9ac7f2..a97c00d 100644 --- a/tests/auto/qhelpgenerator/data/test.qhp +++ b/tests/auto/qhelpgenerator/data/test.qhp @@ -38,9 +38,8 @@ classic.css - test.html - people.html - ./sub/about.html + [pt]*.html + ./sub/abou?.html @@ -69,4 +68,4 @@ cars.html - \ No newline at end of file + diff --git a/tools/assistant/lib/qhelpprojectdata.cpp b/tools/assistant/lib/qhelpprojectdata.cpp index 8947a36..55b4ea7 100644 --- a/tools/assistant/lib/qhelpprojectdata.cpp +++ b/tools/assistant/lib/qhelpprojectdata.cpp @@ -41,6 +41,7 @@ #include "qhelpprojectdata_p.h" +#include #include #include #include @@ -73,6 +74,7 @@ private: void readKeywords(); void readFiles(); void raiseUnknownTokenError(); + void addMatchingFiles(const QString &pattern); }; void QHelpProjectDataPrivate::raiseUnknownTokenError() @@ -161,7 +163,7 @@ void QHelpProjectDataPrivate::readFilterSection() readNext(); if (isStartElement()) { if (name() == QLatin1String("filterAttribute")) - filterSectionList.last().addFilterAttribute(readElementText()); + filterSectionList.last().addFilterAttribute(readElementText()); else if (name() == QLatin1String("toc")) readTOC(); else if (name() == QLatin1String("keywords")) @@ -244,7 +246,7 @@ void QHelpProjectDataPrivate::readFiles() readNext(); if (isStartElement()) { if (name() == QLatin1String("file")) - filterSectionList.last().addFile(readElementText()); + addMatchingFiles(readElementText()); else raiseUnknownTokenError(); } else if (isEndElement()) { @@ -258,7 +260,21 @@ void QHelpProjectDataPrivate::readFiles() } } - +// Expand file pattern and add matches into list. If the pattern does not match +// any files, insert the pattern itself so the QHelpGenerator will emit a +// meaningful warning later. +void QHelpProjectDataPrivate::addMatchingFiles(const QString &pattern) +{ + QFileInfo fileInfo(rootPath + '/' + pattern); + const QStringList &matches = + fileInfo.dir().entryList(QStringList(fileInfo.fileName())); + for (QStringList::ConstIterator it = matches.constBegin(); + it != matches.constEnd(); + ++it) + filterSectionList.last().addFile(QFileInfo(pattern).dir().path() + '/' + *it); + if (matches.empty()) + filterSectionList.last().addFile(pattern); +} /*! \internal -- cgit v0.12 From 53b116be1bbadd416449d9a0104f514139f495c8 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 11:49:59 +0200 Subject: ItemViews: it would go into DraggingState even without clicking an item We now just make sure that we start the drag if there was a pressed index. Task-number: 252643 --- src/gui/itemviews/qabstractitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index b64bc71..cefe8a5 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1602,7 +1602,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) d->checkMouseMove(index); #ifndef QT_NO_DRAGANDDROP - if (index.isValid() + if (d->pressedIndex.isValid() && d->dragEnabled && (state() != DragSelectingState) && (event->buttons() != Qt::NoButton) -- cgit v0.12 From f70f321c8b5769476796e2bae540a57b3b62c684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 7 Jul 2009 11:39:43 +0200 Subject: Make sure we send a ValueChanged event if the spinbox value has changed Unfortunately the codepath for keyPressEvent does not call updateState, so we have to add the same line in two places. Note that updateState() is only called from mousePressEvent() and mouseMoveEvent(). Task-number: 254053 --- src/gui/widgets/qabstractspinbox.cpp | 9 +++++++++ tests/auto/qaccessibility/tst_qaccessibility.cpp | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 25acd6e..da18d13 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -57,6 +57,9 @@ #include #include #include +#ifndef QT_NO_ACCESSIBILITY +# include +#endif #if defined(Q_WS_X11) #include @@ -951,6 +954,9 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) d->buttonState = (Keyboard | (up ? Up : Down)); } stepBy(steps); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged); +#endif return; } #ifdef QT_KEYPAD_NAVIGATION @@ -1548,6 +1554,9 @@ void QAbstractSpinBoxPrivate::updateState(bool up) spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); buttonState = (up ? (Mouse | Up) : (Mouse | Down)); q->stepBy(up ? 1 : -1); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged); +#endif } } diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 8a88b59..b8aec50 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -2623,6 +2623,13 @@ void tst_QAccessibility::spinBoxTest() QVERIFY(childRect.isNull() == false); } + spinBox->setFocus(); + QTestAccessibility::clearEvents(); + QTest::keyPress(spinBox, Qt::Key_Up); + QTest::qWait(200); + EventList events = QTestAccessibility::events(); + QTestAccessibilityEvent expectedEvent(spinBox, 0, (int)QAccessible::ValueChanged); + QVERIFY(events.contains(expectedEvent)); delete spinBox; QTestAccessibility::clearEvents(); #else -- cgit v0.12 From 1e9d76013ef0121bcfc6efbe4328ded58c1eebd3 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 13:25:42 +0200 Subject: QMainWindow: layout private API cleanup using const references to pass parameter --- src/gui/widgets/qmainwindowlayout.cpp | 56 +++++++++++++++++------------------ src/gui/widgets/qmainwindowlayout_p.h | 14 ++++----- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 0318f53..1057f5f 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -426,42 +426,42 @@ QList QMainWindowLayoutState::gapIndex(QWidget *widget, return result; } -bool QMainWindowLayoutState::insertGap(QList path, QLayoutItem *item) +bool QMainWindowLayoutState::insertGap(const QList &path, QLayoutItem *item) { if (path.isEmpty()) return false; - int i = path.takeFirst(); + int i = path.first(); #ifndef QT_NO_TOOLBAR if (i == 0) { Q_ASSERT(qobject_cast(item->widget()) != 0); - return toolBarAreaLayout.insertGap(path, item); + return toolBarAreaLayout.insertGap(path.mid(1), item); } #endif #ifndef QT_NO_DOCKWIDGET if (i == 1) { Q_ASSERT(qobject_cast(item->widget()) != 0); - return dockAreaLayout.insertGap(path, item); + return dockAreaLayout.insertGap(path.mid(1), item); } #endif //QT_NO_DOCKWIDGET return false; } -void QMainWindowLayoutState::remove(QList path) +void QMainWindowLayoutState::remove(const QList &path) { - int i = path.takeFirst(); + int i = path.first(); #ifndef QT_NO_TOOLBAR if (i == 0) - toolBarAreaLayout.remove(path); + toolBarAreaLayout.remove(path.mid(1)); #endif #ifndef QT_NO_DOCKWIDGET if (i == 1) - dockAreaLayout.remove(path); + dockAreaLayout.remove(path.mid(1)); #endif //QT_NO_DOCKWIDGET } @@ -501,88 +501,88 @@ bool QMainWindowLayoutState::isValid() const return rect.isValid(); } -QLayoutItem *QMainWindowLayoutState::item(QList path) +QLayoutItem *QMainWindowLayoutState::item(const QList &path) { - int i = path.takeFirst(); + int i = path.first(); #ifndef QT_NO_TOOLBAR if (i == 0) - return toolBarAreaLayout.item(path).widgetItem; + return toolBarAreaLayout.item(path.mid(1)).widgetItem; #endif #ifndef QT_NO_DOCKWIDGET if (i == 1) - return dockAreaLayout.item(path).widgetItem; + return dockAreaLayout.item(path.mid(1)).widgetItem; #endif //QT_NO_DOCKWIDGET return 0; } -QRect QMainWindowLayoutState::itemRect(QList path) const +QRect QMainWindowLayoutState::itemRect(const QList &path) const { - int i = path.takeFirst(); + int i = path.first(); #ifndef QT_NO_TOOLBAR if (i == 0) - return toolBarAreaLayout.itemRect(path); + return toolBarAreaLayout.itemRect(path.mid(1)); #endif #ifndef QT_NO_DOCKWIDGET if (i == 1) - return dockAreaLayout.itemRect(path); + return dockAreaLayout.itemRect(path.mid(1)); #endif //QT_NO_DOCKWIDGET return QRect(); } -QRect QMainWindowLayoutState::gapRect(QList path) const +QRect QMainWindowLayoutState::gapRect(const QList &path) const { - int i = path.takeFirst(); + int i = path.first(); #ifndef QT_NO_TOOLBAR if (i == 0) - return toolBarAreaLayout.itemRect(path); + return toolBarAreaLayout.itemRect(path.mid(1)); #endif #ifndef QT_NO_DOCKWIDGET if (i == 1) - return dockAreaLayout.gapRect(path); + return dockAreaLayout.gapRect(path.mid(1)); #endif //QT_NO_DOCKWIDGET return QRect(); } -QLayoutItem *QMainWindowLayoutState::plug(QList path) +QLayoutItem *QMainWindowLayoutState::plug(const QList &path) { - int i = path.takeFirst(); + int i = path.first(); #ifndef QT_NO_TOOLBAR if (i == 0) - return toolBarAreaLayout.plug(path); + return toolBarAreaLayout.plug(path.mid(1)); #endif #ifndef QT_NO_DOCKWIDGET if (i == 1) - return dockAreaLayout.plug(path); + return dockAreaLayout.plug(path.mid(1)); #endif //QT_NO_DOCKWIDGET return 0; } -QLayoutItem *QMainWindowLayoutState::unplug(QList path, QMainWindowLayoutState *other) +QLayoutItem *QMainWindowLayoutState::unplug(const QList &path, QMainWindowLayoutState *other) { - int i = path.takeFirst(); + int i = path.first(); #ifdef QT_NO_TOOLBAR Q_UNUSED(other); #else if (i == 0) - return toolBarAreaLayout.unplug(path, other ? &other->toolBarAreaLayout : 0); + return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0); #endif #ifndef QT_NO_DOCKWIDGET if (i == 1) - return dockAreaLayout.unplug(path); + return dockAreaLayout.unplug(path.mid(1)); #endif //QT_NO_DOCKWIDGET return 0; diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index 5c5965a..759461b 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -129,9 +129,9 @@ public: QLayoutItem *itemAt(int index, int *x) const; QLayoutItem *takeAt(int index, int *x); QList indexOf(QWidget *widget) const; - QLayoutItem *item(QList path); - QRect itemRect(QList path) const; - QRect gapRect(QList path) const; // ### get rid of this, use itemRect() instead + QLayoutItem *item(const QList &path); + QRect itemRect(const QList &path) const; + QRect gapRect(const QList &path) const; // ### get rid of this, use itemRect() instead bool contains(QWidget *widget) const; @@ -139,14 +139,14 @@ public: QWidget *centralWidget() const; QList gapIndex(QWidget *widget, const QPoint &pos) const; - bool insertGap(QList path, QLayoutItem *item); - void remove(QList path); + bool insertGap(const QList &path, QLayoutItem *item); + void remove(const QList &path); void remove(QLayoutItem *item); void clear(); bool isValid() const; - QLayoutItem *plug(QList path); - QLayoutItem *unplug(QList path, QMainWindowLayoutState *savedState = 0); + QLayoutItem *plug(const QList &path); + QLayoutItem *unplug(const QList &path, QMainWindowLayoutState *savedState = 0); void saveState(QDataStream &stream) const; bool checkFormat(QDataStream &stream, bool pre43); -- cgit v0.12 From 5c756b368f5a76eeeff9e8e762a89368ba0b8149 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 7 Jul 2009 13:41:09 +0200 Subject: doc: Explained that you can't add new Q3DockAreas to a Widget. They won't be shown. Task-number: 166508 --- src/qt3support/widgets/q3dockarea.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/qt3support/widgets/q3dockarea.cpp b/src/qt3support/widgets/q3dockarea.cpp index a00bc81..a823caa 100644 --- a/src/qt3support/widgets/q3dockarea.cpp +++ b/src/qt3support/widgets/q3dockarea.cpp @@ -473,24 +473,25 @@ int Q3DockAreaLayout::widthForHeight(int h) const contain Q3ToolBars since Q3ToolBar is a Q3DockWindow subclass. QMainWindow contains four Q3DockAreas which you can use for your - Q3ToolBars and Q3DockWindows, so in most situations you do not need - to use the Q3DockArea class directly. Although QMainWindow contains - support for its own dock areas it isn't convenient for adding new - Q3DockAreas. If you need to create your own dock areas we suggest - that you create a subclass of QWidget and add your Q3DockAreas to - your subclass. + Q3ToolBars and Q3DockWindows, so in most situations you do not + need to use the Q3DockArea class directly. Although QMainWindow + contains support for its own dock areas, you can't add new ones. + You also can't add a Q3DockArea to your own subclass of QWidget. + It won't be shown. \img qmainwindow-qdockareas.png QMainWindow's Q3DockAreas \target lines - \e Lines. Q3DockArea uses the concept of lines. A line is a - horizontal region which may contain dock windows side-by-side. A - dock area may have room for more than one line. When dock windows - are docked into a dock area they are usually added at the right - hand side of the top-most line that has room (unless manually - placed by the user). When users move dock windows they may leave - empty lines or gaps in non-empty lines. Qt::Dock windows can be lined - up to minimize wasted space using the lineUp() function. + \section2 Lines. + + Q3DockArea uses the concept of lines. A line is a horizontal + region which may contain dock windows side-by-side. A dock area + may have room for more than one line. When dock windows are docked + into a dock area they are usually added at the right hand side of + the top-most line that has room (unless manually placed by the + user). When users move dock windows they may leave empty lines or + gaps in non-empty lines. Qt::Dock windows can be lined up to + minimize wasted space using the lineUp() function. The Q3DockArea class maintains a position list of all its child dock windows. Qt::Dock windows are added to a dock area from position -- cgit v0.12 From 20b2c6bd8e6f6a7ef384f4b478623768c11e01ae Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 7 Jul 2009 13:45:15 +0200 Subject: Document limitation in Cocoa cursor handling. It seems there is a bug in AppKit which will automatically reset a cursor even when it is grabbed, but won't reset it when it's brought back into the window. The upshot of this is that doing a setCursor() inside of mouse handling behaves slightly different than on the other platforms (including Carbon). However, we are at the mercy of Cocoa here and I would rather have all the other things AppKit does right and live with this bug which they may fix some day. --- src/gui/kernel/qwidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e6a5ae0..9d40b00 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4590,6 +4590,11 @@ void QWidget::unsetLayoutDirection() By default, this property contains a cursor with the Qt::ArrowCursor shape. + Some underlying window implementations will reset the cursor if it + leaves a widget even if the mouse is grabbed. If you want to have + a cursor set for all widgets, even when outside the window, consider + QApplication::setOverrideCursor(). + \sa QApplication::setOverrideCursor() */ -- cgit v0.12 From da1dee6894f96b416bb123578cc6e61c6444ddd8 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 7 Jul 2009 13:49:20 +0200 Subject: improve the QScriptEngine::importExtension() autotest Error messages and __postInit__. --- tests/auto/qscriptengine/script/com/__init__.js | 4 ++++ tests/auto/qscriptengine/script/com/trolltech/__init__.js | 4 ++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/tests/auto/qscriptengine/script/com/__init__.js b/tests/auto/qscriptengine/script/com/__init__.js index 381816a..7db3ee4 100644 --- a/tests/auto/qscriptengine/script/com/__init__.js +++ b/tests/auto/qscriptengine/script/com/__init__.js @@ -3,3 +3,7 @@ __setupPackage__("com"); com.wasDefinedAlready = wasDefinedAlready; com.name = __extension__; com.level = 1; + +com.postInitCallCount = 0; +com.originalPostInit = __postInit__; +__postInit__ = function() { ++com.postInitCallCount; }; diff --git a/tests/auto/qscriptengine/script/com/trolltech/__init__.js b/tests/auto/qscriptengine/script/com/trolltech/__init__.js index f12b17d..a55b132 100644 --- a/tests/auto/qscriptengine/script/com/trolltech/__init__.js +++ b/tests/auto/qscriptengine/script/com/trolltech/__init__.js @@ -3,3 +3,7 @@ __setupPackage__("com.trolltech"); com.trolltech.wasDefinedAlready = wasDefinedAlready; com.trolltech.name = __extension__; com.trolltech.level = com.level + 1; + +com.trolltech.postInitCallCount = 0; +com.trolltech.originalPostInit = __postInit__; +__postInit__ = function() { ++com.trolltech.postInitCallCount; }; diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index c17454d..57c5167 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1583,6 +1583,7 @@ void tst_QScriptEngine::importExtension() QScriptValue ret = eng.importExtension("this.extension.does.not.exist"); QCOMPARE(eng.hasUncaughtException(), true); QCOMPARE(ret.isError(), true); + QCOMPARE(ret.toString(), QString::fromLatin1("Error: Unable to import this.extension.does.not.exist: no such extension")); } { @@ -1601,6 +1602,8 @@ void tst_QScriptEngine::importExtension() .strictlyEquals(QScriptValue(&eng, "com")), true); QCOMPARE(com.property("level") .strictlyEquals(QScriptValue(&eng, 1)), true); + QVERIFY(com.property("originalPostInit").isUndefined()); + QVERIFY(com.property("postInitCallCount").strictlyEquals(1)); QScriptValue trolltech = com.property("trolltech"); QCOMPARE(trolltech.isObject(), true); @@ -1610,6 +1613,8 @@ void tst_QScriptEngine::importExtension() .strictlyEquals(QScriptValue(&eng, "com.trolltech")), true); QCOMPARE(trolltech.property("level") .strictlyEquals(QScriptValue(&eng, 2)), true); + QVERIFY(trolltech.property("originalPostInit").isUndefined()); + QVERIFY(trolltech.property("postInitCallCount").strictlyEquals(1)); } QStringList imp = eng.importedExtensions(); QCOMPARE(imp.size(), 2); @@ -1625,6 +1630,8 @@ void tst_QScriptEngine::importExtension() eng.globalObject().setProperty("__import__", eng.newFunction(__import__)); QScriptValue ret = eng.importExtension("com.trolltech.recursive"); QCOMPARE(eng.hasUncaughtException(), true); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("Error: recursive import of com.trolltech.recursive")); QStringList imp = eng.importedExtensions(); QCOMPARE(imp.size(), 2); QCOMPARE(imp.at(0), QString::fromLatin1("com")); -- cgit v0.12 From 9e2573bac15e39dc4f3545351ad87e221b4785e7 Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 7 Jul 2009 13:54:39 +0200 Subject: Updated docs to mention pattern matching in help project file lists. Reviewed-by: kh --- doc/src/examples/simpletextviewer.qdoc | 7 +------ doc/src/qthelp.qdoc | 14 ++++++++------ doc/src/snippets/code/doc_src_qthelp.qdoc | 6 ++---- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/doc/src/examples/simpletextviewer.qdoc b/doc/src/examples/simpletextviewer.qdoc index 87eae57..2531a86 100644 --- a/doc/src/examples/simpletextviewer.qdoc +++ b/doc/src/examples/simpletextviewer.qdoc @@ -198,12 +198,7 @@ openfile.html wildcardmatching.html images/browse.png - images/fadedfilemenu.png - images/filedialog.png - images/handbook.png - images/mainwindow.png - images/open.png - images/wildcard.png + images/*.png diff --git a/doc/src/qthelp.qdoc b/doc/src/qthelp.qdoc index b5395c9..92c9609 100644 --- a/doc/src/qthelp.qdoc +++ b/doc/src/qthelp.qdoc @@ -398,11 +398,13 @@ Finally, the actual documentation files have to be listed. Make sure that all files neccessary to display the help are mentioned, i.e. - stylesheets or similar files need to be there as well. The file, like all + stylesheets or similar files need to be there as well. The files, like all file references in a Qt help project, are relative to the help project file - itself. All listed files will be compressed and written to the Qt compressed - help file. So, in the end, one single Qt help file contains all - documentation files along with the contents and indices. \note The - referenced files must be inside the same directory (or within a subdirectory) - as the help project file. An absolute file path is not supported either. + itself. As the example shows, files (but not directories) can also be + specified as patterns using wildcards. All listed files will be compressed + and written to the Qt compressed help file. So, in the end, one single Qt + help file contains all documentation files along with the contents and + indices. \note The referenced files must be inside the same directory + (or within a subdirectory) as the help project file. An absolute file path + is not supported either. */ diff --git a/doc/src/snippets/code/doc_src_qthelp.qdoc b/doc/src/snippets/code/doc_src_qthelp.qdoc index 11d231f..949e2a5 100644 --- a/doc/src/snippets/code/doc_src_qthelp.qdoc +++ b/doc/src/snippets/code/doc_src_qthelp.qdoc @@ -92,8 +92,7 @@ if (links.count()) { classic.css - index.html - doc.html + *.html @@ -154,8 +153,7 @@ if (links.count()) { ... classic.css - index.html - doc.html + *.html ... //! [13] -- cgit v0.12 From 0044b3c968f5023f502e3574c96d4e4df0de865d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Jul 2009 14:18:12 +0200 Subject: Doc: Mentioned the use of the meta-type declaration macro and the function for registering types. Additional clean-up. Task-number: 221375 Reviewed-by: Trust Me --- src/network/socket/qlocalsocket.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index acacdf2..7809226 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -63,7 +63,8 @@ QT_BEGIN_NAMESPACE waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected() which blocks until the operation is complete or the timeout expires. - Note that this feature is not supported on Window 9x. + Note that this feature is not supported on versions of Windows earlier than + Windows XP. \sa QLocalServer */ @@ -102,7 +103,7 @@ QT_BEGIN_NAMESPACE opened in the mode specified by \a openMode, and enters the socket state specified by \a socketState. - Note: It is not possible to initialize two local sockets with the same + \note It is not possible to initialize two local sockets with the same native socket descriptor. \sa socketDescriptor(), state(), openMode() @@ -207,10 +208,10 @@ QT_BEGIN_NAMESPACE Returns true if the socket is valid and ready for use; otherwise returns false. - Note: The socket's state must be ConnectedState before reading + \note The socket's state must be ConnectedState before reading and writing can occur. - \sa state() + \sa state(), connectToServer() */ /*! @@ -243,9 +244,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QLocalSocket::waitForConnected(int msec) + \fn bool QLocalSocket::waitForConnected(int msecs) - Waits until the socket is connected, up to \a msec milliseconds. If the + Waits until the socket is connected, up to \a msecs milliseconds. If the connection has been established, this function returns true; otherwise it returns false. In the case where it returns false, you can call error() to determine the cause of the error. @@ -255,7 +256,7 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/code/src_network_socket_qlocalsocket_unix.cpp 0 - If msecs is -1, this function will not time out. + If \a msecs is -1, this function will not time out. \sa connectToServer(), connected() */ @@ -274,7 +275,7 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/code/src_network_socket_qlocalsocket_unix.cpp 1 - If msecs is -1, this function will not time out. + If \a msecs is -1, this function will not time out. \sa disconnectFromServer(), close() */ @@ -309,9 +310,10 @@ QT_BEGIN_NAMESPACE parameter describes the type of error that occurred. QLocalSocket::LocalSocketError is not a registered metatype, so for queued - connections, you will have to register it with Q_DECLARE_METATYPE. + connections, you will have to register it with Q_DECLARE_METATYPE() and + qRegisterMetaType(). - \sa error(), errorString() + \sa error(), errorString(), {Creating Custom Qt Types} */ /*! @@ -321,9 +323,10 @@ QT_BEGIN_NAMESPACE The \a socketState parameter is the new state. QLocalSocket::SocketState is not a registered metatype, so for queued - connections, you will have to register it with Q_DECLARE_METATYPE. + connections, you will have to register it with Q_DECLARE_METATYPE() and + qRegisterMetaType(). - \sa state() + \sa state(), {Creating Custom Qt Types} */ /*! @@ -365,7 +368,7 @@ QString QLocalSocket::serverName() const /*! Returns the server path that the socket is connected to. - Note: This is platform specific + \note The return value of this function is platform specific. \sa connectToServer(), serverName() */ -- cgit v0.12 From 2a834d39a69430058df3916392afab064ca941ee Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 7 Jul 2009 13:48:03 +0200 Subject: try to fix the accept4 not being found in some older kernels --- src/corelib/kernel/qcore_unix.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 2549f77..b04abae 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -138,22 +138,32 @@ static inline int syscall(...) { errno = ENOSYS; return -1;} # define __NR_dup3 330 # define __NR_pipe2 331 # elif defined(__x86_64__) -# define __NR_accept4 288 # define __NR_dup3 292 # define __NR_pipe2 293 # elif defined(__ia64__) -# define __NR_accept4 -1 # define __NR_dup3 1316 # define __NR_pipe2 1317 # else // set the syscalls to absurd numbers so that they'll cause ENOSYS errors -# warning "Please port the pipe2/dup3/accept4 code to this platform" -# define __NR_accept4 -1 +# warning "Please port the pipe2/dup3 code to this platform" # define __NR_dup3 -1 # define __NR_pipe2 -1 # endif # endif +# if !defined(__NR_socketcall) && !defined(__NR_accept4) +# if defined(__x86_64__) +# define __NR_accept4 288 +# elif defined(__ia64__) +// not assigned yet to IA-64 +# define __NR_accept4 -1 +# else +// set the syscalls to absurd numbers so that they'll cause ENOSYS errors +# warning "Please port the accept4 code to this platform" +# define __NR_accept4 -1 +# endif +# endif + QT_BEGIN_NAMESPACE namespace QtLibcSupplement { int pipe2(int pipes[], int flags) -- cgit v0.12 From e5e2f9fd5c1554337a576374ec6744f953d2404d Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 15:13:44 +0200 Subject: QColumnView: didn't react to addition of rows/cols in the current view Task-number: 246999 --- src/gui/itemviews/qabstractitemview_p.h | 13 +++++---- src/gui/itemviews/qcolumnview.cpp | 45 +++++++++++++++++++++++++++++- src/gui/itemviews/qcolumnview.h | 8 ++---- src/gui/itemviews/qcolumnview_p.h | 3 ++ src/gui/itemviews/qheaderview.h | 1 - src/gui/itemviews/qtreeview.h | 7 ++--- src/gui/widgets/qabstractscrollarea.cpp | 3 -- src/gui/widgets/qabstractscrollarea_p.h | 2 +- tests/auto/qcolumnview/tst_qcolumnview.cpp | 42 +++++++++++++++++++++++----- 9 files changed, 96 insertions(+), 28 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index c2c1f32..026912a 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -109,12 +109,13 @@ public: void init(); - void _q_rowsRemoved(const QModelIndex &parent, int start, int end); - void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); - void _q_columnsRemoved(const QModelIndex &parent, int start, int end); - void _q_columnsInserted(const QModelIndex &parent, int start, int end); - void _q_modelDestroyed(); - void _q_layoutChanged(); + virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end); + virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end); + virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end); + virtual void _q_modelDestroyed(); + virtual void _q_layoutChanged(); + void _q_fetchMore(); bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const; diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp index 1662fa8..ff20163 100644 --- a/src/gui/itemviews/qcolumnview.cpp +++ b/src/gui/itemviews/qcolumnview.cpp @@ -52,7 +52,6 @@ #include #include #include -#include QT_BEGIN_NAMESPACE @@ -896,6 +895,15 @@ QList QColumnView::columnWidths() const /*! \reimp */ +void QColumnView::rowsInserted(const QModelIndex &parent, int start, int end) +{ + QAbstractItemView::rowsInserted(parent, start, end); + d_func()->checkColumnCreation(parent); +} + +/*! + \reimp +*/ void QColumnView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { Q_D(QColumnView); @@ -1048,6 +1056,41 @@ QColumnViewPrivate::~QColumnViewPrivate() /*! \internal + + */ +void QColumnViewPrivate::_q_columnsInserted(const QModelIndex &parent, int start, int end) +{ + QAbstractItemViewPrivate::_q_columnsInserted(parent, start, end); + checkColumnCreation(parent); +} + +/*! + \internal + + Makes sure we create a corresponding column as a result of changing the model. + + */ +void QColumnViewPrivate::checkColumnCreation(const QModelIndex &parent) +{ + if (parent == q_func()->currentIndex() && model->hasChildren(parent)) { + //the parent has children and is the current + //let's try to find out if there is already a mapping that is good + for (int i = 0; i < columns.count(); ++i) { + QAbstractItemView *view = columns.at(i); + if (view->rootIndex() == parent) { + if (view == previewColumn) { + //let's recreate the parent + closeColumns(parent, false); + createColumn(parent, true /*show*/); + } + break; + } + } + } +} + +/*! + \internal Place all of the columns where they belong inside of the viewport, resize as necessary. */ void QColumnViewPrivate::doLayout() diff --git a/src/gui/itemviews/qcolumnview.h b/src/gui/itemviews/qcolumnview.h index 880870a..f8697e9 100644 --- a/src/gui/itemviews/qcolumnview.h +++ b/src/gui/itemviews/qcolumnview.h @@ -97,16 +97,14 @@ protected: QRegion visualRegionForSelection(const QItemSelection &selection) const; int horizontalOffset() const; int verticalOffset() const; - void scrollContentsBy(int dx, int dy); + void rowsInserted(const QModelIndex &parent, int start, int end); + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); // QColumnView functions + void scrollContentsBy(int dx, int dy); virtual QAbstractItemView* createColumn(const QModelIndex &rootIndex); void initializeColumn(QAbstractItemView *column) const; -protected Q_SLOTS: - // QAbstractItemView overloads - void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); - private: Q_DECLARE_PRIVATE(QColumnView) Q_DISABLE_COPY(QColumnView) diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h index 92a4d2a..233dc3c 100644 --- a/src/gui/itemviews/qcolumnview_p.h +++ b/src/gui/itemviews/qcolumnview_p.h @@ -148,10 +148,13 @@ public: void closeColumns(const QModelIndex &parent = QModelIndex(), bool build = false); void doLayout(); void setPreviewWidget(QWidget *widget); + void checkColumnCreation(const QModelIndex &parent); + void _q_gripMoved(int offset); void _q_changeCurrentColumn(); void _q_clicked(const QModelIndex &index); + void _q_columnsInserted(const QModelIndex &parent, int start, int end); QList columns; QVector columnSizes; // used during init and corner moving diff --git a/src/gui/itemviews/qheaderview.h b/src/gui/itemviews/qheaderview.h index bf92667..3a66c9a 100644 --- a/src/gui/itemviews/qheaderview.h +++ b/src/gui/itemviews/qheaderview.h @@ -228,7 +228,6 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast)) Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged()) - Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) Q_DECLARE_PRIVATE(QHeaderView) Q_DISABLE_COPY(QHeaderView) }; diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h index 35a205c..0347645 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/gui/itemviews/qtreeview.h @@ -144,19 +144,20 @@ public: void sortByColumn(int column, Qt::SortOrder order); + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void selectAll(); + Q_SIGNALS: void expanded(const QModelIndex &index); void collapsed(const QModelIndex &index); public Q_SLOTS: - void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void hideColumn(int column); void showColumn(int column); void expand(const QModelIndex &index); void collapse(const QModelIndex &index); void resizeColumnToContents(int column); void sortByColumn(int column); - void selectAll(); void expandAll(); void collapseAll(); void expandToDepth(int depth); @@ -225,8 +226,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation()) Q_PRIVATE_SLOT(d_func(), void _q_animate()) Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex&, const QModelIndex &)) - Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int)) - Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex &, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset()) Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order)) Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 66572b8..d952ab0 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -490,9 +490,6 @@ void QAbstractScrollAreaPrivate::layoutChildren() viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect, viewportRect)); // resize the viewport last } -// ### Fix for 4.4, talk to Bjoern E or Girish. -void QAbstractScrollAreaPrivate::scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) {} - /*! \internal diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 5d3494b..7e0f444 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -88,7 +88,7 @@ public: void init(); void layoutChildren(); // ### Fix for 4.4, talk to Bjoern E or Girish. - virtual void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy); + virtual void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) {} void _q_hslide(int); void _q_vslide(int); diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp index 0216e0f..0b3ba7a 100644 --- a/tests/auto/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include "../../../src/gui/itemviews/qcolumnviewgrip_p.h" #include "../../../src/gui/dialogs/qfilesystemmodel_p.h" @@ -87,6 +88,8 @@ private slots: void setSelectionModel(); void visualRegionForSelection(); + void dynamicModelChanges(); + // grip void moveGrip_basic(); void moveGrip_data(); @@ -133,16 +136,10 @@ public: inline QModelIndex thirdLevel() { return index(0, 0, secondLevel()); } }; -class ColumnViewPrivate : public QColumnViewPrivate -{ -public: - ColumnViewPrivate() : QColumnViewPrivate() {} -}; - class ColumnView : public QColumnView { public: - ColumnView(QWidget *parent = 0) : QColumnView(*new ColumnViewPrivate, parent){} + ColumnView(QWidget *parent = 0) : QColumnView(parent){} QList > createdColumns; void ScrollContentsBy(int x, int y) {scrollContentsBy(x,y); } @@ -1002,6 +999,37 @@ void tst_QColumnView::pullRug() // don't crash } +void tst_QColumnView::dynamicModelChanges() +{ + struct MyItemDelegate : public QItemDelegate + { + void paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const + { + paintedIndexes += index; + QItemDelegate::paint(painter, option, index); + } + + mutable QSet paintedIndexes; + + } delegate;; + QStandardItemModel model; + ColumnView view; + view.setModel(&model); + view.setItemDelegate(&delegate); + view.show(); + + QStandardItem *item = new QStandardItem(QLatin1String("item")); + model.appendRow(item); + + QTest::qWait(200); //let the time for painting to occur + QCOMPARE(delegate.paintedIndexes.count(), 1); + QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0)); + + +} + QTEST_MAIN(tst_QColumnView) #include "tst_qcolumnview.moc" -- cgit v0.12 From 1a112561126c7f2148d91e40a6c3f52ccf506fd5 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 15:29:05 +0200 Subject: Getting rid of compiler warnings on windows --- src/gui/kernel/qapplication.cpp | 6 ++---- src/gui/kernel/qapplication_win.cpp | 4 +--- src/gui/util/qsystemtrayicon_win.cpp | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 0e8978f..839e465 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5233,8 +5233,6 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, const QList &touchPoints) { QApplicationPrivate *d = self; - QApplication *q = self->q_func(); - typedef QPair > StatesAndTouchPoints; QHash widgetsNeedingEvents; @@ -5256,7 +5254,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, if (!widget) { // determine which widget this event will go to if (!window) - window = q->topLevelAt(touchPoint.screenPos().toPoint()); + window = QApplication::topLevelAt(touchPoint.screenPos().toPoint()); if (!window) continue; widget = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint())); @@ -5356,7 +5354,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, QTouchEvent touchEvent(eventType, deviceType, - q->keyboardModifiers(), + QApplication::keyboardModifiers(), it.value().first, it.value().second); updateTouchPointsForWidget(widget, &touchEvent); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 13f19a3..e0eda82 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3940,13 +3940,11 @@ void QApplicationPrivate::cleanupMultitouch_sys() bool QApplicationPrivate::translateTouchEvent(const MSG &msg) { - Q_Q(QApplication); - QWidget *widgetForHwnd = QWidget::find(msg.hwnd); if (!widgetForHwnd) return false; - QRect screenGeometry = q->desktop()->screenGeometry(widgetForHwnd); + QRect screenGeometry = QApplication::desktop()->screenGeometry(widgetForHwnd); QList touchPoints; diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp index c1b7e7f..dea9264 100644 --- a/src/gui/util/qsystemtrayicon_win.cpp +++ b/src/gui/util/qsystemtrayicon_win.cpp @@ -163,7 +163,7 @@ void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd) } } -int iconFlag( QSystemTrayIcon::MessageIcon icon ) +static int iconFlag( QSystemTrayIcon::MessageIcon icon ) { #if NOTIFYICON_VERSION >= 3 switch (icon) { @@ -176,7 +176,7 @@ int iconFlag( QSystemTrayIcon::MessageIcon icon ) case QSystemTrayIcon::NoIcon: return NIIF_NONE; default: - Q_ASSERT("Invalid QSystemTrayIcon::MessageIcon value", false); + Q_ASSERT_X(false, "QSystemTrayIconSys::showMessage", "Invalid QSystemTrayIcon::MessageIcon value"); return NIIF_NONE; } #else -- cgit v0.12 From e348e7b633ff3a0279d4d1759e35f0920afcc3e0 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 15:56:07 +0200 Subject: QColumnView: new uses QPropertyAnimation over QTimeLine --- src/gui/itemviews/qcolumnview.cpp | 27 +++++++-------------------- src/gui/itemviews/qcolumnview_p.h | 4 ++-- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp index ff20163..fc89967 100644 --- a/src/gui/itemviews/qcolumnview.cpp +++ b/src/gui/itemviews/qcolumnview.cpp @@ -107,9 +107,10 @@ void QColumnViewPrivate::initialize() { Q_Q(QColumnView); q->setTextElideMode(Qt::ElideMiddle); - QObject::connect(¤tAnimation, SIGNAL(frameChanged(int)), - hbar, SLOT(setValue(int))); QObject::connect(¤tAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn())); + currentAnimation.setDuration(ANIMATION_DURATION_MSEC); + currentAnimation.setTargetObject(hbar); + currentAnimation.setEasingCurve(QEasingCurve::InOutQuad); delete itemDelegate; q->setItemDelegate(new QColumnViewDelegate(q)); } @@ -259,7 +260,7 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint) if (!index.isValid() || d->columns.isEmpty()) return; - if (d->currentAnimation.state() == QTimeLine::Running) + if (d->currentAnimation.state() == QPropertyAnimation::Running) return; d->currentAnimation.stop(); @@ -325,21 +326,7 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint) } } - //horizontalScrollBar()->setValue(newScrollbarValue); - //d->_q_changeCurrentColumn(); - //return; - // or do the following currentAnimation - - int oldValue = horizontalScrollBar()->value(); - - if (oldValue < newScrollbarValue) { - d->currentAnimation.setFrameRange(oldValue, newScrollbarValue); - d->currentAnimation.setDirection(QTimeLine::Forward); - d->currentAnimation.setCurrentTime(0); - } else { - d->currentAnimation.setFrameRange(newScrollbarValue, oldValue); - d->currentAnimation.setDirection(QTimeLine::Backward); - } + d->currentAnimation.setEndValue(newScrollbarValue); d->currentAnimation.start(); } @@ -409,7 +396,7 @@ void QColumnView::resizeEvent(QResizeEvent *event) void QColumnViewPrivate::updateScrollbars() { Q_Q(QColumnView); - if (currentAnimation.state() == QTimeLine::Running) + if (currentAnimation.state() == QPropertyAnimation::Running) return; // find the total horizontal length of the laid out columns @@ -1044,7 +1031,7 @@ QColumnViewPrivate::QColumnViewPrivate() : QAbstractItemViewPrivate() ,showResizeGrips(true) ,offset(0) -,currentAnimation(ANIMATION_DURATION_MSEC) +,currentAnimation(0, "value") // will set the target later ,previewWidget(0) ,previewColumn(0) { diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h index 233dc3c..1a8be70 100644 --- a/src/gui/itemviews/qcolumnview_p.h +++ b/src/gui/itemviews/qcolumnview_p.h @@ -60,7 +60,7 @@ #include #include -#include +#include #include #include #include @@ -160,7 +160,7 @@ public: QVector columnSizes; // used during init and corner moving bool showResizeGrips; int offset; - QTimeLine currentAnimation; + QPropertyAnimation currentAnimation; QWidget *previewWidget; QAbstractItemView *previewColumn; }; -- cgit v0.12 From 5f48e2a16b0b64536a205320fbf7a22f7461d80d Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 7 Jul 2009 15:43:53 +0200 Subject: Fixes a crash when scrolling a scrollarea with a mouse wheel. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a crashed introduced in 60e965fd35037f4a27816d2aeccafdff0d6ae9d6 - those lines were removed by accident. Reviewed-by: João Abecasis Author: João Abecasis --- src/gui/kernel/qwidget.cpp | 1 + src/gui/widgets/qabstractscrollarea.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 611cb44..d1ab45a 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -7484,6 +7484,7 @@ bool QWidget::event(QEvent *event) #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: #endif + return false; default: break; } diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index d952ab0..e78f5a7 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -937,6 +937,7 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::DragMove: case QEvent::DragLeave: #endif + return false; case QEvent::StyleChange: case QEvent::LayoutDirectionChange: case QEvent::ApplicationLayoutDirectionChange: -- cgit v0.12 From 424e2e68f9a3f556ad2d06e2fbceac0d48c060be Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 7 Jul 2009 16:42:20 +0200 Subject: ItemViews: _q_fetchMore now uses a timer instead of invokeMethod --- src/gui/itemviews/qabstractitemview.cpp | 11 +++++++---- src/gui/itemviews/qabstractitemview.h | 1 - src/gui/itemviews/qabstractitemview_p.h | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index cefe8a5..dd84304 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2200,6 +2200,8 @@ void QAbstractItemView::resizeEvent(QResizeEvent *event) void QAbstractItemView::timerEvent(QTimerEvent *event) { Q_D(QAbstractItemView); + if (event->timerId() == d->fetchMoreTimer.timerId()) + d->fetchMore(); if (event->timerId() == d->autoScrollTimer.timerId()) doAutoScroll(); else if (event->timerId() == d->updateTimer.timerId()) @@ -2415,7 +2417,7 @@ void QAbstractItemView::updateEditorGeometries() void QAbstractItemView::updateGeometries() { updateEditorGeometries(); - QMetaObject::invokeMethod(this, "_q_fetchMore", Qt::QueuedConnection); + d_func()->fetchMoreTimer.start(0, this); //fetch more later } /*! @@ -2960,7 +2962,7 @@ void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelInde void QAbstractItemView::rowsInserted(const QModelIndex &, int, int) { if (!isVisible()) - QMetaObject::invokeMethod(this, "_q_fetchMore", Qt::QueuedConnection); + d_func()->fetchMoreTimer.start(0, this); //fetch more later else updateEditorGeometries(); } @@ -3183,7 +3185,7 @@ void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelI update(current); edit(current, CurrentChanged, 0); if (current.row() == (d->model->rowCount(d->root) - 1)) - d->_q_fetchMore(); + d->fetchMore(); } else { d->shouldScrollToCurrentOnShow = d->autoScroll; } @@ -3604,8 +3606,9 @@ QAbstractItemViewPrivate::contiguousSelectionCommand(const QModelIndex &index, } } -void QAbstractItemViewPrivate::_q_fetchMore() +void QAbstractItemViewPrivate::fetchMore() { + fetchMoreTimer.stop(); if (!model->canFetchMore(root)) return; int last = model->rowCount(root) - 1; diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h index f98dd16..da6f0ea 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/gui/itemviews/qabstractitemview.h @@ -353,7 +353,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) - Q_PRIVATE_SLOT(d_func(), void _q_fetchMore()) friend class QTreeViewPrivate; // needed to compile with MSVC friend class QAccessibleItemRow; diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 026912a..2950bcd 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -116,7 +116,7 @@ public: virtual void _q_modelDestroyed(); virtual void _q_layoutChanged(); - void _q_fetchMore(); + void fetchMore(); bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const; bool shouldForwardEvent(QAbstractItemView::EditTrigger trigger, const QEvent *event) const; @@ -388,6 +388,7 @@ public: private: mutable QBasicTimer delayedLayout; + mutable QBasicTimer fetchMoreTimer; }; QT_BEGIN_INCLUDE_NAMESPACE -- cgit v0.12 From f37bd111f7622a34b3a7bd63f5a82f6042dc0f0d Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 7 Jul 2009 16:46:30 +0200 Subject: Stop showing then hiding windows on starting designer in top-level mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We've had this since 4.5 and it's very annoying to see the window show and quickly hide itself. I was hoping it wasn't a bug in Qt, and it turns it isn't and it was happening on all platforms. Reviewed-by: Friedemann Kleint Shout outs: João for testing. --- tools/designer/src/designer/qdesigner_workbench.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp index 923687a2..ce8dde6 100644 --- a/tools/designer/src/designer/qdesigner_workbench.cpp +++ b/tools/designer/src/designer/qdesigner_workbench.cpp @@ -462,8 +462,7 @@ void QDesignerWorkbench::switchToTopLevelMode() // make sure that the widgetbox is visible if it is different from neutral. QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow(); Q_ASSERT(widgetBoxWrapper); - if (!widgetBoxWrapper->action()->isChecked()) - widgetBoxWrapper->action()->trigger(); + const bool needWidgetBoxWrapperVisible = widgetBoxWrapper->action()->isChecked(); switchToNeutralMode(); const QPoint desktopOffset = desktopGeometry().topLeft(); @@ -502,7 +501,7 @@ void QDesignerWorkbench::switchToTopLevelMode() found_visible_window |= tw->isVisible(); } - if (!widgetBoxWrapper->action()->isChecked()) + if (needWidgetBoxWrapperVisible) widgetBoxWrapper->action()->trigger(); if (!m_toolWindows.isEmpty() && !found_visible_window) -- cgit v0.12 From fbc384f1bc1dd57e4af8e008b9db000b6ff82a37 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 7 Jul 2009 16:24:49 +0200 Subject: On Mac OS X, translate the wrect to the coordinates on screen In the following configuration, wrect was off-screen and the widget was not painted: -scroll area "A" -contains another scrollarea "B" with 2*WRECT_MAX < size < XCOORD_MAX -the widget contained in B has size > XCOORD_MAX -A is scrolled to the the bottom To fix the issue, wrect is moved to the area where the top level window is in the widget coordinate. Task-number: 144779 Reviewed-by: nrc --- src/gui/kernel/qwidget_mac.mm | 23 ++++++++++++++++------- tests/auto/qwidget/tst_qwidget.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b0531ec..48e174b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3823,7 +3823,6 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) Qt coordinate system for parent X coordinate system for parent (relative to parent's wrect). */ - QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX); QRect wrect; //xrect is the X geometry of my X widget. (starts out in parent's Qt coord sys, and ends up in parent's X coord sys) QRect xrect = data.crect; @@ -3845,6 +3844,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) parentWRect = QRect(tmpRect.origin.x, tmpRect.origin.y, tmpRect.size.width, tmpRect.size.height); } else { + const QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX); parentWRect = wrectRange; } } else { @@ -3900,15 +3900,24 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) } } - if (xrect.height() > XCOORD_MAX || xrect.width() > XCOORD_MAX) { + const QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX); + if (!validRange.contains(xrect)) { // we are too big, and must clip - xrect &=wrectRange; + QPoint screenOffset(0, 0); // offset of the part being on screen + const QWidget *parentWidget = q->parentWidget(); + while (parentWidget) { + screenOffset -= parentWidget->data->crect.topLeft(); + parentWidget = parentWidget->parentWidget(); + } + QRect cropRect(screenOffset.x() - WRECT_MAX, + screenOffset.y() - WRECT_MAX, + 2*WRECT_MAX, + 2*WRECT_MAX); + + xrect &=cropRect; wrect = xrect; - wrect.translate(-data.crect.topLeft()); - //parent's X coord system is equal to parent's Qt coord - //sys, so we don't need to map xrect. + wrect.translate(-data.crect.topLeft()); // translate wrect in my Qt coordinates } - } // unmap if we are outside the valid window system coord system diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 04ec77d..fa36496 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -353,6 +353,7 @@ private slots: void toplevelLineEditFocus(); void focusWidget_task254563(); + void rectOutsideCoordinatesLimit_task144779(); private: bool ensureScreenSize(int width, int height); @@ -9117,5 +9118,39 @@ void tst_QWidget::focusWidget_task254563() QVERIFY(top.focusWidget() != widget); //dangling pointer } +void tst_QWidget::rectOutsideCoordinatesLimit_task144779() +{ + QWidget main; + QPalette palette; + palette.setColor(QPalette::Window, Qt::red); + main.setPalette(palette); + main.resize(400, 400); + + QWidget *offsetWidget = new QWidget(&main); + offsetWidget->setGeometry(0, -14600, 400, 15000); + + // big widget is too big for the coordinates, it must be limited by wrect + // if wrect is not at the right position because of offsetWidget, bigwidget + // is not painted correctly + QWidget *bigWidget = new QWidget(offsetWidget); + bigWidget->setGeometry(0, 0, 400, 50000); + palette.setColor(QPalette::Window, Qt::green); + bigWidget->setPalette(palette); + bigWidget->setAutoFillBackground(true); + + main.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&main); +#endif + QTest::qWait(100); + QPixmap pixmap = QPixmap::grabWindow(main.winId()); + + QPixmap correct(main.size()); + correct.fill(Qt::green); + + QRect center(100, 100, 200, 200); // to avoid the decorations + QCOMPARE(pixmap.toImage().copy(center), correct.toImage().copy(center)); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" -- cgit v0.12 From e5049ecc4590896a75dedcb098da9e991e1764ee Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Wed, 8 Jul 2009 09:20:31 +1000 Subject: Handle special number cases (nan,{+-}infinity) in PostgreSQL When contructing the EXECUTE statement, there is a special case that we need to handle whereby we explicitly put quotes around the special float values before submutting the statement for execution Task-number:233829 Reviewed-by: Bill King --- src/sql/drivers/psql/qsql_psql.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 69697da..64b2a23 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -54,6 +54,8 @@ #include #include +#include + #include #include @@ -1144,6 +1146,21 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const qPQfreemem(data); break; } + case QVariant::Double: { + double val = field.value().toDouble(); + if (isnan(val)) + r = QLatin1String("'NaN'"); + else { + int res = isinf(val); + if (res == 1) + r = QLatin1String("'Infinity'"); + else if (res == -1) + r = QLatin1String("'-Infinity'"); + else + r = QSqlDriver::formatValue(field, trimStrings); + } + break; + } default: r = QSqlDriver::formatValue(field, trimStrings); break; -- cgit v0.12 From c2198e1c7884b835807e45ff53c3c54e86900211 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Wed, 8 Jul 2009 09:29:33 +1000 Subject: Auto test for task 233829 - postgreSQL specific autotest. Task-number:233829 --- tests/auto/qsqlquery/tst_qsqlquery.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index ed19e91..4b41eaf 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -188,6 +188,9 @@ private slots: void task_205701_data() { generic_data("QMYSQL"); } void task_205701(); + void task_233829_data() { generic_data(); } + void task_233829(); + private: // returns all database connections @@ -301,7 +304,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) tablenames << qTableName( "qtest_lockedtable" ); tablenames << qTableName( "Planet" ); - + tablenames << qTableName( "task_250026" ); tst_Databases::safeDropTables( db, tablenames ); @@ -2814,5 +2817,30 @@ void tst_QSqlQuery::task_234422() #endif +void tst_QSqlQuery::task_233829() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + + if (!db.driverName().startsWith( "QPSQL" )) { + QSKIP( "This is a PostgreSQL specific test", SkipSingle ); + } + + QSqlQuery q( db ); + QString tableName = qTableName("task_233829"); + q.exec("DROP TABLE " + tableName); + QVERIFY_SQL(q,exec("CREATE TABLE " + tableName + " (dbl1 double precision,dbl2 double precision) without oids;")); + + QString queryString("INSERT INTO " + tableName +"(dbl1, dbl2) VALUES(?,?)"); + + double k = 0.0; + QVERIFY_SQL(q,prepare(queryString)); + q.bindValue(0,0.0 / k); // nan + q.bindValue(1,0.0 / k); // nan + QVERIFY_SQL(q,exec()); + q.exec("DROP TABLE " + tableName); +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" -- cgit v0.12 From 529df6f1dbcf8992417d03ef2c9c3ec3f2d7bc4b Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Wed, 8 Jul 2009 09:39:53 +1000 Subject: remove debug --- src/sql/drivers/psql/qsql_psql.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 64b2a23..8de79a3 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -54,7 +54,6 @@ #include #include -#include #include #include -- cgit v0.12 From 355d058a0c7eba3ae3b2a54dda566d94a4134941 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Wed, 8 Jul 2009 10:50:09 +1000 Subject: safely drop tables. --- tests/auto/qsqlquery/tst_qsqlquery.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 4b41eaf..30b85e8 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -295,6 +295,9 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName( "blobstest" ) << qTableName( "oraRowId" ); + if ( db.driverName().startsWith("QPSQL") ) + tablenames <<"task_233829"; + if ( db.driverName().startsWith("QSQLITE") ) tablenames << qTableName( "record_sqlite" ); @@ -2839,7 +2842,6 @@ void tst_QSqlQuery::task_233829() q.bindValue(0,0.0 / k); // nan q.bindValue(1,0.0 / k); // nan QVERIFY_SQL(q,exec()); - q.exec("DROP TABLE " + tableName); } QTEST_MAIN( tst_QSqlQuery ) -- cgit v0.12 From 5ff22b1ed4da11dc16a236825c939b5ae38d27cc Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 8 Jul 2009 11:09:42 +1000 Subject: Fixes Dericks inf/nan patch for msvc --- src/sql/drivers/psql/qsql_psql.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 8de79a3..33f2e2b 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -59,7 +59,20 @@ #include #include +#if defined(_MSC_VER) +#include +#define isnan(x) _isnan(x) +int isinf(double x) +{ + if(_fpclass(x) == _FPCLASS_NINF) + return -1; + else if(_fpclass(x) == _FPCLASS_PINF) + return 1; + else return 0; +} +#else #include +#endif // workaround for postgres defining their OIDs in a private header file #define QBOOLOID 16 -- cgit v0.12 From b2e62931f1b2968a69aa013b27a50d2e6beb4e27 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 8 Jul 2009 11:17:40 +1000 Subject: Cleanup more SQL autotest failures. --- tests/auto/qsqldatabase/tst_databases.h | 13 +++++++++++++ tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 7 ++++++- tests/auto/qsqlquery/tst_qsqlquery.cpp | 20 +++++++++----------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index bd51b97..8ee74df 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -249,12 +249,15 @@ public: // addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" ); // addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql4-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond", "troll", "trond", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "", "", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "", "", "" ); // addDb( "QTDS7", "testdb", "testuser", "Ee4Gabf6_", "bq-winserv2003" ); // addDb( "QTDS7", "testdb", "testuser", "Ee4Gabf6_", "bq-winserv2008" ); +// addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); } void open() @@ -438,6 +441,16 @@ public: return db.databaseName().contains( "Access Driver", Qt::CaseInsensitive ); } + static bool isPostgreSQL( QSqlDatabase db ) + { + return db.driverName().startsWith("QPSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("PostgreSQL") ); + } + + static bool isMySQL( QSqlDatabase db ) + { + return db.driverName().startsWith("QMYSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("MySQL") ); + } + // -1 on fail, else Oracle version static int getOraVersion( QSqlDatabase db ) { diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 21064c3..025e895 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -256,6 +256,8 @@ static int createFieldTable(const FieldDef fieldDefs[], QSqlDatabase db) QString autoName = tst_Databases::autoFieldName(db); if (tst_Databases::isMSAccess(db)) qs.append(" (id int not null"); + else if (tst_Databases::isPostgreSQL(db)) + qs.append(" (id serial not null"); else qs.append(QString("(id integer not null %1 primary key").arg(autoName)); @@ -1350,6 +1352,8 @@ void tst_QSqlDatabase::transaction() } QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 41")); + if(db.driverName().startsWith("QODBC") && dbName.contains("MySQL")) + QEXPECT_FAIL("", "Some odbc drivers don't actually roll back despite telling us they do, especially the mysql driver", Continue); QVERIFY(!q.next()); populateTestTables(db); @@ -1427,7 +1431,8 @@ void tst_QSqlDatabase::caseSensivity() bool cs = false; if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") - || db.driverName().startsWith("QTDS")) + || db.driverName().startsWith("QTDS") + || db.driverName().startsWith("QODBC")) cs = true; QSqlRecord rec = db.record(qTableName("qtest")); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 30b85e8..5e782ca 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -188,7 +188,7 @@ private slots: void task_205701_data() { generic_data("QMYSQL"); } void task_205701(); - void task_233829_data() { generic_data(); } + void task_233829_data() { generic_data("QPSQL"); } void task_233829(); @@ -322,7 +322,10 @@ void tst_QSqlQuery::createTestTables( QSqlDatabase db ) // in the MySQL server startup script q.exec( "set table_type=innodb" ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) ); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id serial NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id)) WITH OIDS" ) ); + else + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) ); if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) ) QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_null" ) + " (id int null, t_varchar varchar(20) null)" ) ); @@ -1874,7 +1877,7 @@ void tst_QSqlQuery::invalidQuery() QVERIFY( !q.next() ); QVERIFY( !q.isActive() ); - if ( !db.driverName().startsWith( "QOCI" ) && !db.driverName().startsWith( "QDB2" ) ) { + if ( !db.driverName().startsWith( "QOCI" ) && !db.driverName().startsWith( "QDB2" ) && !db.driverName().startsWith( "QODBC" ) ) { // oracle and db2 just prepares everything without complaining if ( db.driver()->hasFeature( QSqlDriver::PreparedQueries ) ) QVERIFY( !q.prepare( "blahfasel" ) ); @@ -2034,7 +2037,7 @@ void tst_QSqlQuery::oraArrayBind() q.bindValue( 0, list, QSql::In ); - QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsRows ) ); + QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsColumns ) ); QVERIFY_SQL( q, prepare( "BEGIN " "ora_array_test.get_table(?); " @@ -2046,7 +2049,7 @@ void tst_QSqlQuery::oraArrayBind() q.bindValue( 0, list, QSql::Out ); - QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsRows ) ); + QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsColumns ) ); QVariantList out_list = q.boundValue( 0 ).toList(); @@ -2593,7 +2596,7 @@ void tst_QSqlQuery::blobsPreparedQuery() if ( db.driverName().startsWith( "QPSQL" ) ) typeName = "BYTEA"; - else if ( db.driverName().startsWith( "QODBC" ) ) + else if ( db.driverName().startsWith( "QODBC" ) && tst_Databases::isSqlServer( db )) typeName = "IMAGE"; QVERIFY_SQL( q, exec( QString( "CREATE TABLE %1(id INTEGER, data %2)" ).arg( tableName ).arg( typeName ) ) ); @@ -2826,13 +2829,8 @@ void tst_QSqlQuery::task_233829() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - if (!db.driverName().startsWith( "QPSQL" )) { - QSKIP( "This is a PostgreSQL specific test", SkipSingle ); - } - QSqlQuery q( db ); QString tableName = qTableName("task_233829"); - q.exec("DROP TABLE " + tableName); QVERIFY_SQL(q,exec("CREATE TABLE " + tableName + " (dbl1 double precision,dbl2 double precision) without oids;")); QString queryString("INSERT INTO " + tableName +"(dbl1, dbl2) VALUES(?,?)"); -- cgit v0.12 From 291279cc24aa543454953b93b1db026caf0d7eb6 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 8 Jul 2009 11:52:38 +1000 Subject: Make the table actually delete before the autotest --- tests/auto/qsqlquery/tst_qsqlquery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 5e782ca..c94b693 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -296,7 +296,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName( "oraRowId" ); if ( db.driverName().startsWith("QPSQL") ) - tablenames <<"task_233829"; + tablenames << qTableName("task_233829"); if ( db.driverName().startsWith("QSQLITE") ) tablenames << qTableName( "record_sqlite" ); -- cgit v0.12 From 9e2b47da3b88c63acb1b3a8cb7566f2a1e0e18ff Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Wed, 8 Jul 2009 14:47:21 +1000 Subject: make test behave like others --- tests/auto/qsqlquery/tst_qsqlquery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index c94b693..0e30873 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -2831,7 +2831,7 @@ void tst_QSqlQuery::task_233829() QSqlQuery q( db ); QString tableName = qTableName("task_233829"); - QVERIFY_SQL(q,exec("CREATE TABLE " + tableName + " (dbl1 double precision,dbl2 double precision) without oids;")); + QVERIFY_SQL(q,exec("CREATE TABLE " + tableName + "(dbl1 double precision,dbl2 double precision) without oids;")); QString queryString("INSERT INTO " + tableName +"(dbl1, dbl2) VALUES(?,?)"); -- cgit v0.12 From e33704cdd6f935410dbbdbfedca6ddd648e70f4e Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 8 Jul 2009 15:24:36 +1000 Subject: Tables aren't deleting properly. Send the correct name . --- .../qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index e2dace8..d934b35 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -167,10 +167,10 @@ void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db ) << qTableName( "reltest3" ) << qTableName( "reltest4" ) << qTableName( "reltest5" ) - << qTableName( "rel test6", db.driver() ) - << qTableName( "rel test7", db.driver() ) - << qTableName("CASETEST1", db.driver() ) - << qTableName("casetest1", db.driver() ); + << qTableName( "rel test6" ) + << qTableName( "rel test7" ) + << qTableName("CASETEST1" ) + << qTableName("casetest1" ); tst_Databases::safeDropTables( db, tableNames ); } -- cgit v0.12 From 4d2f47da2e4869b0419cf13856ddca8a3e34e88a Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 8 Jul 2009 10:11:03 +0200 Subject: The offset of cropRect should not depend on the position of the window The rect cropRect should be positioned with the offset to the top-level window, not the screen position. --- src/gui/kernel/qwidget_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 48e174b..ad16485 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3905,7 +3905,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) // we are too big, and must clip QPoint screenOffset(0, 0); // offset of the part being on screen const QWidget *parentWidget = q->parentWidget(); - while (parentWidget) { + while (parentWidget && !parentWidget->isWindow()) { screenOffset -= parentWidget->data->crect.topLeft(); parentWidget = parentWidget->parentWidget(); } -- cgit v0.12 From 7486389a0d742a7c9e70c6110692186f70dbf1e5 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 10:25:04 +0200 Subject: QMainWindow: made use of QPropertyAnimation for animations This required some refactoring as well. Now code is leaner and cleaner --- src/gui/widgets/qmainwindowlayout.cpp | 75 ++++++++++-------------- src/gui/widgets/qmainwindowlayout_p.h | 3 +- src/gui/widgets/qwidgetanimator.cpp | 107 +++++++--------------------------- src/gui/widgets/qwidgetanimator_p.h | 23 ++------ 4 files changed, 59 insertions(+), 149 deletions(-) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 1057f5f..a02dca3 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1550,37 +1550,10 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) return true; } -void QMainWindowLayout::allAnimationsFinished() -{ -#ifndef QT_NO_DOCKWIDGET - parentWidget()->update(layoutState.dockAreaLayout.separatorRegion()); - -#ifndef QT_NO_TABBAR - foreach (QTabBar *tab_bar, usedTabBars) - tab_bar->show(); -#endif // QT_NO_TABBAR -#endif // QT_NO_DOCKWIDGET - - updateGapIndicator(); -} - void QMainWindowLayout::animationFinished(QWidget *widget) { - - /* This signal is delivered from QWidgetAnimator over a qeued connection. The problem is that - the widget can be deleted. This is handled as follows: - - The animator only ever animates widgets that have been added to this layout. If a widget - is deleted during animation, the widget's destructor removes the widget form this layout. - This in turn aborts the animation (see takeAt()) and this signal will never be delivered. - - If the widget is deleted after the animation is finished but before this qeued signal - is delivered, the widget is no longer in the layout and we catch it here. The key is that - QMainWindowLayoutState::contains() never dereferences the pointer. */ - - if (!layoutState.contains(widget)) - return; - + //this function is called from within the Widget Animator whenever an animation is finished + //on a certain widget #ifndef QT_NO_TOOLBAR if (QToolBar *tb = qobject_cast(widget)) { QToolBarLayout *tbl = qobject_cast(tb->layout()); @@ -1593,32 +1566,44 @@ void QMainWindowLayout::animationFinished(QWidget *widget) } #endif - if (widget != pluggingWidget) - return; + if (widget == pluggingWidget) { #ifndef QT_NO_DOCKWIDGET - if (QDockWidget *dw = qobject_cast(widget)) - dw->d_func()->plug(currentGapRect); + if (QDockWidget *dw = qobject_cast(widget)) + dw->d_func()->plug(currentGapRect); #endif #ifndef QT_NO_TOOLBAR - if (QToolBar *tb = qobject_cast(widget)) - tb->d_func()->plug(currentGapRect); + if (QToolBar *tb = qobject_cast(widget)) + tb->d_func()->plug(currentGapRect); #endif - applyState(layoutState, false); + applyState(layoutState, false); #ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_TABBAR - if (qobject_cast(widget) != 0) { - // info() might return null if the widget is destroyed while - // animating but before the animationFinished signal is received. - if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget)) - info->setCurrentTab(widget); - } + if (qobject_cast(widget) != 0) { + // info() might return null if the widget is destroyed while + // animating but before the animationFinished signal is received. + if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget)) + info->setCurrentTab(widget); + } #endif #endif - savedState.clear(); - currentGapPos.clear(); - pluggingWidget = 0; + savedState.clear(); + currentGapPos.clear(); + pluggingWidget = 0; + } + + if (!widgetAnimator.animating()) { + //all animations are finished +#ifndef QT_NO_DOCKWIDGET + parentWidget()->update(layoutState.dockAreaLayout.separatorRegion()); +#ifndef QT_NO_TABBAR + foreach (QTabBar *tab_bar, usedTabBars) + tab_bar->show(); +#endif // QT_NO_TABBAR +#endif // QT_NO_DOCKWIDGET + } + updateGapIndicator(); } diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index 759461b..a7f70b4 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -297,9 +297,8 @@ public: void restore(bool keepSavedState = false); void updateHIToolBarStatus(); void animationFinished(QWidget *widget); - void allAnimationsFinished(); -private slots: +private Q_SLOTS: #ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_TABBAR void tabChanged(); diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index 56b3f43..d820b59 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include #include #include @@ -46,47 +47,25 @@ QT_BEGIN_NAMESPACE -static const int g_animation_steps = 12; -static const int g_animation_interval = 16; - -// 1000 * (x/(1 + x*x) + 0.5) on interval [-1, 1] -static const int g_animate_function[] = -{ - 0, 1, 5, 12, 23, 38, 58, 84, 116, 155, 199, 251, 307, 368, - 433, 500, 566, 631, 692, 748, 799, 844, 883, 915, 941, 961, - 976, 987, 994, 998, 1000 -}; -static const int g_animate_function_points = sizeof(g_animate_function)/sizeof(int); - -static inline int animateHelper(int start, int stop, int step, int steps) -{ - if (start == stop) - return start; - if (step == 0) - return start; - if (step == steps) - return stop; - - int x = g_animate_function_points*step/(steps + 1); - return start + g_animate_function[x]*(stop - start)/1000; -} - QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout(layout) { } -QWidgetAnimator::~QWidgetAnimator() +void QWidgetAnimator::abort(QWidget *w) { + AnimationMap::iterator it = m_animation_map.find(w); + if (it == m_animation_map.end()) + return; + QPropertyAnimation *anim = *it; + m_animation_map.erase(it); + anim->stop(); + m_mainWindowLayout->animationFinished(w); } -void QWidgetAnimator::abort(QWidget *w) +void QWidgetAnimator::animationFinished() { - if (m_animation_map.remove(w) == 0) - return; - if (m_animation_map.isEmpty()) { - m_timer.stop(); - m_mainWindowLayout->allAnimationsFinished(); - } + QPropertyAnimation *anim = qobject_cast(sender()); + abort(static_cast(anim->targetObject())); } void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate) @@ -101,16 +80,17 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo animate = false; AnimationMap::const_iterator it = m_animation_map.constFind(widget); - if (it != m_animation_map.constEnd() && (*it).r2 == final_geometry) + if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry) return; if (animate) { - AnimationItem item(widget, r, final_geometry); - m_animation_map[widget] = item; - if (!m_timer.isActive()) { - m_timer.start(g_animation_interval, this); - m_time.start(); - } + QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry"); + anim->setDuration(200); + anim->setEasingCurve(QEasingCurve::InOutQuad); + anim->setEndValue(final_geometry); + m_animation_map[widget] = anim; + connect(anim, SIGNAL(finished()), SLOT(animationFinished())); + anim->start(QPropertyAnimation::DeleteWhenStopped); } else { if (!final_geometry.isValid() && !widget->isWindow()) { // Make the wigdet go away by sending it to negative space @@ -118,58 +98,15 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo final_geometry = QRect(-500 - s.width(), -500 - s.height(), s.width(), s.height()); } widget->setGeometry(final_geometry); - - if (m_animation_map.remove(widget)) { - m_mainWindowLayout->animationFinished(widget); - if (m_animation_map.isEmpty()) { - m_timer.stop(); - m_mainWindowLayout->allAnimationsFinished(); - } - } - } -} - -void QWidgetAnimator::timerEvent(QTimerEvent *) -{ - int steps = (1 + m_time.restart())/g_animation_interval; - AnimationMap::iterator it = m_animation_map.begin(); - while (it != m_animation_map.end()) { - AnimationItem &item = *it; - - item.step = qMin(item.step + steps, g_animation_steps); - - int x = animateHelper(item.r1.left(), item.r2.left(), - item.step, g_animation_steps); - int y = animateHelper(item.r1.top(), item.r2.top(), - item.step, g_animation_steps); - int w = animateHelper(item.r1.width(), item.r2.width(), - item.step, g_animation_steps); - int h = animateHelper(item.r1.height(), item.r2.height(), - item.step, g_animation_steps); - - item.widget->setGeometry(x, y, w, h); - - if (item.step == g_animation_steps) { - QWidget *widget = item.widget; - it = m_animation_map.erase(it); - m_mainWindowLayout->animationFinished(widget); - } else { - ++it; - } - } - - if (m_animation_map.isEmpty()) { - m_timer.stop(); - m_mainWindowLayout->allAnimationsFinished(); } } bool QWidgetAnimator::animating() const { - return m_timer.isActive(); + return !m_animation_map.isEmpty(); } -bool QWidgetAnimator::animating(QWidget *widget) +bool QWidgetAnimator::animating(QWidget *widget) const { return m_animation_map.contains(widget); } diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h index 0c68e00..edd8e7c 100644 --- a/src/gui/widgets/qwidgetanimator_p.h +++ b/src/gui/widgets/qwidgetanimator_p.h @@ -56,41 +56,30 @@ #include #include #include -#include -#include QT_BEGIN_NAMESPACE class QWidget; class QMainWindowLayout; +class QPropertyAnimation; class QWidgetAnimator : public QObject { + Q_OBJECT public: QWidgetAnimator(QMainWindowLayout *layout); - ~QWidgetAnimator(); void animate(QWidget *widget, const QRect &final_geometry, bool animate); bool animating() const; - bool animating(QWidget *widget); + bool animating(QWidget *widget) const; void abort(QWidget *widget); -protected: - void timerEvent(QTimerEvent *e); +private Q_SLOTS: + void animationFinished(); private: - struct AnimationItem { - AnimationItem(QWidget *_widget = 0, const QRect &_r1 = QRect(), - const QRect &_r2 = QRect()) - : widget(_widget), r1(_r1), r2(_r2), step(0) {} - QWidget *widget; - QRect r1, r2; - int step; - }; - typedef QMap AnimationMap; + typedef QMap AnimationMap; AnimationMap m_animation_map; - QBasicTimer m_timer; - QTime m_time; QMainWindowLayout *m_mainWindowLayout; }; -- cgit v0.12 From ed4c85c33683ce541590639f19adcef8dcd001a8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 8 Jul 2009 12:09:08 +0200 Subject: don't drop all location tags after the first file without any Task-number: 256647 --- tools/linguist/lupdate/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index c28bf8b..52a57fb 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -178,9 +178,10 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil if (options & Verbose) printOut(QObject::tr("Updating '%1'...\n").arg(fn)); + UpdateOptions theseOptions = options; if (tor.locationsType() == Translator::NoLocations) // Could be set from file - options |= NoLocations; - Translator out = merge(tor, fetchedTor, options, err); + theseOptions |= NoLocations; + Translator out = merge(tor, fetchedTor, theseOptions, err); if (!codecForTr.isEmpty()) out.setCodecName(codecForTr); -- cgit v0.12 From 191c621cbaa318e60111ae88c7b1e57286b1368b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 13:18:24 +0200 Subject: QMainWindow: fixed a crash in some cases when deleting the widget This happened because the rubberband used as a gapindicator was not allocated on the heap and might have been deleted by the QMainWindow destructor. Task-number: 257626 --- src/gui/widgets/qmainwindowlayout.cpp | 16 +++++----------- src/gui/widgets/qmainwindowlayout_p.h | 3 +-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index a02dca3..ad608d3 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1639,7 +1639,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow) , widgetAnimator(this) , pluggingWidget(0) #ifndef QT_NO_RUBBERBAND - , gapIndicator(QRubberBand::Rectangle, mainwindow) + , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow)) #endif //QT_NO_RUBBERBAND { #ifndef QT_NO_DOCKWIDGET @@ -1655,8 +1655,8 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow) #ifndef QT_NO_RUBBERBAND // For accessibility to identify this special widget. - gapIndicator.setObjectName(QLatin1String("qt_rubberband")); - gapIndicator.hide(); + gapIndicator->setObjectName(QLatin1String("qt_rubberband")); + gapIndicator->hide(); #endif pluggingWidget = 0; @@ -1762,14 +1762,8 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget) void QMainWindowLayout::updateGapIndicator() { #ifndef QT_NO_RUBBERBAND - if (widgetAnimator.animating() || currentGapPos.isEmpty()) { - gapIndicator.hide(); - } else { - if (gapIndicator.geometry() != currentGapRect) - gapIndicator.setGeometry(currentGapRect); - if (!gapIndicator.isVisible()) - gapIndicator.show(); - } + gapIndicator->setVisible(!widgetAnimator.animating() && !currentGapPos.isEmpty()); + gapIndicator->setGeometry(currentGapRect); #endif } diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index a7f70b4..45f62cd 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -59,7 +59,6 @@ #include "QtGui/qlayout.h" #include "QtGui/qtabbar.h" -#include "QtGui/qrubberband.h" #include "QtCore/qvector.h" #include "QtCore/qset.h" #include "QtCore/qbasictimer.h" @@ -284,7 +283,7 @@ public: QRect currentGapRect; QWidget *pluggingWidget; #ifndef QT_NO_RUBBERBAND - QRubberBand gapIndicator; + QRubberBand *gapIndicator; #endif QList hover(QLayoutItem *widgetItem, const QPoint &mousePos); -- cgit v0.12 From 12dc33d0e7191dbabb03db989b0f56372de731e3 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 14:19:00 +0200 Subject: QMainWindow: compile fix when defining QT_NO_DOCKWIDGET --- src/gui/widgets/qmainwindowlayout.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index ad608d3..8fb7c4f 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -237,7 +237,7 @@ void QMainWindowLayoutState::apply(bool animated) if (centralWidgetItem != 0) { QMainWindowLayout *layout = qobject_cast(mainWindow->layout()); Q_ASSERT(layout != 0); - layout->widgetAnimator->animate(centralWidgetItem->widget(), centralWidgetRect, animated); + layout->widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect, animated); } #endif } @@ -946,7 +946,6 @@ void QMainWindowLayout::toggleToolBarsVisible() r = layoutState.toolBarAreaLayout.rectHint(r); r.moveTo(topLeft); parentWidget()->setGeometry(r); -// widgetAnimator->animate(parentWidget(), r, true); } else{ update(); } -- cgit v0.12 From 19a824cfe36458732f12e6374848df37cd92eed8 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 15:12:08 +0200 Subject: Animations: fix compilation with QT_NO_ANIMATION --- src/corelib/animation/qabstractanimation_p.h | 7 ++++++- src/corelib/animation/qanimationgroup_p.h | 4 ++++ src/corelib/animation/qparallelanimationgroup_p.h | 4 ++++ src/corelib/animation/qpropertyanimation_p.h | 6 +++++- .../animation/qsequentialanimationgroup_p.h | 3 +++ src/corelib/animation/qvariantanimation_p.h | 4 ++++ src/gui/itemviews/qcolumnview.cpp | 12 +++++++++++- src/gui/itemviews/qcolumnview_p.h | 2 ++ src/gui/widgets/qwidgetanimator.cpp | 22 +++++++++++++++++++++- src/gui/widgets/qwidgetanimator_p.h | 3 +++ 10 files changed, 63 insertions(+), 4 deletions(-) diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 00def55..0d8402e 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -58,6 +58,8 @@ #include #include +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE class QAnimationGroup; @@ -147,4 +149,7 @@ private: }; QT_END_NAMESPACE -#endif + +#endif //QT_NO_ANIMATION + +#endif //QABSTRACTANIMATION_P_H diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h index 8e668f0..01252c5 100644 --- a/src/corelib/animation/qanimationgroup_p.h +++ b/src/corelib/animation/qanimationgroup_p.h @@ -59,6 +59,8 @@ #include "private/qabstractanimation_p.h" +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE class QAnimationGroupPrivate : public QAbstractAnimationPrivate @@ -76,4 +78,6 @@ public: QT_END_NAMESPACE +#endif //QT_NO_ANIMATION + #endif //QANIMATIONGROUP_P_H diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h index 201eb16..949a9b2 100644 --- a/src/corelib/animation/qparallelanimationgroup_p.h +++ b/src/corelib/animation/qparallelanimationgroup_p.h @@ -57,6 +57,8 @@ #include "private/qanimationgroup_p.h" #include +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE class QParallelAnimationGroupPrivate : public QAnimationGroupPrivate @@ -82,4 +84,6 @@ public: QT_END_NAMESPACE +#endif //QT_NO_ANIMATION + #endif //QPARALLELANIMATIONGROUP_P_H diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h index 68b2519..a2ae5ec 100644 --- a/src/corelib/animation/qpropertyanimation_p.h +++ b/src/corelib/animation/qpropertyanimation_p.h @@ -58,6 +58,8 @@ #include "private/qvariantanimation_p.h" +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE class QPropertyAnimationPrivate : public QVariantAnimationPrivate @@ -86,4 +88,6 @@ public: QT_END_NAMESPACE -#endif +#endif //QT_NO_ANIMATION + +#endif //QPROPERTYANIMATION_P_H diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h index 555b696..8db79a0 100644 --- a/src/corelib/animation/qsequentialanimationgroup_p.h +++ b/src/corelib/animation/qsequentialanimationgroup_p.h @@ -56,6 +56,7 @@ #include "qsequentialanimationgroup.h" #include "private/qanimationgroup_p.h" +#ifndef QT_NO_ANIMATION QT_BEGIN_NAMESPACE @@ -108,4 +109,6 @@ public: QT_END_NAMESPACE +#endif //QT_NO_ANIMATION + #endif //QSEQUENTIALANIMATIONGROUP_P_H diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index b848e12..69e23dc 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -60,6 +60,8 @@ #include "private/qabstractanimation_p.h" +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE class QVariantAnimationPrivate : public QAbstractAnimationPrivate @@ -120,4 +122,6 @@ template inline QVariant _q_interpolateVariant(const T &from, const QT_END_NAMESPACE +#endif //QT_NO_ANIMATION + #endif //QANIMATION_P_H diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp index fc89967..c544394 100644 --- a/src/gui/itemviews/qcolumnview.cpp +++ b/src/gui/itemviews/qcolumnview.cpp @@ -107,10 +107,13 @@ void QColumnViewPrivate::initialize() { Q_Q(QColumnView); q->setTextElideMode(Qt::ElideMiddle); +#ifndef QT_NO_ANIMATION QObject::connect(¤tAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn())); currentAnimation.setDuration(ANIMATION_DURATION_MSEC); currentAnimation.setTargetObject(hbar); + currentAnimation.setPropertyName("value"); currentAnimation.setEasingCurve(QEasingCurve::InOutQuad); +#endif //QT_NO_ANIMATION delete itemDelegate; q->setItemDelegate(new QColumnViewDelegate(q)); } @@ -260,10 +263,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint) if (!index.isValid() || d->columns.isEmpty()) return; +#ifndef QT_NO_ANIMATION if (d->currentAnimation.state() == QPropertyAnimation::Running) return; d->currentAnimation.stop(); +#endif //QT_NO_ANIMATION // Fill up what is needed to get to index d->closeColumns(index, true); @@ -326,8 +331,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint) } } +#ifndef QT_NO_ANIMATION d->currentAnimation.setEndValue(newScrollbarValue); d->currentAnimation.start(); +#else + horizontalScrollBar()->setValue(newScrollbarValue); +#endif //QT_NO_ANIMATION } /*! @@ -396,8 +405,10 @@ void QColumnView::resizeEvent(QResizeEvent *event) void QColumnViewPrivate::updateScrollbars() { Q_Q(QColumnView); +#ifndef QT_NO_ANIMATION if (currentAnimation.state() == QPropertyAnimation::Running) return; +#endif //QT_NO_ANIMATION // find the total horizontal length of the laid out columns int horizontalLength = 0; @@ -1031,7 +1042,6 @@ QColumnViewPrivate::QColumnViewPrivate() : QAbstractItemViewPrivate() ,showResizeGrips(true) ,offset(0) -,currentAnimation(0, "value") // will set the target later ,previewWidget(0) ,previewColumn(0) { diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h index 1a8be70..3f99220 100644 --- a/src/gui/itemviews/qcolumnview_p.h +++ b/src/gui/itemviews/qcolumnview_p.h @@ -160,7 +160,9 @@ public: QVector columnSizes; // used during init and corner moving bool showResizeGrips; int offset; +#ifndef QT_NO_ANIMATION QPropertyAnimation currentAnimation; +#endif QWidget *previewWidget; QAbstractItemView *previewColumn; }; diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index d820b59..7a3a464 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -53,6 +53,7 @@ QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout void QWidgetAnimator::abort(QWidget *w) { +#ifndef QT_NO_ANIMATION AnimationMap::iterator it = m_animation_map.find(w); if (it == m_animation_map.end()) return; @@ -60,13 +61,18 @@ void QWidgetAnimator::abort(QWidget *w) m_animation_map.erase(it); anim->stop(); m_mainWindowLayout->animationFinished(w); +#else + Q_UNUSED(w); //there is no animation to abort +#endif //QT_NO_ANIMATION } +#ifndef QT_NO_ANIMATION void QWidgetAnimator::animationFinished() { QPropertyAnimation *anim = qobject_cast(sender()); abort(static_cast(anim->targetObject())); } +#endif //QT_NO_ANIMATION void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate) { @@ -76,6 +82,9 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo if (r.right() < 0 || r.bottom() < 0) r = QRect(); +#ifdef QT_NO_ANIMATION + Q_UNUSED(animate); +#else if (r.isNull() || final_geometry.isNull() || r == final_geometry) animate = false; @@ -91,7 +100,9 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo m_animation_map[widget] = anim; connect(anim, SIGNAL(finished()), SLOT(animationFinished())); anim->start(QPropertyAnimation::DeleteWhenStopped); - } else { + } else +#endif //QT_NO_ANIMATION + { if (!final_geometry.isValid() && !widget->isWindow()) { // Make the wigdet go away by sending it to negative space QSize s = widget->size(); @@ -103,12 +114,21 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo bool QWidgetAnimator::animating() const { +#ifdef QT_NO_ANIMATION + return false; +#else return !m_animation_map.isEmpty(); +#endif //QT_NO_ANIMATION } bool QWidgetAnimator::animating(QWidget *widget) const { +#ifdef QT_NO_ANIMATION + Q_UNUSED(widget); + return false; +#else return m_animation_map.contains(widget); +#endif //QT_NO_ANIMATION } QT_END_NAMESPACE diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h index edd8e7c..4047395 100644 --- a/src/gui/widgets/qwidgetanimator_p.h +++ b/src/gui/widgets/qwidgetanimator_p.h @@ -74,12 +74,15 @@ public: void abort(QWidget *widget); +#ifndef QT_NO_ANIMATION private Q_SLOTS: void animationFinished(); private: typedef QMap AnimationMap; AnimationMap m_animation_map; +#endif +private: QMainWindowLayout *m_mainWindowLayout; }; -- cgit v0.12 From a92a6ede9c6a13833d1a6c83b863a5e492b2ba9e Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 8 Jul 2009 13:40:29 +0200 Subject: Cocoa: Plain text from clipboard use '\r' as newline instead of '\n' The 'public.utf16-plain-text' clipboard type maps newlines to '\r' instead of '\n'. The NSStringPboardType from NSPasteboard does this correctly, so first try to get data through this type. Task-number: 257661 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qclipboard_mac.cpp | 14 ++++++++++++-- src/gui/kernel/qt_cocoa_helpers_mac.mm | 12 ++++++++++++ src/gui/kernel/qt_cocoa_helpers_mac_p.h | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp index b7b57b8..45050b2 100644 --- a/src/gui/kernel/qclipboard_mac.cpp +++ b/src/gui/kernel/qclipboard_mac.cpp @@ -50,6 +50,7 @@ #include "qurl.h" #include #include +#include "qt_cocoa_helpers_mac_p.h" QT_BEGIN_NAMESPACE @@ -525,8 +526,17 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const QString c_flavor = c->flavorFor(format); if(!c_flavor.isEmpty()) { // Handle text/plain a little differently. Try handling Unicode first. - if((c_flavor == QLatin1String("com.apple.traditional-mac-plain-text") || c_flavor == QLatin1String("public.utf8-plain-text")) && - hasFlavor(QLatin1String("public.utf16-plain-text"))) + bool checkForUtf16 = (c_flavor == QLatin1String("com.apple.traditional-mac-plain-text") + || c_flavor == QLatin1String("public.utf8-plain-text")); + if (checkForUtf16 || c_flavor == QLatin1String("public.utf16-plain-text")) { + // Try to get the NSStringPboardType from NSPasteboard, newlines are mapped + // correctly (as '\n') in this data. The 'public.utf16-plain-text' type + // usually maps newlines to '\r' instead. + QString str = qt_mac_get_pasteboardString(); + if (!str.isEmpty()) + return str; + } + if (checkForUtf16 && hasFlavor(QLatin1String("public.utf16-plain-text"))) c_flavor = QLatin1String("public.utf16-plain-text"); QVariant ret; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 073a00e..13b0e50 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1131,4 +1131,16 @@ CGFloat qt_mac_get_scalefactor() #endif } +QString qt_mac_get_pasteboardString() +{ + QMacCocoaAutoReleasePool pool; + NSPasteboard *pb = [NSPasteboard generalPasteboard]; + NSString *text = [pb stringForType:NSStringPboardType]; + if (text) { + return qt_mac_NSStringToQString(text); + } else { + return QString(); + } +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 7b975f5..3881ccd 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -162,6 +162,7 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list); void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow); CGFloat qt_mac_get_scalefactor(); +QString qt_mac_get_pasteboardString(); #ifdef __OBJC__ inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist) -- cgit v0.12 From 94c44ba8d6d1220d00a844d95f9dfb15165ea983 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 14:26:57 +0200 Subject: Phonon: Fixed a possible race condition Task-number: 257495 --- src/3rdparty/phonon/ds9/mediaobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 1d0b69d..26ba8eb 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -207,10 +207,10 @@ namespace Phonon HRESULT hr = S_OK; + QMutexLocker locker(&m_mutex); m_currentRender = w.graph; m_currentRenderId = w.id; if (w.task == ReplaceGraph) { - QMutexLocker locker(&m_mutex); HANDLE h; int index = -1; -- cgit v0.12 From e21e83b9b81801257337902102ea1b267227de4a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 2 Jul 2009 14:53:13 +0200 Subject: added auto test tst_QLocalSocket::readBufferOverflow This test handles the case when one limits the size of the socket's read buffer and more data than the buffer size is available. Reviewed-by: ossi --- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index 4f1eb1d..0f636a4 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -80,6 +80,8 @@ private slots: void sendData_data(); void sendData(); + void readBufferOverflow(); + void fullPath(); void hitMaximumConnections_data(); @@ -531,6 +533,37 @@ void tst_QLocalSocket::sendData() QCOMPARE(spy.count(), (canListen ? 1 : 0)); } +void tst_QLocalSocket::readBufferOverflow() +{ + const int readBufferSize = 128; + const int dataBufferSize = readBufferSize * 2; + const QString serverName = QLatin1String("myPreciousTestServer"); + LocalServer server; + server.listen(serverName); + QVERIFY(server.isListening()); + + LocalSocket client; + client.setReadBufferSize(readBufferSize); + client.connectToServer(serverName); + + bool timedOut = true; + QVERIFY(server.waitForNewConnection(3000, &timedOut)); + QVERIFY(!timedOut); + + QCOMPARE(client.state(), QLocalSocket::ConnectedState); + QVERIFY(server.hasPendingConnections()); + + QLocalSocket* serverSocket = server.nextPendingConnection(); + char* buffer = (char*)qMalloc(dataBufferSize); + memset(buffer, 0, dataBufferSize); + serverSocket->write(buffer, dataBufferSize); + serverSocket->flush(); + qFree(buffer); + + QVERIFY(client.waitForReadyRead()); + QCOMPARE(client.readAll().size(), dataBufferSize); +} + // QLocalSocket/Server can take a name or path, check that it works as expected void tst_QLocalSocket::fullPath() { -- cgit v0.12 From 16d23fdced8577e9ad015fd9283373761b8464ef Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 1 Jul 2009 11:06:13 +0200 Subject: fast Windows version of QLocalSocket This commit removes the 100 ms polling timer from QLocalSocket and replaces it with proper overlapped IO handling. Reviewed-by: ossi --- src/network/socket/qlocalsocket.h | 1 + src/network/socket/qlocalsocket_p.h | 16 ++- src/network/socket/qlocalsocket_win.cpp | 241 +++++++++++++++++--------------- 3 files changed, 138 insertions(+), 120 deletions(-) diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h index 417671a..4bff62e 100644 --- a/src/network/socket/qlocalsocket.h +++ b/src/network/socket/qlocalsocket.h @@ -134,6 +134,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_notified()) Q_PRIVATE_SLOT(d_func(), void _q_canWrite()) Q_PRIVATE_SLOT(d_func(), void _q_pipeClosed()) + Q_PRIVATE_SLOT(d_func(), void _q_emitReadyRead()) #else Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState)) Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError)) diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h index bdbba42..2dae7d9 100644 --- a/src/network/socket/qlocalsocket_p.h +++ b/src/network/socket/qlocalsocket_p.h @@ -65,6 +65,7 @@ #elif defined(Q_OS_WIN) # include "private/qwindowspipewriter_p.h" # include "private/qringbuffer_p.h" +# include #else # include "private/qnativesocketengine_p.h" # include @@ -135,18 +136,23 @@ public: void _q_notified(); void _q_canWrite(); void _q_pipeClosed(); - qint64 readData(char *data, qint64 maxSize); - qint64 bytesAvailable(); - bool readFromSocket(); + void _q_emitReadyRead(); + DWORD bytesAvailable(); + void startAsyncRead(); + void completeAsyncRead(); + void checkReadyRead(); HANDLE handle; OVERLAPPED overlapped; QWindowsPipeWriter *pipeWriter; qint64 readBufferMaxSize; QRingBuffer readBuffer; - QTimer dataNotifier; + int actualReadBufferSize; + QWinEventNotifier *dataReadNotifier; QLocalSocket::LocalSocketError error; - bool readyReadEmitted; + bool readSequenceStarted; + bool pendingReadyRead; bool pipeClosed; + static const qint64 initialReadBufferSize = 4096; #else QLocalUnixSocket unixSocket; QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const; diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index b1b69fc..1a971f0 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -48,13 +48,13 @@ QT_BEGIN_NAMESPACE -#define NOTIFYTIMEOUT 100 - void QLocalSocketPrivate::init() { Q_Q(QLocalSocket); - QObject::connect(&dataNotifier, SIGNAL(timeout()), q, SLOT(_q_notified())); + memset(&overlapped, 0, sizeof(overlapped)); overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + dataReadNotifier = new QWinEventNotifier(overlapped.hEvent, q); + q->connect(dataReadNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_notified())); } void QLocalSocketPrivate::setErrorString(const QString &function) @@ -101,8 +101,10 @@ QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(), handle(INVALID_HANDLE_VALUE), pipeWriter(0), readBufferMaxSize(0), + actualReadBufferSize(0), error(QLocalSocket::UnknownSocketError), - readyReadEmitted(false), + readSequenceStarted(false), + pendingReadyRead(false), pipeClosed(false), state(QLocalSocket::UnconnectedState) { @@ -176,82 +178,103 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) qint64 QLocalSocket::readData(char *data, qint64 maxSize) { Q_D(QLocalSocket); - if (d->readBuffer.isEmpty()) { - if (!d->readFromSocket()) { - if (d->pipeClosed) - return -1; - return 0; - } - } - - if (!d->dataNotifier.isActive() && d->threadData->eventDispatcher) - d->dataNotifier.start(NOTIFYTIMEOUT); - - if (d->readBuffer.isEmpty()) - return qint64(0); - // If readFromSocket() read data, copy it to its destination. - if (maxSize == 1) { + qint64 readSoFar; + // If startAsyncRead() read data, copy it to its destination. + if (maxSize == 1 && d->actualReadBufferSize > 0) { *data = d->readBuffer.getChar(); - return 1; + d->actualReadBufferSize--; + readSoFar = 1; + } else { + qint64 bytesToRead = qMin(qint64(d->actualReadBufferSize), maxSize); + readSoFar = 0; + while (readSoFar < bytesToRead) { + const char *ptr = d->readBuffer.readPointer(); + int bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar, + qint64(d->readBuffer.nextDataBlockSize())); + memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock); + readSoFar += bytesToReadFromThisBlock; + d->readBuffer.free(bytesToReadFromThisBlock); + d->actualReadBufferSize -= bytesToReadFromThisBlock; + } } - qint64 bytesToRead = qMin(qint64(d->readBuffer.size()), maxSize); - qint64 readSoFar = 0; - while (readSoFar < bytesToRead) { - const char *ptr = d->readBuffer.readPointer(); - int bytesToReadFromThisBlock = qMin(int(bytesToRead - readSoFar), - d->readBuffer.nextDataBlockSize()); - memcpy(data + readSoFar, ptr, bytesToReadFromThisBlock); - readSoFar += bytesToReadFromThisBlock; - d->readBuffer.free(bytesToReadFromThisBlock); - } + if (!d->readSequenceStarted) + d->startAsyncRead(); + d->checkReadyRead(); + return readSoFar; } /*! \internal - read from the socket + Schedules or cancels a readyRead() emission depending on actual data availability */ -qint64 QLocalSocketPrivate::readData(char *data, qint64 maxSize) +void QLocalSocketPrivate::checkReadyRead() { - DWORD bytesRead = 0; - overlapped.Offset = 0; - overlapped.OffsetHigh = 0; - bool success = ReadFile(handle, data, maxSize, &bytesRead, &overlapped); - if (!success && GetLastError() == ERROR_IO_PENDING) - if (GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) - success = true; - if (!success) { - setErrorString(QLatin1String("QLocalSocket::readData")); - return 0; + if (actualReadBufferSize > 0) { + if (!pendingReadyRead) { + Q_Q(QLocalSocket); + QTimer::singleShot(0, q, SLOT(_q_emitReadyRead())); + pendingReadyRead = true; + } + } else { + pendingReadyRead = false; } - return bytesRead; } /*! \internal Reads data from the socket into the readbuffer */ -bool QLocalSocketPrivate::readFromSocket() +void QLocalSocketPrivate::startAsyncRead() { - qint64 bytesToRead = bytesAvailable(); - if (bytesToRead == 0) - return false; + do { + DWORD bytesToRead = bytesAvailable(); + if (bytesToRead == 0) { + // There are no bytes in the pipe but we need to + // start the overlapped read with some buffer size. + bytesToRead = initialReadBufferSize; + } - if (readBufferMaxSize && bytesToRead - > (readBufferMaxSize - readBuffer.size())) - bytesToRead = readBufferMaxSize - readBuffer.size(); + if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) { + bytesToRead = readBufferMaxSize - readBuffer.size(); + if (bytesToRead == 0) { + // Buffer is full. User must read data from the buffer + // before we can read more from the pipe. + return; + } + } - char *ptr = readBuffer.reserve(bytesToRead); - qint64 readBytes = readData(ptr, bytesToRead); - if (readBytes == 0) { - readBuffer.chop(bytesToRead); - return false; + char *ptr = readBuffer.reserve(bytesToRead); + + readSequenceStarted = true; + if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) { + completeAsyncRead(); + } else if (GetLastError() != ERROR_IO_PENDING) { + setErrorString(QLatin1String("QLocalSocketPrivate::startAsyncRead")); + return; + } + } while (!readSequenceStarted); +} + +/*! + \internal + Sets the correct size of the read buffer after a read operation. + */ +void QLocalSocketPrivate::completeAsyncRead() +{ + ResetEvent(overlapped.hEvent); + readSequenceStarted = false; + + DWORD bytesRead; + if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) { + setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead")); + return; } - readyReadEmitted = false; - readBuffer.chop(int(bytesToRead - (readBytes < 0 ? qint64(0) : readBytes))); - return true; + + actualReadBufferSize += bytesRead; + readBuffer.truncate(actualReadBufferSize); } qint64 QLocalSocket::writeData(const char *data, qint64 maxSize) @@ -273,7 +296,7 @@ void QLocalSocket::abort() /*! The number of bytes available from the pipe */ -qint64 QLocalSocketPrivate::bytesAvailable() +DWORD QLocalSocketPrivate::bytesAvailable() { Q_Q(QLocalSocket); if (q->state() != QLocalSocket::ConnectedState) @@ -300,7 +323,7 @@ qint64 QLocalSocket::bytesAvailable() const { Q_D(const QLocalSocket); qint64 available = QIODevice::bytesAvailable(); - available += (qint64) d->readBuffer.size(); + available += (qint64) d->actualReadBufferSize; return available; } @@ -327,7 +350,6 @@ void QLocalSocket::close() QIODevice::close(); d->state = ClosingState; emit stateChanged(d->state); - d->readyReadEmitted = false; emit readChannelFinished(); d->serverName = QString(); d->fullServerName = QString(); @@ -336,10 +358,13 @@ void QLocalSocket::close() disconnectFromServer(); return; } + d->readSequenceStarted = false; + d->pendingReadyRead = false; d->pipeClosed = false; DisconnectNamedPipe(d->handle); CloseHandle(d->handle); d->handle = INVALID_HANDLE_VALUE; + ResetEvent(d->overlapped.hEvent); d->state = UnconnectedState; emit stateChanged(d->state); emit disconnected(); @@ -347,7 +372,6 @@ void QLocalSocket::close() delete d->pipeWriter; d->pipeWriter = 0; } - d->dataNotifier.stop(); } bool QLocalSocket::flush() @@ -381,12 +405,15 @@ bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor, { Q_D(QLocalSocket); d->readBuffer.clear(); + d->actualReadBufferSize = 0; QIODevice::open(openMode); d->handle = (int*)socketDescriptor; d->state = socketState; emit stateChanged(d->state); - if (d->threadData->eventDispatcher) - d->dataNotifier.start(NOTIFYTIMEOUT); + if (d->state == ConnectedState) { + d->startAsyncRead(); + d->checkReadyRead(); + } return true; } @@ -400,20 +427,18 @@ void QLocalSocketPrivate::_q_canWrite() void QLocalSocketPrivate::_q_notified() { Q_Q(QLocalSocket); - if (0 != bytesAvailable()) { - if (readBufferMaxSize == 0 || readBuffer.size() < readBufferMaxSize) { - if (!readFromSocket()) { - return; - } - // wait until buffer is cleared before starting again - if (readBufferMaxSize && readBuffer.size() == readBufferMaxSize) { - dataNotifier.stop(); - } - } - if (!readyReadEmitted) { - readyReadEmitted = true; - q->emit readyRead(); - } + completeAsyncRead(); + startAsyncRead(); + pendingReadyRead = false; + emit q->readyRead(); +} + +void QLocalSocketPrivate::_q_emitReadyRead() +{ + if (pendingReadyRead) { + Q_Q(QLocalSocket); + pendingReadyRead = false; + emit q->readyRead(); } } @@ -448,9 +473,9 @@ bool QLocalSocket::waitForDisconnected(int msecs) return false; QIncrementalSleepTimer timer(msecs); forever { - d->_q_notified(); - if (d->pipeClosed) - close(); + d->bytesAvailable(); // to check if PeekNamedPipe fails + if (d->pipeClosed) + close(); if (state() == UnconnectedState) return true; Sleep(timer.nextSleepTime()); @@ -470,22 +495,24 @@ bool QLocalSocket::isValid() const bool QLocalSocket::waitForReadyRead(int msecs) { Q_D(QLocalSocket); - QIncrementalSleepTimer timer(msecs); - forever { - d->_q_notified(); - if (bytesAvailable() > 0) { - if (!d->readyReadEmitted) { - d->readyReadEmitted = true; - emit readyRead(); - } - return true; - } - Sleep(timer.nextSleepTime()); - if (timer.hasTimedOut()) - break; + if (bytesAvailable() > 0) + return true; + + if (d->state != QLocalSocket::ConnectedState) + return false; + + Q_ASSERT(d->readSequenceStarted); + DWORD result = WaitForSingleObject(d->overlapped.hEvent, msecs == -1 ? INFINITE : msecs); + switch (result) { + case WAIT_OBJECT_0: + d->_q_notified(); + return true; + case WAIT_TIMEOUT: + return false; } + qWarning("QLocalSocket::waitForReadyRead WaitForSingleObject failed with error code %d.", GetLastError()); return false; } @@ -495,27 +522,11 @@ bool QLocalSocket::waitForBytesWritten(int msecs) if (!d->pipeWriter) return false; - QIncrementalSleepTimer timer(msecs); - forever { - if (d->pipeWriter->hadWritten()) - return true; - - if (d->pipeWriter->bytesToWrite() == 0) - return false; - - // Wait for the pipe writer to acknowledge that it has - // written. This will succeed if either the pipe writer has - // already written the data, or if it manages to write data - // within the given timeout. - if (d->pipeWriter->waitForWrite(0)) - return true; - - Sleep(timer.nextSleepTime()); - if (timer.hasTimedOut()) - break; - } - - return false; + // Wait for the pipe writer to acknowledge that it has + // written. This will succeed if either the pipe writer has + // already written the data, or if it manages to write data + // within the given timeout. + return d->pipeWriter->waitForWrite(msecs); } QT_END_NAMESPACE -- cgit v0.12 From 1dd1cb8c70a8986c1acc911a663d99d7043d15c7 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 14:26:57 +0200 Subject: Phonon: Fixed a possible race condition Task-number: 257495 --- src/3rdparty/phonon/ds9/mediaobject.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 26ba8eb..f77bdc1 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -207,12 +207,14 @@ namespace Phonon HRESULT hr = S_OK; - QMutexLocker locker(&m_mutex); - m_currentRender = w.graph; - m_currentRenderId = w.id; - if (w.task == ReplaceGraph) { - HANDLE h; + { + QMutexLocker locker(&m_mutex); + m_currentRender = w.graph; + m_currentRenderId = w.id; + } + if (w.task == ReplaceGraph) { + QMutexLocker locker(&m_mutex); int index = -1; for(int i = 0; i < FILTER_COUNT; ++i) { if (m_graphHandle[i].graph == w.oldGraph) { @@ -228,6 +230,7 @@ namespace Phonon Q_ASSERT(index != -1); //add the new graph + HANDLE h; if (SUCCEEDED(ComPointer(w.graph, IID_IMediaEvent) ->GetEventHandle(reinterpret_cast(&h)))) { m_graphHandle[index].graph = w.graph; @@ -324,8 +327,11 @@ namespace Phonon } } - m_currentRender = Graph(); - m_currentRenderId = 0; + { + QMutexLocker locker(&m_mutex); + m_currentRender = Graph(); + m_currentRenderId = 0; + } } -- cgit v0.12 From 0ed214105547980803336337096fd9429ce9f1a1 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 8 Jul 2009 14:46:59 +0200 Subject: Use current license header. --- src/corelib/kernel/qcore_unix_p.h | 4 ++-- src/network/socket/qnet_unix_p.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 61d8401..1bf2425 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtCore module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index ffd5b39..392c1e2 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** 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. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v0.12 From 0f34ed602bcb00b19b0e550d790ae6521de37aa6 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 14:48:52 +0200 Subject: QMenuBar: the extension could be visible when it shouldn't If you had invisible actions in the menubar, it would always show the extension button --- src/gui/widgets/qmenubar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index caacc58..be6ed67 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -218,7 +218,7 @@ void QMenuBarPrivate::updateGeometries() bool hasHiddenActions = false; for (int i = 0; i < actions.count(); ++i) { const QRect &rect = actionRects.at(i); - if (!menuRect.contains(rect)) { + if (rect.isValid() && !menuRect.contains(rect)) { hasHiddenActions = true; break; } @@ -229,7 +229,7 @@ void QMenuBarPrivate::updateGeometries() menuRect = this->menuRect(true); for (int i = 0; i < actions.count(); ++i) { const QRect &rect = actionRects.at(i); - if (!menuRect.contains(rect)) { + if (rect.isValid() && !menuRect.contains(rect)) { hiddenActions.append(actions.at(i)); } } -- cgit v0.12 From d85d31c50620a215647ab2c3d27636006c04a01d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 8 Jul 2009 14:54:59 +0200 Subject: doc: Output a clearer "All functions in this class are..." statement. Task-number: 189232 --- tools/qdoc3/generator.cpp | 168 +++++++++++++++++++++++++++++++++++----------- tools/qdoc3/generator.h | 4 ++ tools/qdoc3/separator.cpp | 36 ++++++---- tools/qdoc3/separator.h | 1 + 4 files changed, 156 insertions(+), 53 deletions(-) diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 00831d1..e97b7f2 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -68,10 +68,12 @@ QStringList Generator::imageDirs; QString Generator::outDir; QString Generator::project; -static Text stockLink(const QString &target) +static void singularPlural(Text& text, const NodeList& nodes) { - return Text() << Atom(Atom::Link, target) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << target << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + if (nodes.count() == 1) + text << " is"; + else + text << " are"; } Generator::Generator() @@ -775,64 +777,138 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker) { Text text; Text theStockLink; - Node::ThreadSafeness parent = node->parent()->inheritedThreadSafeness(); + Node::ThreadSafeness threadSafeness = node->threadSafeness(); + + Text rlink; + rlink << Atom(Atom::Link,"reentrant") + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << "reentrant" + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); - switch (node->threadSafeness()) { + Text tlink; + tlink << Atom(Atom::Link,"thread-safe") + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << "thread-safe" + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + + switch (threadSafeness) { case Node::UnspecifiedSafeness: break; case Node::NonReentrant: - text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "Warning:" - << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " This " - << typeString(node) << " is not " << stockLink("reentrant") << "." << Atom::ParaRight; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Warning:" + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD) + << " This " + << typeString(node) + << " is not " + << rlink + << "." + << Atom::ParaRight; break; case Node::Reentrant: case Node::ThreadSafe: - text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); - if (parent == Node::ThreadSafe) { - text << "Warning:"; - } else { - text << "Note:"; - } - text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " "; - - if (node->threadSafeness() == Node::ThreadSafe) - theStockLink = stockLink("thread-safe"); - else - theStockLink = stockLink("reentrant"); + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Note:" + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD) + << " "; if (node->isInnerNode()) { - const InnerNode *innerNode = static_cast(node); - text << "All the functions in this " << typeString(node) << " are " - << theStockLink; - - NodeList except; + const InnerNode* innerNode = static_cast(node); + text << "All functions in this " + << typeString(node) + << " are "; + if (threadSafeness == Node::ThreadSafe) + text << tlink; + else + text << rlink; + + bool exceptions = false; + NodeList reentrant; + NodeList threadsafe; + NodeList nonreentrant; NodeList::ConstIterator c = innerNode->childNodes().begin(); while (c != innerNode->childNodes().end()) { - if ((*c)->threadSafeness() != Node::UnspecifiedSafeness) - except.append(*c); + switch ((*c)->threadSafeness()) { + case Node::Reentrant: + reentrant.append(*c); + if (threadSafeness == Node::ThreadSafe) + exceptions = true; + break; + case Node::ThreadSafe: + threadsafe.append(*c); + if (threadSafeness == Node::Reentrant) + exceptions = true; + break; + case Node::NonReentrant: + nonreentrant.append(*c); + exceptions = true; + break; + default: + break; + } ++c; } - if (except.isEmpty()) { + if (!exceptions) text << "."; + else if (threadSafeness == Node::Reentrant) { + if (nonreentrant.isEmpty()) { + if (!threadsafe.isEmpty()) { + text << ", but "; + appendFullNames(text,threadsafe,innerNode,marker); + singularPlural(text,threadsafe); + text << " also " << tlink << "."; + } + else + text << "."; + } + else { + text << ", except for "; + appendFullNames(text,nonreentrant,innerNode,marker); + text << ", which"; + singularPlural(text,nonreentrant); + text << " nonreentrant."; + if (!threadsafe.isEmpty()) { + text << " "; + appendFullNames(text,threadsafe,innerNode,marker); + singularPlural(text,threadsafe); + text << " " << tlink << "."; + } + } } - else { - text << ", except "; - - NodeList::ConstIterator e = except.begin(); - int index = 0; - while (e != except.end()) { - appendFullName(text, *e, innerNode, marker); - text << separator(index++, except.count()); - ++e; + else { // thread-safe + if (!nonreentrant.isEmpty() || !reentrant.isEmpty()) { + text << ", except for "; + if (!reentrant.isEmpty()) { + appendFullNames(text,reentrant,innerNode,marker); + text << ", which"; + singularPlural(text,reentrant); + text << " only " << rlink; + if (!nonreentrant.isEmpty()) + text << ", and "; + } + if (!nonreentrant.isEmpty()) { + appendFullNames(text,nonreentrant,innerNode,marker); + text << ", which"; + singularPlural(text,nonreentrant); + text << " nonreentrant."; + } + text << "."; } } } else { - text << "This " << typeString(node) << " is " << theStockLink << "."; + text << "This " << typeString(node) << " is "; + if (threadSafeness == Node::ThreadSafe) + text << tlink; + else + text << rlink; + text << "."; } text << Atom::ParaRight; } - generateText(text, node, marker); + generateText(text,node,marker); } void Generator::generateSince(const Node *node, CodeMarker *marker) @@ -966,6 +1042,20 @@ void Generator::appendFullName(Text& text, << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); } +void Generator::appendFullNames(Text& text, + const NodeList& nodes, + const Node* relative, + CodeMarker* marker) +{ + NodeList::ConstIterator n = nodes.begin(); + int index = 0; + while (n != nodes.end()) { + appendFullName(text,*n,relative,marker); + text << comma(index++,nodes.count()); + ++n; + } +} + void Generator::appendSortedNames(Text& text, const ClassNode *classe, const QList &classes, diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 08b857b..cdc4c29 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -154,6 +154,10 @@ class Generator const Node *apparentNode, const QString& fullName, const Node *actualNode); + void appendFullNames(Text& text, + const NodeList& nodes, + const Node* relative, + CodeMarker* marker); void appendSortedNames(Text& text, const ClassNode *classe, const QList &classes, diff --git a/tools/qdoc3/separator.cpp b/tools/qdoc3/separator.cpp index 8f27f90..60674be 100644 --- a/tools/qdoc3/separator.cpp +++ b/tools/qdoc3/separator.cpp @@ -48,22 +48,30 @@ QT_BEGIN_NAMESPACE -QString separator( int index, int count ) +QString separator(int index, int count) { - if ( index == count - 1 ) - return tr( ".", "terminator" ); + if (index == count - 1) + return tr(".", "terminator"); + if (count == 2) + return tr(" and ", "separator when N = 2"); + if (index == 0) + return tr(", ", "first separator when N > 2"); + if (index < count - 2) + return tr(", ", "general separator when N > 2"); + return tr(", and ", "last separator when N > 2"); +} - if ( count == 2 ) { - return tr( " and ", "separator when N = 2" ); - } else { - if ( index == 0 ) { - return tr( ", ", "first separator when N > 2" ); - } else if ( index < count - 2 ) { - return tr( ", ", "general separator when N > 2" ); - } else { - return tr( ", and ", "last separator when N > 2" ); - } - } +QString comma(int index, int count) +{ + if (index == count - 1) + return QString(""); + if (count == 2) + return tr(" and ", "separator when N = 2"); + if (index == 0) + return tr(", ", "first separator when N > 2"); + if (index < count - 2) + return tr(", ", "general separator when N > 2"); + return tr(", and ", "last separator when N > 2"); } QT_END_NAMESPACE diff --git a/tools/qdoc3/separator.h b/tools/qdoc3/separator.h index 70ba624..2336d94 100644 --- a/tools/qdoc3/separator.h +++ b/tools/qdoc3/separator.h @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE QString separator( int index, int count ); +QString comma( int index, int count ); QT_END_NAMESPACE -- cgit v0.12 From 48f049d6fbddd60d99fb6ebc15fd5b52a3b515ec Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 8 Jul 2009 16:23:21 +0200 Subject: Update QGroupBox on focus We cannot assume the position of the decorations when a QGroupBox get the focus. Task-number: 257660 Reviewed-by: Thierry --- src/gui/widgets/qgroupbox.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gui/widgets/qgroupbox.cpp b/src/gui/widgets/qgroupbox.cpp index fe882a6..022c377 100644 --- a/src/gui/widgets/qgroupbox.cpp +++ b/src/gui/widgets/qgroupbox.cpp @@ -479,11 +479,7 @@ void QGroupBox::focusInEvent(QFocusEvent *fe) if (focusPolicy() == Qt::NoFocus) { d->_q_fixFocus(fe->reason()); } else { - QStyleOptionGroupBox box; - initStyleOption(&box); - QRect rect = style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this) - | style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxLabel, this); - update(rect); + QWidget::focusInEvent(fe); } } -- cgit v0.12 From e95f4fb1c11795625be8b3b4adc62ed3c520a467 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 16:36:30 +0200 Subject: autotest compile fix for MacOSX --- tests/auto/qfontdialog/tst_qfontdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qfontdialog/tst_qfontdialog.cpp b/tests/auto/qfontdialog/tst_qfontdialog.cpp index 1444ee0..5f1797b 100644 --- a/tests/auto/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/qfontdialog/tst_qfontdialog.cpp @@ -156,7 +156,7 @@ void tst_QFontDialog::setFont() class FriendlyFontDialog : public QFontDialog { - friend tst_QFontDialog; + friend class tst_QFontDialog; Q_DECLARE_PRIVATE(QFontDialog); }; -- cgit v0.12 From c02a9925f10fbf1a4883983f35c735666862a3f6 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 8 Jul 2009 15:48:57 +0200 Subject: Compile fix for the qapplication autotest. Reviewed-by: TrustMe --- tests/auto/qapplication/tst_qapplication.cpp | 68 ++++++++++++++++++---------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp index 85494af..8532723 100644 --- a/tests/auto/qapplication/tst_qapplication.cpp +++ b/tests/auto/qapplication/tst_qapplication.cpp @@ -1820,27 +1820,38 @@ void tst_QApplication::touchEventPropagation() { int argc = 1; QApplication app(argc, &argv0, QApplication::GuiServer); - QTouchEvent::TouchPoint touchPoint(0); - QTouchEvent touchEvent(QEvent::TouchBegin, Qt::NoModifier, QList() << (&touchPoint)); + + QList pressedTouchPoints; + QTouchEvent::TouchPoint press(0); + press.setState(Qt::TouchPointPressed); + pressedTouchPoints << press; + + QList releasedTouchPoints; + QTouchEvent::TouchPoint release(0); + release.setState(Qt::TouchPointReleased); + releasedTouchPoints << release; { // touch event behavior on a window TouchEventPropagationTestWidget window; window.setObjectName("1. window"); - QApplicationPrivate::sendTouchEvent(&window, &touchEvent); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(!window.seenTouchEvent); - QVERIFY(window.seenMouseEvent); + QVERIFY(!window.seenMouseEvent); window.reset(); - window.setAttribute(Qt::WA_AcceptsTouchEvents); - QApplicationPrivate::sendTouchEvent(&window, &touchEvent); + window.setAttribute(Qt::WA_AcceptTouchEvents); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(window.seenTouchEvent); - QVERIFY(window.seenMouseEvent); + QVERIFY(!window.seenMouseEvent); window.reset(); window.acceptTouchEvent = true; - QApplicationPrivate::sendTouchEvent(&window, &touchEvent); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(window.seenTouchEvent); QVERIFY(!window.seenMouseEvent); } @@ -1852,34 +1863,38 @@ void tst_QApplication::touchEventPropagation() TouchEventPropagationTestWidget widget(&window); widget.setObjectName("2. widget"); - QApplicationPrivate::sendTouchEvent(&widget, &touchEvent); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(!widget.seenTouchEvent); - QVERIFY(widget.seenMouseEvent); + QVERIFY(!widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); - QVERIFY(window.seenMouseEvent); + QVERIFY(!window.seenMouseEvent); window.reset(); widget.reset(); - widget.setAttribute(Qt::WA_AcceptsTouchEvents); - QApplicationPrivate::sendTouchEvent(&widget, &touchEvent); + widget.setAttribute(Qt::WA_AcceptTouchEvents); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(widget.seenTouchEvent); - QVERIFY(widget.seenMouseEvent); + QVERIFY(!widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); - QVERIFY(window.seenMouseEvent); + QVERIFY(!window.seenMouseEvent); window.reset(); widget.reset(); widget.acceptMouseEvent = true; - QApplicationPrivate::sendTouchEvent(&widget, &touchEvent); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(widget.seenTouchEvent); - QVERIFY(widget.seenMouseEvent); + QVERIFY(!widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); QVERIFY(!window.seenMouseEvent); window.reset(); widget.reset(); widget.acceptTouchEvent = true; - QApplicationPrivate::sendTouchEvent(&widget, &touchEvent); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(widget.seenTouchEvent); QVERIFY(!widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); @@ -1887,18 +1902,20 @@ void tst_QApplication::touchEventPropagation() window.reset(); widget.reset(); - widget.setAttribute(Qt::WA_AcceptsTouchEvents, false); - window.setAttribute(Qt::WA_AcceptsTouchEvents); - QApplicationPrivate::sendTouchEvent(&widget, &touchEvent); + widget.setAttribute(Qt::WA_AcceptTouchEvents, false); + window.setAttribute(Qt::WA_AcceptTouchEvents); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(!widget.seenTouchEvent); - QVERIFY(widget.seenMouseEvent); + QVERIFY(!widget.seenMouseEvent); QVERIFY(window.seenTouchEvent); - QVERIFY(window.seenMouseEvent); + QVERIFY(!window.seenMouseEvent); window.reset(); widget.reset(); window.acceptTouchEvent = true; - QApplicationPrivate::sendTouchEvent(&widget, &touchEvent); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(!widget.seenTouchEvent); QVERIFY(!widget.seenMouseEvent); QVERIFY(window.seenTouchEvent); @@ -1908,7 +1925,8 @@ void tst_QApplication::touchEventPropagation() widget.reset(); widget.acceptMouseEvent = true; // doesn't matter, touch events are propagated first window.acceptTouchEvent = true; - QApplicationPrivate::sendTouchEvent(&widget, &touchEvent); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); + qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); QVERIFY(!widget.seenTouchEvent); QVERIFY(!widget.seenMouseEvent); QVERIFY(window.seenTouchEvent); -- cgit v0.12 From c2f2b6509fcd91617ae3eb860d6d3f947c5ea443 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 16:34:55 +0200 Subject: QMainWindow: fix the use of animation and improve code quality --- src/gui/widgets/qmainwindowlayout.cpp | 33 +++++++++++----------- src/gui/widgets/qwidgetanimator.cpp | 53 +++++++++++++---------------------- src/gui/widgets/qwidgetanimator_p.h | 4 +-- 3 files changed, 38 insertions(+), 52 deletions(-) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 8fb7c4f..aba9120 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1527,24 +1527,20 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) layoutState.remove(previousPath); pluggingWidget = widget; - if (dockOptions & QMainWindow::AnimatedDocks) { - QRect globalRect = currentGapRect; - globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft())); + QRect globalRect = currentGapRect; + globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft())); #ifndef QT_NO_DOCKWIDGET - if (qobject_cast(widget) != 0) { - QDockWidgetLayout *layout = qobject_cast(widget->layout()); - if (layout->nativeWindowDeco()) { - globalRect.adjust(0, layout->titleHeight(), 0, 0); - } else { - int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget); - globalRect.adjust(-fw, -fw, fw, fw); - } + if (qobject_cast(widget) != 0) { + QDockWidgetLayout *layout = qobject_cast(widget->layout()); + if (layout->nativeWindowDeco()) { + globalRect.adjust(0, layout->titleHeight(), 0, 0); + } else { + int fw = widget->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, widget); + globalRect.adjust(-fw, -fw, fw, fw); } -#endif - widgetAnimator.animate(widget, globalRect, true); - } else { - animationFinished(widget); } +#endif + widgetAnimator.animate(widget, globalRect, dockOptions & QMainWindow::AnimatedDocks); return true; } @@ -1576,9 +1572,11 @@ void QMainWindowLayout::animationFinished(QWidget *widget) tb->d_func()->plug(currentGapRect); #endif - applyState(layoutState, false); #ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_TABBAR + //it is important to set the current tab before applying the layout + //so that applyState will not try to counter the result of the animation + //by putting the item in negative space if (qobject_cast(widget) != 0) { // info() might return null if the widget is destroyed while // animating but before the animationFinished signal is received. @@ -1587,6 +1585,9 @@ void QMainWindowLayout::animationFinished(QWidget *widget) } #endif #endif + + applyState(layoutState, false); + savedState.clear(); currentGapPos.clear(); pluggingWidget = 0; diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index 7a3a464..26cf905 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -76,59 +76,46 @@ void QWidgetAnimator::animationFinished() void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate) { - QRect final_geometry = _final_geometry; - QRect r = widget->geometry(); if (r.right() < 0 || r.bottom() < 0) r = QRect(); -#ifdef QT_NO_ANIMATION - Q_UNUSED(animate); -#else - if (r.isNull() || final_geometry.isNull() || r == final_geometry) - animate = false; + animate = animate && !r.isNull() && !_final_geometry.isNull(); + + // might make the wigdet go away by sending it to negative space + const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry : + QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size()); + if (r == final_geometry) + return; //the widget is already where it should be +#ifndef QT_NO_ANIMATION AnimationMap::const_iterator it = m_animation_map.constFind(widget); if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry) return; - if (animate) { - QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry"); - anim->setDuration(200); - anim->setEasingCurve(QEasingCurve::InOutQuad); - anim->setEndValue(final_geometry); - m_animation_map[widget] = anim; - connect(anim, SIGNAL(finished()), SLOT(animationFinished())); - anim->start(QPropertyAnimation::DeleteWhenStopped); - } else + QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry"); + anim->setDuration(animate ? 200 : 0); + anim->setEasingCurve(QEasingCurve::InOutQuad); + anim->setEndValue(final_geometry); + m_animation_map[widget] = anim; + connect(anim, SIGNAL(finished()), SLOT(animationFinished())); + anim->start(QPropertyAnimation::DeleteWhenStopped); + Q_ASSERT(animate || widget->geometry() == final_geometry); +#else + //we do it in one shot + widget->setGeometry(final_geometry); + m_mainWindowLayout->animationFinished(widget); #endif //QT_NO_ANIMATION - { - if (!final_geometry.isValid() && !widget->isWindow()) { - // Make the wigdet go away by sending it to negative space - QSize s = widget->size(); - final_geometry = QRect(-500 - s.width(), -500 - s.height(), s.width(), s.height()); - } - widget->setGeometry(final_geometry); - } } bool QWidgetAnimator::animating() const { -#ifdef QT_NO_ANIMATION - return false; -#else return !m_animation_map.isEmpty(); -#endif //QT_NO_ANIMATION } bool QWidgetAnimator::animating(QWidget *widget) const { -#ifdef QT_NO_ANIMATION - Q_UNUSED(widget); - return false; -#else return m_animation_map.contains(widget); -#endif //QT_NO_ANIMATION } QT_END_NAMESPACE diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h index 4047395..64697a9 100644 --- a/src/gui/widgets/qwidgetanimator_p.h +++ b/src/gui/widgets/qwidgetanimator_p.h @@ -54,7 +54,6 @@ // #include -#include #include QT_BEGIN_NAMESPACE @@ -77,12 +76,11 @@ public: #ifndef QT_NO_ANIMATION private Q_SLOTS: void animationFinished(); +#endif private: typedef QMap AnimationMap; AnimationMap m_animation_map; -#endif -private: QMainWindowLayout *m_mainWindowLayout; }; -- cgit v0.12 From cf7ca87e057ef3810c5db36ff975a98f532a8dc0 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 8 Jul 2009 17:00:43 +0200 Subject: Make test pass when executed from debug/release directory. --- tests/auto/qchar/tst_qchar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp index 01ba534..512c180 100644 --- a/tests/auto/qchar/tst_qchar.cpp +++ b/tests/auto/qchar/tst_qchar.cpp @@ -500,6 +500,9 @@ void tst_QChar::normalization() } QFile f("NormalizationTest.txt"); + // Windows - current directory is the debug/release subdirectory where the executable is located + if (!f.exists()) + f.setFileName("../NormalizationTest.txt");; if (!f.exists()) { QFAIL("Couldn't find NormalizationTest.txt"); return; -- cgit v0.12 From b358143b7eb5dc3d76a09e501914fa00d0c3876c Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 8 Jul 2009 17:02:23 +0200 Subject: Define M_PI in qmath.h if not defined by math.h (as is the case on Windows), and remove duplicate defines elsewhere. --- src/corelib/kernel/qmath.h | 4 ++++ src/gui/math3d/qmatrix4x4.cpp | 4 ---- src/gui/math3d/qquaternion.cpp | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index 348957f..7a77d56 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -132,6 +132,10 @@ inline qreal qPow(qreal x, qreal y) return pow(x, y); } +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 9fe487b..b998353 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -1004,10 +1004,6 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector) #endif -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - /*! \overload diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 17c4373..9988e2b 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -339,10 +339,6 @@ QVector3D QQuaternion::rotateVector(const QVector3D& vector) const \sa operator*=() */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - #ifndef QT_NO_VECTOR3D /*! -- cgit v0.12 From 1336f8268512a4ad29732acf75f2e6c4d41683ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 7 Jul 2009 10:31:52 +0200 Subject: Reduce QTransform operations in Graphics View. Use the item's cached scene transform directly instead of always making a copy of it. Moreover, we don't have to use the transform at all if the scene transform is a "translate only" transform :-). QTransform already use the same cut-offs, but it must update the type() before it can find out. We don't have to check the type() because that is already stored (and we usually don't call type() when we store the value either). All auto-tests pass. --- src/gui/graphicsview/qgraphicsitem.cpp | 140 +++++++++++++++++++++++++------- src/gui/graphicsview/qgraphicsitem_p.h | 16 +++- src/gui/graphicsview/qgraphicsscene.cpp | 86 +++++++++++++------- src/gui/graphicsview/qgraphicsview.cpp | 7 +- 4 files changed, 188 insertions(+), 61 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 9a27ef5..85d76d4 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -821,6 +821,42 @@ void QGraphicsItemPrivate::combineTransformFromParent(QTransform *x, const QTran } } +void QGraphicsItemPrivate::updateSceneTransformFromParent() +{ + if (parent) { + Q_ASSERT(!parent->d_ptr->dirtySceneTransform); + if (parent->d_ptr->sceneTransformTranslateOnly) { + sceneTransform = QTransform::fromTranslate(parent->d_ptr->sceneTransform.dx() + pos.x(), + parent->d_ptr->sceneTransform.dy() + pos.y()); + } else { + sceneTransform = parent->d_ptr->sceneTransform; + sceneTransform.translate(pos.x(), pos.y()); + } + if (transformData) { + sceneTransform = transformData->computedFullTransform(&sceneTransform); + sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); + } else { + sceneTransformTranslateOnly = parent->d_ptr->sceneTransformTranslateOnly; + } + } else if (!transformData) { + sceneTransform = QTransform::fromTranslate(pos.x(), pos.y()); + sceneTransformTranslateOnly = 1; + } else if (transformData->onlyTransform) { + sceneTransform = transformData->transform; + if (!pos.isNull()) + sceneTransform *= QTransform::fromTranslate(pos.x(), pos.y()); + sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); + } else if (pos.isNull()) { + sceneTransform = transformData->computedFullTransform(); + sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); + } else { + sceneTransform = QTransform::fromTranslate(pos.x(), pos.y()); + sceneTransform = transformData->computedFullTransform(&sceneTransform); + sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate); + } + dirtySceneTransform = 0; +} + /*! \internal @@ -3145,7 +3181,8 @@ void QGraphicsItem::setTransformOrigin(const QPointF &origin) */ QMatrix QGraphicsItem::sceneMatrix() const { - return sceneTransform().toAffine(); + d_ptr->ensureSceneTransform(); + return d_ptr->sceneTransform.toAffine(); } @@ -3168,16 +3205,7 @@ QMatrix QGraphicsItem::sceneMatrix() const */ QTransform QGraphicsItem::sceneTransform() const { - if (d_ptr->dirtySceneTransform) { - // This item and all its descendants have dirty scene transforms. - // We're about to validate this item's scene transform, so we have to - // invalidate all the children; otherwise there's no way for the descendants - // to detect that the ancestor has changed. - d_ptr->invalidateChildrenSceneTransform(); - } - - QGraphicsItem *that = const_cast(this); - d_ptr->ensureSceneTransformRecursive(&that); + d_ptr->ensureSceneTransform(); return d_ptr->sceneTransform; } @@ -3207,8 +3235,10 @@ QTransform QGraphicsItem::sceneTransform() const QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) const { // Ensure we return the standard transform if we're not untransformable. - if (!d_ptr->itemIsUntransformable()) - return sceneTransform() * viewportTransform; + if (!d_ptr->itemIsUntransformable()) { + d_ptr->ensureSceneTransform(); + return d_ptr->sceneTransform * viewportTransform; + } // Find the topmost item that ignores view transformations. const QGraphicsItem *untransformedAncestor = this; @@ -3227,7 +3257,8 @@ QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) c } // First translate the base untransformable item. - QPointF mappedPoint = (untransformedAncestor->sceneTransform() * viewportTransform).map(QPointF(0, 0)); + untransformedAncestor->d_ptr->ensureSceneTransform(); + QPointF mappedPoint = (untransformedAncestor->d_ptr->sceneTransform * viewportTransform).map(QPointF(0, 0)); // COMBINE QTransform matrix = QTransform::fromTranslate(mappedPoint.x(), mappedPoint.y()); @@ -3320,8 +3351,11 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co // Find the closest common ancestor. If the two items don't share an // ancestor, then the only way is to combine their scene transforms. const QGraphicsItem *commonAncestor = commonAncestorItem(other); - if (!commonAncestor) - return sceneTransform() * other->sceneTransform().inverted(ok); + if (!commonAncestor) { + d_ptr->ensureSceneTransform(); + other->d_ptr->ensureSceneTransform(); + return d_ptr->sceneTransform * other->d_ptr->sceneTransform.inverted(ok); + } // If the two items are cousins (in sibling branches), map both to the // common ancestor, and combine the two transforms. @@ -3716,7 +3750,13 @@ QRectF QGraphicsItem::sceneBoundingRect() const QRectF br = boundingRect(); br.translate(offset); - return !parentItem ? br : parentItem->sceneTransform().mapRect(br); + if (!parentItem) + return br; + if (parentItem->d_ptr->hasTranslateOnlySceneTransform()) { + br.translate(parentItem->d_ptr->sceneTransform.dx(), parentItem->d_ptr->sceneTransform.dy()); + return br; + } + return parentItem->d_ptr->sceneTransform.mapRect(br); } /*! @@ -4484,9 +4524,22 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost } // COMBINE my transform with the parent's scene transform. - sceneTransform = parent ? parent->d_ptr->sceneTransform : QTransform(); - combineTransformFromParent(&sceneTransform); - dirtySceneTransform = 0; + updateSceneTransformFromParent(); + Q_ASSERT(!dirtySceneTransform); +} + +void QGraphicsItemPrivate::ensureSceneTransform() +{ + if (dirtySceneTransform) { + // This item and all its descendants have dirty scene transforms. + // We're about to validate this item's scene transform, so we have to + // invalidate all the children; otherwise there's no way for the descendants + // to detect that the ancestor has changed. + invalidateChildrenSceneTransform(); + } + + QGraphicsItem *that = q_func(); + ensureSceneTransformRecursive(&that); } /*! @@ -4827,7 +4880,9 @@ QPointF QGraphicsItem::mapToParent(const QPointF &point) const */ QPointF QGraphicsItem::mapToScene(const QPointF &point) const { - return sceneTransform().map(point); + if (d_ptr->hasTranslateOnlySceneTransform()) + return QPointF(point.x() + d_ptr->sceneTransform.dx(), point.y() + d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.map(point); } /*! @@ -4894,7 +4949,9 @@ QPolygonF QGraphicsItem::mapToParent(const QRectF &rect) const */ QPolygonF QGraphicsItem::mapToScene(const QRectF &rect) const { - return sceneTransform().map(rect); + if (d_ptr->hasTranslateOnlySceneTransform()) + return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.map(rect); } /*! @@ -4967,7 +5024,9 @@ QRectF QGraphicsItem::mapRectToParent(const QRectF &rect) const */ QRectF QGraphicsItem::mapRectToScene(const QRectF &rect) const { - return sceneTransform().mapRect(rect); + if (d_ptr->hasTranslateOnlySceneTransform()) + return rect.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.mapRect(rect); } /*! @@ -5041,7 +5100,9 @@ QRectF QGraphicsItem::mapRectFromParent(const QRectF &rect) const */ QRectF QGraphicsItem::mapRectFromScene(const QRectF &rect) const { - return sceneTransform().inverted().mapRect(rect); + if (d_ptr->hasTranslateOnlySceneTransform()) + return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.inverted().mapRect(rect); } /*! @@ -5093,7 +5154,9 @@ QPolygonF QGraphicsItem::mapToParent(const QPolygonF &polygon) const */ QPolygonF QGraphicsItem::mapToScene(const QPolygonF &polygon) const { - return sceneTransform().map(polygon); + if (d_ptr->hasTranslateOnlySceneTransform()) + return polygon.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.map(polygon); } /*! @@ -5138,7 +5201,9 @@ QPainterPath QGraphicsItem::mapToParent(const QPainterPath &path) const */ QPainterPath QGraphicsItem::mapToScene(const QPainterPath &path) const { - return sceneTransform().map(path); + if (d_ptr->hasTranslateOnlySceneTransform()) + return path.translated(d_ptr->sceneTransform.dx(), d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.map(path); } /*! @@ -5199,7 +5264,9 @@ QPointF QGraphicsItem::mapFromParent(const QPointF &point) const */ QPointF QGraphicsItem::mapFromScene(const QPointF &point) const { - return sceneTransform().inverted().map(point); + if (d_ptr->hasTranslateOnlySceneTransform()) + return QPointF(point.x() - d_ptr->sceneTransform.dx(), point.y() - d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.inverted().map(point); } /*! @@ -5267,7 +5334,9 @@ QPolygonF QGraphicsItem::mapFromParent(const QRectF &rect) const */ QPolygonF QGraphicsItem::mapFromScene(const QRectF &rect) const { - return sceneTransform().inverted().map(rect); + if (d_ptr->hasTranslateOnlySceneTransform()) + return rect.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.inverted().map(rect); } /*! @@ -5317,7 +5386,9 @@ QPolygonF QGraphicsItem::mapFromParent(const QPolygonF &polygon) const */ QPolygonF QGraphicsItem::mapFromScene(const QPolygonF &polygon) const { - return sceneTransform().inverted().map(polygon); + if (d_ptr->hasTranslateOnlySceneTransform()) + return polygon.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.inverted().map(polygon); } /*! @@ -5360,7 +5431,9 @@ QPainterPath QGraphicsItem::mapFromParent(const QPainterPath &path) const */ QPainterPath QGraphicsItem::mapFromScene(const QPainterPath &path) const { - return sceneTransform().inverted().map(path); + if (d_ptr->hasTranslateOnlySceneTransform()) + return path.translated(-d_ptr->sceneTransform.dx(), -d_ptr->sceneTransform.dy()); + return d_ptr->sceneTransform.inverted().map(path); } /*! @@ -6492,7 +6565,12 @@ void QGraphicsItem::prepareGeometryChange() // _q_processDirtyItems is called before _q_emitUpdated. if ((scenePrivate->connectedSignals & scenePrivate->changedSignalMask) || scenePrivate->views.isEmpty()) { - d_ptr->scene->update(sceneTransform().mapRect(boundingRect())); + if (d_ptr->hasTranslateOnlySceneTransform()) { + d_ptr->scene->update(boundingRect().translated(d_ptr->sceneTransform.dx(), + d_ptr->sceneTransform.dy())); + } else { + d_ptr->scene->update(d_ptr->sceneTransform.mapRect(boundingRect())); + } } } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 99865b0..3ba77b7 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -164,6 +164,7 @@ public: ignoreOpacity(0), acceptTouchEvents(0), acceptedTouchBeginEvent(0), + sceneTransformTranslateOnly(0), globalStackingOrder(-1), q_ptr(0) { @@ -194,6 +195,7 @@ public: void combineTransformToParent(QTransform *x, const QTransform *viewTransform = 0) const; void combineTransformFromParent(QTransform *x, const QTransform *viewTransform = 0) const; + void updateSceneTransformFromParent(); // ### Qt 5: Remove. Workaround for reimplementation added after Qt 4.4. virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const; @@ -303,6 +305,13 @@ public: void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF()); void updateCachedClipPathFromSetPosHelper(const QPointF &newPos); void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem); + void ensureSceneTransform(); + + inline bool hasTranslateOnlySceneTransform() + { + ensureSceneTransform(); + return sceneTransformTranslateOnly; + } inline void invalidateChildrenSceneTransform() { @@ -469,7 +478,8 @@ public: quint32 ignoreOpacity : 1; quint32 acceptTouchEvents : 1; quint32 acceptedTouchBeginEvent : 1; - quint32 unused : 10; // feel free to use + quint32 sceneTransformTranslateOnly : 1; + quint32 unused : 9; // feel free to use // Optional stacking order int globalStackingOrder; @@ -500,6 +510,10 @@ struct QGraphicsItemPrivate::TransformData { if (onlyTransform) { if (!postmultiplyTransform) return transform; + if (postmultiplyTransform->isIdentity()) + return transform; + if (transform.isIdentity()) + return *postmultiplyTransform; QTransform x(transform); x *= *postmultiplyTransform; return x; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index bae1afd..ae6c53c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4228,6 +4228,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * QTransform transform(Qt::Uninitialized); QTransform *transformPtr = 0; + bool translateOnlyTransform = false; #define ENSURE_TRANSFORM_PTR \ if (!transformPtr) { \ Q_ASSERT(!itemIsUntransformable); \ @@ -4237,6 +4238,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * transformPtr = &transform; \ } else { \ transformPtr = &item->d_ptr->sceneTransform; \ + translateOnlyTransform = item->d_ptr->sceneTransformTranslateOnly; \ } \ } @@ -4248,10 +4250,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * transform = item->deviceTransform(viewTransform ? *viewTransform : QTransform()); transformPtr = &transform; } else if (item->d_ptr->dirtySceneTransform) { - item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform - : QTransform(); - item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform); - item->d_ptr->dirtySceneTransform = 0; + item->d_ptr->updateSceneTransformFromParent(); + Q_ASSERT(!item->d_ptr->dirtySceneTransform); wasDirtyParentSceneTransform = true; } @@ -4260,7 +4260,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (drawItem) { const QRectF brect = adjustedItemBoundingRect(item); ENSURE_TRANSFORM_PTR - QRect viewBoundingRect = transformPtr->mapRect(brect).toRect(); + QRect viewBoundingRect = translateOnlyTransform ? brect.translated(transformPtr->dx(), transformPtr->dy()).toRect() + : transformPtr->mapRect(brect).toRect(); item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); viewBoundingRect.adjust(-1, -1, 1, 1); drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect) : !viewBoundingRect.isEmpty(); @@ -4416,13 +4417,45 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b } static inline bool updateHelper(QGraphicsViewPrivate *view, QGraphicsItemPrivate *item, - const QRectF &rect, const QTransform &xform) + const QRectF &rect, bool itemIsUntransformable) { Q_ASSERT(view); Q_ASSERT(item); - if (item->hasBoundingRegionGranularity) + + QGraphicsItem *itemq = static_cast(item->q_ptr); + QGraphicsView *viewq = static_cast(view->q_ptr); + + if (itemIsUntransformable) { + const QTransform xform = itemq->deviceTransform(viewq->viewportTransform()); + if (!item->hasBoundingRegionGranularity) + return view->updateRect(xform.mapRect(rect).toRect()); return view->updateRegion(xform.map(QRegion(rect.toRect()))); - return view->updateRect(xform.mapRect(rect).toRect()); + } + + if (item->sceneTransformTranslateOnly && view->identityMatrix) { + const qreal dx = item->sceneTransform.dx(); + const qreal dy = item->sceneTransform.dy(); + if (!item->hasBoundingRegionGranularity) { + QRectF r(rect); + r.translate(dx - view->horizontalScroll(), dy - view->verticalScroll()); + return view->updateRect(r.toRect()); + } + QRegion r(rect.toRect()); + r.translate(qRound(dx) - view->horizontalScroll(), qRound(dy) - view->verticalScroll()); + return view->updateRegion(r); + } + + if (!viewq->isTransformed()) { + if (!item->hasBoundingRegionGranularity) + return view->updateRect(item->sceneTransform.mapRect(rect).toRect()); + return view->updateRegion(item->sceneTransform.map(QRegion(rect.toRect()))); + } + + QTransform xform = item->sceneTransform; + xform *= viewq->viewportTransform(); + if (!item->hasBoundingRegionGranularity) + return view->updateRect(xform.mapRect(rect).toRect()); + return view->updateRegion(xform.map(QRegion(rect.toRect()))); } void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren, @@ -4460,11 +4493,8 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform; const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); if (wasDirtyParentSceneTransform && !itemIsUntransformable) { - // Calculate the full scene transform for this item. - item->d_ptr->sceneTransform = item->d_ptr->parent ? item->d_ptr->parent->d_ptr->sceneTransform - : QTransform(); - item->d_ptr->combineTransformFromParent(&item->d_ptr->sceneTransform); - item->d_ptr->dirtySceneTransform = 0; + item->d_ptr->updateSceneTransformFromParent(); + Q_ASSERT(!item->d_ptr->dirtySceneTransform); } const bool wasDirtyParentViewBoundingRects = item->d_ptr->paintedViewBoundingRectsNeedRepaint; @@ -4479,8 +4509,14 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool if (item->d_ptr->geometryChanged) { // Update growingItemsBoundingRect. - if (!hasSceneRect) - growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); + if (!hasSceneRect) { + if (item->d_ptr->sceneTransformTranslateOnly) { + growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(), + item->d_ptr->sceneTransform.dy()); + } else { + growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); + } + } item->d_ptr->geometryChanged = 0; } @@ -4493,7 +4529,12 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool // This block of code is kept for compatibility. Since 4.5, by default // QGraphicsView does not connect the signal and we use the below // method of delivering updates. - q->update(item->d_ptr->sceneTransform.mapRect(itemBoundingRect)); + if (item->d_ptr->sceneTransformTranslateOnly) { + q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(), + item->d_ptr->sceneTransform.dy())); + } else { + q->update(item->d_ptr->sceneTransform.mapRect(itemBoundingRect)); + } } else { QRectF dirtyRect; bool uninitializedDirtyRect = true; @@ -4536,18 +4577,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool if (dirtyRect.isEmpty()) continue; // Discard updates outside the bounding rect. - bool valid = false; - if (itemIsUntransformable) { - valid = updateHelper(viewPrivate, item->d_ptr, dirtyRect, - item->deviceTransform(view->viewportTransform())); - } else if (!view->isTransformed()) { - valid = updateHelper(viewPrivate, item->d_ptr, dirtyRect, item->d_ptr->sceneTransform); - } else { - QTransform deviceTransform = item->d_ptr->sceneTransform; - deviceTransform *= view->viewportTransform(); - valid = updateHelper(viewPrivate, item->d_ptr, dirtyRect, deviceTransform); - } - if (!valid) + if (!updateHelper(viewPrivate, item->d_ptr, dirtyRect, itemIsUntransformable)) paintedViewBoundingRect = QRect(); } } diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 995f3f3..1e34320 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1864,7 +1864,12 @@ void QGraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRati void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode aspectRatioMode) { QPainterPath path = item->isClipped() ? item->clipPath() : item->shape(); - fitInView(item->sceneTransform().map(path).boundingRect(), aspectRatioMode); + if (item->d_ptr->hasTranslateOnlySceneTransform()) { + path.translate(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy()); + fitInView(path.boundingRect(), aspectRatioMode); + } else { + fitInView(item->d_ptr->sceneTransform.map(path).boundingRect(), aspectRatioMode); + } } /*! -- cgit v0.12 From 8ca44447283deb333591c6354f16f01f30d74e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 7 Jul 2009 18:05:51 +0200 Subject: Reduce QTransform operations in QGraphicsSceneIndex. Update the scene transform and use it directly in the same fashion as we do in processDirtyItemsRecursive/drawSubtreeRecursive. All auto-tests pass --- src/gui/graphicsview/qgraphicssceneindex.cpp | 97 +++++++++++++++++++++------- src/gui/graphicsview/qgraphicssceneindex_p.h | 7 +- 2 files changed, 76 insertions(+), 28 deletions(-) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 5626051..01efde4 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -72,7 +72,7 @@ class QGraphicsSceneIndexRectIntersector : public QGraphicsSceneIndexIntersector { public: bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, - const QTransform &transform, const QTransform &deviceTransform) const + const QTransform &deviceTransform) const { QRectF brect = item->boundingRect(); _q_adjustRect(&brect); @@ -81,8 +81,10 @@ public: Q_UNUSED(exposeRect); bool keep = true; - if (QGraphicsItemPrivate::get(item)->itemIsUntransformable()) { + const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item); + if (itemd->itemIsUntransformable()) { // Untransformable items; map the scene rect to item coordinates. + const QTransform transform = item->deviceTransform(deviceTransform); QRectF itemRect = (deviceTransform * transform.inverted()).mapRect(sceneRect); if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) keep = itemRect.contains(brect) && itemRect != brect; @@ -94,14 +96,23 @@ public: keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); } } else { + Q_ASSERT(!itemd->dirtySceneTransform); + const QRectF itemSceneBoundingRect = itemd->sceneTransformTranslateOnly + ? brect.translated(itemd->sceneTransform.dx(), + itemd->sceneTransform.dy()) + : itemd->sceneTransform.mapRect(brect); if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) - keep = sceneRect.contains(transform.mapRect(brect)) && sceneRect != brect; + keep = sceneRect != brect && sceneRect.contains(itemSceneBoundingRect); else - keep = sceneRect.intersects(transform.mapRect(brect)); + keep = sceneRect.intersects(itemSceneBoundingRect); if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { QPainterPath rectPath; rectPath.addRect(sceneRect); - keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, transform.inverted().map(rectPath), mode); + if (itemd->sceneTransformTranslateOnly) + rectPath.translate(-itemd->sceneTransform.dx(), -itemd->sceneTransform.dy()); + else + rectPath = itemd->sceneTransform.inverted().map(rectPath); + keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, rectPath, mode); } } return keep; @@ -114,7 +125,7 @@ class QGraphicsSceneIndexPointIntersector : public QGraphicsSceneIndexIntersecto { public: bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, - const QTransform &transform, const QTransform &deviceTransform) const + const QTransform &deviceTransform) const { QRectF brect = item->boundingRect(); _q_adjustRect(&brect); @@ -123,8 +134,10 @@ public: Q_UNUSED(exposeRect); bool keep = false; - if (QGraphicsItemPrivate::get(item)->itemIsUntransformable()) { + const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item); + if (itemd->itemIsUntransformable()) { // Untransformable items; map the scene point to item coordinates. + const QTransform transform = item->deviceTransform(deviceTransform); QPointF itemPoint = (deviceTransform * transform.inverted()).map(scenePoint); keep = brect.contains(itemPoint); if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { @@ -133,8 +146,19 @@ public: keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, pointPath, mode); } } else { - QRectF sceneBoundingRect = transform.mapRect(brect); - keep = sceneBoundingRect.intersects(QRectF(scenePoint, QSizeF(1, 1))) && item->contains(transform.inverted().map(scenePoint)); + Q_ASSERT(!itemd->dirtySceneTransform); + QRectF sceneBoundingRect = itemd->sceneTransformTranslateOnly + ? brect.translated(itemd->sceneTransform.dx(), + itemd->sceneTransform.dy()) + : itemd->sceneTransform.mapRect(brect); + keep = sceneBoundingRect.intersects(QRectF(scenePoint, QSizeF(1, 1))); + if (keep) { + QPointF p = itemd->sceneTransformTranslateOnly + ? QPointF(scenePoint.x() - itemd->sceneTransform.dx(), + scenePoint.y() - itemd->sceneTransform.dy()) + : itemd->sceneTransform.inverted().map(scenePoint); + keep = item->contains(p); + } } return keep; @@ -147,7 +171,7 @@ class QGraphicsSceneIndexPathIntersector : public QGraphicsSceneIndexIntersector { public: bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, - const QTransform &transform, const QTransform &deviceTransform) const + const QTransform &deviceTransform) const { QRectF brect = item->boundingRect(); _q_adjustRect(&brect); @@ -156,8 +180,10 @@ public: Q_UNUSED(exposeRect); bool keep = true; - if (QGraphicsItemPrivate::get(item)->itemIsUntransformable()) { + const QGraphicsItemPrivate *itemd = QGraphicsItemPrivate::get(item); + if (itemd->itemIsUntransformable()) { // Untransformable items; map the scene rect to item coordinates. + const QTransform transform = item->deviceTransform(deviceTransform); QPainterPath itemPath = (deviceTransform * transform.inverted()).map(scenePath); if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) keep = itemPath.contains(brect); @@ -166,12 +192,20 @@ public: if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); } else { + Q_ASSERT(!itemd->dirtySceneTransform); + const QRectF itemSceneBoundingRect = itemd->sceneTransformTranslateOnly + ? brect.translated(itemd->sceneTransform.dx(), + itemd->sceneTransform.dy()) + : itemd->sceneTransform.mapRect(brect); if (mode == Qt::ContainsItemShape || mode == Qt::ContainsItemBoundingRect) - keep = scenePath.contains(transform.mapRect(brect)); + keep = scenePath.contains(itemSceneBoundingRect); else - keep = scenePath.intersects(transform.mapRect(brect)); + keep = scenePath.intersects(itemSceneBoundingRect); if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) { - QPainterPath itemPath = transform.inverted().map(scenePath); + QPainterPath itemPath = itemd->sceneTransformTranslateOnly + ? scenePath.translated(-itemd->sceneTransform.dx(), + -itemd->sceneTransform.dy()) + : itemd->sceneTransform.inverted().map(scenePath); keep = QGraphicsSceneIndexPrivate::itemCollidesWithPath(item, itemPath, mode); } } @@ -236,7 +270,6 @@ bool QGraphicsSceneIndexPrivate::itemCollidesWithPath(const QGraphicsItem *item, void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRectF exposeRect, QGraphicsSceneIndexIntersector *intersector, QList *items, - const QTransform &parentTransform, const QTransform &viewTransform, Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity) const @@ -251,16 +284,23 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) return; - // Calculate the full transform for this item. - QTransform transform(parentTransform); - item->d_ptr->combineTransformFromParent(&transform, &viewTransform); + // Update the item's scene transform if dirty. + const bool itemIsUntransformable = item->d_ptr->itemIsUntransformable(); + const bool wasDirtyParentSceneTransform = item->d_ptr->dirtySceneTransform && !itemIsUntransformable; + if (wasDirtyParentSceneTransform) { + item->d_ptr->updateSceneTransformFromParent(); + Q_ASSERT(!item->d_ptr->dirtySceneTransform); + } const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); bool processItem = !itemIsFullyTransparent; if (processItem) { - processItem = intersector->intersect(item, exposeRect, mode, transform, viewTransform); - if (!processItem && (!itemHasChildren || itemClipsChildrenToShape)) + processItem = intersector->intersect(item, exposeRect, mode, viewTransform); + if (!processItem && (!itemHasChildren || itemClipsChildrenToShape)) { + if (wasDirtyParentSceneTransform) + item->d_ptr->invalidateChildrenSceneTransform(); return; + } } // else we know for sure this item has children we must process. int i = 0; @@ -269,17 +309,24 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe item->d_ptr->ensureSortedChildren(); // Clip to shape. - if (itemClipsChildrenToShape) - exposeRect &= transform.map(item->shape()).controlPointRect(); + if (itemClipsChildrenToShape && !itemIsUntransformable) { + QPainterPath mappedShape = item->d_ptr->sceneTransformTranslateOnly + ? item->shape().translated(item->d_ptr->sceneTransform.dx(), + item->d_ptr->sceneTransform.dy()) + : item->d_ptr->sceneTransform.map(item->shape()); + exposeRect &= mappedShape.controlPointRect(); + } // Process children behind for (i = 0; i < item->d_ptr->children.size(); ++i) { QGraphicsItem *child = item->d_ptr->children.at(i); + if (wasDirtyParentSceneTransform) + child->d_ptr->dirtySceneTransform = 1; if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) break; if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) continue; - recursive_items_helper(child, exposeRect, intersector, items, transform, viewTransform, + recursive_items_helper(child, exposeRect, intersector, items, viewTransform, mode, order, opacity); } } @@ -292,9 +339,11 @@ void QGraphicsSceneIndexPrivate::recursive_items_helper(QGraphicsItem *item, QRe if (itemHasChildren) { for (; i < item->d_ptr->children.size(); ++i) { QGraphicsItem *child = item->d_ptr->children.at(i); + if (wasDirtyParentSceneTransform) + child->d_ptr->dirtySceneTransform = 1; if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) continue; - recursive_items_helper(child, exposeRect, intersector, items, transform, viewTransform, + recursive_items_helper(child, exposeRect, intersector, items, viewTransform, mode, order, opacity); } } diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index 6521765..8cf0294 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -137,7 +137,7 @@ public: void recursive_items_helper(QGraphicsItem *item, QRectF exposeRect, QGraphicsSceneIndexIntersector *intersector, QList *items, - const QTransform &parentTransform, const QTransform &viewTransform, + const QTransform &viewTransform, Qt::ItemSelectionMode mode, Qt::SortOrder order, qreal parentOpacity = 1.0) const; inline void items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector *intersector, QList *items, const QTransform &viewTransform, @@ -155,9 +155,8 @@ inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphi { Q_Q(const QGraphicsSceneIndex); const QList tli = q->estimateTopLevelItems(rect, Qt::DescendingOrder); - const QTransform identity; for (int i = 0; i < tli.size(); ++i) - recursive_items_helper(tli.at(i), rect, intersector, items, identity, viewTransform, mode, order); + recursive_items_helper(tli.at(i), rect, intersector, items, viewTransform, mode, order); if (order == Qt::AscendingOrder) { const int n = items->size(); for (int i = 0; i < n / 2; ++i) @@ -171,7 +170,7 @@ public: QGraphicsSceneIndexIntersector() { } virtual ~QGraphicsSceneIndexIntersector() { } virtual bool intersect(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, - const QTransform &transform, const QTransform &deviceTransform) const = 0; + const QTransform &deviceTransform) const = 0; }; #endif // QT_NO_GRAPHICSVIEW -- cgit v0.12 From e1b6cd9170d9a20fd3ee1b8d7ef11dcd3364e16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 8 Jul 2009 12:18:10 +0200 Subject: Optimize QGraphicsViewPrivate::updateRect/updateRegion. We can do QRect::intersects/contains/operator| faster than QRect because we can assume the rects are normalized. Another important factor is our knowledge about the viewport rect, which is always QRect(0, 0, viewport->width(), viewport->height()). Auto-tests included. --- src/gui/graphicsview/qgraphicsview.cpp | 28 ++++-- src/gui/graphicsview/qgraphicsview_p.h | 2 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 115 +++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 1e34320..b2cc478 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -839,13 +839,29 @@ void QGraphicsViewPrivate::processPendingUpdates() dirtyRegion = QRegion(); } +static inline bool intersectsViewport(const QRect &r, int width, int height) +{ return !(r.left() > width) && !(r.right() < 0) && !(r.top() >= height) && !(r.bottom() < 0); } + +static inline bool containsViewport(const QRect &r, int width, int height) +{ return r.left() <= 0 && r.top() <= 0 && r.right() >= width - 1 && r.bottom() >= height - 1; } + +static inline void QRect_unite(QRect *rect, const QRect &other) +{ + if (rect->isEmpty()) { + *rect = other; + } else { + rect->setCoords(qMin(rect->left(), other.left()), qMin(rect->top(), other.top()), + qMax(rect->right(), other.right()), qMax(rect->bottom(), other.bottom())); + } +} + bool QGraphicsViewPrivate::updateRegion(const QRegion &r) { if (fullUpdatePending || viewportUpdateMode == QGraphicsView::NoViewportUpdate || r.isEmpty()) return false; const QRect boundingRect = r.boundingRect(); - if (!boundingRect.intersects(viewport->rect())) + if (!intersectsViewport(boundingRect, viewport->width(), viewport->height())) return false; // Update region outside viewport. switch (viewportUpdateMode) { @@ -854,8 +870,8 @@ bool QGraphicsViewPrivate::updateRegion(const QRegion &r) viewport->update(); break; case QGraphicsView::BoundingRectViewportUpdate: - dirtyBoundingRect |= boundingRect; - if (dirtyBoundingRect.contains(viewport->rect())) { + QRect_unite(&dirtyBoundingRect, boundingRect); + if (containsViewport(dirtyBoundingRect, viewport->width(), viewport->height())) { fullUpdatePending = true; viewport->update(); } @@ -882,7 +898,7 @@ bool QGraphicsViewPrivate::updateRegion(const QRegion &r) bool QGraphicsViewPrivate::updateRect(const QRect &r) { if (fullUpdatePending || viewportUpdateMode == QGraphicsView::NoViewportUpdate - || !r.intersects(viewport->rect())) { + || !intersectsViewport(r, viewport->width(), viewport->height())) { return false; } @@ -892,8 +908,8 @@ bool QGraphicsViewPrivate::updateRect(const QRect &r) viewport->update(); break; case QGraphicsView::BoundingRectViewportUpdate: - dirtyBoundingRect |= r; - if (dirtyBoundingRect.contains(viewport->rect())) { + QRect_unite(&dirtyBoundingRect, r); + if (containsViewport(dirtyBoundingRect, viewport->width(), viewport->height())) { fullUpdatePending = true; viewport->update(); } diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 7b9fd5e..6617622 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE -class QGraphicsViewPrivate : public QAbstractScrollAreaPrivate +class Q_AUTOTEST_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate { Q_DECLARE_PUBLIC(QGraphicsView) public: diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 6db8f27..297c437 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -63,6 +63,7 @@ #include #include #include +#include //TESTED_CLASS= //TESTED_FILES= @@ -175,6 +176,7 @@ private slots: void transformationAnchor(); void resizeAnchor(); void viewportUpdateMode(); + void viewportUpdateMode2(); void acceptDrops(); void optimizationFlags(); void optimizationFlags_dontSavePainterState(); @@ -195,6 +197,8 @@ private slots: void mouseTracking2(); void render(); void exposeRegion(); + void update_data(); + void update(); // task specific tests below me void task172231_untransformableItems(); @@ -2229,6 +2233,52 @@ void tst_QGraphicsView::viewportUpdateMode() QCOMPARE(view.lastUpdateRegions.size(), 0); } +void tst_QGraphicsView::viewportUpdateMode2() +{ + // Create a view with viewport rect equal to QRect(0, 0, 200, 200). + QGraphicsScene dummyScene; + CustomView view; + view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); + view.setScene(&dummyScene); + int left, top, right, bottom; + view.getContentsMargins(&left, &top, &right, &bottom); + view.resize(200 + left + right, 200 + top + bottom); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(300); + const QRect viewportRect = view.viewport()->rect(); + QCOMPARE(viewportRect, QRect(0, 0, 200, 200)); + QGraphicsViewPrivate *viewPrivate = static_cast(qt_widget_private(&view)); + + QRect boundingRect; + const QRect rect1(0, 0, 10, 10); + QVERIFY(viewPrivate->updateRect(rect1)); + QVERIFY(!viewPrivate->fullUpdatePending); + boundingRect |= rect1; + QCOMPARE(viewPrivate->dirtyBoundingRect, boundingRect); + + const QRect rect2(50, 50, 10, 10); + QVERIFY(viewPrivate->updateRect(rect2)); + QVERIFY(!viewPrivate->fullUpdatePending); + boundingRect |= rect2; + QCOMPARE(viewPrivate->dirtyBoundingRect, boundingRect); + + const QRect rect3(190, 190, 10, 10); + QVERIFY(viewPrivate->updateRect(rect3)); + QVERIFY(viewPrivate->fullUpdatePending); + boundingRect |= rect3; + QCOMPARE(viewPrivate->dirtyBoundingRect, boundingRect); + + view.lastUpdateRegions.clear(); + viewPrivate->processPendingUpdates(); + QTest::qWait(50); + QCOMPARE(view.lastUpdateRegions.size(), 1); + // Note that we adjust by 2 for antialiasing. + QCOMPARE(view.lastUpdateRegions.at(0), QRegion(boundingRect.adjusted(-2, -2, 2, 2) & viewportRect)); +} + void tst_QGraphicsView::acceptDrops() { QGraphicsView view; @@ -3351,6 +3401,71 @@ void tst_QGraphicsView::exposeRegion() QCOMPARE(item->paints, 0); } +void tst_QGraphicsView::update_data() +{ + // In view.viewport() coordinates. (viewport rect: QRect(0, 0, 200, 200)) + QTest::addColumn("updateRect"); + QTest::newRow("empty") << QRect(); + QTest::newRow("outside left") << QRect(-200, 0, 100, 100); + QTest::newRow("outside right") << QRect(400, 0 ,100, 100); + QTest::newRow("outside top") << QRect(0, -200, 100, 100); + QTest::newRow("outside bottom") << QRect(0, 400, 100, 100); + QTest::newRow("partially inside left") << QRect(-50, 0, 100, 100); + QTest::newRow("partially inside right") << QRect(-150, 0, 100, 100); + QTest::newRow("partially inside top") << QRect(0, -150, 100, 100); + QTest::newRow("partially inside bottom") << QRect(0, 150, 100, 100); + QTest::newRow("on topLeft edge") << QRect(-100, -100, 100, 100); + QTest::newRow("on topRight edge") << QRect(200, -100, 100, 100); + QTest::newRow("on bottomRight edge") << QRect(200, 200, 100, 100); + QTest::newRow("on bottomLeft edge") << QRect(-200, 200, 100, 100); + QTest::newRow("inside topLeft") << QRect(-99, -99, 100, 100); + QTest::newRow("inside topRight") << QRect(199, -99, 100, 100); + QTest::newRow("inside bottomRight") << QRect(199, 199, 100, 100); + QTest::newRow("inside bottomLeft") << QRect(-199, 199, 100, 100); + QTest::newRow("large1") << QRect(50, -100, 100, 400); + QTest::newRow("large2") << QRect(-100, 50, 400, 100); + QTest::newRow("large3") << QRect(-100, -100, 400, 400); + QTest::newRow("viewport rect") << QRect(0, 0, 200, 200); +} +void tst_QGraphicsView::update() +{ + QFETCH(QRect, updateRect); + + // Create a view with viewport rect equal to QRect(0, 0, 200, 200). + QGraphicsScene dummyScene; + CustomView view; + view.setScene(&dummyScene); + int left, top, right, bottom; + view.getContentsMargins(&left, &top, &right, &bottom); + view.resize(200 + left + right, 200 + top + bottom); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(300); + const QRect viewportRect = view.viewport()->rect(); + QCOMPARE(viewportRect, QRect(0, 0, 200, 200)); + + const bool intersects = updateRect.intersects(viewportRect); + QGraphicsViewPrivate *viewPrivate = static_cast(qt_widget_private(&view)); + QCOMPARE(viewPrivate->updateRect(updateRect), intersects); + QCOMPARE(viewPrivate->updateRegion(updateRect), intersects); + + view.lastUpdateRegions.clear(); + viewPrivate->processPendingUpdates(); + QVERIFY(viewPrivate->dirtyRegion.isEmpty()); + QVERIFY(viewPrivate->dirtyBoundingRect.isEmpty()); + QTest::qWait(50); + if (!intersects) { + QVERIFY(view.lastUpdateRegions.isEmpty()); + } else { + QCOMPARE(view.lastUpdateRegions.size(), 1); + // Note that we adjust by 2 for antialiasing. + QCOMPARE(view.lastUpdateRegions.at(0), QRegion(updateRect.adjusted(-2, -2, 2, 2) & viewportRect)); + } + QVERIFY(!viewPrivate->fullUpdatePending); +} + void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() { QGraphicsView view; -- cgit v0.12 From 34357998f38614a7c724ba4561c0e68b19fffc4a Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 18:19:21 +0200 Subject: Fix possible crash in QDockAreas --- src/gui/widgets/qdockarealayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index b905ccd..ee29b55 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1707,7 +1707,7 @@ QDockAreaLayoutItem &QDockAreaLayoutInfo::item(const QList &path) Q_ASSERT(!path.isEmpty()); const int index = path.first(); if (path.count() > 1) { - const QDockAreaLayoutItem &item = item_list.at(index); + const QDockAreaLayoutItem &item = item_list[index]; Q_ASSERT(item.subinfo != 0); return item.subinfo->item(path.mid(1)); } -- cgit v0.12 From cfacb284593008094136905a2497843a4bbac639 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 8 Jul 2009 18:22:09 +0200 Subject: QPropertyAnimation: save a Q_GLOBAL_STATIC This is possible because we anyway use a Mutex to access the static hash --- src/corelib/animation/qpropertyanimation.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 7526a81..5f224aa 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -100,10 +100,6 @@ QT_BEGIN_NAMESPACE -typedef QPair QPropertyAnimationPair; -typedef QHash QPropertyAnimationHash; -Q_GLOBAL_STATIC(QPropertyAnimationHash, _q_runningAnimations) - void QPropertyAnimationPrivate::updateMetaProperty() { if (!target || propertyName.isEmpty()) @@ -286,19 +282,21 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, QPropertyAnimation *animToStop = 0; { - QPropertyAnimationHash * hash = _q_runningAnimations(); - QMutexLocker locker(QMutexPool::globalInstanceGet(hash)); + QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject)); + typedef QPair QPropertyAnimationPair; + typedef QHash QPropertyAnimationHash; + static QPropertyAnimationHash hash; QPropertyAnimationPair key(d->target, d->propertyName); if (newState == Running) { d->updateMetaProperty(); - animToStop = hash->value(key, 0); - hash->insert(key, this); + animToStop = hash.value(key, 0); + hash.insert(key, this); // update the default start value if (oldState == Stopped) { d->setDefaultStartValue(d->target->property(d->propertyName.constData())); } - } else if (hash->value(key) == this) { - hash->remove(key); + } else if (hash.value(key) == this) { + hash.remove(key); } } -- cgit v0.12 From 5ed43fa92a0110dce36a38853932187287a153b6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Jul 2009 18:26:07 +0200 Subject: Doc: Added information about newer Visual Studio libraries. Reviewed-by: Trust Me As-seen-on: #pyqt (freenode.net) --- doc/src/deployment.qdoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/src/deployment.qdoc b/doc/src/deployment.qdoc index 0866930..1da2c06 100644 --- a/doc/src/deployment.qdoc +++ b/doc/src/deployment.qdoc @@ -715,17 +715,19 @@ \table 100% \header - \o \o VC++ 6.0 \o VC++ 7.1 (2003) \o VC++ 8.0 (2005) + \o \o VC++ 6.0 \o VC++ 7.1 (2003) \o VC++ 8.0 (2005) \o VC++ 9.0 (2008) \row \o The C run-time \o \c msvcrt.dll \o \c msvcr71.dll \o \c msvcr80.dll + \o \c msvcr90.dll \row \o The C++ run-time \o \c msvcp60.dll \o \c msvcp71.dll \o \c msvcp80.dll + \o \c msvcp90.dll \endtable To verify that the application now can be successfully deployed, @@ -893,7 +895,7 @@ \o \l{qt-conf.html}{Using \c qt.conf}. This approach is the recommended if you have executables in different places sharing the same plugins. - + \o Using QApplication::addLibraryPath() or QApplication::setLibraryPaths(). This approach is recommended if you only have one executable that will use the plugin. @@ -902,10 +904,10 @@ hard-coded paths in the QtCore library. \endlist - + If you add a custom path using QApplication::addLibraryPath it could look like this: - + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 54 Then qApp->libraryPaths() would return something like this: -- cgit v0.12 From e6897a209981d86db3b8bc21944bbbb7a10490a6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Jul 2009 18:27:27 +0200 Subject: Doc: Post review fixes to the SQL data types table. Reviewed-by: Trust Me --- doc/src/qsqldatatype-table.qdoc | 123 ++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/doc/src/qsqldatatype-table.qdoc b/doc/src/qsqldatatype-table.qdoc index 5ab6413..567bb65 100644 --- a/doc/src/qsqldatatype-table.qdoc +++ b/doc/src/qsqldatatype-table.qdoc @@ -40,30 +40,28 @@ ****************************************************************************/ /*! - \module QtSql - - \page qsqldatatype-table.html - - \title QtSql Module - Recommended use of data types + \page sql-types.html + \title QtSql Module - Recommended Use of Data Types - \section1 Recommended use of types and widgets in Qt supported Databases + \section1 Recommended Use of Types in Qt Supported Databases This table shows the recommended data types used when extracting data from the databases supported in Qt. It is important to note that the - types used in Qt not necessary are valid as input to the specific - database. One example could be that a double would work perfect as - input for floating point records in a database, but not necessary - as output to the database since it would be stored with 64-bit in C++. + types used in Qt are not necessarily valid as input to the specific + database. One example could be that a double would work perfectly as + input for floating point records in a database, but not necessarily + as a storage format for output from the database since it would be stored + with 64-bit precision in C++. \tableofcontents - \section2 IBM DB2 data type + \section2 IBM DB2 Data Types - \table - \row - \header IBM DB2 data type - \header SQL Type Description - \header Recommended input (C++ data type and Qt ) + \table 90% + \header + \o IBM DB2 data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o SMALLINT \o 16-bit signed integer @@ -124,13 +122,13 @@ \o Mapped to QDateTime \endtable - \section2 Borland InterBase data type + \section2 Borland InterBase Data Types - \table - \row - \header Borland InterBase data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o Borland InterBase data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BOOLEAN \o Boolean @@ -189,13 +187,13 @@ \o Mapped to QDateTime \endtable - \section2 MySQL data type + \section2 MySQL Data Types - \table - \row - \header MySQL data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o MySQL data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o TINYINT \o 8 bit signed integer @@ -290,13 +288,13 @@ \o Mapped to QString \endtable - \section2 Oracle Call Interface data type + \section2 Oracle Call Interface Data Types - \table - \row - \header Oracle Call Interface data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o Oracle Call Interface data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o NUMBER \o FLOAT, DOUBLE, PRECISIONc REAL @@ -338,13 +336,13 @@ \o Mapped to QDateTime \endtable - \section2 ODBC data type + \section2 ODBC Data Types - \table - \row - \header ODBC data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o ODBC data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BIT \o Boolean @@ -407,13 +405,13 @@ \o Mapped to QDateTime \endtable - \section2 PostgreSQL data type + \section2 PostgreSQL Data Types - \table - \row - \header PostgreSQL data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o PostgreSQL data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BOOLEAN \o Boolean @@ -484,13 +482,13 @@ \o Mapped to QDateTime \endtable - \section2 QSQLITE SQLite version 3 data type + \section2 QSQLITE SQLite version 3 Data Types - \table - \row - \header QSQLITE SQLite version 3 data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o QSQLITE SQLite version 3 data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o NULL \o NULL value. @@ -518,13 +516,13 @@ \o Mapped to QByteArray \endtable - \section2 Sybase Adaptive Server data type + \section2 Sybase Adaptive Server Data Types - \table - \row - \header Sybase Adaptive Server data type - \header SQL Type Description - \header Recommended input (C++ data type/Qt Widget) + \table 90% + \header + \o Sybase Adaptive Server data type + \o SQL type description + \o Recommended input (C++ or Qt data type) \row \o BINARY \o Describes a fixed-length binary value up to 255 bytes in size. @@ -535,8 +533,7 @@ \o Mapped to QString \row \o DATETIME - \o Date and time. Range: 1753-01-01 00:00:00 through - 9999-12-31 23:59:59. + \o Date and time. Range: 1753-01-01 00:00:00 through 9999-12-31 23:59:59. \o Mapped to QDateTime \row \o NCHAR @@ -577,8 +574,8 @@ \endtable \section2 SQLite Version 2 - SQLite V.2 is "typeless". This means that you can store any kind of - data you want in any column of any table, regardless of the declared - data type of that column. We recommend that you map the data to QString. + SQLite version 2 is "typeless". This means that you can store any kind of + data you want in any column of any table, regardless of the declared + data type of that column. We recommend that you map the data to QString. */ -- cgit v0.12 From 6e35b15d75aeb140bf56690ce7369f54342c2739 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 9 Jul 2009 08:41:56 +1000 Subject: Make compile --- src/gui/widgets/qwidgetanimator_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/gui/widgets/qwidgetanimator_p.h index 64697a9..5a3e39d 100644 --- a/src/gui/widgets/qwidgetanimator_p.h +++ b/src/gui/widgets/qwidgetanimator_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE class QWidget; class QMainWindowLayout; class QPropertyAnimation; +class QRect; class QWidgetAnimator : public QObject { -- cgit v0.12 From 53228e1b1993524fb1422a8363647b468b3c7c8d Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 9 Jul 2009 09:41:21 +1000 Subject: Hopefully fix isnan/isinf for good (for all platforms) --- src/sql/drivers/psql/qsql_psql.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 33f2e2b..4eccf4b 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -59,21 +59,29 @@ #include #include -#if defined(_MSC_VER) -#include -#define isnan(x) _isnan(x) -int isinf(double x) -{ - if(_fpclass(x) == _FPCLASS_NINF) - return -1; - else if(_fpclass(x) == _FPCLASS_PINF) - return 1; - else return 0; -} -#else #include +// below code taken from an example at http://www.gnu.org/software/hello/manual/autoconf/Function-Portability.html +#ifndef isnan + # define isnan(x) \ + (sizeof (x) == sizeof (long double) ? isnan_ld (x) \ + : sizeof (x) == sizeof (double) ? isnan_d (x) \ + : isnan_f (x)) + static inline int isnan_f (float x) { return x != x; } + static inline int isnan_d (double x) { return x != x; } + static inline int isnan_ld (long double x) { return x != x; } #endif +#ifndef isinf + # define isinf(x) \ + (sizeof (x) == sizeof (long double) ? isinf_ld (x) \ + : sizeof (x) == sizeof (double) ? isinf_d (x) \ + : isinf_f (x)) + static inline int isinf_f (float x) { return isnan (x - x); } + static inline int isinf_d (double x) { return isnan (x - x); } + static inline int isinf_ld (long double x) { return isnan (x - x); } +#endif + + // workaround for postgres defining their OIDs in a private header file #define QBOOLOID 16 #define QINT8OID 20 -- cgit v0.12 From 6cb86a552f4f320b47232ef745ae897ad5ead591 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 9 Jul 2009 10:56:15 +1000 Subject: Remove some left-over mentions of fixed-point in math3d Reviewed-by: trustme --- src/gui/math3d/qmatrix4x4.cpp | 7 +---- src/gui/math3d/qquaternion.cpp | 4 --- src/gui/math3d/qvector2d.cpp | 4 +-- src/gui/math3d/qvector3d.cpp | 4 +-- src/gui/math3d/qvector4d.cpp | 4 --- tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp | 35 +++++++++++------------ tests/auto/math3d/qquaternion/tst_qquaternion.cpp | 4 +-- tests/auto/math3d/qvectornd/tst_qvectornd.cpp | 4 +-- 8 files changed, 23 insertions(+), 43 deletions(-) diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index b998353..88f58c8 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -53,10 +53,6 @@ QT_BEGIN_NAMESPACE \brief The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space. \since 4.6 - The matrix elements are stored internally using the most efficient - numeric representation for the underlying hardware: floating-point - or fixed-point. - \sa QVector3D, QGenericMatrix */ @@ -308,8 +304,7 @@ QMatrix4x4::QMatrix4x4(const QTransform& transform) // The 4x4 matrix inverse algorithm is based on that described at: // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q24 // Some optimization has been done to avoid making copies of 3x3 -// sub-matrices, to do calculations in fixed-point where required, -// and to unroll the loops. +// sub-matrices and to unroll the loops. // Calculate the determinant of a 3x3 sub-matrix. // | A B C | diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 9988e2b..d9d4160 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -55,10 +55,6 @@ QT_BEGIN_NAMESPACE Quaternions are used to represent rotations in 3D space, and consist of a 3D rotation axis specified by the x, y, and z coordinates, and a scalar representing the rotation angle. - - The components of a quaternion are stored internally using the most - efficient representation for the GL rendering engine, which will be - either floating-point or fixed-point. */ /*! diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index 9b5d123..b492aa8 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -57,9 +57,7 @@ QT_BEGIN_NAMESPACE The QVector2D class can also be used to represent vertices in 2D space. We therefore do not need to provide a separate vertex class. - The coordinates are stored internally using the most efficient - representation for the GL rendering engine, which will be either - floating-point or fixed-point. + \sa QVector3D, QVector4D, QQuaternion */ /*! diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 977152a..95550cd 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -61,9 +61,7 @@ QT_BEGIN_NAMESPACE The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class. - The coordinates are stored internally using the most efficient - representation for the GL rendering engine, which will be either - floating-point or fixed-point. + \sa QVector2D, QVector4D, QQuaternion */ /*! diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index a28d2a1..1f7d921 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -57,10 +57,6 @@ QT_BEGIN_NAMESPACE The QVector4D class can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class. - The coordinates are stored internally using the most efficient - representation for the GL rendering engine, which will be either - floating-point or fixed-point. - \sa QQuaternion, QVector2D, QVector3D */ diff --git a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index 7facf4a..d799c1b 100644 --- a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -172,22 +172,22 @@ private slots: private: static void setMatrix(QMatrix2x2& m, const qreal *values); - static void setMatrixFixed(QMatrix2x2& m, const qreal *values); + static void setMatrixDirect(QMatrix2x2& m, const qreal *values); static bool isSame(const QMatrix2x2& m, const qreal *values); static bool isIdentity(const QMatrix2x2& m); static void setMatrix(QMatrix3x3& m, const qreal *values); - static void setMatrixFixed(QMatrix3x3& m, const qreal *values); + static void setMatrixDirect(QMatrix3x3& m, const qreal *values); static bool isSame(const QMatrix3x3& m, const qreal *values); static bool isIdentity(const QMatrix3x3& m); static void setMatrix(QMatrix4x4& m, const qreal *values); - static void setMatrixFixed(QMatrix4x4& m, const qreal *values); + static void setMatrixDirect(QMatrix4x4& m, const qreal *values); static bool isSame(const QMatrix4x4& m, const qreal *values); static bool isIdentity(const QMatrix4x4& m); static void setMatrix(QMatrix4x3& m, const qreal *values); - static void setMatrixFixed(QMatrix4x3& m, const qreal *values); + static void setMatrixDirect(QMatrix4x3& m, const qreal *values); static bool isSame(const QMatrix4x3& m, const qreal *values); static bool isIdentity(const QMatrix4x3& m); }; @@ -321,8 +321,9 @@ void tst_QMatrix::setMatrix(QMatrix4x3& m, const qreal *values) } // Set a matrix to a specified array of values, which are assumed -// to be in row-major order. This sets the values using fixed-point. -void tst_QMatrix::setMatrixFixed(QMatrix2x2& m, const qreal *values) +// to be in row-major order. This sets the values directly into +// the internal data() array. +void tst_QMatrix::setMatrixDirect(QMatrix2x2& m, const qreal *values) { float *data = m.data(); for (int row = 0; row < 2; ++row) { @@ -331,7 +332,7 @@ void tst_QMatrix::setMatrixFixed(QMatrix2x2& m, const qreal *values) } } } -void tst_QMatrix::setMatrixFixed(QMatrix3x3& m, const qreal *values) +void tst_QMatrix::setMatrixDirect(QMatrix3x3& m, const qreal *values) { float *data = m.data(); for (int row = 0; row < 3; ++row) { @@ -340,7 +341,7 @@ void tst_QMatrix::setMatrixFixed(QMatrix3x3& m, const qreal *values) } } } -void tst_QMatrix::setMatrixFixed(QMatrix4x4& m, const qreal *values) +void tst_QMatrix::setMatrixDirect(QMatrix4x4& m, const qreal *values) { float *data = m.data(); for (int row = 0; row < 4; ++row) { @@ -349,7 +350,7 @@ void tst_QMatrix::setMatrixFixed(QMatrix4x4& m, const qreal *values) } } } -void tst_QMatrix::setMatrixFixed(QMatrix4x3& m, const qreal *values) +void tst_QMatrix::setMatrixDirect(QMatrix4x3& m, const qreal *values) { float *data = m.data(); for (int row = 0; row < 3; ++row) { @@ -359,8 +360,8 @@ void tst_QMatrix::setMatrixFixed(QMatrix4x3& m, const qreal *values) } } -// qFuzzyCompare isn't quite "fuzzy" enough to handle conversion -// to fixed-point and back again. So create "fuzzier" compares. +// qFuzzyCompare isn't always "fuzzy" enough to handle conversion +// between float, double, and qreal. So create "fuzzier" compares. static bool fuzzyCompare(float x, float y, qreal epsilon = 0.001) { float diff = x - y; @@ -511,7 +512,7 @@ void tst_QMatrix::create2x2() QVERIFY(!m2.isIdentity()); QMatrix2x2 m3; - setMatrixFixed(m3, uniqueValues2); + setMatrixDirect(m3, uniqueValues2); QVERIFY(isSame(m3, uniqueValues2)); QMatrix2x2 m4(m3); @@ -546,7 +547,7 @@ void tst_QMatrix::create3x3() QVERIFY(!m2.isIdentity()); QMatrix3x3 m3; - setMatrixFixed(m3, uniqueValues3); + setMatrixDirect(m3, uniqueValues3); QVERIFY(isSame(m3, uniqueValues3)); QMatrix3x3 m4(m3); @@ -581,7 +582,7 @@ void tst_QMatrix::create4x4() QVERIFY(!m2.isIdentity()); QMatrix4x4 m3; - setMatrixFixed(m3, uniqueValues4); + setMatrixDirect(m3, uniqueValues4); QVERIFY(isSame(m3, uniqueValues4)); QMatrix4x4 m4(m3); @@ -623,7 +624,7 @@ void tst_QMatrix::create4x3() QVERIFY(!m2.isIdentity()); QMatrix4x3 m3; - setMatrixFixed(m3, uniqueValues4x3); + setMatrixDirect(m3, uniqueValues4x3); QVERIFY(isSame(m3, uniqueValues4x3)); QMatrix4x3 m4(m3); @@ -2961,10 +2962,6 @@ void tst_QMatrix::extractTranslation() QVERIFY(fuzzyCompare(vec.y(), y, epsilon)); QVERIFY(fuzzyCompare(vec.z(), z, epsilon)); - // Have to be careful with numbers here, it is really easy to blow away - // the precision of a fixed pointer number, especially when doing distance - // formula for vector normalization - QMatrix4x4 lookAt; QVector3D eye(1.5f, -2.5f, 2.5f); lookAt.lookAt(eye, diff --git a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp index 395032f..16b87a1 100644 --- a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp @@ -95,8 +95,8 @@ private slots: void nlerp(); }; -// qFuzzyCompare isn't quite "fuzzy" enough to handle conversion -// to fixed-point and back again. So create "fuzzier" compares. +// qFuzzyCompare isn't always "fuzzy" enough to handle conversion +// between float, double, and qreal. So create "fuzzier" compares. static bool fuzzyCompare(float x, float y) { float diff = x - y; diff --git a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp index 0eb5b07..9c1ea83 100644 --- a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp +++ b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp @@ -139,8 +139,8 @@ private slots: void dotProduct4(); }; -// qFuzzyCompare isn't quite "fuzzy" enough to handle conversion -// to fixed-point and back again. So create "fuzzier" compares. +// qFuzzyCompare isn't always "fuzzy" enough to handle conversion +// between float, double, and qreal. So create "fuzzier" compares. static bool fuzzyCompare(float x, float y) { float diff = x - y; -- cgit v0.12 From 3e50d680a37401c05d753982eb5d43c0f1225f63 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 9 Jul 2009 11:11:35 +1000 Subject: Directly copy QGenericMatrix members instead of using qMemCopy() Using qMemCopy limits QGenericMatrix to plain old types like float and double. Copying the values normally will allow copy constructors to work on non plain types. Reviewed-by: trustme --- src/gui/math3d/qgenericmatrix.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index 1131f9b..7bdf70a 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -119,7 +119,9 @@ Q_INLINE_TEMPLATE QGenericMatrix::QGenericMatrix() template Q_INLINE_TEMPLATE QGenericMatrix::QGenericMatrix(const QGenericMatrix& other) { - qMemCopy(m, other.m, sizeof(m)); + for (int col = 0; col < N; ++col) + for (int row = 0; row < M; ++row) + m[col][row] = other.m[col][row]; } template -- cgit v0.12 From 99cda3446c6ff5c3da4fe8fb4bc8869497f8da8b Mon Sep 17 00:00:00 2001 From: Stian Sandvik Thomassen Date: Thu, 9 Jul 2009 13:26:18 +1000 Subject: Plugged possible memory leak in getPSQLVersion() Call PQclear() regardless of the status of the result returned by PQexec(). Reviewed-by: Bill King --- src/sql/drivers/psql/qsql_psql.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 4eccf4b..147cd6d 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -626,10 +626,9 @@ static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection) { QPSQLDriver::Protocol serverVersion = QPSQLDriver::Version6; PGresult* result = PQexec(connection, "select version()"); - int status = PQresultStatus(result); + int status = PQresultStatus(result); if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) { QString val = QString::fromAscii(PQgetvalue(result, 0, 0)); - PQclear(result); QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)")); rx.setMinimal(true); // enforce non-greedy RegExp if (rx.indexIn(val) != -1) { @@ -670,6 +669,7 @@ static QPSQLDriver::Protocol getPSQLVersion(PGconn* connection) } } } + PQclear(result); if (serverVersion < QPSQLDriver::Version71) qWarning("This version of PostgreSQL is not supported and may not work."); -- cgit v0.12 From 5142a27c19fb01ec80010d2d1de12b0e3082751f Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Thu, 9 Jul 2009 13:58:28 +1000 Subject: emit dataChanged() signal Task-number:207874 --- src/sql/models/qsqltablemodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 1acc846..591b506 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -538,6 +538,7 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in isOk = updateRowInTable(index.row(), d->editBuffer); if (isOk) select(); + emit dataChanged(index, index); break; } case OnRowChange: if (index.row() == d->insertIndex) { -- cgit v0.12 From bae8bc5d23946036b2c1079fc6f1b3bceeaa19ca Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 8 Jul 2009 10:18:56 +1000 Subject: Disable private unit tests when Qt is configured without -developer-build, part 1. Adds QT_CONFIG+=private_tests to qconfig.pri when Qt is configured with -developer-build. Reviewed-by: Michael Goddard --- configure | 4 +++- tools/configure/configureapp.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure b/configure index f9b3030..bd8b0ca 100755 --- a/configure +++ b/configure @@ -6256,7 +6256,6 @@ esac # debug release # dll staticlib # -# internal # nocrosscompiler # GNUmake # largefile @@ -6736,6 +6735,9 @@ fi if [ "$PLATFORM_MAC" = "yes" ]; then QT_CONFIG="$QT_CONFIG $CFG_MAC_ARCHS" fi +if [ "$CFG_DEV" = "yes" ]; then + QT_CONFIG="$QT_CONFIG private_tests" +fi # Make the application arch follow the Qt arch for single arch builds. # (for multiple-arch builds, set CONFIG manually in the application .pro file) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index ce9fe6b..80cfc64 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1135,6 +1135,10 @@ void Configure::parseCmdLine() useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++"); + // Allow tests for private classes to be compiled against internal builds + if (dictionary["BUILDDEV"] == "yes") + qtConfig += "private_tests"; + #if !defined(EVAL) for( QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis ) { @@ -1997,7 +2001,6 @@ bool Configure::verifyConfiguration() no-gif gif dll staticlib - internal nocrosscompiler GNUmake largefile -- cgit v0.12 From 87df094ed204c237393eac1dd0b2fb907e642dcb Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 6 Jul 2009 16:40:59 +1000 Subject: Disable private unit tests when Qt is configured without -developer-build, part 2. Some autotests use private (unexported) code, either because they're testing private classes or because that's the easiest way to test the public classes. Configuring Qt with `-developer-build' is needed for these tests. This commit fixes the tests so configuring without `-developer-build' only builds the tests which strictly use public API. --- tests/auto/qcombobox/tst_qcombobox.cpp | 6 ++++ tests/auto/qcssparser/qcssparser.pro | 1 + tests/auto/qfiledialog/tst_qfiledialog.cpp | 18 ++++++++++-- .../auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 2 ++ tests/auto/qgl/qgl.pro | 3 +- tests/auto/qgl/tst_qgl.cpp | 23 ++-------------- .../qhttpnetworkconnection.pro | 2 ++ tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro | 2 ++ .../qitemeditorfactory/tst_qitemeditorfactory.cpp | 10 +++---- tests/auto/qkeysequence/tst_qkeysequence.cpp | 2 +- tests/auto/qmainwindow/tst_qmainwindow.cpp | 6 ++++ .../qnativesocketengine/qnativesocketengine.pro | 2 ++ tests/auto/qnetworkreply/qnetworkreply.pro | 2 ++ tests/auto/qpathclipper/qpathclipper.pro | 2 ++ tests/auto/qplaintextedit/tst_qplaintextedit.cpp | 2 ++ tests/auto/qregion/tst_qregion.cpp | 6 ++-- tests/auto/qsettings/tst_qsettings.cpp | 22 +++++++++++++-- tests/auto/qsharedpointer/qsharedpointer.pro | 1 + tests/auto/qsocketnotifier/qsocketnotifier.pro | 2 ++ .../qsocks5socketengine/qsocks5socketengine.pro | 1 + .../qstandarditemmodel/tst_qstandarditemmodel.cpp | 4 +++ tests/auto/qstatemachine/tst_qstatemachine.cpp | 2 ++ tests/auto/qstylesheetstyle/qstylesheetstyle.pro | 1 + tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 4 +++ tests/auto/qtextedit/tst_qtextedit.cpp | 4 +++ tests/auto/qtextpiecetable/qtextpiecetable.pro | 5 ++-- tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp | 32 +--------------------- tests/auto/qurl/tst_qurl.cpp | 4 +++ .../xmlpatternsdiagnosticsts.pro | 1 + tests/auto/xmlpatternsview/xmlpatternsview.pro | 1 + tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro | 3 ++ tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro | 1 + 32 files changed, 108 insertions(+), 69 deletions(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index c94ace0..67c9ac9 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -1973,6 +1973,7 @@ void tst_QComboBox::task190351_layout() listCombo.showPopup(); QTest::qWait(100); +#ifdef QT_BUILD_INTERNAL QFrame *container = qFindChild(&listCombo); QVERIFY(container); QCOMPARE(static_cast(list), qFindChild(container)); @@ -1980,6 +1981,7 @@ void tst_QComboBox::task190351_layout() QVERIFY(top); QVERIFY(top->isVisible()); QCOMPARE(top->mapToGlobal(QPoint(0, top->height())).y(), list->mapToGlobal(QPoint()).y()); +#endif QApplication::setStyle(oldStyle); #else @@ -2045,6 +2047,7 @@ void tst_QComboBox::task191329_size() tableCombo.showPopup(); QTest::qWait(100); +#ifdef QT_BUILD_INTERNAL QFrame *container = qFindChild(&tableCombo); QVERIFY(container); QCOMPARE(static_cast(table), qFindChild(container)); @@ -2052,6 +2055,7 @@ void tst_QComboBox::task191329_size() //the popup should be large enough to contains everithing so the top and left button are hidden QVERIFY(!button->isVisible()); } +#endif QApplication::setStyle(oldStyle); #else @@ -2107,9 +2111,11 @@ void tst_QComboBox::task248169_popupWithMinimalSize() comboBox.showPopup(); QTest::qWait(100); +#ifdef QT_BUILD_INTERNAL QFrame *container = qFindChild(&comboBox); QVERIFY(container); QVERIFY(desktop.screenGeometry(container).contains(container->geometry())); +#endif } void tst_QComboBox::task247863_keyBoardSelection() diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index 57d6804..723e4d3 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -3,6 +3,7 @@ SOURCES += tst_cssparser.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" QT += xml +requires(contains(QT_CONFIG,private_tests)) wince*: { addFiles.sources = testdata diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index e4fec1d..8bb81e7 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -231,6 +231,7 @@ void tst_QFiledialog::currentChangedSignal() // only emited from the views, sidebar, or lookin combo void tst_QFiledialog::directoryEnteredSignal() { +#if defined QT_BUILD_INTERNAL QNonNativeFileDialog fd(0, "", QDir::root().path()); fd.setOptions(QFileDialog::DontUseNativeDialog); fd.show(); @@ -274,6 +275,7 @@ void tst_QFiledialog::directoryEnteredSignal() QTest::mouseDClick(listView->viewport(), Qt::LeftButton, 0, listView->visualRect(folder).center()); QTRY_COMPARE(spyDirectoryEntered.count(), 1); */ +#endif } Q_DECLARE_METATYPE(QFileDialog::FileMode) @@ -1314,16 +1316,14 @@ void tst_QFiledialog::hooks() void tst_QFiledialog::listRoot() { +#if defined QT_BUILD_INTERNAL QFileInfoGatherer::fetchedRoot = false; QString dir(QDir::currentPath()); QNonNativeFileDialog fd(0, QString(), dir); fd.show(); -#if defined Q_AUTOTEST_EXPORT QCOMPARE(QFileInfoGatherer::fetchedRoot,false); -#endif fd.setDirectory(""); QTest::qWait(500); -#if defined Q_AUTOTEST_EXPORT QCOMPARE(QFileInfoGatherer::fetchedRoot,true); #endif } @@ -1347,6 +1347,7 @@ struct FriendlyQFileDialog : public QFileDialog void tst_QFiledialog::deleteDirAndFiles() { +#if defined QT_BUILD_INTERNAL QString tempPath = QDir::tempPath() + '/' + "QFileDialogTestDir4FullDelete"; QDir dir; QVERIFY(dir.mkpath(tempPath + "/foo")); @@ -1373,6 +1374,7 @@ void tst_QFiledialog::deleteDirAndFiles() QFileInfo info(tempPath); QTest::qWait(2000); QVERIFY(!info.exists()); +#endif } void tst_QFiledialog::filter() @@ -1583,6 +1585,7 @@ QString &dir, const QString &filter) void tst_QFiledialog::task227304_proxyOnFileDialog() { +#if defined QT_BUILD_INTERNAL QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0); fd.setProxyModel(new FilterDirModel(QDir::currentPath())); fd.show(); @@ -1616,6 +1619,7 @@ void tst_QFiledialog::task227304_proxyOnFileDialog() QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center()); QTest::qWait(250); //We shouldn't crash +#endif } void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior() @@ -1727,6 +1731,7 @@ void tst_QFiledialog::task235069_hideOnEscape() void tst_QFiledialog::task236402_dontWatchDeletedDir() { +#if defined QT_BUILD_INTERNAL //THIS TEST SHOULD NOT DISPLAY WARNINGS QDir current = QDir::currentPath(); //make sure it is the first on the list @@ -1746,6 +1751,7 @@ void tst_QFiledialog::task236402_dontWatchDeletedDir() QTest::qWait(200); fd.d_func()->removeDirectory(current.absolutePath() + "/aaaaaaaaaa/"); QTest::qWait(1000); +#endif } void tst_QFiledialog::task203703_returnProperSeparator() @@ -1870,6 +1876,7 @@ void tst_QFiledialog::task218353_relativePaths() void tst_QFiledialog::task251321_sideBarHiddenEntries() { +#if defined QT_BUILD_INTERNAL QNonNativeFileDialog fd; QDir current = QDir::currentPath(); @@ -1899,8 +1906,10 @@ void tst_QFiledialog::task251321_sideBarHiddenEntries() hiddenSubDir.rmdir("happy"); hiddenDir.rmdir("subdir"); current.rmdir(".hidden"); +#endif } +#if defined QT_BUILD_INTERNAL class MyQSideBar : public QSidebar { public : @@ -1918,9 +1927,11 @@ public : model()->removeRow(indexes.at(i).row()); } }; +#endif void tst_QFiledialog::task251341_sideBarRemoveEntries() { +#if defined QT_BUILD_INTERNAL QNonNativeFileDialog fd; QDir current = QDir::currentPath(); @@ -1980,6 +1991,7 @@ void tst_QFiledialog::task251341_sideBarRemoveEntries() QCOMPARE(mySideBar.urls(), expected); current.rmdir("testDir"); +#endif } void tst_QFiledialog::task254490_selectFileMultipleTimes() diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index e415b02..d49083f 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -254,6 +254,7 @@ void tst_QFileSystemModel::naturalCompare_data() void tst_QFileSystemModel::naturalCompare() { +#ifdef QT_BUILD_INTERNAL QFETCH(QString, s1); QFETCH(QString, s2); QFETCH(int, caseSensitive); @@ -271,6 +272,7 @@ void tst_QFileSystemModel::naturalCompare() // created. The scheduler takes its time to recognize ended threads. QTest::qWait(300); #endif +#endif } void tst_QFileSystemModel::readOnly() diff --git a/tests/auto/qgl/qgl.pro b/tests/auto/qgl/qgl.pro index 55e329d..420c4bb 100644 --- a/tests/auto/qgl/qgl.pro +++ b/tests/auto/qgl/qgl.pro @@ -3,7 +3,8 @@ ############################################################ load(qttest_p4) -contains(QT_CONFIG, opengl):QT += opengl +requires(contains(QT_CONFIG,opengl)) +QT += opengl SOURCES += tst_qgl.cpp diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 078c559..96f5ddd 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -44,9 +44,7 @@ #include #include -#ifndef QT_NO_OPENGL #include -#endif #include #include @@ -78,7 +76,6 @@ tst_QGL::~tst_QGL() { } -#ifndef QT_NO_OPENGL class MyGLContext : public QGLContext { public: @@ -96,13 +93,10 @@ public: bool autoBufferSwap() const { return QGLWidget::autoBufferSwap(); } void setAutoBufferSwap(bool on) { QGLWidget::setAutoBufferSwap(on); } }; -#endif + // Testing get/set functions void tst_QGL::getSetCheck() { -#ifdef QT_NO_OPENGL - QSKIP("QGL not yet supported", SkipAll); -#else if (!QGLFormat::hasOpenGL()) QSKIP("QGL not supported on this platform", SkipAll); @@ -246,10 +240,9 @@ void tst_QGL::getSetCheck() QCOMPARE(false, obj3.autoBufferSwap()); obj3.setAutoBufferSwap(true); QCOMPARE(true, obj3.autoBufferSwap()); -#endif } -#ifndef QT_NO_OPENGL +#ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE extern QGLFormat::OpenGLVersionFlags qOpenGLVersionFlagsFromString(const QString &versionString); QT_END_NAMESPACE @@ -257,9 +250,7 @@ QT_END_NAMESPACE void tst_QGL::openGLVersionCheck() { -#ifdef QT_NO_OPENGL - QSKIP("QGL not yet supported", SkipAll); -#else +#ifdef QT_BUILD_INTERNAL if (!QGLFormat::hasOpenGL()) QSKIP("QGL not supported on this platform", SkipAll); @@ -366,9 +357,6 @@ public: void tst_QGL::graphicsViewClipping() { -#ifdef QT_NO_OPENGL - QSKIP("QGL not supported", SkipAll); -#else const int size = 64; UnclippedWidget *widget = new UnclippedWidget; widget->setFixedSize(size, size); @@ -403,7 +391,6 @@ void tst_QGL::graphicsViewClipping() p.end(); QCOMPARE(image, expected); -#endif } void tst_QGL::partialGLWidgetUpdates_data() @@ -420,9 +407,6 @@ void tst_QGL::partialGLWidgetUpdates_data() void tst_QGL::partialGLWidgetUpdates() { -#ifdef QT_NO_OPENGL - QSKIP("QGL not yet supported", SkipAll); -#else if (!QGLFormat::hasOpenGL()) QSKIP("QGL not supported on this platform", SkipAll); @@ -466,7 +450,6 @@ void tst_QGL::partialGLWidgetUpdates() QCOMPARE(widget.paintEventRegion, QRegion(50, 50, 50, 50)); else QCOMPARE(widget.paintEventRegion, QRegion(widget.rect())); -#endif } QTEST_MAIN(tst_QGL) diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro index 3283873..e19d962 100644 --- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -2,4 +2,6 @@ load(qttest_p4) SOURCES += tst_qhttpnetworkconnection.cpp INCLUDEPATH += $$(QTDIR)/src/3rdparty/zlib +requires(contains(QT_CONFIG,private_tests)) + QT = core network diff --git a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro index 2e41fcd..f86250a 100644 --- a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro +++ b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro @@ -2,4 +2,6 @@ load(qttest_p4) SOURCES += tst_qhttpnetworkreply.cpp INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib +requires(contains(QT_CONFIG,private_tests)) + QT = core network diff --git a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp index d9a7d56..e235ff5 100644 --- a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp +++ b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp @@ -59,13 +59,13 @@ void tst_QItemEditorFactory::createEditor() QCOMPARE(w->metaObject()->className(), "QExpandingLineEdit"); } -void tst_QItemEditorFactory::createCustomEditor() +//we make it inherit from QObject so that we can use QPointer +class MyEditor : public QObject, public QStandardItemEditorCreator { - //we make it inherit from QObject so that we can use QPointer - class MyEditor : public QObject, public QStandardItemEditorCreator - { - }; +}; +void tst_QItemEditorFactory::createCustomEditor() +{ QPointer creator = new MyEditor; QPointer creator2 = new MyEditor; diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp index aeb57ef..2e4b850 100644 --- a/tests/auto/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp @@ -270,7 +270,7 @@ void tst_QKeySequence::checkMultipleNames() void tst_QKeySequence::ensureSorted() { //### accessing static members from private classes does not work on msvc at the moment -#ifndef Q_WS_WIN +#if defined(QT_BUILD_INTERNAL) && !defined(Q_WS_WIN) uint N = QKeySequencePrivate::numberOfKeyBindings; uint val = QKeySequencePrivate::keyBindings[0].shortcut; for ( uint i = 1 ; i < N ; ++i) { diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index e46c2e1..6ae7a3e 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -1400,6 +1400,7 @@ void AddDockWidget::apply(QMainWindow *mw) const } } +#ifdef QT_BUILD_INTERNAL struct MoveSeparator { MoveSeparator() {} @@ -1436,6 +1437,7 @@ void MoveSeparator::apply(QMainWindow *mw) const l->layoutState.dockAreaLayout.separatorMove(path, QPoint(0, 0), QPoint(delta, delta)); } +#endif QMap dockWidgetGeometries(QMainWindow *mw) { @@ -1463,6 +1465,7 @@ QMap dockWidgetGeometries(QMainWindow *mw) void tst_QMainWindow::saveRestore_data() { +#ifdef QT_BUILD_INTERNAL QTest::addColumn("addList"); QTest::addColumn("moveList"); @@ -1497,10 +1500,12 @@ void tst_QMainWindow::saveRestore_data() << MoveSeparator(-30, "right1") << MoveSeparator(30, "right2a") ); +#endif } void tst_QMainWindow::saveRestore() { +#ifdef QT_BUILD_INTERNAL QFETCH(AddList, addList); QFETCH(MoveList, moveList); @@ -1570,6 +1575,7 @@ void tst_QMainWindow::saveRestore() mainWindow.show(); COMPARE_DOCK_WIDGET_GEOS(dockWidgetGeos, dockWidgetGeometries(&mainWindow)); } +#endif } void tst_QMainWindow::iconSizeChanged() diff --git a/tests/auto/qnativesocketengine/qnativesocketengine.pro b/tests/auto/qnativesocketengine/qnativesocketengine.pro index 320f24c..ad40d53 100644 --- a/tests/auto/qnativesocketengine/qnativesocketengine.pro +++ b/tests/auto/qnativesocketengine/qnativesocketengine.pro @@ -3,6 +3,8 @@ SOURCES += tst_qnativesocketengine.cpp include(../qnativesocketengine/qsocketengine.pri) +requires(contains(QT_CONFIG,private_tests)) + MOC_DIR=tmp QT = core network diff --git a/tests/auto/qnetworkreply/qnetworkreply.pro b/tests/auto/qnetworkreply/qnetworkreply.pro index 0bcf067..fd8454c 100644 --- a/tests/auto/qnetworkreply/qnetworkreply.pro +++ b/tests/auto/qnetworkreply/qnetworkreply.pro @@ -1,4 +1,6 @@ TEMPLATE = subdirs SUBDIRS = test +requires(contains(QT_CONFIG,private_tests)) + !wince*:SUBDIRS += echo diff --git a/tests/auto/qpathclipper/qpathclipper.pro b/tests/auto/qpathclipper/qpathclipper.pro index 675e463..dc9d60f 100644 --- a/tests/auto/qpathclipper/qpathclipper.pro +++ b/tests/auto/qpathclipper/qpathclipper.pro @@ -3,6 +3,8 @@ INCLUDEPATH += . HEADERS += paths.h SOURCES += tst_qpathclipper.cpp paths.cpp +requires(contains(QT_CONFIG,private_tests)) + unix:!mac:LIBS+=-lm diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp index fceefd2..40ad539 100644 --- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp @@ -1106,6 +1106,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations() QCOMPARE(ed.canInsertCallCount, 0); QCOMPARE(ed.insertCallCount, 0); +#ifdef QT_BUILD_INTERNAL QTextControl *control = qFindChild(&ed); QVERIFY(control); @@ -1120,6 +1121,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations() QCOMPARE(ed.createMimeDataCallCount, 1); QCOMPARE(ed.canInsertCallCount, 1); QCOMPARE(ed.insertCallCount, 1); +#endif } void tst_QPlainTextEdit::shiftEnterShouldInsertLineSeparator() diff --git a/tests/auto/qregion/tst_qregion.cpp b/tests/auto/qregion/tst_qregion.cpp index 3ffa87e..2ad202d 100644 --- a/tests/auto/qregion/tst_qregion.cpp +++ b/tests/auto/qregion/tst_qregion.cpp @@ -96,7 +96,7 @@ private slots: #ifdef Q_OS_WIN void handle(); #endif -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL) void clipRectangles(); #endif @@ -865,7 +865,7 @@ void tst_QRegion::handle() } #endif -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL) void tst_QRegion::clipRectangles() { QRegion region(30, 30, 30, 30); @@ -967,6 +967,7 @@ void tst_QRegion::regionToPath_data() void tst_QRegion::regionToPath() { +#ifdef QT_BUILD_INTERNAL extern QPainterPath qt_regionToPath(const QRegion ®ion); QFETCH(QPainterPath, path); @@ -1002,6 +1003,7 @@ void tst_QRegion::regionToPath() QCOMPARE(ia, ib); QCOMPARE(a.boundingRect(), b.boundingRect()); } +#endif } QTEST_MAIN(tst_QRegion) diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp index f0f446d..77fef1f 100644 --- a/tests/auto/qsettings/tst_qsettings.cpp +++ b/tests/auto/qsettings/tst_qsettings.cpp @@ -713,6 +713,7 @@ void tst_QSettings::testErrorHandling_data() void tst_QSettings::testErrorHandling() { +#ifdef QT_BUILD_INTERNAL #ifdef Q_OS_WIN QSKIP("Windows doesn't support most file modes, including read-only directories, so this test is moot.", SkipAll); #else @@ -776,6 +777,7 @@ void tst_QSettings::testErrorHandling() QCOMPARE((int)settings.status(), statusAfterSetAndSync); } #endif // !Q_OS_WIN +#endif } Q_DECLARE_METATYPE(QVariant) @@ -821,6 +823,7 @@ void tst_QSettings::testIniParsing_data() void tst_QSettings::testIniParsing() { +#ifdef QT_BUILD_INTERNAL qRegisterMetaType("QVariant"); qRegisterMetaType("QSettings::Status"); @@ -854,6 +857,7 @@ void tst_QSettings::testIniParsing() } QCOMPARE(settings.status(), status); +#endif } /* @@ -1058,6 +1062,7 @@ void tst_QSettings::testVariantTypes_data() void tst_QSettings::testVariantTypes() { +#ifdef QT_BUILD_INTERNAL #define testVal(key, val, tp, rtype) \ { \ QSettings settings1(format, QSettings::UserScope, "software.org", "KillerAPP"); \ @@ -1141,6 +1146,7 @@ void tst_QSettings::testVariantTypes() } #undef testVal +#endif } void tst_QSettings::remove() @@ -1801,9 +1807,7 @@ void tst_QSettings::testNormalizedKey_data() void tst_QSettings::testNormalizedKey() { -#ifdef QTEST_REDUCED_EXPORTS - QSKIP("We can't test QSettingsPrivate on Windows", SkipAll); -#else +#ifdef QT_BUILD_INTERNAL QFETCH(QString, inKey); QFETCH(QString, outKey); @@ -1981,6 +1985,7 @@ void tst_QSettings::fromFile() void tst_QSettings::setIniCodec() { +#ifdef QT_BUILD_INTERNAL QByteArray expeContents4, expeContents5; QByteArray actualContents4, actualContents5; @@ -2040,6 +2045,7 @@ void tst_QSettings::setIniCodec() QCOMPARE(settings4.allKeys().first(), settings5.allKeys().first()); QCOMPARE(settings4.value(settings4.allKeys().first()).toString(), settings5.value(settings5.allKeys().first()).toString()); +#endif } static bool containsSubList(QStringList mom, QStringList son) @@ -2316,6 +2322,7 @@ void tst_QSettings::testArrays() settings1.endArray(); } +#ifdef QT_BUILD_INTERNAL static QByteArray iniEscapedKey(const QString &str) { QByteArray result; @@ -2360,6 +2367,7 @@ static QStringList iniUnescapedStringList(const QByteArray &ba) #endif return result; } +#endif QString escapeWeirdChars(const QString &s) { @@ -2383,6 +2391,7 @@ QString escapeWeirdChars(const QString &s) void tst_QSettings::testEscapes() { +#ifdef QT_BUILD_INTERNAL QSettings settings(QSettings::UserScope, "software.org", "KillerAPP"); #define testEscapedKey(plainKey, escKey) \ @@ -2505,6 +2514,7 @@ void tst_QSettings::testEscapes() testBadEscape("@Rect)", "@Rect)"); testBadEscape("@Rect(1 2 3)", "@Rect(1 2 3)"); testBadEscape("@@Rect(1 2 3)", "@Rect(1 2 3)"); +#endif } void tst_QSettings::testCompatFunctions() @@ -3355,6 +3365,7 @@ void tst_QSettings::childGroups_data() void tst_QSettings::childGroups() { +#ifdef QT_BUILD_INTERNAL QFETCH(QSettings::Format, format); { @@ -3408,6 +3419,7 @@ void tst_QSettings::childGroups() QCOMPARE(settings.childGroups(), QStringList() << "alpha" << "gamma" << "omicron" << "zeta"); } +#endif } void tst_QSettings::childKeys_data() @@ -3417,6 +3429,7 @@ void tst_QSettings::childKeys_data() void tst_QSettings::childKeys() { +#ifdef QT_BUILD_INTERNAL QFETCH(QSettings::Format, format); { @@ -3470,6 +3483,7 @@ void tst_QSettings::childKeys() QCOMPARE(settings.childKeys(), QStringList() << "alpha" << "beta" << "gamma"); } +#endif } void tst_QSettings::allKeys_data() @@ -3479,6 +3493,7 @@ void tst_QSettings::allKeys_data() void tst_QSettings::allKeys() { +#ifdef QT_BUILD_INTERNAL QFETCH(QSettings::Format, format); QStringList allKeys; @@ -3527,6 +3542,7 @@ void tst_QSettings::allKeys() QCOMPARE(settings.allKeys(), allKeys); } +#endif } void tst_QSettings::registerFormat() diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/qsharedpointer/qsharedpointer.pro index 30c81cb..90fde06 100644 --- a/tests/auto/qsharedpointer/qsharedpointer.pro +++ b/tests/auto/qsharedpointer/qsharedpointer.pro @@ -4,5 +4,6 @@ SOURCES += tst_qsharedpointer.cpp \ forwarddeclared.cpp QT = core DEFINES += SRCDIR=\\\"$$PWD/\\\" +requires(contains(QT_CONFIG,private_tests)) include(externaltests.pri) HEADERS += forwarddeclared.h diff --git a/tests/auto/qsocketnotifier/qsocketnotifier.pro b/tests/auto/qsocketnotifier/qsocketnotifier.pro index 10ed3a5..ec924c1 100644 --- a/tests/auto/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/qsocketnotifier/qsocketnotifier.pro @@ -2,6 +2,8 @@ load(qttest_p4) SOURCES += tst_qsocketnotifier.cpp QT = core network +requires(contains(QT_CONFIG,private_tests)) + include(../qnativesocketengine/qsocketengine.pri) diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro index 2949ee2..d19b732 100644 --- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro @@ -11,3 +11,4 @@ QT = core network +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp index fa44034..fba7b1b 100644 --- a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -1454,6 +1454,7 @@ static QStandardItem *itemFromText(QStandardItem *parent, const QString &text) return item; } +#ifdef QT_BUILD_INTERNAL static QModelIndex indexFromText(QStandardItemModel *model, const QString &text) { QStandardItem *item = itemFromText(model->invisibleRootItem(), text); @@ -1467,9 +1468,11 @@ struct FriendlyTreeView : public QTreeView friend class tst_QStandardItemModel; Q_DECLARE_PRIVATE(QTreeView) }; +#endif void tst_QStandardItemModel::treeDragAndDrop() { +#ifdef QT_BUILD_INTERNAL const int nRow = 5; const int nCol = 3; @@ -1605,6 +1608,7 @@ void tst_QStandardItemModel::treeDragAndDrop() QVERIFY(compareModels(&model, &checkModel)); } +#endif } void tst_QStandardItemModel::removeRowsAndColumns() diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index a859866..efcb983 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1015,6 +1015,7 @@ void tst_QStateMachine::rootState() void tst_QStateMachine::addAndRemoveState() { +#ifdef QT_BUILD_INTERNAL QStateMachine machine; QStatePrivate *root_d = QStatePrivate::get(machine.rootState()); QCOMPARE(root_d->childStates().size(), 0); @@ -1075,6 +1076,7 @@ void tst_QStateMachine::addAndRemoveState() delete s2; // ### how to deal with this? // machine.removeState(machine.errorState()); +#endif } void tst_QStateMachine::stateEntryAndExit() diff --git a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro index 6acb0b4..f6101f4 100644 --- a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro @@ -13,3 +13,4 @@ contains(QT_CONFIG, qt3support): QT += qt3support # Input SOURCES += tst_qstylesheetstyle.cpp RESOURCES += resources.qrc +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index 7b62eae..3f658ec 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -625,9 +625,11 @@ void tst_QSvgRenderer::testGzLoading() QVERIFY(autoDetectGzData.isValid()); } +#ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE QByteArray qt_inflateGZipDataFrom(QIODevice *device); QT_END_NAMESPACE +#endif void tst_QSvgRenderer::testGzHelper_data() { @@ -660,6 +662,7 @@ void tst_QSvgRenderer::testGzHelper_data() void tst_QSvgRenderer::testGzHelper() { +#ifdef QT_BUILD_INTERNAL QFETCH(QByteArray, in); QFETCH(QByteArray, out); @@ -668,6 +671,7 @@ void tst_QSvgRenderer::testGzHelper() QVERIFY(buffer.isReadable()); QByteArray result = qt_inflateGZipDataFrom(&buffer); QCOMPARE(result, out); +#endif } #endif diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index 3bc1517..d54645c 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -1460,6 +1460,7 @@ void tst_QTextEdit::mimeDataReimplementations() QCOMPARE(ed.canInsertCallCount, 0); QCOMPARE(ed.insertCallCount, 0); +#ifdef QT_BUILD_INTERNAL QTextControl *control = qFindChild(&ed); QVERIFY(control); @@ -1474,6 +1475,7 @@ void tst_QTextEdit::mimeDataReimplementations() QCOMPARE(ed.createMimeDataCallCount, 1); QCOMPARE(ed.canInsertCallCount, 1); QCOMPARE(ed.insertCallCount, 1); +#endif } void tst_QTextEdit::ctrlEnterShouldInsertLineSeparator_NOT() @@ -2066,6 +2068,7 @@ void tst_QTextEdit::cursorRect() void tst_QTextEdit::setDocumentPreservesPalette() { +#ifdef QT_BUILD_INTERNAL QTextControl *control = qFindChild(ed); QVERIFY(control); @@ -2085,6 +2088,7 @@ void tst_QTextEdit::setDocumentPreservesPalette() QVERIFY(control->document() == newDoc); QVERIFY(whitePal.color(QPalette::Active, QPalette::Text) == control->palette().color(QPalette::Active, QPalette::Text)); +#endif } class PublicTextEdit : public QTextEdit diff --git a/tests/auto/qtextpiecetable/qtextpiecetable.pro b/tests/auto/qtextpiecetable/qtextpiecetable.pro index 318a8c7..0926b83 100644 --- a/tests/auto/qtextpiecetable/qtextpiecetable.pro +++ b/tests/auto/qtextpiecetable/qtextpiecetable.pro @@ -2,7 +2,6 @@ load(qttest_p4) SOURCES += tst_qtextpiecetable.cpp HEADERS += ../qtextdocument/common.h -!win32:DEFINES += QTEST_REDUCED_EXPORTS - - +requires(!win32) +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp index accbabb..0e60c16 100644 --- a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp +++ b/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp @@ -42,9 +42,7 @@ #include -#ifdef QTEST_REDUCED_EXPORTS #define private public -#endif #include #include @@ -65,7 +63,6 @@ public: tst_QTextPieceTable(); -#ifdef QTEST_REDUCED_EXPORTS public slots: void init(); void cleanup(); @@ -112,13 +109,7 @@ private slots: void removeFrameDirect(); void removeWithChildFrame(); void clearWithFrames(); -#else -public slots: - void init(); - void cleanup(); -private slots: - void skip(); -#endif + private: QTextDocument *doc; QTextDocumentPrivate *table; @@ -130,8 +121,6 @@ tst_QTextPieceTable::tst_QTextPieceTable() { doc = 0; table = 0; } -#ifdef QTEST_REDUCED_EXPORTS - void tst_QTextPieceTable::init() { doc = new QTextDocument(0); @@ -1148,25 +1137,6 @@ void tst_QTextPieceTable::clearWithFrames() QVERIFY(true); } -#else // QTEST_REDUCED_EXPORTS - -void tst_QTextPieceTable::init() -{ -} - -void tst_QTextPieceTable::cleanup() -{ -} - -void tst_QTextPieceTable::skip() -{ - QSKIP( "Not tested on win32", SkipAll ); -} - - -#endif // QTEST_REDUCED_EXPORTS - - QTEST_MAIN(tst_QTextPieceTable) diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index ea551da..723f882 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -3057,12 +3057,15 @@ void tst_QUrl::nameprep_testsuite_data() << QString() << 0 << 0; } +#ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE extern QString qt_nameprep(const QString &source); QT_END_NAMESPACE +#endif void tst_QUrl::nameprep_testsuite() { +#ifdef QT_BUILD_INTERNAL QFETCH(QString, in); QFETCH(QString, out); QFETCH(QString, profile); @@ -3082,6 +3085,7 @@ void tst_QUrl::nameprep_testsuite() QEXPECT_FAIL("Larger test (expanding)", "Investigate further", Continue); QCOMPARE(qt_nameprep(in), out); +#endif } void tst_QUrl::ace_testsuite_data() diff --git a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro index e90b335..3d82eaf 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro +++ b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro @@ -2,3 +2,4 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS = ../xmlpatternsxqts test +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/xmlpatternsview/xmlpatternsview.pro b/tests/auto/xmlpatternsview/xmlpatternsview.pro index 3544264..04ee4d0 100644 --- a/tests/auto/xmlpatternsview/xmlpatternsview.pro +++ b/tests/auto/xmlpatternsview/xmlpatternsview.pro @@ -6,3 +6,4 @@ SUBDIRS = ../xmlpatternsxqts test contains(QT_CONFIG,xmlpatterns) { SUBDIRS += view } +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro index 368a028..a3b13da 100644 --- a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro +++ b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro @@ -9,3 +9,6 @@ contains(QT_CONFIG,xmlpatterns) { # Needed on the win32-g++ setup and on the test machine arsia. INCLUDEPATH += $$QT_BUILD_TREE/include/QtXmlPatterns/private \ ../../../include/QtXmlPatterns/private + +requires(contains(QT_CONFIG,private_tests)) + diff --git a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro index 4a688c4..9b63a52 100644 --- a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro +++ b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro @@ -23,3 +23,4 @@ wince*: { DEPLOYMENT += testdata } +requires(contains(QT_CONFIG,private_tests)) -- cgit v0.12 From 21b32a69fc4607e60677b978fbcdc6424cc4f63b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 9 Jul 2009 14:36:26 +1000 Subject: New configure.exe. Includes: 9b532a999944c70c2e8f57d9156c1887867ad9f1 - qtlibinfix bb8e25a5074a378d5003577fefbeabb1de846a81 - cetest fix 5ea86cfac34f65b2321ceeeb651e4e7099bf59a0 - QT_WA removal 349997b5c4167b07d0bdc55beff175b39f3abe75 - spelling fix bae8bc5d23946036b2c1079fc6f1b3bceeaa19ca - QT_CONFIG+=private_tests --- configure.exe | Bin 835584 -> 1101312 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index a139116..10b926e 100644 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 458c547aefcb529fe807a220109e2a7ce6bd9105 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 9 Jul 2009 16:51:41 +1000 Subject: Improved cetest error reporting. Now, if you try to run an unsigned test on a locked device, you'll get: "Error invoking qRemoteLaunch on \Windows\QtRemote.dll: Invalid Signature. (0x80090006)" Instead of what you would previously get: "Error: Could not execute target file" --- tools/qtestlib/wince/cetest/activesyncconnection.cpp | 12 ++++++++---- tools/qtestlib/wince/cetest/remoteconnection.cpp | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp index 0f98619..1080477 100644 --- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp +++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp @@ -385,10 +385,14 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo DWORD error = 0; HRESULT res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0); if (S_OK != res) { - if (S_OK != CeGetLastError()) - debugOutput(QString::fromLatin1("Error: Could not invoke method on QtRemote"),1); - else - debugOutput(QString::fromLatin1("Error: QtRemote return unexpectedly with error Code %1").arg(res), 1); + DWORD ce_error = CeGetLastError(); + if (S_OK != ce_error) { + qWarning("Error invoking %s on %s: %s", qPrintable(functionName), + qPrintable(dllLocation), strwinerror(ce_error).constData()); + } else { + qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName), + qPrintable(dllLocation), res); + } } else { DWORD written; int strSize = program.length(); diff --git a/tools/qtestlib/wince/cetest/remoteconnection.cpp b/tools/qtestlib/wince/cetest/remoteconnection.cpp index 75788e2..3d0c3f3 100644 --- a/tools/qtestlib/wince/cetest/remoteconnection.cpp +++ b/tools/qtestlib/wince/cetest/remoteconnection.cpp @@ -66,8 +66,8 @@ QByteArray strwinerror(DWORD errorcode) out.chop(2); /* Append error number to error message for good measure */ - out.append(" ("); - out.append(QByteArray::number((int)errorcode)); + out.append(" (0x"); + out.append(QByteArray::number(uint(errorcode), 16).rightJustified(8, '0')); out.append(")"); } return out; -- cgit v0.12 From c365e7e91feab7d07653e0086ba297bb1f8a6234 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 9 Jul 2009 17:03:58 +1000 Subject: Let cetest return nonzero when it fails to run a test. --- tools/qtestlib/wince/cetest/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp index ba3ef8d..782f6d9 100644 --- a/tools/qtestlib/wince/cetest/main.cpp +++ b/tools/qtestlib/wince/cetest/main.cpp @@ -320,6 +320,7 @@ int main(int argc, char **argv) cout << endl << "Remote Launch:" << qPrintable(TestConfiguration::remoteExecutable) << " " << qPrintable(launchArguments.join(" ")) << endl; if (!connection.execute(TestConfiguration::remoteExecutable, launchArguments.join(" "), timeout)) { cout << "Error: Could not execute target file" << endl; + return -1; } -- cgit v0.12 From 13bc92c6c9c0b1b7b6c9915848175a77ec082a85 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 8 Jul 2009 16:02:55 -0700 Subject: Pass the device arg to the keyboard drivers. We didn't use to pass the device in to the keyboard handlers rendering them mostly useless. Reviewed-by: TrustMe --- src/plugins/kbddrivers/sl5000/main.cpp | 3 +-- src/plugins/kbddrivers/usb/main.cpp | 3 +-- src/plugins/kbddrivers/vr41xx/main.cpp | 3 +-- src/plugins/kbddrivers/yopy/main.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/kbddrivers/sl5000/main.cpp b/src/plugins/kbddrivers/sl5000/main.cpp index 4d61266..cc68747 100644 --- a/src/plugins/kbddrivers/sl5000/main.cpp +++ b/src/plugins/kbddrivers/sl5000/main.cpp @@ -66,10 +66,9 @@ QStringList QSL5000KbdDriver::keys() const QWSKeyboardHandler* QSL5000KbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("SL5000"), Qt::CaseInsensitive)) return 0; - return new QWSSL5000KeyboardHandler(driver); + return new QWSSL5000KeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwssl5000kbddriver, QSL5000KbdDriver) diff --git a/src/plugins/kbddrivers/usb/main.cpp b/src/plugins/kbddrivers/usb/main.cpp index 8f49366..38d460c 100644 --- a/src/plugins/kbddrivers/usb/main.cpp +++ b/src/plugins/kbddrivers/usb/main.cpp @@ -66,10 +66,9 @@ QStringList QUsbKbdDriver::keys() const QWSKeyboardHandler* QUsbKbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("Usb"), Qt::CaseInsensitive)) return 0; - return new QWSUsbKeyboardHandler(driver); + return new QWSUsbKeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwsusbkbddriver, QUsbKbdDriver) diff --git a/src/plugins/kbddrivers/vr41xx/main.cpp b/src/plugins/kbddrivers/vr41xx/main.cpp index 2cba1f7..c9ba4d7 100644 --- a/src/plugins/kbddrivers/vr41xx/main.cpp +++ b/src/plugins/kbddrivers/vr41xx/main.cpp @@ -66,10 +66,9 @@ QStringList QVr41xxKbdDriver::keys() const QWSKeyboardHandler* QVr41xxKbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("VR41xx"), Qt::CaseInsensitive)) return 0; - return new QWSVr41xxKeyboardHandler(driver); + return new QWSVr41xxKeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwsvr41xxkbddriver, QVr41xxKbdDriver) diff --git a/src/plugins/kbddrivers/yopy/main.cpp b/src/plugins/kbddrivers/yopy/main.cpp index bfddabe..7079d88 100644 --- a/src/plugins/kbddrivers/yopy/main.cpp +++ b/src/plugins/kbddrivers/yopy/main.cpp @@ -66,10 +66,9 @@ QStringList QYopyKbdDriver::keys() const QWSKeyboardHandler* QYopyKbdDriver::create(const QString &driver, const QString &device) { - Q_UNUSED(device); if (driver.compare(QLatin1String("Yopy"), Qt::CaseInsensitive)) return 0; - return new QWSYopyKeyboardHandler(driver); + return new QWSYopyKeyboardHandler(device); } Q_EXPORT_PLUGIN2(qwsyopykbddriver, QYopyKbdDriver) -- cgit v0.12 From dc2b39a866190e302eed171381c2c0384e152800 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Jul 2009 09:25:30 +0200 Subject: qdoc: Removed unnecessary error report/rule qdoc reported an error if you used \section2 on its owin, i.e. with no outer \section1. While strictly speaking correct, it imposed an unnecessary restriction, e.g. sometimes you just want to use \section2 to get a smaller title for a section. --- tools/qdoc3/doc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 222b9a1..d5aca0e 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -1677,10 +1677,13 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd) leavePara(); if (currentSectioningUnit == Doc::Book) { +#if 0 + // mws didn't think this was necessary. if (unit > Doc::Section1) location().warning(tr("Unexpected '\\%1' without '\\%2'") .arg(cmdName(cmd)) .arg(cmdName(CMD_SECTION1))); +#endif currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); priv->constructExtra(); priv->extra->sectioningUnit = currentSectioningUnit; -- cgit v0.12 From d0a36a9e33937066866ef1ecfde3eaecd578d0b7 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 9 Jul 2009 10:37:26 +0200 Subject: Add QT_END_HEADER to fix compile on PowerPC Mac and make autotest pass. --- src/corelib/tools/qstring.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 6bb0d8e..235c603 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -1235,6 +1235,8 @@ inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef QT_END_NAMESPACE +QT_END_HEADER + #ifdef QT_USE_FAST_CONCATENATION #include #endif -- cgit v0.12 From 015946b60c991593d28cd1d9383f0eb7e8c30334 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 9 Jul 2009 10:40:13 +0200 Subject: Remove unneeded assert. Triggered on Designer startup on Linux. Acked-by: Thierry Bastian --- src/gui/widgets/qwidgetanimator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/gui/widgets/qwidgetanimator.cpp index 26cf905..1a93b51 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/gui/widgets/qwidgetanimator.cpp @@ -100,7 +100,6 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo m_animation_map[widget] = anim; connect(anim, SIGNAL(finished()), SLOT(animationFinished())); anim->start(QPropertyAnimation::DeleteWhenStopped); - Q_ASSERT(animate || widget->geometry() == final_geometry); #else //we do it in one shot widget->setGeometry(final_geometry); -- cgit v0.12 From def00d15449551cd2e98b1f3f5b4199ad8be92c2 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 9 Jul 2009 12:14:38 +0200 Subject: autotest fix On the font from the font dialog, we can only test family, size and style --- tests/auto/qfontdialog/tst_qfontdialog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/qfontdialog/tst_qfontdialog.cpp b/tests/auto/qfontdialog/tst_qfontdialog.cpp index 5f1797b..cbdd440 100644 --- a/tests/auto/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/qfontdialog/tst_qfontdialog.cpp @@ -170,8 +170,12 @@ void tst_QFontDialog::task256466_wrongStyle() for (int i = 0; i < familyList->model()->rowCount(); ++i) { QModelIndex currentFamily = familyList->model()->index(i, 0); familyList->setCurrentIndex(currentFamily); - QCOMPARE(dialog.currentFont(), fdb.font(currentFamily.data().toString(), - styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt())); + const QFont current = dialog.currentFont(), + expected = fdb.font(currentFamily.data().toString(), + styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt()); + QCOMPARE(current.family(), expected.family()); + QCOMPARE(current.style(), expected.style()); + QCOMPARE(current.pointSizeF(), expected.pointSizeF()); } } -- cgit v0.12 From ce770ef755e2dae405ea3c91bd0dedda2f267716 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 9 Jul 2009 10:52:50 +0200 Subject: QRingBuffer micro optimization --- src/corelib/tools/qringbuffer_p.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index f3daca7..008c068 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -303,6 +303,9 @@ public: // read an unspecified amount (will read the first buffer) inline QByteArray read() { + if (bufferSize == 0) + return QByteArray(); + // multiple buffers, just take the first one if (head == 0 && tailBuffer != 0) { QByteArray qba = buffers.takeFirst(); @@ -325,7 +328,7 @@ public: // We can avoid by initializing the QRingBuffer with basicBlockSize of 0 // and only using this read() function. QByteArray qba(readPointer(), nextDataBlockSize()); - buffers.takeFirst(); + buffers.removeFirst(); head = 0; if (tailBuffer == 0) { buffers << QByteArray(); -- cgit v0.12 From cdedc4374b02c0c291c110fd03c77eb6cd1ce69d Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 2 Jul 2009 13:42:09 +0200 Subject: QNAM: httpDownloadPerformance auto test Reviewed-by: Peter Hartmann --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 126 +++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 0dd3cd1..18919a7 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -219,6 +219,9 @@ private Q_SLOTS: void proxyChange(); void authorizationError_data(); void authorizationError(); + + void httpDownloadPerformance_data(); + void httpDownloadPerformance(); }; QT_BEGIN_NAMESPACE @@ -3066,5 +3069,128 @@ void tst_QNetworkReply::authorizationError() QCOMPARE(QString(reply->readAll()), httpBody); } +class HttpDownloadPerformanceClient : QObject { + Q_OBJECT; + QIODevice *device; + public: + HttpDownloadPerformanceClient (QIODevice *dev) : device(dev){ + connect(dev, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + } + + public slots: + void readyReadSlot() { + device->readAll(); + } + +}; + +class HttpDownloadPerformanceServer : QObject { + Q_OBJECT; + qint64 dataSize; + qint64 dataSent; + QTcpServer server; + QTcpSocket *client; + bool serverSendsContentLength; + bool chunkedEncoding; + +public: + HttpDownloadPerformanceServer (qint64 ds, bool sscl, bool ce) : dataSize(ds), dataSent(0), + client(0), serverSendsContentLength(sscl), chunkedEncoding(ce) { + server.listen(); + connect(&server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot())); + } + + int serverPort() { + return server.serverPort(); + } + +public slots: + + void newConnectionSlot() { + client = server.nextPendingConnection(); + client->setParent(this); + connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot(qint64))); + } + + void readyReadSlot() { + client->readAll(); + client->write("HTTP/1.0 200 OK\n"); + if (serverSendsContentLength) + client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii()); + if (chunkedEncoding) + client->write(QString("Transfer-Encoding: chunked\n").toAscii()); + client->write("Connection: close\n\n"); + } + + void bytesWrittenSlot(qint64 amount) { + if (dataSent == dataSize && client) { + // close eventually + + // chunked encoding: we have to send a last "empty" chunk + if (chunkedEncoding) + client->write(QString("0\r\n\r\n").toAscii()); + + client->disconnectFromHost(); + server.close(); + client = 0; + return; + } + + // send data + if (client && client->bytesToWrite() < 100*1024 && dataSent < dataSize) { + qint64 amount = qMin(qint64(16*1024), dataSize - dataSent); + QByteArray data(amount, '@'); + + if (chunkedEncoding) { + client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii()); + client->write(data.constData(), amount); + client->write(QString("\r\n").toAscii()); + } else { + client->write(data.constData(), amount); + } + + dataSent += amount; + } + } +}; + +void tst_QNetworkReply::httpDownloadPerformance_data() +{ + QTest::addColumn("serverSendsContentLength"); + QTest::addColumn("chunkedEncoding"); + + QTest::newRow("Server sends no Content-Length") << false << false; + QTest::newRow("Server sends Content-Length") << true << false; + QTest::newRow("Server uses chunked encoding") << false << true; + +} + +void tst_QNetworkReply::httpDownloadPerformance() +{ + QFETCH(bool, serverSendsContentLength); + QFETCH(bool, chunkedEncoding); + + enum {UploadSize = 1000*1024*1024}; // 1000 MB + HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding); + + QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1")); + QNetworkReply* reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + HttpDownloadPerformanceClient client(reply); + + QTime time; + time.start(); + QTestEventLoop::instance().enterLoop(40); + QVERIFY(!QTestEventLoop::instance().timeout()); + + qint64 elapsed = time.elapsed(); + qWarning() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " + << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; + + delete reply; +} + QTEST_MAIN(tst_QNetworkReply) #include "tst_qnetworkreply.moc" -- cgit v0.12 From bdb6d461f4889e38296c859446283c0f9397dbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 9 Jul 2009 11:08:48 +0200 Subject: Rendering artifacts when hiding a QGraphicsItem. The problem was that update() followed by hide() didn't work as expected because the update() caused all sub-sequent update requests to be discareded. This is correct, however, we have to make sure the ignoreVisible/ignoreOpacity bit is set properly; we won't process a hidden item otherwise. Auto-test included. --- src/gui/graphicsview/qgraphicsscene.cpp | 10 ++++++++++ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index ae6c53c..0ca72b7 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4358,6 +4358,16 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b /*ignoreVisibleBit=*/force, /*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren, /*ignoreOpacity=*/ignoreOpacity)) { + if (item->d_ptr->dirty) { + // The item is already marked as dirty and will be processed later. However, + // we have to make sure ignoreVisible and ignoreOpacity are set properly; + // otherwise things like: item->update(); item->hide() (force is now true) + // won't work as expected. + if (force) + item->d_ptr->ignoreVisible = 1; + if (ignoreOpacity) + item->d_ptr->ignoreOpacity = 1; + } return; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 3f7a50b..d689293 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6625,6 +6625,17 @@ void tst_QGraphicsItem::update() qApp->processEvents(); QCOMPARE(item->repaints, 0); QCOMPARE(view.repaints, 0); + + // Make sure the area occupied by an item is repainted when hiding it. + view.reset(); + item->repaints = 0; + item->update(); // Full update; all sub-sequent update requests are discarded. + item->hide(); // visible set to 0. ignoreVisible must be set to 1; the item won't be processed otherwise. + qApp->processEvents(); + QCOMPARE(item->repaints, 0); + QCOMPARE(view.repaints, 1); + // The entire item's bounding rect (adjusted for antialiasing) should have been painted. + QCOMPARE(view.paintedRegion, expectedRegion); } void tst_QGraphicsItem::setTransformProperties_data() -- cgit v0.12 From 259575734a52c27018f26e1f7c857ae25a27d39a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Jul 2009 11:35:56 +0200 Subject: doc: Clarified the meanings in Qt for reentrant and thread-safe. Task-number: 189232 --- doc/src/threads.qdoc | 82 ++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/doc/src/threads.qdoc b/doc/src/threads.qdoc index 9f7f857..e3da0d4 100644 --- a/doc/src/threads.qdoc +++ b/doc/src/threads.qdoc @@ -262,48 +262,41 @@ \keyword thread-safe \section1 Reentrancy and Thread-Safety - Throughout the Qt documentation, the terms \e reentrant and \e - thread-safe are used to specify how a function can be used in - multithreaded applications: + Throughout the documentation, the terms \e{reentrant} and + \e{thread-safe} are used to mark classes and functions to indicate + how they can be used in multithread applications: \list - \o A \e reentrant function can be called simultaneously by - multiple threads provided that each invocation of the function - references unique data. - \o A \e thread-safe function can be called simultaneously by - multiple threads when each invocation references shared data. - All access to the shared data is serialized. + \o A \e thread-safe function can be called simultaneously from + multiple threads, even when the invocations use shared data, + because all references to the shared data are serialized. + \o A \e reentrant function can also be called simultaneously from + multiple threads, but only if each invocation uses its own data. \endlist - By extension, a class is said to be reentrant if each and every - one of its functions can be called simultaneously by multiple - threads on different instances of the class. Similarly, the class - is said to be thread-safe if the functions can be called by - different threads on the same instance. + Hence, a \e{thread-safe} function is always \e{reentrant}, but a + \e{reentrant} function is not always \e{thread-safe}. - Classes in the documentation will be documented as thread-safe only - if they are intended to be used by multiple threads. + By extension, a class is said to be \e{reentrant} if its member + functions can be called safely from multiple threads as long as + each thread uses a \e{different} instance of the class. The class + is \e{thread-safe} if its member functions can be called safely + from multiple threads, even if all the threads use the \e{same} + instance of the class. - Note that the terminology in this domain isn't entirely - standardized. POSIX uses a somewhat different definition of - reentrancy and thread-safety for its C APIs. When dealing with an - object-oriented C++ class library such as Qt, the definitions - must be adapted. - - Most C++ classes are inherently reentrant, since they typically - only reference member data. Any thread can call such a member - function on an instance of the class, as long as no other thread - is calling a member function on the same instance. For example, - the \c Counter class below is reentrant: + C++ classes are often reentrant, simply because they only access + their own member data. Any thread can call a member function on an + instance of a reentrant class, as long as no other thread can call + a member function on the \e{same} instance of the class at the + same time. For example, the \c Counter class below is reentrant: \snippet doc/src/snippets/threads/threads.cpp 3 \snippet doc/src/snippets/threads/threads.cpp 4 The class isn't thread-safe, because if multiple threads try to modify the data member \c n, the result is undefined. This is - because C++'s \c ++ and \c -- operators aren't necessarily - atomic. Indeed, they usually expand to three machine - instructions: + because the \c ++ and \c -- operators aren't always atomic. + Indeed, they usually expand to three machine instructions: \list 1 \o Load the variable's value in a register. @@ -332,14 +325,27 @@ declared with the \c mutable qualifier because we need to lock and unlock the mutex in \c value(), which is a const function. - Most Qt classes are reentrant and not thread-safe, to avoid the - overhead of repeatedly locking and unlocking a QMutex. For - example, QString is reentrant, meaning that you can use it in - different threads, but you can't access the same QString object - from different threads simultaneously (unless you protect it with - a mutex yourself). A few classes and functions are thread-safe; - these are mainly thread-related classes such as QMutex, or - fundamental functions such as QCoreApplication::postEvent(). + Most Qt classes are \e{reentrant}, but they are not made + \e{thread-safe}, because making them thread-safe would incur the + extra overhead of repeatedly locking and unlocking a QMutex. For + example, QString is reentrant but not thread-safe. You can safely + access \e{different} instances of QString from multiple threads + simultaneously, but you can't access the \e{same} instance of + QString from multiple threads simultaneously (unless you protect + the accesses yourself with a QMutex). + + Some Qt classes and functions are thread-safe. These are mainly + the thread-related classes (e.g. QMutex) and fundamental functions + (e.g. QCoreApplication::postEvent()). + + \note Qt Classes are only documented as \e{thread-safe} if they + are intended to be used by multiple threads. + + \note Terminology in the multithreading domain isn't entirely + standardized. POSIX uses definitions of reentrant and thread-safe + that are somewhat different for its C APIs. When using other + object-oriented C++ class libraries with Qt, be sure the + definitions in use are understood. \section1 Threads and QObjects -- cgit v0.12 From d64754db278e9fe07dbd6c8b7d297600a10d3ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 8 Jul 2009 19:21:37 +0200 Subject: Stop showing then hiding windows on starting designer in top-level mode Kind of like f37bd111f7622a34b3a7bd63f5a82f6042dc0f0d, but the real thing. The widget box wasn't showing on Linux when switching to top-level mode. Incidentally, this was the main window there... Reviewed-by: Friedemann Kleint After some persuasion the Cat also came to see things this way. --- tools/designer/src/designer/qdesigner_workbench.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp index ce8dde6..5f8d2a9 100644 --- a/tools/designer/src/designer/qdesigner_workbench.cpp +++ b/tools/designer/src/designer/qdesigner_workbench.cpp @@ -462,7 +462,6 @@ void QDesignerWorkbench::switchToTopLevelMode() // make sure that the widgetbox is visible if it is different from neutral. QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow(); Q_ASSERT(widgetBoxWrapper); - const bool needWidgetBoxWrapperVisible = widgetBoxWrapper->action()->isChecked(); switchToNeutralMode(); const QPoint desktopOffset = desktopGeometry().topLeft(); @@ -501,9 +500,6 @@ void QDesignerWorkbench::switchToTopLevelMode() found_visible_window |= tw->isVisible(); } - if (needWidgetBoxWrapperVisible) - widgetBoxWrapper->action()->trigger(); - if (!m_toolWindows.isEmpty() && !found_visible_window) m_toolWindows.first()->show(); -- cgit v0.12 From ed99255e8e998ef3f51de22b31c76107bb9aa0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 9 Jul 2009 10:55:37 +0200 Subject: Designer: Restore Widget box title when switching to docked mode Reviewed-by: Friedemann Kleint --- tools/designer/src/designer/qdesigner_workbench.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/designer/src/designer/qdesigner_workbench.cpp b/tools/designer/src/designer/qdesigner_workbench.cpp index 5f8d2a9..c9d9fc4 100644 --- a/tools/designer/src/designer/qdesigner_workbench.cpp +++ b/tools/designer/src/designer/qdesigner_workbench.cpp @@ -410,6 +410,12 @@ void QDesignerWorkbench::switchToDockedMode() switchToNeutralMode(); +#ifndef Q_WS_MAC + QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow(); + widgetBoxWrapper->action()->setVisible(true); + widgetBoxWrapper->setWindowTitle(tr("Widget Box")); +#endif + m_mode = DockedMode; const QDesignerSettings settings(m_core); m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows); -- cgit v0.12 From 14ef40f9b96c5afea9d08701a2a1856388349f9e Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 3 Jul 2009 16:32:26 +0200 Subject: Use 'struct QConcatenable' instead of 'class QConcatenable' to make compiler distinguishing both happy. --- src/corelib/tools/qstringbuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 852c072..4d6b64b 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -69,7 +69,7 @@ private: }; -template class QConcatenable {}; +template struct QConcatenable {}; template class QStringBuilder -- cgit v0.12 From 6574240d8ea657d02c3d5bf5567da7d28f42d69b Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 9 Jul 2009 12:40:22 +0200 Subject: QHttpNetworkReply: Cache isChunked Cache return value of expensive function. Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkreply.cpp | 6 +++++- src/network/access/qhttpnetworkreply_p.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 483589b..7a616aa 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -201,6 +201,7 @@ bool QHttpNetworkReply::isFinished() const QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) : QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100), majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0), + chunkedTransferEncoding(0), currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), autoDecompress(false), responseData(0), requestIsPrepared(false) { @@ -506,6 +507,9 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) state = ReadingDataState; fragment.clear(); // next fragment bodyLength = contentLength(); // cache the length + + // cache isChunked() since it is called often + chunkedTransferEncoding = headerField("transfer-encoding").toLower().contains("chunked"); } return bytes; } @@ -546,7 +550,7 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header) bool QHttpNetworkReplyPrivate::isChunked() { - return headerField("transfer-encoding").toLower().contains("chunked"); + return chunkedTransferEncoding; } bool QHttpNetworkReplyPrivate::connectionCloseEnabled() diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index b86cfaa..5eb70ce 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -198,6 +198,7 @@ public: qint64 contentRead; qint64 totalProgress; QByteArray fragment; // used for header, status, chunk header etc, not for reply data + bool chunkedTransferEncoding; qint64 currentChunkSize; qint64 currentChunkRead; QPointer connection; -- cgit v0.12 From 1c6edd28d528dbb946fcf2a9e0d4349075ca6f9b Mon Sep 17 00:00:00 2001 From: Suneel BS Date: Tue, 7 Jul 2009 14:57:02 +0530 Subject: Fixed inheritence of SVG fill attributes. Fixed inheritence of fill-opacity, fill-rule and fill. Autotest included. Reviewed-by: Kim --- src/svg/qsvghandler.cpp | 57 ++++++++++++++--------- src/svg/qsvgstyle.cpp | 14 +++++- src/svg/qsvgstyle_p.h | 28 +++++++----- tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 68 ++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 35 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 5950fac..f64fb3e 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -631,15 +631,32 @@ static void parseBrush(QSvgNode *node, QString opacity = attributes.value(QLatin1String("fill-opacity")).toString(); QString myId = someId(attributes); - value = value.trimmed(); - fillRule = fillRule.trimmed(); - if (!value.isEmpty() || !fillRule.isEmpty()) { - Qt::FillRule f = Qt::WindingFill; + QSvgFillStyle *inherited = + static_cast(node->parent()->styleProperty( + QSvgStyleProperty::FILL)); + QSvgFillStyle *prop = new QSvgFillStyle(QColor(Qt::black)); + + //fill-rule attribute handling + Qt::FillRule f = Qt::WindingFill; + if (!fillRule.isEmpty() && fillRule != QLatin1String("inherit")) { if (fillRule == QLatin1String("evenodd")) f = Qt::OddEvenFill; + } else if (inherited) { + f = inherited->fillRule(); + } + + //fill-opacity atttribute handling + qreal fillOpacity = 1.0; + if (!opacity.isEmpty() && opacity != QLatin1String("inherit")) { + fillOpacity = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity))); + } else if (inherited) { + fillOpacity = inherited->fillOpacity(); + } + + //fill attribute handling + if ((!value.isEmpty()) && (value != QLatin1String("inherit")) ) { if (value.startsWith(QLatin1String("url"))) { value = value.remove(0, 3); - QSvgFillStyle *prop = new QSvgFillStyle(0); QSvgStyleProperty *style = styleFromUrl(node, value); if (style) { prop->setFillStyle(style); @@ -648,30 +665,26 @@ static void parseBrush(QSvgNode *node, prop->setGradientId(id); prop->setGradientResolved(false); } - if (!opacity.isEmpty()) { - qreal clampedOpacity = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity))); - prop->setFillOpacity(clampedOpacity); - } - if (!fillRule.isEmpty()) - prop->setFillRule(f); - node->appendStyleProperty(prop,myId); } else if (value != QLatin1String("none")) { QColor color; - if (constructColor(value, opacity, color, handler)) { - QSvgFillStyle *prop = new QSvgFillStyle(QBrush(color)); - if (!fillRule.isEmpty()) - prop->setFillRule(f); - node->appendStyleProperty(prop, myId); - } + if (resolveColor(value, color, handler)) + prop->setBrush(QBrush(color)); } else { - QSvgFillStyle *prop = new QSvgFillStyle(QBrush(Qt::NoBrush)); - if (!fillRule.isEmpty()) - prop->setFillRule(f); - node->appendStyleProperty(prop, myId); + prop->setBrush(QBrush(Qt::NoBrush)); + } + } else if (inherited) { + if (inherited->style()) { + prop->setFillStyle(inherited->style()); + } else { + prop->setBrush(inherited->qbrush()); } } + prop->setFillOpacity(fillOpacity); + prop->setFillRule(f); + node->appendStyleProperty(prop,myId); } + static void parseQPen(QPen &pen, QSvgNode *node, const QSvgAttributes &attributes, QSvgHandler *handler) diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index 556201b..4c8247b 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -81,12 +81,12 @@ void QSvgQualityStyle::revert(QPainter *, QSvgExtraStates &) } QSvgFillStyle::QSvgFillStyle(const QBrush &brush) - : m_fill(brush), m_style(0), m_fillRuleSet(false), m_fillOpacitySet(false), m_gradientResolved (true) + : m_fill(brush), m_style(0), m_fillRuleSet(false), m_fillOpacitySet(false), m_fillRule(Qt::WindingFill), m_fillOpacity(1.0), m_gradientResolved (true) { } QSvgFillStyle::QSvgFillStyle(QSvgStyleProperty *style) - : m_style(style), m_fillRuleSet(false), m_fillOpacitySet(false), m_gradientResolved (true) + : m_style(style), m_fillRuleSet(false), m_fillOpacitySet(false), m_fillRule(Qt::WindingFill), m_fillOpacity(1.0), m_gradientResolved (true) { } @@ -102,6 +102,16 @@ void QSvgFillStyle::setFillOpacity(qreal opacity) m_fillOpacity = opacity; } +void QSvgFillStyle::setFillStyle(QSvgStyleProperty* style) +{ + m_style = style; +} + +void QSvgFillStyle::setBrush(QBrush brush) +{ + m_fill = brush; +} + static void recursivelySetFill(QSvgNode *node, Qt::FillRule f) { if (node->type() == QSvgNode::PATH) { diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index f1d0811..ac5e109 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -224,12 +224,29 @@ public: void setFillRule(Qt::FillRule f); void setFillOpacity(qreal opacity); + void setFillStyle(QSvgStyleProperty* style); + void setBrush(QBrush brush); const QBrush & qbrush() const { return m_fill; } + qreal fillOpacity() const + { + return m_fillOpacity; + } + + Qt::FillRule fillRule() const + { + return m_fillRule; + } + + QSvgStyleProperty* style() const + { + return m_style; + } + void setGradientId(const QString &Id) { m_gradientId = Id; @@ -240,7 +257,6 @@ public: return m_gradientId; } - void setGradientResolved(bool resolved) { m_gradientResolved = resolved; @@ -251,16 +267,6 @@ public: return m_gradientResolved; } - void setFillStyle(QSvgStyleProperty* style) - { - m_style = style; - } - - void setBrush(QBrush brush) - { - m_fill = brush; - } - private: // fill v v 'inherit' | // fill-opacity v v 'inherit' | diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index 3f658ec..68539ef 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -81,6 +81,7 @@ private slots: void paths(); void displayMode(); void strokeInherit(); + void testFillInheritance(); #ifndef QT_NO_COMPRESS void testGzLoading(); @@ -1053,5 +1054,72 @@ void tst_QSvgRenderer::strokeInherit() } } +void tst_QSvgRenderer::testFillInheritance() +{ + static const char *svgs[] = { + //reference + "" + " " + "", + "" + " " + " " + "", + "" + " " + " " + " " + " " + "", + "" + " " + " " + " " + " " + " " + " " + "", + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "", + "" + " " + " " + " " + " " + " " + " " + "" + }; + + const int COUNT = sizeof(svgs) / sizeof(svgs[0]); + QImage images[COUNT]; + QPainter p; + + for (int i = 0; i < COUNT; ++i) { + QByteArray data(svgs[i]); + QSvgRenderer renderer(data); + QVERIFY(renderer.isValid()); + images[i] = QImage(200, 200, QImage::Format_ARGB32_Premultiplied); + images[i].fill(-1); + p.begin(&images[i]); + renderer.render(&p); + p.end(); + if (i != 0) { + QCOMPARE(images[0], images[i]); + } + } +} QTEST_MAIN(tst_QSvgRenderer) #include "tst_qsvgrenderer.moc" -- cgit v0.12 From ed564a3fef39b649bd38a181126711431f0b40ab Mon Sep 17 00:00:00 2001 From: Suneel BS Date: Thu, 14 May 2009 14:25:16 +0530 Subject: Fixed handling of some SVG attributes when value is invalid. When the parsing of an SVG attribute fails, it should be given the default value. Fixed handling of invalid viewBox, stop-opacity and stop-offset. Autotest included. Reviewed-by: Kim --- src/svg/qsvghandler.cpp | 48 +++++++++++----- tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 84 ++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 14 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index f64fb3e..5f9d1dd 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -68,6 +68,7 @@ QT_BEGIN_NAMESPACE + double qstrtod(const char *s00, char const **se, bool *ok); static bool parsePathDataFast(const QStringRef &data, QPainterPath &path); @@ -320,6 +321,7 @@ static qreal toDouble(const QChar *&str) ++str; } } + temp[pos] = '\0'; qreal val; @@ -365,16 +367,24 @@ static qreal toDouble(const QChar *&str) return val; } -static qreal toDouble(const QString &str) +static qreal toDouble(const QString &str, bool *ok = NULL) { const QChar *c = str.constData(); - return toDouble(c); + qreal res = toDouble(c); + if (ok) { + *ok = ((*c) == QLatin1Char('\0')); + } + return res; } -static qreal toDouble(const QStringRef &str) +static qreal toDouble(const QStringRef &str, bool *ok = NULL) { const QChar *c = str.constData(); - return toDouble(c); + qreal res = toDouble(c); + if (ok) { + *ok = (c == (str.constData() + str.length())); + } + return res; } static QVector parseNumbersList(const QChar *&str) @@ -497,14 +507,17 @@ static bool constructColor(const QString &colorStr, const QString &opacity, if (!resolveColor(colorStr, color, handler)) return false; if (!opacity.isEmpty()) { - qreal op = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity))); + bool ok = true; + qreal op = qMin(qreal(1.0), qMax(qreal(0.0), toDouble(opacity, &ok))); + if (!ok) + op = 1.0; color.setAlphaF(op); } return true; } static qreal parseLength(const QString &str, QSvgHandler::LengthType &type, - QSvgHandler *handler) + QSvgHandler *handler, bool *ok = NULL) { QString numStr = str.trimmed(); @@ -533,15 +546,15 @@ static qreal parseLength(const QString &str, QSvgHandler::LengthType &type, type = handler->defaultCoordinateSystem(); //type = QSvgHandler::LT_OTHER; } - qreal len = toDouble(numStr); + qreal len = toDouble(numStr, ok); //qDebug()<<"len is "<setViewBox(QRectF(x, y, w, h)); - } else if (width && height){ + + } else if (width && height) { if (type == QSvgHandler::LT_PT) { width = convertToPixels(width, false, type); height = convertToPixels(height, false, type); } - node->setViewBox(QRectF(0, 0, width, height)); } - handler->setDefaultCoordinateSystem(QSvgHandler::LT_PX); return node; diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index 68539ef..2bbe897 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -82,6 +82,7 @@ private slots: void displayMode(); void strokeInherit(); void testFillInheritance(); + void testStopOffsetOpacity(); #ifndef QT_NO_COMPRESS void testGzLoading(); @@ -1121,5 +1122,88 @@ void tst_QSvgRenderer::testFillInheritance() } } } +void tst_QSvgRenderer::testStopOffsetOpacity() +{ + static const char *svgs[] = { + //reference + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "", + //Stop Offset + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "", + //Stop Opacity + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "", + //Stop offset and Stop opacity + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + }; + + QImage images[4]; + QPainter p; + + for (int i = 0; i < 4; ++i) { + QByteArray data(svgs[i]); + QSvgRenderer renderer(data); + QVERIFY(renderer.isValid()); + images[i] = QImage(64, 64, QImage::Format_ARGB32_Premultiplied); + images[i].fill(-1); + p.begin(&images[i]); + renderer.render(&p); + p.end(); + } + QCOMPARE(images[0], images[1]); + QCOMPARE(images[0], images[2]); + QCOMPARE(images[0], images[3]); +} + QTEST_MAIN(tst_QSvgRenderer) #include "tst_qsvgrenderer.moc" -- cgit v0.12 From cae93bf07958ea065f4fefd729099bac59a1bf14 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 9 Jul 2009 13:18:28 +0200 Subject: Fixes a memory corruption when converting data with QIconvCodec This partially reverts 9a5b40a011bd1b15a67d83564af55011761f8ad9 for the QIconvCodec. Reviewed-by: hjk --- src/corelib/codecs/qiconvcodec.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 1bf76ea..188ac8c 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -225,10 +225,11 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState char *inBytes = const_cast(chars); #endif + QByteArray in; if (remainingCount) { // we have to prepend the remaining bytes from the previous conversion inBytesLeft += remainingCount; - QByteArray in(inBytesLeft, Qt::Uninitialized); + in.resize(inBytesLeft); inBytes = in.data(); memcpy(in.data(), remainingBuffer, remainingCount); @@ -362,9 +363,10 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt inBytes = const_cast(reinterpret_cast(uc)); inBytesLeft = len * sizeof(QChar); + QByteArray in; if (convState && convState->remainingChars) { // we have one surrogate char to be prepended - QByteArray in(sizeof(QChar) + len, Qt::Uninitialized); + in.resize(sizeof(QChar) + len); inBytes = in.data(); QChar remaining = convState->state_data[0]; -- cgit v0.12 From 916b5c69e1ed5667e4fe97a21e7e15abfd60ec3d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Jul 2009 13:41:40 +0200 Subject: doc: Minor edits of reentrant/thread-safe expalantion. Task-number: 189232 --- doc/src/threads.qdoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/threads.qdoc b/doc/src/threads.qdoc index e3da0d4..8469f51 100644 --- a/doc/src/threads.qdoc +++ b/doc/src/threads.qdoc @@ -278,7 +278,7 @@ \e{reentrant} function is not always \e{thread-safe}. By extension, a class is said to be \e{reentrant} if its member - functions can be called safely from multiple threads as long as + functions can be called safely from multiple threads, as long as each thread uses a \e{different} instance of the class. The class is \e{thread-safe} if its member functions can be called safely from multiple threads, even if all the threads use the \e{same} @@ -325,14 +325,14 @@ declared with the \c mutable qualifier because we need to lock and unlock the mutex in \c value(), which is a const function. - Most Qt classes are \e{reentrant}, but they are not made + Many Qt classes are \e{reentrant}, but they are not made \e{thread-safe}, because making them thread-safe would incur the extra overhead of repeatedly locking and unlocking a QMutex. For example, QString is reentrant but not thread-safe. You can safely access \e{different} instances of QString from multiple threads - simultaneously, but you can't access the \e{same} instance of - QString from multiple threads simultaneously (unless you protect - the accesses yourself with a QMutex). + simultaneously, but you can't safely access the \e{same} instance + of QString from multiple threads simultaneously (unless you + protect the accesses yourself with a QMutex). Some Qt classes and functions are thread-safe. These are mainly the thread-related classes (e.g. QMutex) and fundamental functions @@ -345,7 +345,7 @@ standardized. POSIX uses definitions of reentrant and thread-safe that are somewhat different for its C APIs. When using other object-oriented C++ class libraries with Qt, be sure the - definitions in use are understood. + definitions are understood. \section1 Threads and QObjects -- cgit v0.12 From c5371bd1f3df4467ca17350ec7c3e3635d16e393 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 9 Jul 2009 12:10:18 +0200 Subject: QTreeView: use QVariantAnimation over QTimeLine --- src/gui/itemviews/qabstractitemview_p.h | 3 -- src/gui/itemviews/qtreeview.cpp | 74 ++++++++++++++------------------- src/gui/itemviews/qtreeview.h | 2 - src/gui/itemviews/qtreeview_p.h | 43 ++++++++++--------- 4 files changed, 55 insertions(+), 67 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 2950bcd..3119c9d 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -61,8 +61,6 @@ #include "QtGui/qmime.h" #include "QtGui/qpainter.h" #include "QtCore/qpair.h" -#include "QtCore/qtimer.h" -#include "QtCore/qtimeline.h" #include "QtGui/qregion.h" #include "QtCore/qdebug.h" #include "QtGui/qpainter.h" @@ -376,7 +374,6 @@ public: QBasicTimer updateTimer; QBasicTimer delayedEditing; QBasicTimer delayedAutoScroll; //used when an item is clicked - QTimeLine timeline; QAbstractItemView::ScrollMode verticalScrollMode; QAbstractItemView::ScrollMode horizontalScrollMode; diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 7c319dc..ab700e9 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1267,10 +1267,13 @@ void QTreeView::paintEvent(QPaintEvent *event) Q_D(QTreeView); d->executePostedLayout(); QPainter painter(viewport()); +#ifndef QT_NO_ANIMATION if (d->isAnimating()) { - drawTree(&painter, event->region() - d->animationRect()); + drawTree(&painter, event->region() - d->animatedOperation.rect()); d->drawAnimatedOperation(&painter); - } else { + } else +#endif //QT_NO_ANIMATION + { drawTree(&painter, event->region()); #ifndef QT_NO_DRAGANDDROP d->paintDropIndicator(&painter); @@ -2851,10 +2854,6 @@ void QTreeViewPrivate::initialize() header->setStretchLastSection(true); header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter); q->setHeader(header); - - // animation - QObject::connect(&timeline, SIGNAL(frameChanged(int)), q, SLOT(_q_animate())); - QObject::connect(&timeline, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation()), Qt::QueuedConnection); } void QTreeViewPrivate::expand(int item, bool emitSignal) @@ -2864,9 +2863,10 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) if (item == -1 || viewItems.at(item).expanded) return; +#ifndef QT_NO_ANIMATION if (emitSignal && animationsEnabled) - prepareAnimatedOperation(item, AnimatedOperation::Expand); - + prepareAnimatedOperation(item, QVariantAnimation::Forward); +#endif //QT_NO_ANIMATION QAbstractItemView::State oldState = q->state(); q->setState(QAbstractItemView::ExpandingState); const QModelIndex index = viewItems.at(item).index; @@ -2877,8 +2877,10 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) if (emitSignal) { emit q->expanded(index); +#ifndef QT_NO_ANIMATION if (animationsEnabled) beginAnimatedOperation(); +#endif //QT_NO_ANIMATION } if (model->canFetchMore(index)) model->fetchMore(index); @@ -2902,8 +2904,10 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal) if (it == expandedIndexes.end() || viewItems.at(item).expanded == false) return; // nothing to do +#ifndef QT_NO_ANIMATION if (emitSignal && animationsEnabled) - prepareAnimatedOperation(item, AnimatedOperation::Collapse); + prepareAnimatedOperation(item, QVariantAnimation::Backward); +#endif //QT_NO_ANIMATION QAbstractItemView::State oldState = q->state(); q->setState(QAbstractItemView::CollapsingState); @@ -2922,29 +2926,33 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal) if (emitSignal) { emit q->collapsed(modelIndex); +#ifndef QT_NO_ANIMATION if (animationsEnabled) beginAnimatedOperation(); +#endif //QT_NO_ANIMATION } } -void QTreeViewPrivate::prepareAnimatedOperation(int item, AnimatedOperation::Type type) +#ifndef QT_NO_ANIMATION +void QTreeViewPrivate::prepareAnimatedOperation(int item, QVariantAnimation::Direction direction) { animatedOperation.item = item; - animatedOperation.type = type; + animatedOperation.view = q_func(); + animatedOperation.setDirection(direction); int top = coordinateForItem(item) + itemHeight(item); QRect rect = viewport->rect(); rect.setTop(top); - if (type == AnimatedOperation::Collapse) { + if (direction == QVariantAnimation::Backward) { const int limit = rect.height() * 2; int h = 0; int c = item + viewItems.at(item).total + 1; for (int i = item + 1; i < c && h < limit; ++i) h += itemHeight(i); rect.setHeight(h); - animatedOperation.duration = h; + animatedOperation.setEndValue(top + h); } - animatedOperation.top = top; + animatedOperation.setStartValue(top); animatedOperation.before = renderTreeToPixmapForAnimation(rect); } @@ -2953,50 +2961,29 @@ void QTreeViewPrivate::beginAnimatedOperation() Q_Q(QTreeView); QRect rect = viewport->rect(); - rect.setTop(animatedOperation.top); - if (animatedOperation.type == AnimatedOperation::Expand) { + rect.setTop(animatedOperation.top()); + if (animatedOperation.direction() == QVariantAnimation::Forward) { const int limit = rect.height() * 2; int h = 0; int c = animatedOperation.item + viewItems.at(animatedOperation.item).total + 1; for (int i = animatedOperation.item + 1; i < c && h < limit; ++i) h += itemHeight(i); rect.setHeight(h); - animatedOperation.duration = h; + animatedOperation.setEndValue(animatedOperation.top() + h); } animatedOperation.after = renderTreeToPixmapForAnimation(rect); q->setState(QAbstractItemView::AnimatingState); - - timeline.stop(); - timeline.setDuration(250); - timeline.setFrameRange(animatedOperation.top, animatedOperation.top + animatedOperation.duration); - timeline.start(); -} - -void QTreeViewPrivate::_q_endAnimatedOperation() -{ - Q_Q(QTreeView); - animatedOperation.before = QPixmap(); - animatedOperation.after = QPixmap(); - q->setState(QAbstractItemView::NoState); - q->updateGeometries(); - viewport->update(); -} - -void QTreeViewPrivate::_q_animate() -{ - QRect rect = viewport->rect(); - rect.moveTop(animatedOperation.top); - viewport->repaint(rect); + animatedOperation.start(); //let's start the animation } void QTreeViewPrivate::drawAnimatedOperation(QPainter *painter) const { - int start = timeline.startFrame(); - int end = timeline.endFrame(); - bool collapsing = animatedOperation.type == AnimatedOperation::Collapse; - int current = collapsing ? end - timeline.currentFrame() + start : timeline.currentFrame(); + const int start = animatedOperation.startValue().toInt(), + end = animatedOperation.endValue().toInt(), + current = animatedOperation.currentValue().toInt(); + bool collapsing = animatedOperation.direction() == QVariantAnimation::Backward; const QPixmap top = collapsing ? animatedOperation.before : animatedOperation.after; painter->drawPixmap(0, start, top, 0, end - current - 1, top.width(), top.height()); const QPixmap bottom = collapsing ? animatedOperation.after : animatedOperation.before; @@ -3038,6 +3025,7 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons return pixmap; } +#endif //QT_NO_ANIMATION void QTreeViewPrivate::_q_currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h index 0347645..34f7630 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/gui/itemviews/qtreeview.h @@ -223,8 +223,6 @@ private: Q_DECLARE_PRIVATE(QTreeView) Q_DISABLE_COPY(QTreeView) - Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation()) - Q_PRIVATE_SLOT(d_func(), void _q_animate()) Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex&, const QModelIndex &)) Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset()) Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order)) diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index 6a1dfe5..77e57d6 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -54,6 +54,7 @@ // #include "private/qabstractitemview_p.h" +#include #ifndef QT_NO_TREEVIEW @@ -81,42 +82,48 @@ public: uniformRowHeights(false), rootDecoration(true), itemsExpandable(true), sortingEnabled(false), expandsOnDoubleClick(true), - allColumnsShowFocus(false), + allColumnsShowFocus(false), current(0), animationsEnabled(false), columnResizeTimerID(0), autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false) {} ~QTreeViewPrivate() {} void initialize(); - struct AnimatedOperation +#ifndef QT_NO_ANIMATION + struct AnimatedOperation : public QVariantAnimation { - enum Type { Expand, Collapse }; int item; - int top; - int duration; - Type type; QPixmap before; QPixmap after; - }; - - void expand(int item, bool emitSignal); - void collapse(int item, bool emitSignal); - - void prepareAnimatedOperation(int item, AnimatedOperation::Type type); + QTreeView *view; + AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); } + int top() const { return startValue().toInt(); } + QRect rect() const { QRect rect = view->viewport()->rect(); rect.moveTop(top()); return rect; } + void updateCurrentValue(const QVariant &) { view->viewport()->update(rect()); } + void updateState(State, State state) + { + if (state == Stopped) { + before = after = QPixmap(); + view->setState(QAbstractItemView::NoState); + view->updateGeometries(); + view->viewport()->update(); + } + } + } animatedOperation; + void prepareAnimatedOperation(int item, QVariantAnimation::Direction d); void beginAnimatedOperation(); - void _q_endAnimatedOperation(); void drawAnimatedOperation(QPainter *painter) const; QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const; +#endif //QT_NO_ANIMATION + + void expand(int item, bool emitSignal); + void collapse(int item, bool emitSignal); - inline QRect animationRect() const - { return QRect(0, animatedOperation.top, viewport->width(), - viewport->height() - animatedOperation.top); } void _q_currentChanged(const QModelIndex&, const QModelIndex&); void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int); void _q_columnsRemoved(const QModelIndex &, int, int); void _q_modelAboutToBeReset(); - void _q_animate(); void _q_sortIndicatorChanged(int column, Qt::SortOrder order); void _q_modelDestroyed(); @@ -177,8 +184,6 @@ public: // used when expanding and collapsing items QSet expandedIndexes; - QStack expandParent; - AnimatedOperation animatedOperation; bool animationsEnabled; inline bool storeExpanded(const QPersistentModelIndex &idx) { -- cgit v0.12 From 17cd046cfd7ab8ff3eaf0c09ae083ff8b2c89c89 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 9 Jul 2009 13:45:35 +0200 Subject: QTreeView: cleanup of useless private slots currentChange is slot in the public class (QAbstractItemView --- src/gui/dialogs/qfiledialog_p.h | 1 - src/gui/itemviews/qtreeview.cpp | 63 +++++++++++++---------------------------- src/gui/itemviews/qtreeview.h | 2 -- src/gui/itemviews/qtreeview_p.h | 2 -- 4 files changed, 20 insertions(+), 48 deletions(-) diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index d798f9d..4c599cc 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -73,7 +73,6 @@ #include #include #include -#include #include #include "qsidebar_p.h" diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index ab700e9..e4c7cd3 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -262,10 +262,6 @@ void QTreeView::setSelectionModel(QItemSelectionModel *selectionModel) Q_D(QTreeView); Q_ASSERT(selectionModel); if (d->selectionModel) { - if (d->allColumnsShowFocus) { - QObject::disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(_q_currentChanged(QModelIndex,QModelIndex))); - } // support row editing disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), d->model, SLOT(submit())); @@ -275,10 +271,6 @@ void QTreeView::setSelectionModel(QItemSelectionModel *selectionModel) QAbstractItemView::setSelectionModel(selectionModel); if (d->selectionModel) { - if (d->allColumnsShowFocus) { - QObject::connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(_q_currentChanged(QModelIndex,QModelIndex))); - } // support row editing connect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), d->model, SLOT(submit())); @@ -901,15 +893,6 @@ void QTreeView::setAllColumnsShowFocus(bool enable) Q_D(QTreeView); if (d->allColumnsShowFocus == enable) return; - if (d->selectionModel) { - if (enable) { - QObject::connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(_q_currentChanged(QModelIndex,QModelIndex))); - } else { - QObject::disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(_q_currentChanged(QModelIndex,QModelIndex))); - } - } d->allColumnsShowFocus = enable; d->viewport->update(); } @@ -1309,13 +1292,13 @@ bool QTreeViewPrivate::expandOrCollapseItemAtPos(const QPoint &pos) { Q_Q(QTreeView); // we want to handle mousePress in EditingState (persistent editors) - if ((q->state() != QAbstractItemView::NoState - && q->state() != QAbstractItemView::EditingState) + if ((state != QAbstractItemView::NoState + && state != QAbstractItemView::EditingState) || !viewport->rect().contains(pos)) return true; int i = itemDecorationAt(pos); - if ((i != -1) && q->itemsExpandable() && hasVisibleChildren(viewItems.at(i).index)) { + if ((i != -1) && itemsExpandable && hasVisibleChildren(viewItems.at(i).index)) { if (viewItems.at(i).expanded) collapse(i, true); else @@ -2867,7 +2850,7 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) if (emitSignal && animationsEnabled) prepareAnimatedOperation(item, QVariantAnimation::Forward); #endif //QT_NO_ANIMATION - QAbstractItemView::State oldState = q->state(); + QAbstractItemView::State oldState = state; q->setState(QAbstractItemView::ExpandingState); const QModelIndex index = viewItems.at(item).index; storeExpanded(index); @@ -2909,7 +2892,7 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal) prepareAnimatedOperation(item, QVariantAnimation::Backward); #endif //QT_NO_ANIMATION - QAbstractItemView::State oldState = q->state(); + QAbstractItemView::State oldState = state; q->setState(QAbstractItemView::CollapsingState); expandedIndexes.erase(it); viewItems[item].expanded = false; @@ -3027,27 +3010,6 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons } #endif //QT_NO_ANIMATION -void QTreeViewPrivate::_q_currentChanged(const QModelIndex ¤t, const QModelIndex &previous) -{ - Q_Q(QTreeView); - if (previous.isValid()) { - QRect previousRect = q->visualRect(previous); - if (allColumnsShowFocus) { - previousRect.setX(0); - previousRect.setWidth(viewport->width()); - } - viewport->update(previousRect); - } - if (current.isValid()) { - QRect currentRect = q->visualRect(current); - if (allColumnsShowFocus) { - currentRect.setX(0); - currentRect.setWidth(viewport->width()); - } - viewport->update(currentRect); - } -} - void QTreeViewPrivate::_q_modelAboutToBeReset() { viewItems.clear(); @@ -3775,6 +3737,21 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr } #endif QAbstractItemView::currentChanged(current, previous); + + if (allColumnsShowFocus()) { + if (previous.isValid()) { + QRect previousRect = visualRect(previous); + previousRect.setX(0); + previousRect.setWidth(viewport()->width()); + viewport()->update(previousRect); + } + if (current.isValid()) { + QRect currentRect = visualRect(current); + currentRect.setX(0); + currentRect.setWidth(viewport()->width()); + viewport()->update(currentRect); + } + } } /*! diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h index 34f7630..b2a9de2f 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/gui/itemviews/qtreeview.h @@ -223,10 +223,8 @@ private: Q_DECLARE_PRIVATE(QTreeView) Q_DISABLE_COPY(QTreeView) - Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex&, const QModelIndex &)) Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset()) Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order)) - Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) }; #endif // QT_NO_TREEVIEW diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index 77e57d6..38f6fd3 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -119,8 +119,6 @@ public: void expand(int item, bool emitSignal); void collapse(int item, bool emitSignal); - - void _q_currentChanged(const QModelIndex&, const QModelIndex&); void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int); void _q_columnsRemoved(const QModelIndex &, int, int); void _q_modelAboutToBeReset(); -- cgit v0.12 From 8b5f25ef98d29859e14d992ed90d976e64dc6382 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 9 Jul 2009 15:23:58 +0200 Subject: autotest: removed tons of warnings --- tests/auto/qmenubar/tst_qmenubar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 500465c..1245de1 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -1576,8 +1576,9 @@ void tst_QMenuBar::menubarSizeHint() return 11; case PM_MenuBarPanelWidth: return 1; + default: + return QWindowsStyle::pixelMetric(metric, option, widget); } - return QWindowsStyle::pixelMetric(metric, option, widget); } } style; -- cgit v0.12 From 43760604b1e08792938449885a938a641669c11d Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 9 Jul 2009 14:20:54 +0200 Subject: Added some links to the appropriate functions to the doc. Reviewed-by: trustme --- doc/src/dnd.qdoc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/src/dnd.qdoc b/doc/src/dnd.qdoc index b5039f6..5ede20c 100644 --- a/doc/src/dnd.qdoc +++ b/doc/src/dnd.qdoc @@ -141,15 +141,17 @@ types of data that the widget accepts. You must reimplement this function if you want to receive either QDragMoveEvent or QDropEvent in your reimplementations of - \l{QWidget::dragMoveEvent()}{dragMoveEvent()} and dropEvent(). + \l{QWidget::dragMoveEvent()}{dragMoveEvent()} and + \l{QWidget::dropEvent()}{dropEvent()}. - The following code shows how dragEnterEvent() can be reimplemented to + The following code shows how \l{QWidget::dragEnterEvent()}{dragEnterEvent()} + can be reimplemented to tell the drag and drop system that we can only handle plain text: \snippet doc/src/snippets/dropevents/window.cpp 3 - The dropEvent() is used to unpack dropped data and handle it in way that - is suitable for your application. + The \l{QWidget::dropEvent()}{dropEvent()} is used to unpack dropped data + and handle it in way that is suitable for your application. In the following code, the text supplied in the event is passed to a QTextBrowser and a QComboBox is filled with the list of MIME types that @@ -159,7 +161,8 @@ In this case, we accept the proposed action without checking what it is. In a real world application, it may be necessary to return from the - dropEvent() function without accepting the proposed action or handling + \l{QWidget::dropEvent()}{dropEvent()} function without accepting the + proposed action or handling the data if the action is not relevant. For example, we may choose to ignore Qt::LinkAction actions if we do not support links to external sources in our application. -- cgit v0.12 From b89e878003c5732482a8afb1be66a42cb9122b9e Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 9 Jul 2009 16:12:49 +0200 Subject: Updated the french phrasebook (some translations from Qt Creator) Reviewed-by: TrustMe --- tools/linguist/phrasebooks/french.qph | 227 +++++++++++++++++++++++++++++++++- 1 file changed, 226 insertions(+), 1 deletion(-) diff --git a/tools/linguist/phrasebooks/french.qph b/tools/linguist/phrasebooks/french.qph index f244013..d38da5a 100644 --- a/tools/linguist/phrasebooks/french.qph +++ b/tools/linguist/phrasebooks/french.qph @@ -1,4 +1,5 @@ - + + About A propos @@ -1101,4 +1102,228 @@ Yes Oui + + Split + Scinder + + + &Edit + &Édition + + + &Redo + Re&faire + + + debugger + débogueur + + + Start Debugger + Lancer le débogueur + + + Executable: + Exécutable: + + + Filter: + Filtre: + + + Clear + Effacer + + + Host and port: + Hôte et port: + + + Architecture: + Architecture: + + + Server start script: + Script de démarrage du serveur: + + + &Undo + Annu&ler + + + Add Bookmark + Ajouter un signet + + + Bookmark: + Signet: + + + Add in Folder: + Ajouter dans le dossier: + + + + + + + + + New Folder + Nouveau dossier + + + Bookmarks + Signets + + + Rename Folder + Renommer le dossier + + + Bookmark + Signet + + + Remove + Retirer + + + Delete Folder + Supprimer le dossier + + + Add + Ajouter + + + Move Up + Vers le Haut + + + Move Down + Vers le Bas + + + Show Bookmark + Afficher le signet + + + Show Bookmark in New Tab + Afficher le signet dans un nouvel onglet + + + Delete Bookmark + Supprimer le signet + + + Rename Bookmark + Renommer le signet + + + Previous Bookmark + Signet précédent + + + Next Bookmark + Signet suivant + + + Condition: + Condition: + + + Working Directory: + Répertoire de travail: + + + Environment + Environnement + + + Arguments + Arguments + + + Build directory: + Répertoire de compilation: + + + Path: + Chemin: + + + General + Général + + + Username: + Nom d'utilisateur: + + + User interface + Interface utilisateur + + + Open Link + Ouvrir le lien + + + [read only] + [lecture seule] + + + [directory] + [répertoire] + + + Close All + Fermer tout + + + Failed! + Échec! + + + Proceed + Continuer + + + Make writable + Rendre inscriptible + + + Qt Creator + Qt Creator + + + &File + &Fichier + + + Activate %1 + Activer %1 + + + New Project + Nouveau projet + + + Close %1 + Fermer %1 + + + * + * + + + &Change + &Modifier + + + Close Other Editors + Fermer les autres éditeurs + + + Close All Except %1 + Fermer tout sauf %1 + -- cgit v0.12 From e96c108e7f71f3e1bd08dc739e6ec46fe4603332 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 9 Jul 2009 15:58:20 +0200 Subject: QTabBar: now uses QVariantAnimation over QTimeLine QTimeLine is now no more used in private APIs --- src/gui/widgets/qprogressbar.cpp | 2 +- src/gui/widgets/qtabbar.cpp | 66 ++++++++++++++------------------------ src/gui/widgets/qtabbar.h | 2 -- src/gui/widgets/qtabbar_p.h | 68 ++++++++++++++++++++++++---------------- 4 files changed, 65 insertions(+), 73 deletions(-) diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp index ac3338b..d168028 100644 --- a/src/gui/widgets/qprogressbar.cpp +++ b/src/gui/widgets/qprogressbar.cpp @@ -204,7 +204,7 @@ bool QProgressBarPrivate::repaintRequired() const \o A progress bar shown in the Plastique widget style. \endtable - \sa QTimeLine, QProgressDialog, {fowler}{GUI Design Handbook: Progress Indicator} + \sa QProgressDialog, {fowler}{GUI Design Handbook: Progress Indicator} */ /*! diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 11cb6a1..690e624 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -663,7 +663,7 @@ void QTabBarPrivate::refresh() if (pressedIndex != -1 && movable && QApplication::mouseButtons() == Qt::NoButton) { - _q_moveTabFinished(pressedIndex); + moveTabFinished(pressedIndex); if (!validIndex(pressedIndex)) pressedIndex = -1; } @@ -1662,26 +1662,17 @@ void QTabBarPrivate::slide(int from, int to) q->setUpdatesEnabled(true); int postLocation = vertical ? q->tabRect(to).y() : q->tabRect(to).x(); int length = postLocation - preLocation; - tabList[to].makeTimeLine(q); - tabList[to].dragOffset += -1 * length; - tabList[to].timeLine->setFrameRange(tabList[to].dragOffset, 0); - animations[tabList[to].timeLine] = to; - tabList[to].timeLine->setDuration(ANIMATION_DURATION); - if (tabList[to].timeLine->state() != QTimeLine::Running) - tabList[to].timeLine->start(); + tabList[to].dragOffset -= length; + tabList[to].startAnimation(this, ANIMATION_DURATION); } -void QTabBarPrivate::_q_moveTab(int offset) +void QTabBarPrivate::moveTab(int index, int offset) { - Q_Q(QTabBar); - if (QTimeLine *timeLine = qobject_cast(q->sender())) { - int index = animations[timeLine]; - if (!validIndex(index)) - return; - tabList[index].dragOffset = offset; - layoutTab(index); // Make buttons follow tab - q->update(); - } + if (!validIndex(index)) + return; + tabList[index].dragOffset = offset; + layoutTab(index); // Make buttons follow tab + q_func()->update(); } /*!\reimp @@ -1695,7 +1686,7 @@ void QTabBar::mousePressEvent(QMouseEvent *event) } // Be safe! if (d->pressedIndex != -1 && d->movable) - d->_q_moveTabFinished(d->pressedIndex); + d->moveTabFinished(d->pressedIndex); d->pressedIndex = d->indexAtPos(event->pos()); if (d->validIndex(d->pressedIndex)) { @@ -1721,7 +1712,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) // Be safe! if (d->pressedIndex != -1 && event->buttons() == Qt::NoButton) - d->_q_moveTabFinished(d->pressedIndex); + d->moveTabFinished(d->pressedIndex); // Start drag if (!d->dragInProgress && d->pressedIndex != -1) { @@ -1789,16 +1780,6 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) optTabBase.documentMode = d->documentMode; } -void QTabBarPrivate::_q_moveTabFinished() -{ - Q_Q(QTabBar); - if (QTimeLine *timeLine = qobject_cast(q->sender())) { - int index = animations[timeLine]; - animations.remove(timeLine); - _q_moveTabFinished(index); - } -} - void QTabBarPrivate::setupMovableTab() { Q_Q(QTabBar); @@ -1838,11 +1819,19 @@ void QTabBarPrivate::setupMovableTab() movingTab->setVisible(true); } -void QTabBarPrivate::_q_moveTabFinished(int index) +void QTabBarPrivate::moveTabFinished(int index) { Q_Q(QTabBar); bool cleanup = (pressedIndex == index) || (pressedIndex == -1) || !validIndex(index); - if (animations.isEmpty() && cleanup) { + bool allAnimationsFinished = true; +#ifndef QT_NO_ANIMATION + for(int i = 0; allAnimationsFinished && i < tabList.count(); ++i) { + const Tab &t = tabList.at(i); + if (t.animation && t.animation->state() == QAbstractAnimation::Running) + allAnimationsFinished = false; + } +#endif //QT_NO_ANIMATION + if (allAnimationsFinished && cleanup) { movingTab->setVisible(false); // We might not get a mouse release for (int i = 0; i < tabList.count(); ++i) { tabList[i].dragOffset = 0; @@ -1877,17 +1866,8 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event) ? tabRect(d->pressedIndex).height() : tabRect(d->pressedIndex).width(); int duration = qMin(ANIMATION_DURATION, - ((length < 0 ? (-1 * length) : length) * ANIMATION_DURATION) / width); - if (duration > 0) { - d->tabList[d->pressedIndex].makeTimeLine(this); - d->tabList[d->pressedIndex].timeLine->setFrameRange(length, 0); - d->animations[d->tabList[d->pressedIndex].timeLine] = d->pressedIndex; - d->tabList[d->pressedIndex].timeLine->setDuration(duration); - if (d->tabList[d->pressedIndex].timeLine->state() != QTimeLine::Running) - d->tabList[d->pressedIndex].timeLine->start(); - } else { - d->_q_moveTabFinished(d->pressedIndex); - } + (qAbs(length) * ANIMATION_DURATION) / width); + d->tabList[d->pressedIndex].startAnimation(d, duration); d->dragInProgress = false; d->movingTab->setVisible(false); d->dragStartPosition = QPoint(); diff --git a/src/gui/widgets/qtabbar.h b/src/gui/widgets/qtabbar.h index 7514486..402f54b 100644 --- a/src/gui/widgets/qtabbar.h +++ b/src/gui/widgets/qtabbar.h @@ -215,8 +215,6 @@ private: Q_DECLARE_PRIVATE(QTabBar) Q_PRIVATE_SLOT(d_func(), void _q_scrollTabs()) Q_PRIVATE_SLOT(d_func(), void _q_closeTab()) - Q_PRIVATE_SLOT(d_func(), void _q_moveTab(int)) - Q_PRIVATE_SLOT(d_func(), void _q_moveTabFinished()) }; #endif // QT_NO_TABBAR diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h index dbae055..b9b9fba 100644 --- a/src/gui/widgets/qtabbar_p.h +++ b/src/gui/widgets/qtabbar_p.h @@ -58,9 +58,8 @@ #include #include -#include -#include #include +#include #ifndef QT_NO_TABBAR @@ -75,9 +74,10 @@ class QTabBarPrivate : public QWidgetPrivate Q_DECLARE_PUBLIC(QTabBar) public: QTabBarPrivate() - :currentIndex(-1), pressedIndex(-1), - shape(QTabBar::RoundedNorth), - layoutDirty(false), drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), movingTab(0) {} + :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), + drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), + selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), + dragInProgress(false), documentMode(false), movingTab(0) {} int currentIndex; int pressedIndex; @@ -88,16 +88,13 @@ public: struct Tab { inline Tab(const QIcon &ico, const QString &txt) - : enabled(true) - , shortcutId(0) - , text(txt) - , icon(ico) - , leftWidget(0) - , rightWidget(0) - , lastTab(-1) - , timeLine(0) - , dragOffset(0) + : enabled(true) , shortcutId(0), text(txt), icon(ico), + leftWidget(0), rightWidget(0), lastTab(-1), dragOffset(0) +#ifndef QT_NO_ANIMATION + , animation(0) +#endif //QT_NO_ANIMATION {} + bool operator==(const Tab &other) const { return &other == this; } bool enabled; int shortcutId; QString text; @@ -117,21 +114,39 @@ public: QWidget *leftWidget; QWidget *rightWidget; int lastTab; - - QTimeLine *timeLine; int dragOffset; - void makeTimeLine(QWidget *q) { - if (timeLine) - return; - timeLine = new QTimeLine(ANIMATION_DURATION, q); - q->connect(timeLine, SIGNAL(frameChanged(int)), q, SLOT(_q_moveTab(int))); - q->connect(timeLine, SIGNAL(finished()), q, SLOT(_q_moveTabFinished())); +#ifndef QT_NO_ANIMATION + ~Tab() { delete animation; } + struct TabBarAnimation : public QVariantAnimation { + TabBarAnimation(Tab *t, QTabBarPrivate *_priv) : tab(t), priv(_priv) + { setEasingCurve(QEasingCurve::InOutQuad); } + + void updateCurrentValue(const QVariant ¤t) + { priv->moveTab(priv->tabList.indexOf(*tab), current.toInt()); } + + void updateState(State, State newState) + { if (newState == Stopped) priv->moveTabFinished(priv->tabList.indexOf(*tab)); } + private: + //these are needed for the callbacks + Tab *tab; + QTabBarPrivate *priv; + } *animation; + + void startAnimation(QTabBarPrivate *priv, int duration) { + if (!animation) + animation = new TabBarAnimation(this, priv); + animation->setStartValue(dragOffset); + animation->setEndValue(0); + animation->setDuration(duration); + animation->start(); } - +#else + void startAnimation(QTabBarPrivate *priv, int duration) + { Q_UNUSED(duration); priv->moveTabFinished(priv->tabList.indexOf(*this)); } +#endif //QT_NO_ANIMATION }; QList tabList; - QHash animations; int calculateNewPosition(int from, int to, int index) const; void slide(int from, int to); @@ -152,9 +167,8 @@ public: void _q_scrollTabs(); void _q_closeTab(); - void _q_moveTab(int); - void _q_moveTabFinished(); - void _q_moveTabFinished(int offset); + void moveTab(int index, int offset); + void moveTabFinished(int index); QRect hoverRect; void refresh(); -- cgit v0.12 From 93c5eddcead6d0fa9601d3ec992086ddcc5656e9 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 9 Jul 2009 16:23:26 +0200 Subject: Fix compile issue --- src/gui/itemviews/qtreeview.cpp | 13 ++++++++++++- src/gui/itemviews/qtreeview.h | 3 +++ src/gui/itemviews/qtreeview_p.h | 17 +++++------------ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index e4c7cd3..f13ff0c 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2837,6 +2837,9 @@ void QTreeViewPrivate::initialize() header->setStretchLastSection(true); header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter); q->setHeader(header); +#ifndef QT_NO_ANIMATION + QObject::connect(&animatedOperation, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation())); +#endif //QT_NO_ANIMATION } void QTreeViewPrivate::expand(int item, bool emitSignal) @@ -2920,7 +2923,7 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal) void QTreeViewPrivate::prepareAnimatedOperation(int item, QVariantAnimation::Direction direction) { animatedOperation.item = item; - animatedOperation.view = q_func(); + animatedOperation.viewport = viewport; animatedOperation.setDirection(direction); int top = coordinateForItem(item) + itemHeight(item); @@ -3008,6 +3011,14 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons return pixmap; } + +void QTreeViewPrivate::_q_endAnimatedOperation() +{ + Q_Q(QTreeView); + q->setState(QAbstractItemView::NoState); + q->updateGeometries(); + viewport->update(); +} #endif //QT_NO_ANIMATION void QTreeViewPrivate::_q_modelAboutToBeReset() diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h index b2a9de2f..4411781 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/gui/itemviews/qtreeview.h @@ -223,6 +223,9 @@ private: Q_DECLARE_PRIVATE(QTreeView) Q_DISABLE_COPY(QTreeView) +#ifndef QT_NO_ANIMATION + Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation()) +#endif //QT_NO_ANIMATION Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset()) Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order)) }; diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index 38f6fd3..6fb2e41 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -95,25 +95,18 @@ public: int item; QPixmap before; QPixmap after; - QTreeView *view; + QWidget *viewport; AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); } int top() const { return startValue().toInt(); } - QRect rect() const { QRect rect = view->viewport()->rect(); rect.moveTop(top()); return rect; } - void updateCurrentValue(const QVariant &) { view->viewport()->update(rect()); } - void updateState(State, State state) - { - if (state == Stopped) { - before = after = QPixmap(); - view->setState(QAbstractItemView::NoState); - view->updateGeometries(); - view->viewport()->update(); - } - } + QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; } + void updateCurrentValue(const QVariant &) { viewport->update(rect()); } + void updateState(State, State state) { if (state == Stopped) before = after = QPixmap(); } } animatedOperation; void prepareAnimatedOperation(int item, QVariantAnimation::Direction d); void beginAnimatedOperation(); void drawAnimatedOperation(QPainter *painter) const; QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const; + void _q_endAnimatedOperation(); #endif //QT_NO_ANIMATION void expand(int item, bool emitSignal); -- cgit v0.12 From f4fb6207a91b62526b31e0f77c0713bdc243e4f2 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 9 Jul 2009 16:51:59 +0200 Subject: Compile fix. --- src/gui/itemviews/qabstractitemview_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 3119c9d..00647f6 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -64,6 +64,7 @@ #include "QtGui/qregion.h" #include "QtCore/qdebug.h" #include "QtGui/qpainter.h" +#include "QtCore/qbasictimer.h" #ifndef QT_NO_ITEMVIEWS -- cgit v0.12 From 4bec76fceb2297cdbde765b74075046b94bfaf75 Mon Sep 17 00:00:00 2001 From: Nils Christian Roscher-Nielsen Date: Thu, 9 Jul 2009 17:29:46 +0200 Subject: Add the complex control SC_SpinBoxEditField to style option Reviewed-by: Thierry --- src/gui/widgets/qabstractspinbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index da18d13..433406c 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -1577,7 +1577,7 @@ void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const option->initFrom(this); option->activeSubControls = QStyle::SC_None; option->buttonSymbols = d->buttonSymbols; - option->subControls = QStyle::SC_SpinBoxFrame; + option->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField; if (d->buttonSymbols != QAbstractSpinBox::NoButtons) { option->subControls |= QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown; if (d->buttonState & Up) { -- cgit v0.12 From 020ed5b7caaba5cf877cdb9ebaa575db1d15b7f0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 9 Jul 2009 18:09:12 +0200 Subject: QLocalSocket WriteOnly mode fixed on Windows Write only local sockets silently disconnected after some time. Reason: we cannot call PeekNamedPipe on a write only pipe. Task-number: 257714 Reviewed-by: ossi Autotest: tst_QLocalSocket::writeOnlySocket --- src/network/socket/qlocalsocket_win.cpp | 10 ++++++---- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 1a971f0..794b2b7 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -168,7 +168,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) // we have a valid handle d->serverName = name; - if (setSocketDescriptor((quintptr)localSocket), openMode) { + if (setSocketDescriptor((quintptr)localSocket, ConnectedState, openMode)) { d->handle = localSocket; emit connected(); } @@ -299,8 +299,6 @@ void QLocalSocket::abort() DWORD QLocalSocketPrivate::bytesAvailable() { Q_Q(QLocalSocket); - if (q->state() != QLocalSocket::ConnectedState) - return 0; DWORD bytes; if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) { return bytes; @@ -410,7 +408,7 @@ bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor, d->handle = (int*)socketDescriptor; d->state = socketState; emit stateChanged(d->state); - if (d->state == ConnectedState) { + if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) { d->startAsyncRead(); d->checkReadyRead(); } @@ -471,6 +469,10 @@ bool QLocalSocket::waitForDisconnected(int msecs) Q_D(QLocalSocket); if (state() == UnconnectedState) return false; + if (!openMode().testFlag(QIODevice::ReadOnly)) { + qWarning("QLocalSocket::waitForDisconnected isn't supported for write only pipes."); + return false; + } QIncrementalSleepTimer timer(msecs); forever { d->bytesAvailable(); // to check if PeekNamedPipe fails diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index 0f636a4..a41eecd 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -104,6 +104,7 @@ private slots: void recycleServer(); void multiConnect(); + void writeOnlySocket(); void debug(); @@ -906,6 +907,22 @@ void tst_QLocalSocket::multiConnect() QVERIFY(server.nextPendingConnection() != 0); } +void tst_QLocalSocket::writeOnlySocket() +{ + QLocalServer server; + QVERIFY(server.listen("writeOnlySocket")); + + QLocalSocket client; + client.connectToServer("writeOnlySocket", QIODevice::WriteOnly); + QVERIFY(client.waitForConnected()); + + QVERIFY(server.waitForNewConnection()); + QLocalSocket* serverSocket = server.nextPendingConnection(); + + QCOMPARE(client.bytesAvailable(), qint64(0)); + QCOMPARE(client.state(), QLocalSocket::ConnectedState); +} + void tst_QLocalSocket::debug() { // Make sure this compiles -- cgit v0.12 From 5c11a5a38bcc68c17da8fe59e8db03d43ea55ac1 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 8 Jul 2009 17:21:51 +0200 Subject: Ensure that when we hide QToolBar in unified, unified follows. Basically if you would hide a toolbar in the unified toolbar, you would still see a little bit of area at the top instead of having everything flush with the titlebar. This change basically unsures that the unified toolbar makes a decision to hide itself if all the toolbars inside it are hidden. It makes the behavior of clicking on the toolbar button behave more or less correctly since we are going to show the unified toolbar whether we want to or not. This all will get the toolbar button switch event to be dispatched in Cocoa as well. Also add an optimization for checking if we need to change the geometry. If we don't have any items the other toolbar areas, we can skip the set geometry call, which wrecks havoc with things in Cocoa. We still don't solve the case of someone who has hidden the items with the toolbar button then goes full-screen, then goes back out. I'm not motivated to solve it as is because we need to keep track of the hides we do on the button press vs. other hides from the user and still people can workaround it easy enough by handling window state change and doing what is recommended in the docs. Task-number: 208439 Rev-by: Denis --- src/gui/kernel/qcocoapanel_mac.mm | 6 +++ src/gui/kernel/qcocoawindow_mac.mm | 6 +++ src/gui/kernel/qt_cocoa_helpers_mac.mm | 34 +++++++------- src/gui/kernel/qt_cocoa_helpers_mac_p.h | 3 +- src/gui/kernel/qwidget_mac.mm | 3 +- src/gui/widgets/qmainwindow.cpp | 13 ++++-- src/gui/widgets/qmainwindowlayout.cpp | 76 ++++++++++++++++++++++++++++---- src/gui/widgets/qmainwindowlayout_mac.mm | 31 ++++++++++--- src/gui/widgets/qmainwindowlayout_p.h | 2 + src/gui/widgets/qtoolbar.cpp | 29 +++++++++--- 10 files changed, 161 insertions(+), 42 deletions(-) diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm index bdc7ecb..1e0bbdf 100644 --- a/src/gui/kernel/qcocoapanel_mac.mm +++ b/src/gui/kernel/qcocoapanel_mac.mm @@ -85,6 +85,12 @@ QT_USE_NAMESPACE last resort (i.e., this is code that can potentially be removed). */ +- (void)toggleToolbarShown:(id)sender +{ + macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]); + [super toggleToolbarShown:sender]; +} + - (void)keyDown:(NSEvent *)theEvent { bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm index 7084416..eb08982 100644 --- a/src/gui/kernel/qcocoawindow_mac.mm +++ b/src/gui/kernel/qcocoawindow_mac.mm @@ -104,6 +104,12 @@ QT_USE_NAMESPACE last resort (i.e., this is code that can potentially be removed). */ +- (void)toggleToolbarShown:(id)sender +{ + macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]); + [super toggleToolbarShown:sender]; +} + - (void)keyDown:(NSEvent *)theEvent { bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 13b0e50..a98a7f8 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -177,11 +177,10 @@ void macWindowToolbarShow(const QWidget *widget, bool show ) { OSWindowRef wnd = qt_mac_window_for(widget); #if QT_MAC_USE_COCOA - NSToolbar *toolbar = [wnd toolbar]; - if (toolbar) { + if (NSToolbar *toolbar = [wnd toolbar]) { QMacCocoaAutoReleasePool pool; if (show != [toolbar isVisible]) { - [wnd toggleToolbarShown:wnd]; + [toolbar setVisible:show]; } else { // The toolbar may be in sync, but we are not, update our framestrut. qt_widget_private(const_cast(widget))->updateFrameStrut(); @@ -197,22 +196,21 @@ void macWindowToolbarSet( void * /*OSWindowRef*/ window, void *toolbarRef ) { OSWindowRef wnd = static_cast(window); #if QT_MAC_USE_COCOA - [wnd setToolbar:static_cast(toolbarRef)]; + [wnd setToolbar:static_cast(toolbarRef)]; #else SetWindowToolbar(wnd, static_cast(toolbarRef)); #endif } -bool macWindowToolbarVisible( void * /*OSWindowRef*/ window ) +bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window ) { OSWindowRef wnd = static_cast(window); #if QT_MAC_USE_COCOA - NSToolbar *toolbar = [wnd toolbar]; - if (toolbar) + if (NSToolbar *toolbar = [wnd toolbar]) return [toolbar isVisible]; return false; #else - return IsWindowToolbarVisible(wnd); + return IsWindowToolbarVisible(wnd); #endif } @@ -220,12 +218,12 @@ void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow ) { OSWindowRef wnd = static_cast(window); #if QT_MAC_USE_COCOA - [wnd setHasShadow:BOOL(hasShadow)]; + [wnd setHasShadow:BOOL(hasShadow)]; #else - if (hasShadow) - ChangeWindowAttributes(wnd, 0, kWindowNoShadowAttribute); - else - ChangeWindowAttributes(wnd, kWindowNoShadowAttribute, 0); + if (hasShadow) + ChangeWindowAttributes(wnd, 0, kWindowNoShadowAttribute); + else + ChangeWindowAttributes(wnd, kWindowNoShadowAttribute, 0); #endif } @@ -233,9 +231,9 @@ void macWindowFlush(void * /*OSWindowRef*/ window) { OSWindowRef wnd = static_cast(window); #if QT_MAC_USE_COCOA - [wnd flushWindowIfNeeded]; + [wnd flushWindowIfNeeded]; #else - HIWindowFlush(wnd); + HIWindowFlush(wnd); #endif } @@ -352,6 +350,12 @@ Qt::MouseButton qt_mac_get_button(EventMouseButton button) return Qt::NoButton; } +void macSendToolbarChangeEvent(QWidget *widget) +{ + QToolBarChangeEvent ev(!(GetCurrentKeyModifiers() & cmdKey)); + qt_sendSpontaneousEvent(widget, &ev); +} + Q_GLOBAL_STATIC(QMacTabletHash, tablet_hash) QMacTabletHash *qt_mac_tablet_hash() { diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 3881ccd..5f6204f 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -118,9 +118,10 @@ void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0); bool macWindowIsTextured(void * /*OSWindowRef*/ window); void macWindowToolbarShow(const QWidget *widget, bool show ); void macWindowToolbarSet( void * /*OSWindowRef*/ window, void* toolbarRef ); -bool macWindowToolbarVisible( void * /*OSWindowRef*/ window ); +bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window ); void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow ); void macWindowFlush(void * /*OSWindowRef*/ window); +void macSendToolbarChangeEvent(QWidget *widget); struct HIContentBorderMetrics; void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::HIContentBorderMetrics &metrics); void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm); diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index dcc5056..5e2dfb6 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -843,8 +843,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, extern QPointer qt_button_down; //qapplication_mac.cpp qt_button_down = 0; } else if(ekind == kEventWindowToolbarSwitchMode) { - QToolBarChangeEvent ev(!(GetCurrentKeyModifiers() & cmdKey)); - QApplication::sendSpontaneousEvent(widget, &ev); + macSendToolbarChangeEvent(widget); HIToolbarRef toolbar; if (GetWindowToolbar(wid, &toolbar) == noErr) { if (toolbar) { diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 0c841eb..c51bed9 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1369,20 +1369,25 @@ bool QMainWindow::event(QEvent *event) #ifdef Q_WS_MAC case QEvent::Show: if (unifiedTitleAndToolBarOnMac()) - macWindowToolbarShow(this, true); + d->layout->syncUnifiedToolbarVisibility(); + d->layout->blockVisiblityCheck = false; break; -# ifdef QT_MAC_USE_COCOA case QEvent::WindowStateChange: { + if (isHidden()) { + // We are coming out of a minimize, leave things as is. + d->layout->blockVisiblityCheck = true; + } +# ifdef QT_MAC_USE_COCOA // We need to update the HIToolbar status when we go out of or into fullscreen. QWindowStateChangeEvent *wce = static_cast(event); if ((windowState() & Qt::WindowFullScreen) || (wce->oldState() & Qt::WindowFullScreen)) { d->layout->updateHIToolBarStatus(); } +# endif // Cocoa } break; -# endif // Cocoa -#endif +#endif // Q_WS_MAC #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) case QEvent::CursorChange: if (d->cursorAdjusted) { diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index aba9120..541907e 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -939,15 +939,70 @@ void QMainWindowLayout::getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar void QMainWindowLayout::toggleToolBarsVisible() { - layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible; - if (!layoutState.mainWindow->isMaximized()){ - QPoint topLeft = parentWidget()->geometry().topLeft(); - QRect r = parentWidget()->geometry(); - r = layoutState.toolBarAreaLayout.rectHint(r); - r.moveTo(topLeft); - parentWidget()->setGeometry(r); - } else{ - update(); + bool updateNonUnifiedParts = true; +#ifdef Q_WS_MAC + if (layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) { + // If we hit this case, someone has pressed the "toolbar button" which will + // toggle the unified toolbar visiblity, because that's what the user wants. + // We might be in a situation where someone has hidden all the toolbars + // beforehand (maybe in construction), but now they've hit this button and + // and are expecting the items to show. What do we do? + // 1) Check the visibility of all the toolbars, if one is visible, do nothing, this + // preserves what people would expect (these toolbars were visible when I clicked last time). + // 2) If NONE are visible, then show them all. Again, this preserves the user expectation + // of, "I want to see the toolbars." The user may get more toolbars than expected, but this + // is better seeing nothing. + // Don't worry about any of this if we are going invisible. This does mean we may get + // into issues when switching into and out of fullscreen mode, but this is probably minor. + // If we ever need to do hiding, that would have to be taken care of after the unified toolbar + // has finished hiding. + // People can of course handle the QEvent::ToolBarChange event themselves and do + // WHATEVER they want if they don't like what we are doing (though the unified toolbar + // will fire regardless). + + // Check if we REALLY need to update the geometry below. If we only have items in the + // unified toolbar, all the docks will be empty, so there's very little point + // in doing the geometry as Apple will do it (we also avoid flicker in Cocoa as well). + // FWIW, layoutState.toolBarAreaLayout.visible and the state of the unified toolbar + // visibility can get out of sync. I really don't think it's a big issue. It is kept + // to a minimum because we only change the visibility if we absolutely must. + // update the "non unified parts." + updateNonUnifiedParts = !layoutState.toolBarAreaLayout.isEmpty(); + + // We get this function before the unified toolbar does its thing. + // So, the value will be opposite of what we expect. + bool goingVisible = !macWindowToolbarIsVisible(qt_mac_window_for(layoutState.mainWindow)); + if (goingVisible) { + const int ToolBarCount = qtoolbarsInUnifiedToolbarList.size(); + bool needAllVisible = true; + for (int i = 0; i < ToolBarCount; ++i) { + if (!qtoolbarsInUnifiedToolbarList.at(i)->isHidden()) { + needAllVisible = false; + break; + } + } + if (needAllVisible) { + QBoolBlocker blocker(blockVisiblityCheck); // Disable the visibilty check because + // the toggle has already happened. + for (int i = 0; i < ToolBarCount; ++i) + qtoolbarsInUnifiedToolbarList.at(i)->setVisible(true); + } + } + if (!updateNonUnifiedParts) + layoutState.toolBarAreaLayout.visible = goingVisible; + } +#endif + if (updateNonUnifiedParts) { + layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible; + if (!layoutState.mainWindow->isMaximized()) { + QPoint topLeft = parentWidget()->geometry().topLeft(); + QRect r = parentWidget()->geometry(); + r = layoutState.toolBarAreaLayout.rectHint(r); + r.moveTo(topLeft); + parentWidget()->setGeometry(r); + } else { + update(); + } } } @@ -1641,6 +1696,9 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow) #ifndef QT_NO_RUBBERBAND , gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow)) #endif //QT_NO_RUBBERBAND +#ifdef Q_WS_MAC + , blockVisiblityCheck(false) +#endif { #ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_TABBAR diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index 6632be7..61719c2 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -338,18 +338,16 @@ void QMainWindowLayout::updateHIToolBarStatus() 0, kWindowUnifiedTitleAndToolbarAttribute); } #endif - macWindowToolbarShow(layoutState.mainWindow, useMacToolbar); layoutState.mainWindow->setUpdatesEnabled(false); // reduces a little bit of flicker, not all though if (!useMacToolbar) { - OSWindowRef windowRef = qt_mac_window_for(parentWidget()); - macWindowToolbarShow(parentWidget(), false); + macWindowToolbarShow(layoutState.mainWindow, false); // Move everything out of the HIToolbar into the main toolbar. while (!qtoolbarsInUnifiedToolbarList.isEmpty()) { // Should shrink the list by one every time. layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, qtoolbarsInUnifiedToolbarList.first()); } - macWindowToolbarSet(windowRef, NULL); + macWindowToolbarSet(qt_mac_window_for(layoutState.mainWindow), 0); } else { QList toolbars = layoutState.mainWindow->findChildren(); for (int i = 0; i < toolbars.size(); ++i) { @@ -359,6 +357,7 @@ void QMainWindowLayout::updateHIToolBarStatus() layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, toolbar); } } + syncUnifiedToolbarVisibility(); } layoutState.mainWindow->setUpdatesEnabled(true); } @@ -439,7 +438,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar #else NSString *toolbarID = kQToolBarNSToolbarIdentifier; toolbarID = [toolbarID stringByAppendingFormat:@"%p", toolbar]; - cocoaItemIDToToolbarHash.insert(QCFString::toQString(CFStringRef(toolbarID)), toolbar); + cocoaItemIDToToolbarHash.insert(qt_mac_NSStringToQString(toolbarID), toolbar); [macToolbar insertItemWithItemIdentifier:toolbarID atIndex:beforeIndex]; #endif } @@ -487,6 +486,7 @@ void QMainWindowLayout::cleanUpMacToolbarItems() void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const { +#ifdef QT_MAC_USE_COCOA QHash::const_iterator it = unifiedToolbarHash.constBegin(); NSToolbarItem *item = nil; while (it != unifiedToolbarHash.constEnd()) { @@ -507,5 +507,26 @@ void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const nssize.height = size.height() - 2; [item setMinSize:nssize]; } +#else + Q_UNUSED(tb); +#endif } + +void QMainWindowLayout::syncUnifiedToolbarVisibility() +{ + if (blockVisiblityCheck) + return; + + Q_ASSERT(layoutState.mainWindow->unifiedTitleAndToolBarOnMac()); + bool show = false; + const int ToolBarCount = qtoolbarsInUnifiedToolbarList.count(); + for (int i = 0; i < ToolBarCount; ++i) { + if (qtoolbarsInUnifiedToolbarList.at(i)->isVisible()) { + show = true; + break; + } + } + macWindowToolbarShow(layoutState.mainWindow, show); +} + QT_END_NAMESPACE diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index 45f62cd..524fdbf 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -335,6 +335,8 @@ public: void cleanUpMacToolbarItems(); void fixSizeInUnifiedToolbar(QToolBar *tb) const; bool useHIToolBar; + void syncUnifiedToolbarVisibility(); + bool blockVisiblityCheck; #endif }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index b249915..b65f1ba 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -1074,6 +1074,15 @@ static bool waitForPopup(QToolBar *tb, QWidget *popup) return false; } +#if defined(Q_WS_MAC) +static bool toolbarInUnifiedToolBar(QToolBar *toolbar) +{ + const QMainWindow *mainWindow = qobject_cast(toolbar->parentWidget()); + return mainWindow && mainWindow->unifiedTitleAndToolBarOnMac() + && mainWindow->toolBarArea(toolbar) == Qt::TopToolBarArea; +} +#endif + /*! \reimp */ bool QToolBar::event(QEvent *event) { @@ -1096,7 +1105,15 @@ bool QToolBar::event(QEvent *event) // fallthrough intended case QEvent::Show: d->toggleViewAction->setChecked(event->type() == QEvent::Show); -#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) +#if defined(Q_WS_MAC) + if (toolbarInUnifiedToolBar(this)) { + // I can static_cast because I did the qobject_cast in the if above, therefore + // we must have a QMainWindowLayout here. + QMainWindowLayout *mwLayout = static_cast(parentWidget()->layout()); + mwLayout->fixSizeInUnifiedToolbar(this); + mwLayout->syncUnifiedToolbarVisibility(); + } +# if !defined(QT_MAC_USE_COCOA) // Fall through case QEvent::LayoutRequest: { // There's currently no way to invalidate the size and let @@ -1111,10 +1128,9 @@ bool QToolBar::event(QEvent *event) } if (needUpdate) { - OSWindowRef windowRef = qt_mac_window_for(this); - if (mainWindow->unifiedTitleAndToolBarOnMac() - && mainWindow->toolBarArea(this) == Qt::TopToolBarArea - && macWindowToolbarVisible(windowRef)) { + OSWindowRef windowRef = qt_mac_window_for(mainWindow); + if (toolbarInUnifiedToolBar(this) + && macWindowToolbarIsVisible(windowRef)) { DisableScreenUpdates(); macWindowToolbarShow(this, false); macWindowToolbarShow(this, true); @@ -1126,7 +1142,8 @@ bool QToolBar::event(QEvent *event) return earlyResult; } } -#endif +# endif // !QT_MAC_USE_COCOA +#endif // Q_WS_MAC break; case QEvent::ParentChange: d->layout->checkUsePopupMenu(); -- cgit v0.12 From a21230152c4ea8cd2e641f436230e76a835384c2 Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 10 Jul 2009 12:07:38 +1000 Subject: Fixes a heisenbug when using two ODBC connections with diff quoters. Can have situations where 2 odbc connections are active, that have differing quoting charachters. Before this fix, everything fell over. Reviewed-by: Justin McPherson --- src/sql/drivers/odbc/qsql_odbc.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 50defdf..fa9031a 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -89,7 +89,8 @@ public: enum DefaultCase{Lower, Mixed, Upper, Sensitive}; QODBCDriverPrivate() : hEnv(0), hDbc(0), useSchema(false), disconnectCount(0), isMySqlServer(false), - isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false) + isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false), + isQuoteInitialized(false), quote(QLatin1Char('"')) { unicode = false; } @@ -116,7 +117,10 @@ public: QString &schema, QString &table); DefaultCase defaultCase() const; QString adjustCase(const QString&) const; - QChar quoteChar() const; + QChar quoteChar(); +private: + bool isQuoteInitialized; + QChar quote; }; class QODBCPrivate @@ -566,10 +570,8 @@ static int qGetODBCVersion(const QString &connOpts) return SQL_OV_ODBC2; } -QChar QODBCDriverPrivate::quoteChar() const +QChar QODBCDriverPrivate::quoteChar() { - static bool isQuoteInitialized = false; - static QChar quote = QChar::fromLatin1('"'); if (!isQuoteInitialized) { char driverResponse[4]; SQLSMALLINT length; @@ -579,9 +581,9 @@ QChar QODBCDriverPrivate::quoteChar() const sizeof(driverResponse), &length); if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { - quote = QChar::fromLatin1(driverResponse[0]); + quote = QLatin1Char(driverResponse[0]); } else { - quote = QChar::fromLatin1('"'); + quote = QLatin1Char('"'); } isQuoteInitialized = true; } -- cgit v0.12 From 0d156972b868c951fa33f21735040ab1e7a76f21 Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 10 Jul 2009 12:12:45 +1000 Subject: Get more sql autotests passing or expect-failing. --- tests/auto/qsqlquery/tst_qsqlquery.cpp | 2 ++ .../tst_qsqlrelationaltablemodel.cpp | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 9a873cb..f3dd920 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -495,7 +495,9 @@ void tst_QSqlQuery::mysqlOutValues() QVERIFY_SQL( q, exec( "create procedure " + qTableName( "qtestproc" ) + " () " "BEGIN select * from " + qTableName( "qtest" ) + " order by id; END" ) ); QVERIFY_SQL( q, exec( "call " + qTableName( "qtestproc" ) + "()" ) ); + QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue); QVERIFY_SQL( q, next() ); + QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue); QCOMPARE( q.value( 1 ).toString(), QString( "VarChar1" ) ); QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) ); diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index d934b35..1e23d3d 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -145,8 +145,17 @@ void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db) void tst_QSqlRelationalTableModel::initTestCase() { - foreach (const QString &dbname, dbs.dbNames) - recreateTestTables(QSqlDatabase::database(dbname)); + foreach (const QString &dbname, dbs.dbNames) { + QSqlDatabase db=QSqlDatabase::database(dbname); + if (db.driverName().startsWith("QIBASE")) + db.exec("SET DIALECT 3"); + else if (tst_Databases::isSqlServer(db)) { + QSqlQuery q(db); + QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); + QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); + } + recreateTestTables(db); + } } void tst_QSqlRelationalTableModel::cleanupTestCase() @@ -490,6 +499,7 @@ void tst_QSqlRelationalTableModel::insertWithStrategies() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setSort(0, Qt::AscendingOrder); if (!db.driverName().startsWith("QTDS")) model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); @@ -914,8 +924,8 @@ void tst_QSqlRelationalTableModel::casing() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - if (db.driverName().startsWith("QSQLITE")) - QSKIP("The casing test for SQLITE is irrelevant since SQLITE is case insensitive", SkipAll); + if (db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QIBASE") || tst_Databases::isSqlServer(db)) + QSKIP("The casing test for this database is irrelevant since this database does not treat different cases as separate entities", SkipAll); QSqlQuery q(db); QVERIFY_SQL( q, exec("create table " + qTableName("CASETEST1", db.driver()).toUpper() + -- cgit v0.12 From 5f798ce8208fd5b1f2212246bc6b8ee2ec4652f0 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 2 Jul 2009 18:16:42 -0700 Subject: Fix QDFBPaintEngine::drawTiledPixmap/fillRect Until this fix very few cases of drawTiledPixmap and fillRect(r, textureBrush) have been handled by DirectFB. This patch makes it possible to accelerate such operations. Reviewed-By: Donald --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 168 ++++++++++++++------- 1 file changed, 111 insertions(+), 57 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 947cc76..27df0da 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -241,7 +241,7 @@ public: void fillRects(const QRectF *rects, int count); void drawRects(const QRectF *rects, int count); - void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap); + void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos); void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src); inline void updateClip(); @@ -284,6 +284,7 @@ private: bool unsupportedCompositionMode; QDirectFBPaintEngine *q; + QRect currentClip; friend class QDirectFBPaintEngine; }; @@ -343,6 +344,7 @@ bool QDirectFBPaintEngine::end() #if (Q_DIRECTFB_VERSION >= 0x010000) d->surface->ReleaseSource(d->surface); #endif + d->currentClip = QRect(); d->surface->SetClip(d->surface, NULL); d->surface = 0; return QRasterPaintEngine::end(); @@ -613,30 +615,26 @@ void QDirectFBPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, - const QPointF &sp) + const QPointF &offset) { Q_D(QDirectFBPaintEngine); d->updateClip(); if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { - RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); + RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); d->lock(); - QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp); - } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull() + QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset); + } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { - RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); + RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); const QImage *img = static_cast(pixmap.pixmapData())->buffer(DSLF_READ); d->lock(); QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); data->fromImage(*img, Qt::AutoColor); const QPixmap pix(data); - QRasterPaintEngine::drawTiledPixmap(r, pix, sp); + QRasterPaintEngine::drawTiledPixmap(r, pix, offset); } else { d->unlock(); - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbData = static_cast(data); - dfbData->unlockDirectFB(); - d->drawTiledPixmap(r, pixmap); + d->drawTiledPixmap(r, pixmap, offset); } } @@ -733,14 +731,17 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()); return; } - case Qt::TexturePattern: - if (state()->brushOrigin == QPointF() && brush.transform().isIdentity()) { - //could handle certain types of brush.transform() E.g. scale - d->unlock(); - d->drawTiledPixmap(rect, brush.texture()); - return; - } - break; + case Qt::TexturePattern: { + if (d->scale == QDirectFBPaintEnginePrivate::NegativeScale) + break; + + const QPixmap texture = brush.texture(); + if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass) + break; + + d->unlock(); + d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin); + return; } default: break; } @@ -1077,55 +1078,105 @@ void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, DirectFBError("QDirectFBPaintEngine::drawPixmap()", result); } -void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, - const QPixmap &pixmap) +static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset) { + qreal pos = rect_pos - offset; + while (pos > rect_pos) + pos -= pixmapSize; + while (pos + pixmapSize < rect_pos) + pos += pixmapSize; + return pos; +} + +void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off) +{ + Q_ASSERT(!dirtyClip); + const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); + QRect newClip = destinationRect; + if (!currentClip.isEmpty()) + newClip &= currentClip; + + if (newClip.isNull()) + return; + + const DFBRegion clip = { + newClip.x(), + newClip.y(), + newClip.x() + newClip.width() - 1, + newClip.y() + newClip.height() - 1 + }; + surface->SetClip(surface, &clip); + + QPointF offset = off; + Q_ASSERT(transform.type() <= QTransform::TxScale); prepareForBlit(pixmap.hasAlphaChannel()); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast(data); - IDirectFBSurface *s = dfbData->directFBSurface(); - const QRect dr = transform.mapRect(dest).toRect(); - DFBResult result = DFB_OK; - - if (scale == NoScale && dr == QRect(0, 0, fbWidth, fbHeight)) { - result = surface->TileBlit(surface, s, 0, 0, 0); - } else if (scale == NoScale) { - const int dx = pixmap.width(); - const int dy = pixmap.height(); - const DFBRectangle rect = { 0, 0, dx, dy }; - QVarLengthArray rects; - QVarLengthArray points; - - for (int y = dr.y(); y <= dr.bottom(); y += dy) { - for (int x = dr.x(); x <= dr.right(); x += dx) { - rects.append(rect); - const DFBPoint point = { x, y }; - points.append(point); + dfbData->unlockDirectFB(); + const QSize pixmapSize = dfbData->size(); + IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); + if (transform.isScaling()) { + Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0); + offset.rx() *= transform.m11(); + offset.ry() *= transform.m22(); + + const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22()); + qreal y = ::fixCoord(destinationRect.y(), mappedSize.height(), offset.y()); + const qreal startX = ::fixCoord(destinationRect.x(), mappedSize.width(), offset.x()); + while (y < destinationRect.bottom()) { + qreal x = startX; + while (x < destinationRect.right()) { + const DFBRectangle destination = { qRound(x), qRound(y), mappedSize.width(), mappedSize.height() }; + surface->StretchBlit(surface, sourceSurface, 0, &destination); + x += mappedSize.width(); } + y += mappedSize.height(); } - result = surface->BatchBlit(surface, s, rects.constData(), - points.constData(), points.size()); } else { - const QRect sr = transform.mapRect(QRect(0, 0, pixmap.width(), pixmap.height())); - const int dx = sr.width(); - const int dy = sr.height(); - const DFBRectangle sRect = { 0, 0, dx, dy }; - - for (int y = dr.y(); y <= dr.bottom(); y += dy) { - for (int x = dr.x(); x <= dr.right(); x += dx) { - const DFBRectangle dRect = { x, y, dx, dy }; - result = surface->StretchBlit(surface, s, &sRect, &dRect); - if (result != DFB_OK) { - y = dr.bottom() + 1; - break; - } + qreal y = ::fixCoord(destinationRect.y(), pixmapSize.height(), offset.y()); + const qreal startX = ::fixCoord(destinationRect.x(), pixmapSize.width(), offset.x()); + int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1; + if (startX != destinationRect.x()) + ++horizontal; + int vertical = qMax(1, destinationRect.height() / pixmapSize.height()) + 1; + if (y != destinationRect.y()) + ++vertical; + + const int maxCount = (vertical * horizontal); + QVarLengthArray sourceRects(maxCount); + QVarLengthArray points(maxCount); + + int i = 0; + while (y < destinationRect.bottom()) { + Q_ASSERT(i < maxCount); + qreal x = startX; + while (x < destinationRect.right()) { + points[i].x = qRound(x); + points[i].y = qRound(y); + sourceRects[i].x = 0; + sourceRects[i].y = 0; + sourceRects[i].w = int(pixmapSize.width()); + sourceRects[i].h = int(pixmapSize.height()); + x += pixmapSize.width(); + ++i; } + y += pixmapSize.height(); } + surface->BatchBlit(surface, sourceSurface, sourceRects.constData(), points.constData(), i); } - if (result != DFB_OK) - DirectFBError("QDirectFBPaintEngine::drawTiledPixmap()", result); + if (currentClip.isEmpty()) { + surface->SetClip(surface, 0); + } else { + const DFBRegion clip = { + currentClip.x(), + currentClip.y(), + currentClip.x() + currentClip.width(), + currentClip.y() + currentClip.height() + }; + surface->SetClip(surface, &clip); + } } void QDirectFBPaintEnginePrivate::updateClip() @@ -1133,6 +1184,7 @@ void QDirectFBPaintEnginePrivate::updateClip() if (!dirtyClip) return; + currentClip = QRect(); const QClipData *clipData = clip(); if (!clipData || !clipData->enabled) { surface->SetClip(surface, NULL); @@ -1145,6 +1197,8 @@ void QDirectFBPaintEnginePrivate::updateClip() clipData->clipRect.y() + clipData->clipRect.height() }; surface->SetClip(surface, &r); + currentClip = clipData->clipRect.normalized(); + // ### is this guaranteed to always be normalized? dfbHandledClip = true; } else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) { dfbHandledClip = true; -- cgit v0.12 From f3acf50b1410d7756788b8f9b6144bf7af61a24e Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 10 Jul 2009 13:13:44 +1000 Subject: Update test db definitions. --- tests/auto/qsqldatabase/tst_databases.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index 5b19023..9c8c313 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -105,7 +105,11 @@ inline static QString qTableName( const QString& prefix, QSqlDriver* driver = 0 inline static bool testWhiteSpaceNames( const QString &name ) { - return name != QLatin1String("QTDS7"); +/* return name.startsWith( "QPSQL" ) + || name.startsWith( "QODBC" ) + || name.startsWith( "QSQLITE" ) + || name.startsWith( "QMYSQL" );*/ + return name != QLatin1String("QSQLITE2"); } inline static QString toHex( const QString& binary ) @@ -246,10 +250,10 @@ public: // addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql4-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); -// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk;TDS_Version=8.0", "troll", "trondk", "" ); -// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond;TDS_Version=8.0", "troll", "trond", "" ); -// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "testuser", "Ee4Gabf6_", "" ); -// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" ); +// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond", "troll", "trond", "" ); +// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "", "", "" ); +// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "", "", "" ); // addDb( "QTDS7", "testdb", "testuser", "Ee4Gabf6_", "bq-winserv2003" ); // addDb( "QTDS7", "testdb", "testuser", "Ee4Gabf6_", "bq-winserv2008" ); // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); -- cgit v0.12 From 64b485855637ef4fa31d3a4efca694db888ae612 Mon Sep 17 00:00:00 2001 From: Luc Devallonne Date: Fri, 10 Jul 2009 10:10:02 +0200 Subject: Support Tablet coordinate on Windows with non-zero physical origin Most Wacom tablet have a coordinate origin at 0 (Bamboo,Intous), but some tablet (like DTF 720, which have an integrated screen) have a non zero coordinate origin. Which lead to an errounous y/a tablet pos reported by Qt tablet event. Merge-request: 822 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qapplication_p.h | 10 ++++++---- src/gui/kernel/qapplication_win.cpp | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index db77b07..90eaba0 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -158,17 +158,19 @@ inline QPointF QTabletDeviceData::scaleCoord(int coordX, int coordY, int outOriginY, int outExtentY) const { QPointF ret; + if (sign(outExtentX) == sign(maxX)) - ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX))) + outOriginX); + ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) + outOriginX); else - ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX))) + ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) + outOriginX); if (sign(outExtentY) == sign(maxY)) - ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY))) + outOriginY); + ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) + outOriginY); else - ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY))) + ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) + outOriginY); + return ret; } #endif diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index e0eda82..e26d82e 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3324,17 +3324,19 @@ static void tabletInit(UINT wActiveCsr, HCTX hTab) tdd.minTanPressure = int(np.axMin); tdd.maxTanPressure = int(np.axMax); - ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_X, &np); - tdd.minX = int(np.axMin); - tdd.maxX = int(np.axMax); + LOGCONTEXT lcMine; - ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_Y, &np); - tdd.minY = int(np.axMin); - tdd.maxY = int(np.axMax); + /* get default region */ + ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine); - ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_Z, &np); - tdd.minZ = int(np.axMin); - tdd.maxZ = int(np.axMax); + tdd.minX = 0; + tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX); + + tdd.minY = 0; + tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY); + + tdd.minZ = 0; + tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ); int csr_type, csr_physid; -- cgit v0.12 From 28f31572b95a28e14f7ed4cebb907cfe1e257177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 10 Jul 2009 10:37:29 +0200 Subject: Painting artifacts when moving an item with partial updates. Found during manual testing (dndrobotinproxy). The problem was that the paintedViewBoundingRect was set to an empty rect because the partial update area didn't intersect with the viewport. The item itself was partially inside the viewport. Then, when the item was moved, its old area was not repainted due to this empty paintedViewBoundingRect. Auto-test included. --- src/gui/graphicsview/qgraphicsitem.cpp | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 49 +++++++++++++------------- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 47 ++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 24 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 85d76d4..2f646f7 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1821,6 +1821,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo if (q_ptr->isSelected()) q_ptr->setSelected(false); } else { + geometryChanged = 1; if (isWidget && scene) { QGraphicsWidget *widget = static_cast(q_ptr); if (widget->windowType() == Qt::Popup) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0ca72b7..c7c0865 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4517,17 +4517,14 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool item->d_ptr->paintedViewBoundingRectsNeedRepaint = 0; } - if (item->d_ptr->geometryChanged) { + if (!hasSceneRect && item->d_ptr->geometryChanged && item->d_ptr->visible) { // Update growingItemsBoundingRect. - if (!hasSceneRect) { - if (item->d_ptr->sceneTransformTranslateOnly) { - growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(), - item->d_ptr->sceneTransform.dy()); - } else { - growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); - } + if (item->d_ptr->sceneTransformTranslateOnly) { + growingItemsBoundingRect |= item->boundingRect().translated(item->d_ptr->sceneTransform.dx(), + item->d_ptr->sceneTransform.dy()); + } else { + growingItemsBoundingRect |= item->d_ptr->sceneTransform.mapRect(item->boundingRect()); } - item->d_ptr->geometryChanged = 0; } // Process item. @@ -4552,29 +4549,31 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool for (int j = 0; j < views.size(); ++j) { QGraphicsView *view = views.at(j); QGraphicsViewPrivate *viewPrivate = view->d_func(); - if (viewPrivate->fullUpdatePending) - continue; - switch (viewPrivate->viewportUpdateMode) { - case QGraphicsView::NoViewportUpdate: - continue; - case QGraphicsView::FullViewportUpdate: - view->viewport()->update(); - viewPrivate->fullUpdatePending = 1; + QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport]; + if (viewPrivate->fullUpdatePending + || viewPrivate->viewportUpdateMode == QGraphicsView::NoViewportUpdate) { + // Okay, if we have a full update pending or no viewport update, this item's + // paintedViewBoundingRect will be updated correctly in the next paintEvent if + // it is inside the viewport, but for now we can pretend that it is outside. + paintedViewBoundingRect = QRect(-1, -1, -1, -1); continue; - default: - break; } - QRect &paintedViewBoundingRect = item->d_ptr->paintedViewBoundingRects[viewPrivate->viewport]; - if (item->d_ptr->paintedViewBoundingRectsNeedRepaint) { + if (item->d_ptr->paintedViewBoundingRectsNeedRepaint && !paintedViewBoundingRect.isEmpty()) { paintedViewBoundingRect.translate(viewPrivate->dirtyScrollOffset); if (!viewPrivate->updateRect(paintedViewBoundingRect)) - paintedViewBoundingRect = QRect(); + paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport. } if (!item->d_ptr->dirty) continue; + if (!item->d_ptr->geometryChanged + && paintedViewBoundingRect.x() == -1 && paintedViewBoundingRect.y() == -1 + && paintedViewBoundingRect.width() == -1 && paintedViewBoundingRect.height() == -1) { + continue; // Outside viewport. + } + if (uninitializedDirtyRect) { dirtyRect = itemBoundingRect; if (!item->d_ptr->fullUpdatePending) { @@ -4587,8 +4586,10 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool if (dirtyRect.isEmpty()) continue; // Discard updates outside the bounding rect. - if (!updateHelper(viewPrivate, item->d_ptr, dirtyRect, itemIsUntransformable)) - paintedViewBoundingRect = QRect(); + if (!updateHelper(viewPrivate, item->d_ptr, dirtyRect, itemIsUntransformable) + && item->d_ptr->geometryChanged) { + paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport. + } } } } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index d689293..2dbd5f1 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6580,6 +6580,7 @@ public: void tst_QGraphicsItem::update() { QGraphicsScene scene; + scene.setSceneRect(-100, -100, 200, 200); MyGraphicsView view(&scene); view.show(); @@ -6636,6 +6637,52 @@ void tst_QGraphicsItem::update() QCOMPARE(view.repaints, 1); // The entire item's bounding rect (adjusted for antialiasing) should have been painted. QCOMPARE(view.paintedRegion, expectedRegion); + + // Make sure item is repainted when shown (after being hidden). + view.reset(); + item->repaints = 0; + item->show(); + qApp->processEvents(); + QCOMPARE(item->repaints, 1); + QCOMPARE(view.repaints, 1); + // The entire item's bounding rect (adjusted for antialiasing) should have been painted. + QCOMPARE(view.paintedRegion, expectedRegion); + + item->repaints = 0; + item->hide(); + qApp->processEvents(); + view.reset(); + const QPointF originalPos = item->pos(); + item->setPos(5000, 5000); + qApp->processEvents(); + QCOMPARE(item->repaints, 0); + QCOMPARE(view.repaints, 0); + qApp->processEvents(); + + item->setPos(originalPos); + qApp->processEvents(); + QCOMPARE(item->repaints, 0); + QCOMPARE(view.repaints, 0); + item->show(); + qApp->processEvents(); + QCOMPARE(item->repaints, 1); + QCOMPARE(view.repaints, 1); + // The entire item's bounding rect (adjusted for antialiasing) should have been painted. + QCOMPARE(view.paintedRegion, expectedRegion); + + QGraphicsViewPrivate *viewPrivate = static_cast(qt_widget_private(&view)); + item->setPos(originalPos + QPoint(50, 50)); + viewPrivate->updateAll(); + QVERIFY(viewPrivate->fullUpdatePending); + QTest::qWait(50); + item->repaints = 0; + view.reset(); + item->setPos(originalPos); + QTest::qWait(50); + qApp->processEvents(); + QCOMPARE(item->repaints, 1); + QCOMPARE(view.repaints, 1); + QCOMPARE(view.paintedRegion, expectedRegion + expectedRegion.translated(50, 50)); } void tst_QGraphicsItem::setTransformProperties_data() -- cgit v0.12 From 00cc4c9cfc83fa2a20fc72712c7caf9f8bc6f7bb Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 11:08:24 +0200 Subject: Phonon videos on windows would not show with video acceleration disabled Task-number: 257805 --- src/3rdparty/phonon/ds9/videowidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/ds9/videowidget.cpp b/src/3rdparty/phonon/ds9/videowidget.cpp index 0ef653f..34ff8cb 100644 --- a/src/3rdparty/phonon/ds9/videowidget.cpp +++ b/src/3rdparty/phonon/ds9/videowidget.cpp @@ -153,7 +153,7 @@ namespace Phonon } } else if (!isEmbedded()) { m_currentRenderer = m_node->switchRendering(m_currentRenderer); - setAttribute(Qt::WA_PaintOnScreen, true); + setAttribute(Qt::WA_PaintOnScreen, false); } } -- cgit v0.12 From f9128d973f60e225045bebb97a19d292395b865d Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 11:24:35 +0200 Subject: QDoubleSpinBox: make sure people can't choose too many decimals Maximum number of decimals is DBL_MAX_10_EXP + DBL_DIG Task-number: 257291 --- src/gui/widgets/qspinbox.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index e069a21..3933272 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -50,6 +50,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -823,8 +824,8 @@ void QDoubleSpinBox::setRange(double minimum, double maximum) Sets how many decimals the spinbox will use for displaying and interpreting doubles. - \warning The results might not be reliable with very high values - for \a decimals. + \warning The maximum value for \a decimals is DBL_MAX_10_EXP + + DBL_DIG (ie. 323) because of the limitations of the double type. Note: The maximum, minimum and value might change as a result of changing this property. @@ -840,7 +841,7 @@ int QDoubleSpinBox::decimals() const void QDoubleSpinBox::setDecimals(int decimals) { Q_D(QDoubleSpinBox); - d->decimals = qMax(0, decimals); + d->decimals = qBound(0, decimals, DBL_MAX_10_EXP + DBL_DIG); setRange(minimum(), maximum()); // make sure values are rounded setValue(value()); -- cgit v0.12 From fdf5fd0cc63c20579250087905331eb76385d528 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 12:32:26 +0200 Subject: QFileDialog: the side urls are now always cleaned when they are local Task-number: 257579 --- src/gui/dialogs/qsidebar.cpp | 13 +++++++++---- tests/auto/qfiledialog/tst_qfiledialog.cpp | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp index 1915e21..e4821ad 100644 --- a/src/gui/dialogs/qsidebar.cpp +++ b/src/gui/dialogs/qsidebar.cpp @@ -247,11 +247,16 @@ void QUrlModel::addUrls(const QList &list, int row, bool move) QUrl url = list.at(i); if (!url.isValid() || url.scheme() != QLatin1String("file")) continue; + //this makes sure the url is clean + const QString cleanUrl = QDir::cleanPath(url.toLocalFile()); + url = QUrl::fromLocalFile(cleanUrl); + for (int j = 0; move && j < rowCount(); ++j) { + QString local = index(j, 0).data(UrlRole).toUrl().toLocalFile(); #if defined(Q_OS_WIN) - if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()).toLower() == QDir::cleanPath(url.toLocalFile()).toLower()) { + if (index(j, 0).data(UrlRole).toUrl().toLocalFile().toLower() == cleanUrl.toLower()) { #else - if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()) == QDir::cleanPath(url.toLocalFile())) { + if (index(j, 0).data(UrlRole).toUrl().toLocalFile() == cleanUrl) { #endif removeRow(j); if (j <= row) @@ -260,12 +265,12 @@ void QUrlModel::addUrls(const QList &list, int row, bool move) } } row = qMax(row, 0); - QModelIndex idx = fileSystemModel->index(url.toLocalFile()); + QModelIndex idx = fileSystemModel->index(cleanUrl); if (!fileSystemModel->isDir(idx)) continue; insertRows(row, 1); setUrl(index(row, 0), url, idx); - watching.append(QPair(idx, url.toLocalFile())); + watching.append(qMakePair(idx, cleanUrl)); } } diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 8bb81e7..50cab0e 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -160,6 +160,7 @@ private slots: void task251321_sideBarHiddenEntries(); void task251341_sideBarRemoveEntries(); void task254490_selectFileMultipleTimes(); + void task257579_sideBarWithNonCleanUrls(); private: QByteArray userSettings; @@ -2026,5 +2027,25 @@ void tst_QFiledialog::task254490_selectFileMultipleTimes() t->deleteLater(); } +void tst_QFiledialog::task257579_sideBarWithNonCleanUrls() +{ + QDir tempDir = QDir::temp(); + QLatin1String dirname("autotest_task257579"); + tempDir.rmdir(dirname); //makes sure it doesn't exist any more + QVERIFY(tempDir.mkdir(dirname)); + QString url = QString::fromLatin1("%1/%2/..").arg(tempDir.absolutePath()).arg(dirname); + QNonNativeFileDialog fd; + fd.setSidebarUrls(QList() << QUrl::fromLocalFile(url)); + QSidebar *sidebar = qFindChild(&fd, "sidebar"); + QCOMPARE(sidebar->urls().count(), 1); + QVERIFY(sidebar->urls().first().toLocalFile() != url); + QCOMPARE(sidebar->urls().first().toLocalFile(), QDir::cleanPath(url)); + QCOMPARE(sidebar->model()->index(0,0).data().toString(), tempDir.dirName()); + + //all tests are finished, we can remove the temporary dir + QVERIFY(tempDir.rmdir(dirname)); +} + + QTEST_MAIN(tst_QFiledialog) #include "tst_qfiledialog.moc" -- cgit v0.12 From 9d073c3c92f732ec73587b0696e8994107a98402 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Jul 2009 11:54:53 +0200 Subject: Fix compilation support with namespaces for QtLibcSupplement Reviewed-By: hjk --- src/corelib/kernel/qcore_unix_p.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 1bf2425..8d43897 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -69,19 +69,19 @@ struct sockaddr; -QT_BEGIN_NAMESPACE - #if defined(Q_OS_LINUX) && defined(O_CLOEXEC) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204 // Linux supports thread-safe FD_CLOEXEC # define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 1 +QT_BEGIN_NAMESPACE namespace QtLibcSupplement { Q_CORE_EXPORT int accept4(int, sockaddr *, QT_SOCKLEN_T *, int flags); Q_CORE_EXPORT int dup3(int oldfd, int newfd, int flags); Q_CORE_EXPORT int pipe2(int pipes[], int flags); } +QT_END_NAMESPACE +using namespace QT_PREPEND_NAMESPACE(QtLibcSupplement); -using namespace QtLibcSupplement; #else # define QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC 0 #endif @@ -91,6 +91,7 @@ using namespace QtLibcSupplement; var = cmd; \ } while (var == -1 && errno == EINTR) +QT_BEGIN_NAMESPACE // don't call QT_OPEN or ::open // call qt_safe_open -- cgit v0.12 From c1cf0eb65e87386d1875ed309e5c13cdc0f33e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 10 Jul 2009 12:50:10 +0200 Subject: Painting artifacts when closing an embedded popup in Graphics View. Found during manual testing (demos/embeddeddialogs). The problem was that a full update (right before hiding/deleting an item) caused the update request made from the destructor to be discarded. Auto-test included. --- src/gui/graphicsview/qgraphicsitem.cpp | 7 ++-- .../tst_qgraphicsproxywidget.cpp | 39 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2f646f7..0cfaab7 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -4325,12 +4325,11 @@ bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignore { // No scene, or if the scene is updating everything, means we have nothing // to do. The only exception is if the scene tracks the growing scene rect. - return (!visible && !ignoreVisibleBit) + return !scene + || (!visible && !ignoreVisibleBit && !this->ignoreVisible) || (!ignoreDirtyBit && fullUpdatePending) - || !scene - || (scene->d_func()->updateAll && scene->d_func()->hasSceneRect) || (!ignoreClipping && (childrenClippedToShape() && isClippedAway())) - || (!ignoreOpacity && childrenCombineOpacity() && isFullyTransparent()); + || (!ignoreOpacity && !this->ignoreOpacity && childrenCombineOpacity() && isFullyTransparent()); } /*! diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 0b1d5cf..3b13bcc 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -178,6 +178,7 @@ private slots: void windowFlags_data(); void windowFlags(); void comboboxWindowFlags(); + void updateAndDelete(); }; // Subclass that exposes the protected functions. @@ -3217,6 +3218,44 @@ void tst_QGraphicsProxyWidget::comboboxWindowFlags() QVERIFY((static_cast(popupProxy)->windowFlags() & Qt::Popup) == Qt::Popup); } +void tst_QGraphicsProxyWidget::updateAndDelete() +{ + QGraphicsScene scene; + QGraphicsProxyWidget *proxy = scene.addWidget(new QPushButton("Hello World")); + View view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(200); + + const QRect itemDeviceBoundingRect = proxy->deviceTransform(view.viewportTransform()) + .mapRect(proxy->boundingRect()).toRect(); + const QRegion expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); + + view.npaints = 0; + view.paintEventRegion = QRegion(); + + // Update and hide. + proxy->update(); + proxy->hide(); + QTest::qWait(50); + QCOMPARE(view.npaints, 1); + QCOMPARE(view.paintEventRegion, expectedRegion); + + proxy->show(); + QTest::qWait(50); + view.npaints = 0; + view.paintEventRegion = QRegion(); + + // Update and delete. + proxy->update(); + delete proxy; + QTest::qWait(50); + QCOMPARE(view.npaints, 1); + QCOMPARE(view.paintEventRegion, expectedRegion); +} + QTEST_MAIN(tst_QGraphicsProxyWidget) #include "tst_qgraphicsproxywidget.moc" -- cgit v0.12 From b420385f15f109765fc31c5bcc5b4ea9498b82d4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 10 Jul 2009 13:17:43 +0200 Subject: doc: Clarified that native messages are being handled. Task-number: 214026 --- src/corelib/kernel/qabstracteventdispatcher.cpp | 25 ++++++++------- src/corelib/kernel/qcoreapplication.cpp | 42 +++++++++++++++++-------- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index a98d005..e2682f5 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -398,20 +398,23 @@ void QAbstractEventDispatcher::closingDown() */ /*! - Sets the event filter \a filter. Returns a pointer to the filter - function previously defined. - - The event filter is a function that receives all messages taken - from the system event loop before the event is dispatched to the - respective target. This includes messages that are not sent to Qt + Replaces the event filter function for this + QAbstractEventDispatcher with \a filter and returns the replaced + event filter function. Only the current event filter function is + called. If you want to use both filter functions, save the + replaced EventFilter in a place where yours can call it. + + The event filter function set here is called for all messages + taken from the system event loop before the event is dispatched to + the respective target, including the messages not meant for Qt objects. - The function can return true to stop the event to be processed by - Qt, or false to continue with the standard event processing. + The event filter function should return true if the message should + be filtered, (i.e. stopped). It should return false to allow + processing the message to continue. - Only one filter can be defined, but the filter can use the return - value to call the previously set event filter. By default, no - filter is set (i.e. the function returns 0). + By default, no event filter function is set (i.e., this function + returns a null EventFilter the first time it is called). */ QAbstractEventDispatcher::EventFilter QAbstractEventDispatcher::setEventFilter(EventFilter filter) { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 054be70..706dc54 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2183,21 +2183,37 @@ void QCoreApplication::removeLibraryPath(const QString &path) /*! \fn EventFilter QCoreApplication::setEventFilter(EventFilter filter) - Sets the event filter \a filter. Returns a pointer to the filter - function previously defined. - - The event filter is a function that is called for every message - received in all threads. This does \e not include messages to + Replaces the event filter function for the QCoreApplication with + \a filter and returns the pointer to the replaced event filter + function. Only the current event filter function is called. If you + want to use both filter functions, save the replaced EventFilter + in a place where yours can call it. + + The event filter function set here is called for all messages + received by all threads meant for all Qt objects. It is \e not + called for messages that are not meant for Qt objects. + + The event filter function should return true if the message should + be filtered, (i.e. stopped). It should return false to allow + processing the message to continue. + + By default, no event filter function is set (i.e., this function + returns a null EventFilter the first time it is called). + + \note The filter function set here receives native messages, + i.e. MSG or XEvent structs, that are going to Qt objects. It is + called by QCoreApplication::filterEvent(). If the filter function + returns false to indicate the message should be processed further, + the native message can then be translated into a QEvent and + handled by the standard Qt \l{QEvent} {event} filering, e.g. + QObject::installEventFilter(). + + \note The filter function set here is different form the filter + function set via QAbstractEventDispatcher::setEventFilter(), which + gets all messages received by its thread, even messages meant for objects that are not handled by Qt. - The function can return true to stop the event to be processed by - Qt, or false to continue with the standard event processing. - - Only one filter can be defined, but the filter can use the return - value to call the previously set event filter. By default, no - filter is set (i.e., the function returns 0). - - \sa installEventFilter() + \sa QObject::installEventFilter(), QAbstractEventDispatcher::setEventFilter() */ QCoreApplication::EventFilter QCoreApplication::setEventFilter(QCoreApplication::EventFilter filter) -- cgit v0.12 From bc747a81f4f6f0978f71cd8d19f69060fc8a8041 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 14:30:05 +0200 Subject: QMainWindow: it is useless to apply the stte after a call to plug The layoutState is already current (ie. already applied). --- src/gui/widgets/qmainwindowlayout.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 541907e..3936a67 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1629,9 +1629,6 @@ void QMainWindowLayout::animationFinished(QWidget *widget) #ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_TABBAR - //it is important to set the current tab before applying the layout - //so that applyState will not try to counter the result of the animation - //by putting the item in negative space if (qobject_cast(widget) != 0) { // info() might return null if the widget is destroyed while // animating but before the animationFinished signal is received. @@ -1641,8 +1638,6 @@ void QMainWindowLayout::animationFinished(QWidget *widget) #endif #endif - applyState(layoutState, false); - savedState.clear(); currentGapPos.clear(); pluggingWidget = 0; -- cgit v0.12 From e2bf5eeee12329ad4aee941b5bb70af4ee5bb32f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 15:30:01 +0200 Subject: QTableView: horizontal scrollbar could be inoperent with big columns Task-number: 240266 --- src/gui/itemviews/qtableview.cpp | 4 ++++ tests/auto/qtableview/tst_qtableview.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index c676237..882a213 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1528,6 +1528,8 @@ void QTableView::updateGeometries() ++columnsInViewport; } } + columnsInViewport = qMax(columnsInViewport, 1); //there must be always at least 1 column + if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) { const int visibleColumns = columnCount - d->horizontalHeader->hiddenSectionCount(); horizontalScrollBar()->setRange(0, visibleColumns - columnsInViewport); @@ -1554,6 +1556,8 @@ void QTableView::updateGeometries() ++rowsInViewport; } } + rowsInViewport = qMax(rowsInViewport, 1); //there must be always at least 1 row + if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) { const int visibleRows = rowCount - d->verticalHeader->hiddenSectionCount(); verticalScrollBar()->setRange(0, visibleRows - rowsInViewport); diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index ae023ba..0a69b75 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -175,6 +175,7 @@ private slots: // task-specific tests: void task173773_updateVerticalHeader(); void task227953_setRootIndex(); + void task240266_veryBigColumn(); void mouseWheel_data(); void mouseWheel(); @@ -3127,6 +3128,31 @@ void tst_QTableView::task227953_setRootIndex() QVERIFY(!tableView.verticalHeader()->isHidden()); } +void tst_QTableView::task240266_veryBigColumn() +{ + QTableView table; + table.setFixedSize(500, 300); //just to make sure we have the 2 first columns visible + QStandardItemModel model(1, 3); + table.setModel(&model); + table.setColumnWidth(0, 100); //normal column + table.setColumnWidth(1, 100); //normal column + table.setColumnWidth(2, 9000); //very big column + table.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(100); + + QScrollBar *scroll = table.horizontalScrollBar(); + QCOMPARE(scroll->minimum(), 0); + QCOMPARE(scroll->maximum(), model.columnCount() - 1); + QCOMPARE(scroll->singleStep(), 1); + + //1 is not always a very correct value for pageStep. Ideally this should be dynamic. + //Maybe something for Qt 5 ;-) + QCOMPARE(scroll->pageStep(), 1); + +} void tst_QTableView::mouseWheel_data() { -- cgit v0.12 From 788b8ab3eed9314310408a577d797471d392d582 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 15:46:13 +0200 Subject: adding autotest Task-number: 248688 --- tests/auto/qtableview/tst_qtableview.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 0a69b75..6fa57f0 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -176,6 +176,7 @@ private slots: void task173773_updateVerticalHeader(); void task227953_setRootIndex(); void task240266_veryBigColumn(); + void task248688_autoScrollNavigation(); void mouseWheel_data(); void mouseWheel(); @@ -587,7 +588,7 @@ void tst_QTableView::keyboardNavigation() QModelIndex index = model.index(rowCount - 1, columnCount - 1); view.setCurrentIndex(index); - QApplication::instance()->processEvents(); + QApplication::processEvents(); int row = rowCount - 1; int column = columnCount - 1; @@ -619,7 +620,7 @@ void tst_QTableView::keyboardNavigation() } QTest::keyClick(&view, key); - QApplication::instance()->processEvents(); + QApplication::processEvents(); QModelIndex index = model.index(row, column); QCOMPARE(view.currentIndex(), index); @@ -3154,6 +3155,31 @@ void tst_QTableView::task240266_veryBigColumn() } +void tst_QTableView::task248688_autoScrollNavigation() +{ + //we make sure that when navigating with the keyboard the view is correctly scrolled + //to the current item + QStandardItemModel model(16, 16); + QTableView view; + view.setModel(&model); + + view.hideColumn(8); + view.hideRow(8); + view.show(); + for (int r = 0; r < model.rowCount(); ++r) { + if (view.isRowHidden(r)) + continue; + for (int c = 0; c < model.columnCount(); ++c) { + if (view.isColumnHidden(c)) + continue; + QModelIndex index = model.index(r, c); + view.setCurrentIndex(index); + QVERIFY(view.viewport()->rect().contains(view.visualRect(index))); + } + } +} + + void tst_QTableView::mouseWheel_data() { QTest::addColumn("scrollMode"); -- cgit v0.12 From 7cca54d2bd7e8e42419210c499e27a1452447330 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 16:02:24 +0200 Subject: QTableView: auto-scrolling could be broken by invisible sections Task-number: 248688 --- src/gui/itemviews/qtableview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 882a213..2009499 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -2040,7 +2040,7 @@ void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint) if (positionAtRight || hint == PositionAtCenter || positionAtLeft) { int hiddenSections = 0; if (d->horizontalHeader->sectionsHidden()) { - for (int s = horizontalIndex; s >= 0; --s) { + for (int s = horizontalIndex - 1; s >= 0; --s) { int column = d->horizontalHeader->logicalIndex(s); if (d->horizontalHeader->isSectionHidden(column)) ++hiddenSections; @@ -2095,7 +2095,7 @@ void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint) if (hint == PositionAtBottom || hint == PositionAtCenter || hint == PositionAtTop) { int hiddenSections = 0; if (d->verticalHeader->sectionsHidden()) { - for (int s = verticalIndex; s >= 0; --s) { + for (int s = verticalIndex - 1; s >= 0; --s) { int row = d->verticalHeader->logicalIndex(s); if (d->verticalHeader->isSectionHidden(row)) ++hiddenSections; -- cgit v0.12 From 4ed3ee42bae92b0feb5c898e4f0fdf7d34e34108 Mon Sep 17 00:00:00 2001 From: Luc Devallonne Date: Fri, 10 Jul 2009 16:22:33 +0200 Subject: Tablet events get delivered to the widget where the tablet down happend. This is basically the Windows version of the bug fixed in change 82e825ed841bce324a6892fcbace03f9936d4f4f Merge-request: 855 Reviewed-by: Norwegian Rock Cat --- src/gui/kernel/qapplication_win.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index e26d82e..e0c62b7 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -2956,7 +2956,9 @@ bool QETWidget::translateMouseEvent(const MSG &msg) if (alienWidget && alienWidget->internalWinId()) alienWidget = 0; - if (type == QEvent::MouseMove || type == QEvent::NonClientAreaMouseMove) { + if (type == QEvent::MouseMove || type == QEvent::NonClientAreaMouseMove + || type == QEvent::TabletMove) { + if (!(state & Qt::MouseButtonMask)) qt_button_down = 0; #ifndef QT_NO_CURSOR @@ -3087,6 +3089,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg) popupButtonFocus = popupChild; break; case QEvent::MouseButtonRelease: + case QEvent::TabletRelease: + releaseAfter = true; break; default: @@ -3446,13 +3450,34 @@ bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, } QPoint globalPos(qRound(hiResGlobal.x()), qRound(hiResGlobal.y())); + if (t == QEvent::TabletPress) + { + qt_button_down = QApplication::widgetAt(globalPos); + } + // make sure the tablet event get's sent to the proper widget... - QWidget *w = QApplication::widgetAt(globalPos); + QWidget *w = 0; + if (qt_button_down) w = qt_button_down; // Pass it to the thing that's grabbed it. + else + w = QApplication::widgetAt(globalPos); if (!w) w = this; + + if (t == QEvent::TabletRelease) + { + if (qt_win_ignoreNextMouseReleaseEvent) { + qt_win_ignoreNextMouseReleaseEvent = false; + if (qt_button_down && qt_button_down->internalWinId() == autoCaptureWnd) { + releaseAutoCapture(); + qt_button_down = 0; + } + } + + } + QPoint localPos = w->mapFromGlobal(globalPos); #ifndef QT_NO_TABLETEVENT if (currentTabletPointer.currentDevice == QTabletEvent::Airbrush) { -- cgit v0.12 From 364aa2a21512d32f3f4271f438e3a6fa799c1e9e Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 16:30:49 +0200 Subject: ItemViews: make the pixmap from drag and drop more efficient We don't need to draw all the items that are selected. We just need those whose rect intersects the one from the viewport. Task-number: 233342 --- src/gui/itemviews/qabstractitemview.cpp | 33 ++++++++++++++++++++------------- src/gui/itemviews/qabstractitemview_p.h | 2 +- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index dd84304..5f347dd 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -3883,28 +3883,35 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const { + Q_ASSERT(r); Q_Q(const QAbstractItemView); - QRect rect = q->visualRect(indexes.at(0)); + QRect &rect = *r; + const QRect viewportRect = viewport->rect(); QList rects; + QModelIndexList paintedIndexes; for (int i = 0; i < indexes.count(); ++i) { - rects.append(q->visualRect(indexes.at(i))); - rect |= rects.at(i); + const QModelIndex &index = indexes.at(i); + const QRect current = q->visualRect(index); + if (current.intersects(viewportRect)) { + paintedIndexes += index; + rects += current; + rect |= current; + } } - rect = rect.intersected(viewport->rect()); - if (rect.width() <= 0 || rect.height() <= 0) + rect = rect.intersected(viewportRect); + if (rect.isEmpty()) return QPixmap(); - QImage image(rect.size(), QImage::Format_ARGB32_Premultiplied); - image.fill(0); - QPainter painter(&image); + QPixmap pixmap(rect.size()); + pixmap.fill(Qt::transparent); + QPainter painter(&pixmap); QStyleOptionViewItemV4 option = viewOptionsV4(); option.state |= QStyle::State_Selected; - for (int j = 0; j < indexes.count(); ++j) { + for (int j = 0; j < paintedIndexes.count(); ++j) { + const QModelIndex ¤t = paintedIndexes.at(j); option.rect = QRect(rects.at(j).topLeft() - rect.topLeft(), rects.at(j).size()); - delegateForIndex(indexes.at(j))->paint(&painter, option, indexes.at(j)); + delegateForIndex(current)->paint(&painter, option, current); } - painter.end(); - if (r) *r = rect; - return QPixmap::fromImage(image); + return pixmap; } void QAbstractItemViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 00647f6..7443d50 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -221,7 +221,7 @@ public: void clearOrRemove(); void checkPersistentEditorFocus(); - QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r = 0) const; + QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r) const; inline QPoint offset() const { const Q_Q(QAbstractItemView); -- cgit v0.12 From 577b3d7efc56f23dcf2b377816caa7d1aa3c7f88 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Fri, 10 Jul 2009 16:36:53 +0200 Subject: Fix compilation on SnowLeopard On 64-bit an id (void *) is 64-bit also, so, it really should be a pointer, but I'll make it a 64-bit int for the time being just so stuff compiles. --- src/gui/kernel/qmultitouch_mac.mm | 6 +++--- src/gui/kernel/qmultitouch_mac_p.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qmultitouch_mac.mm b/src/gui/kernel/qmultitouch_mac.mm index 3fe85a9..3d2eae6 100644 --- a/src/gui/kernel/qmultitouch_mac.mm +++ b/src/gui/kernel/qmultitouch_mac.mm @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE #ifdef QT_MAC_USE_COCOA -QHash QCocoaTouch::_currentTouches; +QHash QCocoaTouch::_currentTouches; QPointF QCocoaTouch::_screenReferencePos; QPointF QCocoaTouch::_trackpadReferencePos; int QCocoaTouch::_idAssignmentCount = 0; @@ -62,7 +62,7 @@ QCocoaTouch::QCocoaTouch(NSTouch *nstouch) _touchPoint.setId(_idAssignmentCount++); _touchPoint.setPressure(1.0); - _identity = int([nstouch identity]); + _identity = qint64([nstouch identity]); _currentTouches.insert(_identity, this); updateTouchData(nstouch, NSTouchPhaseBegan); } @@ -100,7 +100,7 @@ void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase) QCocoaTouch *QCocoaTouch::findQCocoaTouch(NSTouch *nstouch) { - int identity = int([nstouch identity]); + qint64 identity = qint64([nstouch identity]); if (_currentTouches.contains(identity)) return _currentTouches.value(identity); return 0; diff --git a/src/gui/kernel/qmultitouch_mac_p.h b/src/gui/kernel/qmultitouch_mac_p.h index 3fa8f6c..618e9ca 100644 --- a/src/gui/kernel/qmultitouch_mac_p.h +++ b/src/gui/kernel/qmultitouch_mac_p.h @@ -74,7 +74,7 @@ class QCocoaTouch static void setMouseInDraggingState(bool inDraggingState); private: - static QHash _currentTouches; + static QHash _currentTouches; static QPointF _screenReferencePos; static QPointF _trackpadReferencePos; static int _idAssignmentCount; @@ -82,7 +82,7 @@ class QCocoaTouch static bool _updateInternalStateOnly; QTouchEvent::TouchPoint _touchPoint; - int _identity; + qint64 _identity; QCocoaTouch(NSTouch *nstouch); ~QCocoaTouch(); -- cgit v0.12 From 3384aea1357a0f2e7c633701f467d5f8b0855c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 10 Jul 2009 16:42:08 +0200 Subject: Fixes broken item-lookup for untransformable items. Found during manual testing (manualtests/graphicsview/untransformable). At some point it was not possible to click on an untransformable item. The problem was that none of the untransformable items were top-levels, and none of the transformable top-level items were in the same area, resulting in an empty list of estimated top-level items. Auto-test included. --- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 7 ++- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 51 ++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index a7b4828..a54ade9 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -387,8 +387,13 @@ QList QGraphicsSceneBspTreeIndexPrivate::estimateItems(const QR if (onlyTopLevelItems) { for (int i = 0; i < untransformableItems.size(); ++i) { QGraphicsItem *item = untransformableItems.at(i); - if (!item->d_ptr->parent) + if (!item->d_ptr->parent) { rectItems << item; + } else { + item = item->topLevelItem(); + if (!rectItems.contains(item)) + rectItems << item; + } } } else { rectItems += untransformableItems; diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 2dbd5f1..4e669ae 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -231,6 +231,7 @@ private slots: void sorting_data(); void sorting(); void itemHasNoContents(); + void hitTestUntransformableItem(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -7131,5 +7132,55 @@ void tst_QGraphicsItem::itemHasNoContents() QCOMPARE(_paintedItems, QList() << item2); } +void tst_QGraphicsItem::hitTestUntransformableItem() +{ + QGraphicsScene scene; + scene.setSceneRect(-100, -100, 200, 200); + + QGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(100); + + // Confuse the BSP with dummy items. + QGraphicsRectItem *dummy = new QGraphicsRectItem(0, 0, 20, 20); + dummy->setPos(-100, -100); + scene.addItem(dummy); + for (int i = 0; i < 100; ++i) { + QGraphicsItem *parent = dummy; + dummy = new QGraphicsRectItem(0, 0, 20, 20); + dummy->setPos(-100 + i, -100 + i); + dummy->setParentItem(parent); + } + + QGraphicsRectItem *item1 = new QGraphicsRectItem(0, 0, 20, 20); + item1->setPos(-200, -200); + + QGraphicsRectItem *item2 = new QGraphicsRectItem(0, 0, 20, 20); + item2->setFlag(QGraphicsItem::ItemIgnoresTransformations); + item2->setParentItem(item1); + item2->setPos(200, 200); + + QGraphicsRectItem *item3 = new QGraphicsRectItem(0, 0, 20, 20); + item3->setParentItem(item2); + item3->setPos(80, 80); + + scene.addItem(item1); + QTest::qWait(100); + + QList items = scene.items(QPointF(80, 80)); + QCOMPARE(items.size(), 1); + QCOMPARE(items.at(0), static_cast(item3)); + + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + QTest::qWait(100); + + items = scene.items(QPointF(80, 80)); + QCOMPARE(items.size(), 1); + QCOMPARE(items.at(0), static_cast(item3)); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From 4d31527417419d4f7c1417b9360ef91d72469aa0 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 10 Jul 2009 17:13:06 +0200 Subject: QListView: improve performance on QListView::selectedIndexes Task-number: 233342 --- src/gui/itemviews/qlistview.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 4652b91..6ff516a 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1633,14 +1633,16 @@ QRegion QListView::visualRegionForSelection(const QItemSelection &selection) con QModelIndexList QListView::selectedIndexes() const { Q_D(const QListView); - QModelIndexList viewSelected; - QModelIndexList modelSelected; - if (d->selectionModel) - modelSelected = d->selectionModel->selectedIndexes(); - for (int i = 0; i < modelSelected.count(); ++i) { - QModelIndex index = modelSelected.at(i); + if (!d->selectionModel) + return QModelIndexList(); + + QModelIndexList viewSelected = d->selectionModel->selectedIndexes(); + for (int i = 0; i < viewSelected.count(); ++i) { + const QModelIndex &index = viewSelected.at(i); if (!isIndexHidden(index) && index.parent() == d->root && index.column() == d->column) - viewSelected.append(index); + ++i; + else + viewSelected.removeAt(i); } return viewSelected; } -- cgit v0.12 From 5425853ec6a9f29af3378c982f12a0cca4bcb0e0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jul 2009 14:46:44 +0200 Subject: make tests independent of PATH contents use absolute paths for the tested executables --- tests/auto/linguist/lconvert/tst_lconvert.cpp | 9 +++++---- tests/auto/linguist/lrelease/tst_lrelease.cpp | 16 +++++++++++----- tests/auto/linguist/lupdate/testlupdate.cpp | 5 +++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 40be55a..3ad2925 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -47,7 +47,7 @@ class tst_lconvert : public QObject Q_OBJECT public: - tst_lconvert() : dataDir("data/") {} + tst_lconvert() : dataDir("data/"), binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {} private slots: void initTestCase(); @@ -73,6 +73,7 @@ private: const QList &args); QString dataDir; + QString binDir; }; void tst_lconvert::initTestCase() @@ -151,7 +152,7 @@ void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn) void tst_lconvert::verifyReadFail(const QString &fn) { QProcess cvt; - cvt.start("lconvert", QStringList() << (dataDir + fn)); + cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn)); QVERIFY(cvt.waitForFinished(1000)); QVERIFY(cvt.exitStatus() == QProcess::NormalExit); QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input"); @@ -178,7 +179,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF if (!argList.isEmpty()) args += argList[i]; args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1]; - cvts.at(i)->start("lconvert", args); + cvts.at(i)->start(binDir + "/lconvert", args); } int st = 0; foreach (QProcess *cvt, cvts) @@ -242,7 +243,7 @@ void tst_lconvert::converts() QString outFileNameFq = dataDir + outFileName; QProcess cvt; - cvt.start("lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format); + cvt.start(binDir + "/lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format); doWait(&cvt, 0); if (QTest::currentTestFailed()) return; diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 512987d..858e477 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -49,6 +49,10 @@ class tst_lrelease : public QObject { Q_OBJECT + +public: + tst_lrelease() : binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {} + private: private slots: @@ -59,6 +63,8 @@ private slots: private: void doCompare(const QStringList &actual, const QString &expectedFn); + + QString binDir; }; void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedFn) @@ -111,7 +117,7 @@ void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedF void tst_lrelease::translate() { - QVERIFY(!QProcess::execute("lrelease testdata/translate.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/translate.ts")); QTranslator translator; QVERIFY(translator.load("testdata/translate.qm")); @@ -161,8 +167,8 @@ void tst_lrelease::translate() void tst_lrelease::mixedcodecs() { - QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts11.ts")); - QVERIFY(!QProcess::execute("lrelease testdata/mixedcodecs-ts20.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts11.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/mixedcodecs-ts20.ts")); QVERIFY(!QProcess::execute("cmp testdata/mixedcodecs-ts11.qm testdata/mixedcodecs-ts20.qm")); QTranslator translator; QVERIFY(translator.load("testdata/mixedcodecs-ts11.qm")); @@ -176,7 +182,7 @@ void tst_lrelease::mixedcodecs() void tst_lrelease::compressed() { - QVERIFY(!QProcess::execute("lrelease -compress testdata/compressed.ts")); + QVERIFY(!QProcess::execute(binDir + "/lrelease -compress testdata/compressed.ts")); QTranslator translator; QVERIFY(translator.load("testdata/compressed.qm")); @@ -194,7 +200,7 @@ void tst_lrelease::compressed() void tst_lrelease::dupes() { QProcess proc; - proc.start("lrelease testdata/dupes.ts"); + proc.start(binDir + "/lrelease testdata/dupes.ts"); QVERIFY(proc.waitForFinished()); QVERIFY(proc.exitStatus() == QProcess::NormalExit); doCompare(QString(proc.readAllStandardError()).trimmed().remove('\r').split('\n'), "testdata/dupes.errors"); diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp index 8abc2b0..04c03f1 100644 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ b/tests/auto/linguist/lupdate/testlupdate.cpp @@ -56,8 +56,9 @@ TestLUpdate::TestLUpdate() { childProc = 0; - m_cmdLupdate = QLatin1String("lupdate"); - m_cmdQMake = QLatin1String("qmake"); + QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath); + m_cmdLupdate = binPath + QLatin1String("/lupdate"); + m_cmdQMake = binPath + QLatin1String("/qmake"); } TestLUpdate::~TestLUpdate() -- cgit v0.12 From 593f8a322895dc011d88fbe112987f2189d43724 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jul 2009 18:05:30 +0200 Subject: rewrite makeplurals.sh in perl ... so it works under windows as well. --- tests/auto/linguist/lconvert/data/makeplurals.pl | 42 +++++++++++++++++++++++ tests/auto/linguist/lconvert/data/makeplurals.sh | 43 ------------------------ tests/auto/linguist/lconvert/tst_lconvert.cpp | 2 +- 3 files changed, 43 insertions(+), 44 deletions(-) create mode 100755 tests/auto/linguist/lconvert/data/makeplurals.pl delete mode 100755 tests/auto/linguist/lconvert/data/makeplurals.sh diff --git a/tests/auto/linguist/lconvert/data/makeplurals.pl b/tests/auto/linguist/lconvert/data/makeplurals.pl new file mode 100755 index 0000000..19bffe0 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/makeplurals.pl @@ -0,0 +1,42 @@ +#! /usr/bin/env perl + +sub makeit2($$$) +{ + for (my $i = 0; $i < (1 << $_[0]); $i++) { + print OUTFILE "\n"; + print OUTFILE "$_[2]\n" unless $3 eq ""; + print OUTFILE "msgid \"singular $_[1] $i\"\n"; + print OUTFILE "msgid_plural \"plural $_[1] $i\"\n"; + for (my $j = 0; $j < $_[0]; $j++) { + my $tr; + if (($i & (1 << $j)) == 0) { + $tr = "translated $_[1] $i $j"; + } + print OUTFILE "msgstr[$j] \"$tr\"\n"; + } + } +} + +sub makeit($$) +{ + open OUTFILE, ">${OUTDIR}plural-$_[0].po" || die "cannot write file in $OUTDIR"; + print OUTFILE < ${OUTDIR}plural-$1.po -} - -OUTDIR=$1 -makeit 1 zh_CN -makeit 2 de_DE -makeit 3 pl_PL diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 3ad2925..1ed71ab 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -79,7 +79,7 @@ private: void tst_lconvert::initTestCase() { if (!QFile::exists(QLatin1String("data/plural-1.po"))) - QProcess::execute(QLatin1String("data/makeplurals.sh"), QStringList() << QLatin1String("data/")); + QProcess::execute(QLatin1String("perl"), QStringList() << QLatin1String("data/makeplurals.pl") << QLatin1String("data/")); QVERIFY(QFile::exists(QLatin1String("data/plural-1.po"))); } -- cgit v0.12 From 435fae071798817f57bc89bf5d1ac20aae488625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 10 Jul 2009 18:14:48 +0200 Subject: QGraphicsItem not updated properly when moving parent. Found during manual testing (manualtests/graphicsview/movableitems). Moving a child item (via its parent) outside the viewport, and then back again didn't trigger an update on the child. Reason was that we had a cut-off checking the wrong bit (geometryChanged). This bit means exactly the same as the paintedViewBoundingRectsNeedRepaint bit, except that it doesn't propagate to the children (and that's the bug). We use paintedViewBoundingRectsNeedRepaint instead. Auto-test included. --- src/gui/graphicsview/qgraphicsitem.cpp | 1 + src/gui/graphicsview/qgraphicsscene.cpp | 4 ++-- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 33 +++++++++++++++++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0cfaab7..b7385d4 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1822,6 +1822,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo q_ptr->setSelected(false); } else { geometryChanged = 1; + paintedViewBoundingRectsNeedRepaint = 1; if (isWidget && scene) { QGraphicsWidget *widget = static_cast(q_ptr); if (widget->windowType() == Qt::Popup) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index c7c0865..aa7fa4c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4568,7 +4568,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool if (!item->d_ptr->dirty) continue; - if (!item->d_ptr->geometryChanged + if (!item->d_ptr->paintedViewBoundingRectsNeedRepaint && paintedViewBoundingRect.x() == -1 && paintedViewBoundingRect.y() == -1 && paintedViewBoundingRect.width() == -1 && paintedViewBoundingRect.height() == -1) { continue; // Outside viewport. @@ -4587,7 +4587,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool continue; // Discard updates outside the bounding rect. if (!updateHelper(viewPrivate, item->d_ptr, dirtyRect, itemIsUntransformable) - && item->d_ptr->geometryChanged) { + && item->d_ptr->paintedViewBoundingRectsNeedRepaint) { paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport. } } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 4e669ae..4ca1b48 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6614,9 +6614,9 @@ void tst_QGraphicsItem::update() qApp->processEvents(); QCOMPARE(item->repaints, 1); QCOMPARE(view.repaints, 1); - const QRect itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform()) - .mapRect(item->boundingRect()).toRect(); - const QRegion expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); + QRect itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform()) + .mapRect(item->boundingRect()).toRect(); + QRegion expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); // The entire item's bounding rect (adjusted for antialiasing) should have been painted. QCOMPARE(view.paintedRegion, expectedRegion); @@ -6684,6 +6684,33 @@ void tst_QGraphicsItem::update() QCOMPARE(item->repaints, 1); QCOMPARE(view.repaints, 1); QCOMPARE(view.paintedRegion, expectedRegion + expectedRegion.translated(50, 50)); + + // Make sure moving a parent item triggers an update on the children + // (even though the parent itself is outside the viewport). + QGraphicsRectItem *parent = new QGraphicsRectItem(0, 0, 10, 10); + parent->setPos(-400, 0); + item->setParentItem(parent); + item->setPos(400, 0); + scene.addItem(parent); + QTest::qWait(50); + itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform()) + .mapRect(item->boundingRect()).toRect(); + expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); + view.reset(); + item->repaints = 0; + parent->translate(-400, 0); + qApp->processEvents(); + QCOMPARE(item->repaints, 0); + QCOMPARE(view.repaints, 1); + QCOMPARE(view.paintedRegion, expectedRegion); + view.reset(); + item->repaints = 0; + parent->translate(400, 0); + qApp->processEvents(); + QCOMPARE(item->repaints, 1); + QCOMPARE(view.repaints, 1); + QCOMPARE(view.paintedRegion, expectedRegion); + QCOMPARE(view.paintedRegion, expectedRegion); } void tst_QGraphicsItem::setTransformProperties_data() -- cgit v0.12 From baacf493e1c968ee2ffa59a8b87754388cb7a61a Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 10 Jul 2009 19:15:25 +0200 Subject: Fixed a crash with input methods The inputContext's focusWidget was not reset when disabling input methods. Thanks to Benjamin P. Task-number: 257832 Reviewed-by: Denis --- src/gui/kernel/qapplication.cpp | 2 +- src/gui/kernel/qwidget.cpp | 7 ++----- tests/auto/qwidget/tst_qwidget.cpp | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index c6af728..114ebb2 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -126,7 +126,7 @@ int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly QApplication::Type qt_appType=QApplication::Tty; QApplicationPrivate *QApplicationPrivate::self = 0; -QInputContext *QApplicationPrivate::inputContext; +QInputContext *QApplicationPrivate::inputContext = 0; bool QApplicationPrivate::quitOnLastWindowClosed = true; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9d40b00..fb9084e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -9879,11 +9879,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) QInputContextPrivate::updateImeStatus(this, true); #endif QInputContext *ic = d->ic; - if (!ic) { - // implicitly create input context only if we have a focus - if (hasFocus()) - ic = d->inputContext(); - } + if (!ic && (!on || hasFocus())) + ic = d->inputContext(); if (ic) { if (on && hasFocus() && ic->focusWidget() != this) { ic->setFocusWidget(this); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 7b68732..1db6eb2 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -350,6 +350,7 @@ private slots: #endif void updateOnDestroyedSignal(); void toplevelLineEditFocus(); + void inputFocus_task257832(); private: bool ensureScreenSize(int width, int height); @@ -8965,5 +8966,19 @@ void tst_QWidget::toplevelLineEditFocus() QCOMPARE(QApplication::focusWidget(), &w); } +void tst_QWidget::inputFocus_task257832() +{ + QLineEdit *widget = new QLineEdit; + QInputContext *context = widget->inputContext(); + if (!context) + QSKIP("No input context", SkipSingle); + widget->setFocus(); + context->setFocusWidget(widget); + QCOMPARE(context->focusWidget(), widget); + widget->setReadOnly(true); + QVERIFY(!context->focusWidget()); + delete widget; +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" -- cgit v0.12 From 3ded2e1ea5a74a6fc0d3938fa732f886aa275ca2 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Fri, 10 Jul 2009 20:27:42 +0200 Subject: Remove builtin xml schema file until legal issues are clarified --- src/xmlpatterns/schema/builtinschemas.qrc | 1 - src/xmlpatterns/schema/schemas/xml.xsd | 145 ------------------------------ 2 files changed, 146 deletions(-) delete mode 100644 src/xmlpatterns/schema/schemas/xml.xsd diff --git a/src/xmlpatterns/schema/builtinschemas.qrc b/src/xmlpatterns/schema/builtinschemas.qrc index fb43d78..4ca9cd5 100644 --- a/src/xmlpatterns/schema/builtinschemas.qrc +++ b/src/xmlpatterns/schema/builtinschemas.qrc @@ -1,5 +1,4 @@ - schemas/xml.xsd diff --git a/src/xmlpatterns/schema/schemas/xml.xsd b/src/xmlpatterns/schema/schemas/xml.xsd deleted file mode 100644 index eeb9db5..0000000 --- a/src/xmlpatterns/schema/schemas/xml.xsd +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - See http://www.w3.org/XML/1998/namespace.html and - http://www.w3.org/TR/REC-xml for information about this namespace. - - This schema document describes the XML namespace, in a form - suitable for import by other schema documents. - - Note that local names in this namespace are intended to be defined - only by the World Wide Web Consortium or its subgroups. The - following names are currently defined in this namespace and should - not be used with conflicting semantics by any Working Group, - specification, or document instance: - - base (as an attribute name): denotes an attribute whose value - provides a URI to be used as the base for interpreting any - relative URIs in the scope of the element on which it - appears; its value is inherited. This name is reserved - by virtue of its definition in the XML Base specification. - - id (as an attribute name): denotes an attribute whose value - should be interpreted as if declared to be of type ID. - This name is reserved by virtue of its definition in the - xml:id specification. - - lang (as an attribute name): denotes an attribute whose value - is a language code for the natural language of the content of - any element; its value is inherited. This name is reserved - by virtue of its definition in the XML specification. - - space (as an attribute name): denotes an attribute whose - value is a keyword indicating what whitespace processing - discipline is intended for the content of the element; its - value is inherited. This name is reserved by virtue of its - definition in the XML specification. - - Father (in any context at all): denotes Jon Bosak, the chair of - the original XML Working Group. This name is reserved by - the following decision of the W3C XML Plenary and - XML Coordination groups: - - In appreciation for his vision, leadership and dedication - the W3C XML Plenary on this 10th day of February, 2000 - reserves for Jon Bosak in perpetuity the XML name - xml:Father - - - - - This schema defines attributes and an attribute group - suitable for use by - schemas wishing to allow xml:base, xml:lang, xml:space or xml:id - attributes on elements they define. - - To enable this, such a schema must import this schema - for the XML namespace, e.g. as follows: - <schema . . .> - . . . - <import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="http://www.w3.org/2001/xml.xsd"/> - - Subsequently, qualified reference to any of the attributes - or the group defined below will have the desired effect, e.g. - - <type . . .> - . . . - <attributeGroup ref="xml:specialAttrs"/> - - will define a type which will schema-validate an instance - element with any of those attributes - - - - In keeping with the XML Schema WG's standard versioning - policy, this schema document will persist at - http://www.w3.org/2007/08/xml.xsd. - At the date of issue it can also be found at - http://www.w3.org/2001/xml.xsd. - The schema document at that URI may however change in the future, - in order to remain compatible with the latest version of XML Schema - itself, or with the XML namespace itself. In other words, if the XML - Schema or XML namespaces change, the version of this document at - http://www.w3.org/2001/xml.xsd will change - accordingly; the version at - http://www.w3.org/2007/08/xml.xsd will not change. - - - - - - Attempting to install the relevant ISO 2- and 3-letter - codes as the enumerated possible values is probably never - going to be a realistic possibility. See - RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry - at http://www.iana.org/assignments/lang-tag-apps.htm for - further information. - - The union allows for the 'un-declaration' of xml:lang with - the empty string. - - - - - - - - - - - - - - - - - - - - - - - - See http://www.w3.org/TR/xmlbase/ for - information about this attribute. - - - - - - See http://www.w3.org/TR/xml-id/ for - information about this attribute. - - - - - - - - - - - -- cgit v0.12 From 357d4598512b4b42fc515b4fc0d2d419db604544 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 11 May 2009 17:35:20 +0200 Subject: remove dead code cherry-picked d8b1cc5f0ecbb8de734d241d72a05b325c2bbb2c from creator --- tools/linguist/shared/profileevaluator.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 8605733..c68ac46 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1511,16 +1511,6 @@ bool ProFileEvaluator::Private::evaluateFile(const QString &fileName, bool *resu if (result) *result = false; } -/* if (ok && readFeatures) { - QStringList configs = values("CONFIG"); - QSet processed; - foreach (const QString &fn, configs) { - if (!processed.contains(fn)) { - processed.insert(fn); - evaluateFeatureFile(fn, 0); - } - } - } */ return ok; } -- cgit v0.12 From b7cfdc075ce53a5aaf243161c849ee1ee079885c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 May 2009 15:02:32 +0200 Subject: remove totally pointless conditional cherry-picked 167a09b20614d282ec898f69fc2a3f0bafa11229 from creator --- tools/linguist/shared/profileevaluator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index c68ac46..c56f1d4 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1501,7 +1501,7 @@ bool ProFileEvaluator::Private::evaluateFile(const QString &fileName, bool *resu ProFile *pro = q->parsedProFile(fileName); if (pro) { m_profileStack.push(pro); - ok = (currentProFile() ? pro->Accept(this) : false); + ok = pro->Accept(this); m_profileStack.pop(); q->releaseParsedProFile(pro); -- cgit v0.12 From 3f9a894acb30ff3fb5907f82327af088f96a088d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 4 Jun 2009 15:18:14 +0200 Subject: Fix memory leak in $$system() calls from .pro files cherry-picked 07730341bd739aac823ac9b4336d8294510a35e2 from creator --- tools/linguist/shared/profileevaluator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index c56f1d4..4ea9c10 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -58,8 +58,10 @@ #ifdef Q_OS_WIN32 #define QT_POPEN _popen +#define QT_PCLOSE _pclose #else #define QT_POPEN popen +#define QT_PCLOSE pclose #endif QT_BEGIN_NAMESPACE @@ -1204,6 +1206,8 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun output += QLatin1String(buff); } ret += split_value_list(output); + if (proc) + QT_PCLOSE(proc); } } break; } -- cgit v0.12 From a701175aef8912b69afe61d23749dcfca765a231 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 16:56:28 +0200 Subject: ItemViews: make dragging faster when lots of items are selected QListView know exactly what they have on their viewport and we only paint items clipped to the viewport. So we don't need to ask for each item its visualRect. NB: QTreeView and QTableView probably deservee the same treatment --- src/gui/itemviews/qabstractitemview.cpp | 33 ++++++++++++++++++++++----------- src/gui/itemviews/qabstractitemview_p.h | 5 +++++ src/gui/itemviews/qlistview.cpp | 26 ++++++++++++++++++++++++++ src/gui/itemviews/qlistview_p.h | 2 ++ 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 5f347dd..a4a69c3 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -3881,34 +3881,45 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even return true; } -QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const +/* + \internal + + returns the pair QRect/QModelIndex that should be painted on the viewports's rect + */ + +QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const { Q_ASSERT(r); Q_Q(const QAbstractItemView); QRect &rect = *r; const QRect viewportRect = viewport->rect(); - QList rects; - QModelIndexList paintedIndexes; + QItemViewPaintPairs ret; for (int i = 0; i < indexes.count(); ++i) { const QModelIndex &index = indexes.at(i); const QRect current = q->visualRect(index); if (current.intersects(viewportRect)) { - paintedIndexes += index; - rects += current; + ret += qMakePair(current, index); rect |= current; } } - rect = rect.intersected(viewportRect); - if (rect.isEmpty()) + rect &= viewportRect; + return ret; +} + +QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const +{ + Q_ASSERT(r); + QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r); + if (paintPairs.isEmpty()) return QPixmap(); - QPixmap pixmap(rect.size()); + QPixmap pixmap(r->size()); pixmap.fill(Qt::transparent); QPainter painter(&pixmap); QStyleOptionViewItemV4 option = viewOptionsV4(); option.state |= QStyle::State_Selected; - for (int j = 0; j < paintedIndexes.count(); ++j) { - const QModelIndex ¤t = paintedIndexes.at(j); - option.rect = QRect(rects.at(j).topLeft() - rect.topLeft(), rects.at(j).size()); + for (int j = 0; j < paintPairs.count(); ++j) { + option.rect = paintPairs.at(j).first.translated(r->topLeft()); + const QModelIndex ¤t = paintPairs.at(j).second; delegateForIndex(current)->paint(&painter, option, current); } return pixmap; diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 7443d50..557e98b 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -86,6 +86,9 @@ struct QEditorInfo }; +typedef QPair QItemViewPaintPair; +typedef QList QItemViewPaintPairs; + class QEmptyModel : public QAbstractItemModel { public: @@ -176,7 +179,9 @@ public: q_func()->style()->drawPrimitive(QStyle::PE_IndicatorItemViewItemDrop, &opt, painter, q_func()); } } + #endif + virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; inline void releaseEditor(QWidget *editor) const { if (editor) { diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 6ff516a..44bcf6f 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -709,6 +709,32 @@ void QListViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) selectionModel->select(selection, command); } +/*! + \reimp + + We have a QListView way of knowing what elements are on the viewport + through the intersectingSet function +*/ +QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const +{ + Q_ASSERT(r); + Q_Q(const QListView); + QRect &rect = *r; + const QRect viewportRect = viewport->rect(); + QItemViewPaintPairs ret; + intersectingSet(viewportRect); + const QSet visibleIndexes = intersectVector.toList().toSet(); + for (int i = 0; i < indexes.count(); ++i) { + const QModelIndex &index = indexes.at(i); + if (visibleIndexes.contains(index)) { + const QRect current = q->visualRect(index); + ret += qMakePair(current, index); + rect |= current; + } + } + rect &= viewportRect; + return ret; +} /*! \internal diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index a7a7000..16f2de9 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -351,6 +351,8 @@ public: void scrollElasticBandBy(int dx, int dy); + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; + // ### FIXME: we only need one at a time QDynamicListViewBase *dynamicListView; QStaticListViewBase *staticListView; -- cgit v0.12 From 69a3c65d177a4a6ecc3d3fd63455dcd53d62b75f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 15:49:51 +0200 Subject: build fix on windows --- src/gui/graphicsview/qgraphicsview_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 28b4bdc..0fa8b34 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -59,6 +59,7 @@ #include #include "qgraphicssceneevent.h" +#include #include QT_BEGIN_NAMESPACE -- cgit v0.12 From cbf18d5b24e9ae541bc7e6a7b6698666cce30478 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 16:20:40 +0200 Subject: ItemViews selection: improve performance of QItemSelection::indexes On windows it makes it 2x faster --- src/gui/itemviews/qitemselectionmodel.cpp | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index e4cb0f0..87825d9 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -270,24 +270,35 @@ QItemSelectionRange QItemSelectionRange::intersect(const QItemSelectionRange &ot */ -/*! - Returns the list of model index items stored in the selection. -*/ +/* + \internal -QModelIndexList QItemSelectionRange::indexes() const + utility function for getting the indexes from a range + it avoid concatenating list and works on one + */ + +static void indexesFromRange(const QItemSelectionRange &range, QModelIndexList &result) { - QModelIndex index; - QModelIndexList result; - if (isValid() && model()) { - for (int column = left(); column <= right(); ++column) { - for (int row = top(); row <= bottom(); ++row) { - index = model()->index(row, column, parent()); - Qt::ItemFlags flags = model()->flags(index); + if (range.isValid() && range.model()) { + for (int column = range.left(); column <= range.right(); ++column) { + for (int row = range.top(); row <= range.bottom(); ++row) { + QModelIndex index = range.model()->index(row, column, range.parent()); + Qt::ItemFlags flags = range.model()->flags(index); if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled)) result.append(index); } } } +} + +/*! + Returns the list of model index items stored in the selection. +*/ + +QModelIndexList QItemSelectionRange::indexes() const +{ + QModelIndexList result; + indexesFromRange(*this, result); return result; } @@ -404,7 +415,7 @@ QModelIndexList QItemSelection::indexes() const QModelIndexList result; QList::const_iterator it = begin(); for (; it != end(); ++it) - result += (*it).indexes(); + indexesFromRange(*it, result); return result; } -- cgit v0.12 From e84e16954e9b96479964368e2dcb3114dd2bd5f1 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Sat, 11 Jul 2009 18:01:49 +0200 Subject: QListView: small refactoring It is useless to store the vector of modelindex from intersectingSet --- src/gui/itemviews/qlistview.cpp | 106 ++++++++++++++++++++-------------------- src/gui/itemviews/qlistview_p.h | 22 +++------ 2 files changed, 61 insertions(+), 67 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 44bcf6f..9a94b31 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -723,7 +723,7 @@ QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList const QRect viewportRect = viewport->rect(); QItemViewPaintPairs ret; intersectingSet(viewportRect); - const QSet visibleIndexes = intersectVector.toList().toSet(); + const QSet visibleIndexes = intersectingSet(viewportRect).toList().toSet(); for (int i = 0; i < indexes.count(); ++i) { const QModelIndex &index = indexes.at(i); if (visibleIndexes.contains(index)) { @@ -951,9 +951,9 @@ void QListView::dragMoveEvent(QDragMoveEvent *e) QModelIndex index; if (d->movement == Snap) { QRect rect(d->dynamicListView->snapToGrid(e->pos() + d->offset()), d->gridSize()); - d->intersectingSet(rect); - index = d->intersectVector.count() > 0 - ? d->intersectVector.last() : QModelIndex(); + const QVector intersectVector = d->intersectingSet(rect); + index = intersectVector.count() > 0 + ? intersectVector.last() : QModelIndex(); } else { index = indexAt(e->pos()); } @@ -1126,10 +1126,8 @@ void QListView::paintEvent(QPaintEvent *e) return; QStyleOptionViewItemV4 option = d->viewOptionsV4(); QPainter painter(d->viewport); - QRect area = e->rect(); - d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false); - const QVector toBeRendered = d->intersectVector; + const QVector toBeRendered = d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false); const QModelIndex current = currentIndex(); const QModelIndex hover = d->hover; @@ -1251,9 +1249,9 @@ QModelIndex QListView::indexAt(const QPoint &p) const { Q_D(const QListView); QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1); - d->intersectingSet(rect); - QModelIndex index = d->intersectVector.count() > 0 - ? d->intersectVector.last() : QModelIndex(); + const QVector intersectVector = d->intersectingSet(rect); + QModelIndex index = intersectVector.count() > 0 + ? intersectVector.last() : QModelIndex(); if (index.isValid() && visualRect(index).contains(p)) return index; return QModelIndex(); @@ -1351,38 +1349,38 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie if (d->gridSize().isValid()) rect.setSize(d->gridSize()); QSize contents = d->contentsSize(); - d->intersectVector.clear(); + QVector intersectVector; switch (cursorAction) { case MoveLeft: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(-rect.width(), 0); if (rect.right() <= 0) return current; if (rect.left() < 0) rect.setLeft(0); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MoveRight: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(rect.width(), 0); if (rect.left() >= contents.width()) return current; if (rect.right() > contents.width()) rect.setRight(contents.width()); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MovePageUp: rect.moveTop(rect.top() - d->viewport->height()); if (rect.top() < rect.height()) rect.moveTop(rect.height()); case MovePrevious: case MoveUp: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(0, -rect.height()); if (rect.bottom() <= 0) { #ifdef QT_KEYPAD_NAVIGATION @@ -1398,17 +1396,17 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie } if (rect.top() < 0) rect.setTop(0); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MovePageDown: rect.moveTop(rect.top() + d->viewport->height()); if (rect.bottom() > contents.height() - rect.height()) rect.moveBottom(contents.height() - rect.height()); case MoveNext: case MoveDown: - while (d->intersectVector.isEmpty()) { + while (intersectVector.isEmpty()) { rect.translate(0, rect.height()); if (rect.top() >= contents.height()) { #ifdef QT_KEYPAD_NAVIGATION @@ -1425,10 +1423,10 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie } if (rect.bottom() > contents.height()) rect.setBottom(contents.height()); - d->intersectingSet(rect); - d->removeCurrentAndDisabled(&d->intersectVector, current); + intersectVector = d->intersectingSet(rect); + d->removeCurrentAndDisabled(&intersectVector, current); } - return d->closestIndex(initialRect, d->intersectVector); + return d->closestIndex(initialRect, intersectVector); case MoveHome: return d->model->index(0, d->column, d->root); case MoveEnd: @@ -1503,10 +1501,10 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl QItemSelection selection; if (rect.width() == 1 && rect.height() == 1) { - d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset())); + const QVector intersectVector = d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset())); QModelIndex tl; - if (!d->intersectVector.isEmpty()) - tl = d->intersectVector.last(); // special case for mouse press; only select the top item + if (!intersectVector.isEmpty()) + tl = intersectVector.last(); // special case for mouse press; only select the top item if (tl.isValid() && d->isIndexEnabled(tl)) selection.select(tl, tl); } else { @@ -1516,14 +1514,14 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl QModelIndex tl, br; // get the first item const QRect topLeft(rect.left() + horizontalOffset(), rect.top() + verticalOffset(), 1, 1); - d->intersectingSet(topLeft); - if (!d->intersectVector.isEmpty()) - tl = d->intersectVector.last(); + QVector intersectVector = d->intersectingSet(topLeft); + if (!intersectVector.isEmpty()) + tl = intersectVector.last(); // get the last item const QRect bottomRight(rect.right() + horizontalOffset(), rect.bottom() + verticalOffset(), 1, 1); - d->intersectingSet(bottomRight); - if (!d->intersectVector.isEmpty()) - br = d->intersectVector.last(); + intersectVector = d->intersectingSet(bottomRight); + if (!intersectVector.isEmpty()) + br = intersectVector.last(); // get the ranges if (tl.isValid() && br.isValid() @@ -2144,8 +2142,8 @@ QItemSelection QListViewPrivate::selection(const QRect &rect) const { QItemSelection selection; QModelIndex tl, br; - intersectingSet(rect); - QVector::iterator it = intersectVector.begin(); + const QVector intersectVector = intersectingSet(rect); + QVector::const_iterator it = intersectVector.begin(); for (; it != intersectVector.end(); ++it) { if (!tl.isValid() && !br.isValid()) { tl = br = *it; @@ -2436,9 +2434,9 @@ void QStaticListViewBase::doStaticLayout(const QListViewLayoutInfo &info) Finds the set of items intersecting with \a area. In this function, itemsize is counted from topleft to the start of the next item. */ -void QStaticListViewBase::intersectingStaticSet(const QRect &area) const +QVector QStaticListViewBase::intersectingStaticSet(const QRect &area) const { - clearIntersections(); + QVector ret; int segStartPosition; int segEndPosition; int flowStartPosition; @@ -2455,7 +2453,7 @@ void QStaticListViewBase::intersectingStaticSet(const QRect &area) const flowEndPosition = area.bottom(); } if (segmentPositions.count() < 2 || flowPositions.isEmpty()) - return; + return ret; // the last segment position is actually the edge of the last segment const int segLast = segmentPositions.count() - 2; int seg = qBinarySearch(segmentPositions, segStartPosition, 0, segLast + 1); @@ -2470,13 +2468,14 @@ void QStaticListViewBase::intersectingStaticSet(const QRect &area) const continue; QModelIndex index = modelIndex(row); if (index.isValid()) - appendToIntersections(index); + ret += index; #if 0 // for debugging else qWarning("intersectingStaticSet: row %d was invalid", row); #endif } } + return ret; } int QStaticListViewBase::itemIndex(const QListViewItem &item) const @@ -2797,12 +2796,15 @@ void QDynamicListViewBase::doDynamicLayout(const QListViewLayoutInfo &info) viewport()->update(); } -void QDynamicListViewBase::intersectingDynamicSet(const QRect &area) const +QVector QDynamicListViewBase::intersectingDynamicSet(const QRect &area) const { - clearIntersections(); - QListViewPrivate *that = const_cast(dd); + QDynamicListViewBase *that = const_cast(this); QBspTree::Data data(static_cast(that)); - that->dynamicListView->tree.climbTree(area, &QDynamicListViewBase::addLeaf, data); + QVector res; + that->interSectingVector = &res; + that->tree.climbTree(area, &QDynamicListViewBase::addLeaf, data); + that->interSectingVector = 0; + return res; } void QDynamicListViewBase::createItems(int to) @@ -2879,20 +2881,20 @@ int QDynamicListViewBase::itemIndex(const QListViewItem &item) const } void QDynamicListViewBase::addLeaf(QVector &leaf, const QRect &area, - uint visited, QBspTree::Data data) + uint visited, QBspTree::Data data) { QListViewItem *vi; - QListViewPrivate *_this = static_cast(data.ptr); + QDynamicListViewBase *_this = static_cast(data.ptr); for (int i = 0; i < leaf.count(); ++i) { int idx = leaf.at(i); - if (idx < 0 || idx >= _this->dynamicListView->items.count()) + if (idx < 0 || idx >= _this->items.count()) continue; - vi = &_this->dynamicListView->items[idx]; + vi = &_this->items[idx]; Q_ASSERT(vi); if (vi->isValid() && vi->rect().intersects(area) && vi->visited != visited) { - QModelIndex index = _this->listViewItemToIndex(*vi); + QModelIndex index = _this->dd->listViewItemToIndex(*vi); Q_ASSERT(index.isValid()); - _this->intersectVector.append(index); + _this->interSectingVector->append(index); vi->visited = visited; } } diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index 16f2de9..1727ba4 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -153,9 +153,6 @@ public: inline bool isHidden(int row) const; inline int hiddenCount() const; - inline void clearIntersections() const; - inline void appendToIntersections(const QModelIndex &idx) const; - inline bool isRightToLeft() const; QListViewPrivate *dd; @@ -186,7 +183,7 @@ public: QPoint initStaticLayout(const QListViewLayoutInfo &info); void doStaticLayout(const QListViewLayoutInfo &info); - void intersectingStaticSet(const QRect &area) const; + QVector intersectingStaticSet(const QRect &area) const; int itemIndex(const QListViewItem &item) const; @@ -216,7 +213,7 @@ class QDynamicListViewBase : public QCommonListViewBase friend class QListViewPrivate; public: QDynamicListViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d), - batchStartRow(0), batchSavedDeltaSeg(0) {} + batchStartRow(0), batchSavedDeltaSeg(0), interSectingVector(0) {} QBspTree tree; QVector items; @@ -230,6 +227,7 @@ public: // used when laying out in batches int batchStartRow; int batchSavedDeltaSeg; + QVector *interSectingVector; //used from within intersectingDynamicSet void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); @@ -237,7 +235,7 @@ public: void initBspTree(const QSize &contents); QPoint initDynamicLayout(const QListViewLayoutInfo &info); void doDynamicLayout(const QListViewLayoutInfo &info); - void intersectingDynamicSet(const QRect &area) const; + QVector intersectingDynamicSet(const QRect &area) const; static void addLeaf(QVector &leaf, const QRect &area, uint visited, QBspTree::Data data); @@ -277,11 +275,11 @@ public: bool doItemsLayout(int num); - inline void intersectingSet(const QRect &area, bool doLayout = true) const { + inline QVector intersectingSet(const QRect &area, bool doLayout = true) const { if (doLayout) executePostedLayout(); QRect a = (q_func()->isRightToLeft() ? flipX(area.normalized()) : area.normalized()); - if (viewMode == QListView::ListMode) staticListView->intersectingStaticSet(a); - else dynamicListView->intersectingDynamicSet(a); + return (viewMode == QListView::ListMode) ? staticListView->intersectingStaticSet(a) + : dynamicListView->intersectingDynamicSet(a); } // ### FIXME: @@ -385,9 +383,6 @@ public: QRect layoutBounds; - // used for intersecting set - mutable QVector intersectVector; - // timers QBasicTimer batchLayoutTimer; @@ -440,9 +435,6 @@ inline QAbstractItemDelegate *QCommonListViewBase::delegate(const QModelIndex &i inline bool QCommonListViewBase::isHidden(int row) const { return dd->isHidden(row); } inline int QCommonListViewBase::hiddenCount() const { return dd->hiddenRows.count(); } -inline void QCommonListViewBase::clearIntersections() const { dd->intersectVector.clear(); } -inline void QCommonListViewBase::appendToIntersections(const QModelIndex &idx) const { dd->intersectVector.append(idx); } - inline bool QCommonListViewBase::isRightToLeft() const { return qq->isRightToLeft(); } QT_END_NAMESPACE -- cgit v0.12 From 6fbd79e45330044b059aa55873eaf2b73bdc49b2 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 08:14:02 +1000 Subject: Fixes merge mixup. --- src/sql/drivers/ibase/qsql_ibase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index c7409e1..0c4fff0 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1621,7 +1621,7 @@ QSqlRecord QIBaseDriver::record(const QString& tablename) const "b.RDB$FIELD_SCALE, b.RDB$FIELD_PRECISION, a.RDB$NULL_FLAG " "FROM RDB$RELATION_FIELDS a, RDB$FIELDS b " "WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE " - "AND UPPER(a.RDB$RELATION_NAME) = '") + table.toUpper() + QLatin1String("' " + "AND a.RDB$RELATION_NAME = '") + table + QLatin1String("' " "ORDER BY a.RDB$FIELD_POSITION")); while (q.next()) { @@ -1660,7 +1660,7 @@ QSqlIndex QIBaseDriver::primaryIndex(const QString &table) const q.exec(QLatin1String("SELECT a.RDB$INDEX_NAME, b.RDB$FIELD_NAME, d.RDB$FIELD_TYPE, d.RDB$FIELD_SCALE " "FROM RDB$RELATION_CONSTRAINTS a, RDB$INDEX_SEGMENTS b, RDB$RELATION_FIELDS c, RDB$FIELDS d " "WHERE a.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' " - "AND UPPER(a.RDB$RELATION_NAME) = '") + tablename.toUpper() + + "AND a.RDB$RELATION_NAME = '") + tablename + QLatin1String(" 'AND a.RDB$INDEX_NAME = b.RDB$INDEX_NAME " "AND c.RDB$RELATION_NAME = a.RDB$RELATION_NAME " "AND c.RDB$FIELD_NAME = b.RDB$FIELD_NAME " -- cgit v0.12 From c402f363d8502c688433eb4f21ba3528d9ac89e5 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 13 Jul 2009 10:36:51 +1000 Subject: Fixed linking of QtSvg with MSVC. --- src/gui/graphicsview/qgraphicsitem_p.h | 17 +++++++++++++++++ src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h | 18 ------------------ src/gui/widgets/qabstractscrollarea_p.h | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index ed1982e..9bdd273 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -506,6 +506,23 @@ struct QGraphicsItemPrivate::TransformData { /*! \internal */ +inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + // Return true if sibling item1 is on top of item2. + const QGraphicsItemPrivate *d1 = item1->d_ptr; + const QGraphicsItemPrivate *d2 = item2->d_ptr; + bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; + bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; + if (f1 != f2) + return f2; + if (d1->z != d2->z) + return d1->z > d2->z; + return d1->siblingIndex > d2->siblingIndex; +} + +/*! + \internal +*/ static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) { return qt_closestLeaf(item2, item1); } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 3ac922b..2e02458 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -164,24 +164,6 @@ public: bool cached, bool onlyTopLevelItems = false); }; - -/*! - \internal -*/ -inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - // Return true if sibling item1 is on top of item2. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; - bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; - bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; - if (f1 != f2) - return f2; - if (d1->z != d2->z) - return d1->z > d2->z; - return d1->siblingIndex > d2->siblingIndex; -} - static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) { qreal xp = s.left(); diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 7e0f444..aef8ac5 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QScrollBar; class QAbstractScrollAreaScrollBarContainer; -class QAbstractScrollAreaPrivate: public QFramePrivate +class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate { Q_DECLARE_PUBLIC(QAbstractScrollArea) -- cgit v0.12 From de07df9001586cc18ae267591359541b7ea494a0 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 13:28:52 +1000 Subject: Fixes failure when table has null fields to update Fixes an issue where too many parameters are bound when updating QSqlTableModel where the stored record has NULLs in it. Reviewed-by: Justin McPherson --- src/sql/models/qsqltablemodel.cpp | 2 +- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 62 ++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 591b506..18d89b4 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -202,7 +202,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement, editQuery.addBindValue(rec.value(i)); } for (i = 0; i < whereValues.count(); ++i) { - if (whereValues.isGenerated(i)) + if (whereValues.isGenerated(i) && !whereValues.isNull(i)) editQuery.addBindValue(whereValues.value(i)); } diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 5d1f9d4..24bc42b 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -116,6 +116,8 @@ private slots: void insertRecordsInLoop(); void sqlite_attachedDatabase_data() { generic_data("QSQLITE"); } void sqlite_attachedDatabase(); // For task 130799 + void tableModifyWithBlank_data() { generic_data(); } + void tableModifyWithBlank(); // For mail task private: void generic_data(const QString& engine=QString()); @@ -141,6 +143,7 @@ void tst_QSqlTableModel::dropTestTables() tableNames << qTableName("test") << qTableName("test2") << qTableName("test3") + << qTableName("test4") << qTableName("emptytable") << qTableName("bigtable") << qTableName("foo"); @@ -167,6 +170,8 @@ void tst_QSqlTableModel::createTestTables() QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id int, random varchar(20), randomtwo varchar(20))")); + QVERIFY_SQL( q, exec("create table " + qTableName("test4") + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + QVERIFY_SQL( q, exec("create table " + qTableName("emptytable") + "(id int)")); if (testWhiteSpaceNames(db.driverName())) { @@ -922,5 +927,62 @@ void tst_QSqlTableModel::sqlite_attachedDatabase() QCOMPARE(model.data(model.index(0, 1), Qt::DisplayRole).toString(), QLatin1String("main")); } + +void tst_QSqlTableModel::tableModifyWithBlank() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlTableModel model(0, db); + model.setTable(qTableName("test4")); + model.select(); + + //generate a time stamp for the test. Add one second to the current time to make sure + //it is different than the QSqlQuery test. + QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); + + //insert a new row, with column0 being the timestamp. + //Should be equivalent to QSqlQuery INSERT INTO... command) + QVERIFY_SQL(model, insertRow(0)); + QVERIFY_SQL(model, setData(model.index(0,0),timeString)); + QVERIFY_SQL(model, submitAll()); + + //set a filter on the table so the only record we get is the one we just made + //I could just do another setData command, but I want to make sure the TableModel + //matches exactly what is stored in the database + model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row + QVERIFY_SQL(model, select()); + + //Make sure we only get one record, and that it is the one we just made + QCOMPARE(model.rowCount(), 1); //verify only one entry + QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record + + //At this point we know that the intial value (timestamp) was succsefully stored in the database + //Attempt to modify the data in the new record + //equivalent to query.exec("update test set column3="... command in direct test + //set the data in the first column to "col1ModelData" + QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData")); + + //do a quick check to make sure that the setData command properly set the value in the model + QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); + + //submit the changed data to the database + //This is where I have been getting errors. + QVERIFY_SQL(model, submitAll()); + + //make sure the model has the most current data for our record + QVERIFY_SQL(model, select()); + + //verify that our new record was the only record returned + QCOMPARE(model.rowCount(), 1); + + //And that the record returned is, in fact, our test record. + QCOMPARE(model.record(0).value(0).toString(), timeString); + + //Make sure the value of the first column matches what we set it to previously. + QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); +} + QTEST_MAIN(tst_QSqlTableModel) #include "tst_qsqltablemodel.moc" -- cgit v0.12 From c2f6c3eb4381a987df47601fcbab4e3a98d40813 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 14:56:24 +1000 Subject: Fixes up the autotest for mysql over ODBC connection. --- tests/auto/qsqldriver/tst_qsqldriver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp index 6d428df..b79c093 100644 --- a/tests/auto/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -158,7 +158,7 @@ void tst_QSqlDriver::record() //check that we can't get records using incorrect tablename casing that's been quoted rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName)); - if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) + if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) QCOMPARE(rec.count(), 4); //mysql, sqlite and tds will match else QCOMPARE(rec.count(), 0); @@ -204,7 +204,7 @@ void tst_QSqlDriver::primaryIndex() tablename = tablename.toUpper(); index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName)); - if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) + if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) QCOMPARE(index.count(), 1); //mysql will always find the table name regardless of casing else QCOMPARE(index.count(), 0); -- cgit v0.12 From 049ff0b4f74400ab3c8571f6ba3a73106ca3a9dd Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 13 Jul 2009 15:21:01 +1000 Subject: Fixes autotest to match the new code (db level precisionPolicy). --- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 82e25d7..994a3d7 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -918,7 +918,7 @@ void tst_QSqlDatabase::recordOCI() FieldDef("varchar(20)", QVariant::String, QString("blah2")), FieldDef("nchar(20)", QVariant::String, QString("blah3")), FieldDef("nvarchar2(20)", QVariant::String, QString("blah4")), - FieldDef("number(10,5)", QVariant::String, 1.1234567), + FieldDef("number(10,5)", QVariant::Double, 1.1234567), FieldDef("date", QVariant::DateTime, dt), #ifdef QT3_SUPPORT //X? FieldDef("long raw", QVariant::ByteArray, QByteArray(Q3CString("blah5"))), -- cgit v0.12 From f6079b8407e20942a27f1fe40c4ce0e0a11d3320 Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Mon, 13 Jul 2009 10:16:17 +0200 Subject: Fix broken tst_QGraphicsItem::sorting. A top-level window on Windows cannot have a smaller width than 120. Increase the width by 20 and expect another row of items to be painted. --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 4ca1b48..96ee070 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7113,7 +7113,7 @@ void tst_QGraphicsItem::sorting() QGraphicsView view(&scene); view.setResizeAnchor(QGraphicsView::NoAnchor); view.setTransformationAnchor(QGraphicsView::NoAnchor); - view.resize(100, 100); + view.resize(120, 100); view.setFrameStyle(0); view.show(); #ifdef Q_WS_X11 @@ -7130,6 +7130,7 @@ void tst_QGraphicsItem::sorting() << grid[1][0] << grid[1][1] << grid[1][2] << grid[1][3] << grid[2][0] << grid[2][1] << grid[2][2] << grid[2][3] << grid[3][0] << grid[3][1] << grid[3][2] << grid[3][3] + << grid[4][0] << grid[4][1] << grid[4][2] << grid[4][3] << item1 << item2); } -- cgit v0.12 From dacfd67ad35ed3edb079e9795088f852b98717e3 Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Mon, 13 Jul 2009 10:27:15 +0200 Subject: Stabilize tst_QGraphicsView::mouseTracking2 (on Windows). Use QApplication::sendEvent directly instead of calling the static sendMouseMove function, which also calls QTest::mouseMove. This test failed with spy.count() being 2 instead of 1 (which is correct since we both use QTest::mouseMove and QApplication::sendEvent). --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 77ab977..9a5089b 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3311,7 +3311,9 @@ void tst_QGraphicsView::mouseTracking2() EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove); QCOMPARE(spy.count(), 0); - sendMouseMove(view.viewport(), view.viewport()->rect().center()); + QMouseEvent event(QEvent::MouseMove,view.viewport()->rect().center(), Qt::NoButton, + Qt::MouseButtons(Qt::NoButton), 0); + QApplication::sendEvent(view.viewport(), &event); QCOMPARE(spy.count(), 1); } -- cgit v0.12 From d705f5cd9d3bac765346af361038f2f9249183e7 Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Mon, 13 Jul 2009 10:48:43 +0200 Subject: Fix crash after "Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support" tst_QGraphicsProxyWidget crashed because the QAlphaWidget tried to access a deleted widget. Before we had the if check, but that was removed with this commit: 55137901. Completely wrong, we must check the widget pointer before using it. Reviewed-by: jbache --- src/gui/widgets/qeffects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index d6d0a16..f3b1b76 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -128,7 +128,8 @@ QAlphaWidget::~QAlphaWidget() { #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) // Restore user-defined opacity value - widget->setWindowOpacity(windowOpacity); + if (widget) + widget->setWindowOpacity(windowOpacity); #endif } -- cgit v0.12 From e8e6e8c1722618a48cb4a2e46b24ecad4b056270 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Jul 2009 11:03:41 +0200 Subject: Added QSyntaxHighlighter::rehighlightBlock(QTextBlock) Merge-request: 379 Reviewed-by: Simon Hausmann --- src/gui/text/qsyntaxhighlighter.cpp | 27 +++++++++++++++++++++++++++ src/gui/text/qsyntaxhighlighter.h | 1 + 2 files changed, 28 insertions(+) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index db1a38e..ccf229e 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -356,6 +356,8 @@ QTextDocument *QSyntaxHighlighter::document() const \since 4.2 Redoes the highlighting of the whole document. + + \sa rehighlightBlock() */ void QSyntaxHighlighter::rehighlight() { @@ -375,6 +377,31 @@ void QSyntaxHighlighter::rehighlight() } /*! + \since 4.6 + + Redoes the highlighting of the given QTextBlock \a block. + + \sa rehighlight() +*/ +void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) +{ + Q_D(QSyntaxHighlighter); + if (!d->doc) + return; + + disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), + this, SLOT(_q_reformatBlocks(int,int,int))); + QTextCursor cursor(block); + cursor.beginEditBlock(); + int from = cursor.position(); + cursor.movePosition(QTextCursor::EndOfBlock); + d->_q_reformatBlocks(from, 0, cursor.position() - from); + cursor.endEditBlock(); + connect(d->doc, SIGNAL(contentsChange(int,int,int)), + this, SLOT(_q_reformatBlocks(int,int,int))); +} + +/*! \fn void QSyntaxHighlighter::highlightBlock(const QString &text) Highlights the given text block. This function is called when diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index 4e5271b..ee249b8 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -78,6 +78,7 @@ public: public Q_SLOTS: void rehighlight(); + void rehighlightBlock(const QTextBlock &block); protected: virtual void highlightBlock(const QString &text) = 0; -- cgit v0.12 From 9a46bc5f02866134fb66ff1a03863d09382f7d40 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Jul 2009 11:03:42 +0200 Subject: Added QSyntaxHighlighter::rehighlightBlock() auto test Merge-request: 379 Reviewed-by: Simon Hausmann --- .../qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index 22e9455..1699e72 100644 --- a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -99,7 +99,8 @@ private slots: void avoidUnnecessaryRehighlight(); void noContentsChangedDuringHighlight(); void rehighlight(); - + void rehighlightBlock(); + private: QTextDocument *doc; QTestDocumentLayout *lout; @@ -517,6 +518,32 @@ void tst_QSyntaxHighlighter::rehighlight() QCOMPARE(hl->callCount, 1); } +void tst_QSyntaxHighlighter::rehighlightBlock() +{ + TestHighlighter *hl = new TestHighlighter(doc); + + cursor.movePosition(QTextCursor::Start); + cursor.beginEditBlock(); + cursor.insertText("Hello"); + cursor.insertBlock(); + cursor.insertText("World"); + cursor.endEditBlock(); + + hl->callCount = 0; + hl->highlightedText.clear(); + QTextBlock block = doc->begin(); + hl->rehighlightBlock(block); + + QCOMPARE(hl->highlightedText, QString("Hello")); + QCOMPARE(hl->callCount, 1); + + hl->callCount = 0; + hl->highlightedText.clear(); + hl->rehighlightBlock(block.next()); + + QCOMPARE(hl->highlightedText, QString("World")); + QCOMPARE(hl->callCount, 1); +} QTEST_MAIN(tst_QSyntaxHighlighter) #include "tst_qsyntaxhighlighter.moc" -- cgit v0.12 From d5c71b7ede48fd832145cc3921da77b10772053c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Jul 2009 11:03:44 +0200 Subject: Unified common code in QSyntaxHighlighter::rehighlight() and QSyntaxHighlighter::rehighlightBlock() Merge-request: 379 Reviewed-by: Simon Hausmann --- src/gui/text/qsyntaxhighlighter.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index ccf229e..f69562d 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -65,6 +65,18 @@ public: void _q_reformatBlocks(int from, int charsRemoved, int charsAdded); void reformatBlock(QTextBlock block); + + inline void rehighlight(QTextCursor &cursor, QTextCursor::MoveOperation operation) { + QObject::disconnect(doc, SIGNAL(contentsChange(int,int,int)), + q_func(), SLOT(_q_reformatBlocks(int,int,int))); + cursor.beginEditBlock(); + int from = cursor.position(); + cursor.movePosition(operation); + _q_reformatBlocks(from, 0, cursor.position() - from); + cursor.endEditBlock(); + QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), + q_func(), SLOT(_q_reformatBlocks(int,int,int))); + } inline void _q_delayedRehighlight() { if (!rehighlightPending) @@ -365,15 +377,8 @@ void QSyntaxHighlighter::rehighlight() if (!d->doc) return; - disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); QTextCursor cursor(d->doc); - cursor.beginEditBlock(); - cursor.movePosition(QTextCursor::End); - d->_q_reformatBlocks(0, 0, cursor.position()); - cursor.endEditBlock(); - connect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); + d->rehighlight(cursor, QTextCursor::End); } /*! @@ -389,16 +394,8 @@ void QSyntaxHighlighter::rehighlightBlock(const QTextBlock &block) if (!d->doc) return; - disconnect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); QTextCursor cursor(block); - cursor.beginEditBlock(); - int from = cursor.position(); - cursor.movePosition(QTextCursor::EndOfBlock); - d->_q_reformatBlocks(from, 0, cursor.position() - from); - cursor.endEditBlock(); - connect(d->doc, SIGNAL(contentsChange(int,int,int)), - this, SLOT(_q_reformatBlocks(int,int,int))); + d->rehighlight(cursor, QTextCursor::EndOfBlock); } /*! -- cgit v0.12 From 425f9035d6309111cdc8f30e1fdb4995e96c38a6 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 13 Jul 2009 11:25:02 +0200 Subject: Fix line endings. --- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 24bc42b..ded29d7 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -938,49 +938,49 @@ void tst_QSqlTableModel::tableModifyWithBlank() model.setTable(qTableName("test4")); model.select(); - //generate a time stamp for the test. Add one second to the current time to make sure - //it is different than the QSqlQuery test. - QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); - - //insert a new row, with column0 being the timestamp. - //Should be equivalent to QSqlQuery INSERT INTO... command) + //generate a time stamp for the test. Add one second to the current time to make sure + //it is different than the QSqlQuery test. + QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); + + //insert a new row, with column0 being the timestamp. + //Should be equivalent to QSqlQuery INSERT INTO... command) QVERIFY_SQL(model, insertRow(0)); QVERIFY_SQL(model, setData(model.index(0,0),timeString)); QVERIFY_SQL(model, submitAll()); - - //set a filter on the table so the only record we get is the one we just made - //I could just do another setData command, but I want to make sure the TableModel - //matches exactly what is stored in the database + + //set a filter on the table so the only record we get is the one we just made + //I could just do another setData command, but I want to make sure the TableModel + //matches exactly what is stored in the database model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row QVERIFY_SQL(model, select()); - //Make sure we only get one record, and that it is the one we just made + //Make sure we only get one record, and that it is the one we just made QCOMPARE(model.rowCount(), 1); //verify only one entry QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record - //At this point we know that the intial value (timestamp) was succsefully stored in the database - //Attempt to modify the data in the new record - //equivalent to query.exec("update test set column3="... command in direct test - //set the data in the first column to "col1ModelData" + //At this point we know that the intial value (timestamp) was succsefully stored in the database + //Attempt to modify the data in the new record + //equivalent to query.exec("update test set column3="... command in direct test + //set the data in the first column to "col1ModelData" QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData")); - //do a quick check to make sure that the setData command properly set the value in the model + //do a quick check to make sure that the setData command properly set the value in the model QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); - //submit the changed data to the database - //This is where I have been getting errors. + //submit the changed data to the database + //This is where I have been getting errors. QVERIFY_SQL(model, submitAll()); - //make sure the model has the most current data for our record + //make sure the model has the most current data for our record QVERIFY_SQL(model, select()); - //verify that our new record was the only record returned + //verify that our new record was the only record returned QCOMPARE(model.rowCount(), 1); - //And that the record returned is, in fact, our test record. + //And that the record returned is, in fact, our test record. QCOMPARE(model.record(0).value(0).toString(), timeString); - //Make sure the value of the first column matches what we set it to previously. + //Make sure the value of the first column matches what we set it to previously. QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); } -- cgit v0.12 From 839fbd22a602aa4b9fa20e6c302329008c3aab09 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 10 Jul 2009 14:44:53 +0200 Subject: Removed an assert from the QNetworkReply. It is possible that finished() function will be called several times, for example if the user calls QNetworkReply::close() as a result of the authenticationRequired() signal, the connection will be closed (which results in emitting a finished() signal), and then the authentication will be cancelled, which will also try to emit the same signal, however the connection state will already be set to Finished. The fix is to just make sure if the finished() signal has already been emitted by checking if the connection state is not Finished or Aborted. Reviewed-by: Thiago Macieira --- src/network/access/qnetworkreplyimpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index de39970..28319bb 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -461,8 +461,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data) void QNetworkReplyImplPrivate::finished() { Q_Q(QNetworkReplyImpl); - Q_ASSERT_X(state != Finished, "QNetworkReplyImpl", - "Backend called finished/finishedWithError more than once"); + if (state == Finished || state == Aborted) + return; state = Finished; pendingNotifications.clear(); -- cgit v0.12 From 5cf6c626c6a1a23291dfe65662b914497ce81c05 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 13 Jul 2009 11:36:37 +0200 Subject: Fixed the lineendings in the tst_qsqltablemodel.cpp --- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index a30fbdb..576c190 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -943,49 +943,49 @@ void tst_QSqlTableModel::tableModifyWithBlank() model.setTable(qTableName("test4")); model.select(); - //generate a time stamp for the test. Add one second to the current time to make sure - //it is different than the QSqlQuery test. - QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); - - //insert a new row, with column0 being the timestamp. - //Should be equivalent to QSqlQuery INSERT INTO... command) + //generate a time stamp for the test. Add one second to the current time to make sure + //it is different than the QSqlQuery test. + QString timeString=QDateTime::currentDateTime().addSecs(1).toString(Qt::ISODate); + + //insert a new row, with column0 being the timestamp. + //Should be equivalent to QSqlQuery INSERT INTO... command) QVERIFY_SQL(model, insertRow(0)); QVERIFY_SQL(model, setData(model.index(0,0),timeString)); QVERIFY_SQL(model, submitAll()); - - //set a filter on the table so the only record we get is the one we just made - //I could just do another setData command, but I want to make sure the TableModel - //matches exactly what is stored in the database + + //set a filter on the table so the only record we get is the one we just made + //I could just do another setData command, but I want to make sure the TableModel + //matches exactly what is stored in the database model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row QVERIFY_SQL(model, select()); - //Make sure we only get one record, and that it is the one we just made + //Make sure we only get one record, and that it is the one we just made QCOMPARE(model.rowCount(), 1); //verify only one entry QCOMPARE(model.record(0).value(0).toString(), timeString); //verify correct record - //At this point we know that the intial value (timestamp) was succsefully stored in the database - //Attempt to modify the data in the new record - //equivalent to query.exec("update test set column3="... command in direct test - //set the data in the first column to "col1ModelData" + //At this point we know that the intial value (timestamp) was succsefully stored in the database + //Attempt to modify the data in the new record + //equivalent to query.exec("update test set column3="... command in direct test + //set the data in the first column to "col1ModelData" QVERIFY_SQL(model, setData(model.index(0,1), "col1ModelData")); - //do a quick check to make sure that the setData command properly set the value in the model + //do a quick check to make sure that the setData command properly set the value in the model QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); - //submit the changed data to the database - //This is where I have been getting errors. + //submit the changed data to the database + //This is where I have been getting errors. QVERIFY_SQL(model, submitAll()); - //make sure the model has the most current data for our record + //make sure the model has the most current data for our record QVERIFY_SQL(model, select()); - //verify that our new record was the only record returned + //verify that our new record was the only record returned QCOMPARE(model.rowCount(), 1); - //And that the record returned is, in fact, our test record. + //And that the record returned is, in fact, our test record. QCOMPARE(model.record(0).value(0).toString(), timeString); - //Make sure the value of the first column matches what we set it to previously. + //Make sure the value of the first column matches what we set it to previously. QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); } -- cgit v0.12 From b9ea022e206bad5d80b4b9a7b957e8b8521d9fb9 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 10 Jul 2009 11:33:48 +0200 Subject: fix warning in qstringbuilder.h by using QLatin1Char Reviewed-by: Volker Hilsheimer --- src/corelib/tools/qstringbuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 97f13ee..3b43253 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -211,7 +211,7 @@ template <> struct QConcatenable { const char *data = ba.constData(); while (*data) - *out++ = *data++; + *out++ = QLatin1Char(*data++); } }; #endif -- cgit v0.12 From 486bd135faa2c8269044f9c03597bc6b05644540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 10 Jul 2009 15:36:02 +0200 Subject: Revert "Fixed leak of plugin instances" mjansen reported on #qt-labs that this change crashes KDE applications that were calling delete on their plugins. It turns out that is also how QPluginLoader works, so the commit was a bad idea to start with. This reverts commit 4c7004122a858cd6d891efc7923ba11484fbf997. Reviewed-by: Thiago Macieira --- src/corelib/plugin/qplugin.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index ff2b412..233b4f9 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -63,21 +63,6 @@ typedef QObject *(*QtPluginInstanceFunction)(); void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function); -struct qt_plugin_instance_deleter -{ - qt_plugin_instance_deleter(QPointer &instance) - : instance_(instance) - { - } - - ~qt_plugin_instance_deleter() - { - delete instance_; - } - - QPointer &instance_; -}; - #define Q_IMPORT_PLUGIN(PLUGIN) \ extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \ class Static##PLUGIN##PluginInstance{ \ @@ -91,10 +76,8 @@ struct qt_plugin_instance_deleter #define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \ { \ static QT_PREPEND_NAMESPACE(QPointer) _instance; \ - if (!_instance) { \ - static QT_PREPEND_NAMESPACE(qt_plugin_instance_deleter) deleter(_instance); \ + if (!_instance) \ _instance = new IMPLEMENTATION; \ - } \ return _instance; \ } -- cgit v0.12 From 3d55ab91148c13f1905a4c1983d144efb4315297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 13 Jul 2009 13:00:06 +0200 Subject: Cut-off in QGraphicsView not hit if setting a scene rect. QGraphicsScene::sceneRect() returns the growingItemsBoundingRect if not a particular scene rect is set; otherwise the sceneRect is returned. This cut-off aims to do less processing when the exposed region covers the entire scene, but it won't get hit in case of a sceneRect because we always check against the growingItemsBoundingRect. Task-number: 257192 --- src/gui/graphicsview/qgraphicsview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 3a8a696..bcfd68c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -971,7 +971,7 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg // rect does not take into account untransformable items. const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 1, 1)) .boundingRect(); - if (exposedRegionSceneBounds.contains(scene->d_func()->growingItemsBoundingRect)) { + if (exposedRegionSceneBounds.contains(scene->sceneRect())) { Q_ASSERT(allItems); *allItems = true; -- cgit v0.12 From 0aca5cf05288dc4d2175d1c4a78bf62a5ea96b21 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Jul 2009 12:48:33 +0200 Subject: doc: Clarified what Qt::HANDLE is on Windows. Task-number: 193615 --- doc/src/qnamespace.qdoc | 5 +++-- src/corelib/thread/qthread.cpp | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index b691ac7..85b020d 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -1246,8 +1246,9 @@ /*! \typedef Qt::HANDLE Platform-specific handle type for system objects. This is - equivalent to \c{void *} on Windows and Mac OS X, and embedded - Linux, and to \c{unsigned long} on X11. + equivalent to \c{void *} on Mac OS X and embedded Linux, + and to \c{unsigned long} on X11. On Windows it is the + DWORD returned by the Win32 function getCurrentThreadId(). \warning Using this type is not portable. */ diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 24522f2..2e31c6d 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -261,9 +261,14 @@ void QAdoptedThread::run() Returns the thread handle of the currently executing thread. \warning The handle returned by this function is used for internal - purposes and should not be used in any application code. On - Windows, the returned value is a pseudo-handle for the current - thread that cannot be used for numerical comparison. + purposes and should not be used in any application code. + + \warning On Windows, the returned value is a pseudo-handle for the + current thread. It can't be used for numerical comparison. i.e., + this function returns the DWORD (Windows-Thread ID) returned by + the Win32 function getCurrentThreadId(), not the HANDLE + (Windows-Thread HANDLE) returned by the Win32 function + getCurrentThread(). */ /*! -- cgit v0.12 From cc24c46c117248ecb98200416e7f25375e6bb476 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Mon, 13 Jul 2009 13:02:20 +0200 Subject: QFlags::testFlag(): handle the zero case appropriately. Brought up by Andy. See perforce change 314809, 17b07e3ab6192b31f77fd2f126705b9ab53b3937. Related to task 221708. Reviewed-By: Andy Shaw --- src/corelib/global/qglobal.h | 2 +- tests/auto/qflags/tst_qflags.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index a139a55..d6c708c 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2062,7 +2062,7 @@ public: inline bool operator!() const { return !i; } - inline bool testFlag(Enum f) const { return (i & f) == f; } + inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == f ); } }; #define Q_DECLARE_FLAGS(Flags, Enum)\ diff --git a/tests/auto/qflags/tst_qflags.cpp b/tests/auto/qflags/tst_qflags.cpp index a5f68dc..87d8258 100644 --- a/tests/auto/qflags/tst_qflags.cpp +++ b/tests/auto/qflags/tst_qflags.cpp @@ -45,6 +45,7 @@ class tst_QFlags: public QObject Q_OBJECT private slots: void testFlag() const; + void testFlagZeroFlag() const; void testFlagMultiBits() const; }; @@ -59,8 +60,31 @@ void tst_QFlags::testFlag() const QVERIFY(!btn.testFlag(Qt::LeftButton)); } +void tst_QFlags::testFlagZeroFlag() const +{ + { + Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton; + /* Qt::NoButton has the value 0. */ + + QVERIFY(!btn.testFlag(Qt::NoButton)); + } + + { + /* A zero enum set should test true with zero. */ + QVERIFY(Qt::MouseButtons().testFlag(Qt::NoButton)); + } + + { + Qt::MouseButtons btn = Qt::NoButton; + QVERIFY(btn.testFlag(Qt::NoButton)); + } +} + void tst_QFlags::testFlagMultiBits() const { + /* Qt::Window is 0x00000001 + * Qt::Dialog is 0x00000002 | Window + */ { const Qt::WindowFlags onlyWindow(Qt::Window); QVERIFY(!onlyWindow.testFlag(Qt::Dialog)); -- cgit v0.12 From 9b6eacab99673d7d9848b341c4cf36a7c35f07c0 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Mon, 13 Jul 2009 13:02:20 +0200 Subject: QFlags::testFlag(): handle the zero case appropriately. Brought up by Andy. See perforce change 314809, 17b07e3ab6192b31f77fd2f126705b9ab53b3937. Related to task 221708. Reviewed-By: Andy Shaw (cherry picked from commit cc24c46c117248ecb98200416e7f25375e6bb476) --- src/corelib/global/qglobal.h | 2 +- tests/auto/qflags/tst_qflags.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 63f6c31..f650bd2 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2017,7 +2017,7 @@ public: inline bool operator!() const { return !i; } - inline bool testFlag(Enum f) const { return (i & f) == f; } + inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == f ); } }; #define Q_DECLARE_FLAGS(Flags, Enum)\ diff --git a/tests/auto/qflags/tst_qflags.cpp b/tests/auto/qflags/tst_qflags.cpp index a5f68dc..87d8258 100644 --- a/tests/auto/qflags/tst_qflags.cpp +++ b/tests/auto/qflags/tst_qflags.cpp @@ -45,6 +45,7 @@ class tst_QFlags: public QObject Q_OBJECT private slots: void testFlag() const; + void testFlagZeroFlag() const; void testFlagMultiBits() const; }; @@ -59,8 +60,31 @@ void tst_QFlags::testFlag() const QVERIFY(!btn.testFlag(Qt::LeftButton)); } +void tst_QFlags::testFlagZeroFlag() const +{ + { + Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton; + /* Qt::NoButton has the value 0. */ + + QVERIFY(!btn.testFlag(Qt::NoButton)); + } + + { + /* A zero enum set should test true with zero. */ + QVERIFY(Qt::MouseButtons().testFlag(Qt::NoButton)); + } + + { + Qt::MouseButtons btn = Qt::NoButton; + QVERIFY(btn.testFlag(Qt::NoButton)); + } +} + void tst_QFlags::testFlagMultiBits() const { + /* Qt::Window is 0x00000001 + * Qt::Dialog is 0x00000002 | Window + */ { const Qt::WindowFlags onlyWindow(Qt::Window); QVERIFY(!onlyWindow.testFlag(Qt::Dialog)); -- cgit v0.12 From 1ed4c52dd7ad3cb6b0d846464b69489031ab68a5 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 13 Jul 2009 13:31:36 +0200 Subject: QNAM: Fix double sending of a HTTP request In some cases, weird timing issues could occur. In those cases, an EOF was sent twice for the upload data, leading to the HTTP code being confused and sending the request headers twice. Task-number: 257662 Reviewed-by: Thiago Macieira --- src/network/access/qnetworkaccesshttpbackend.cpp | 4 ++++ src/network/access/qnetworkreplyimpl.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index ce800c2..c57157e 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -628,6 +628,10 @@ void QNetworkAccessHttpBackend::closeUpstreamChannel() { // this indicates that the user finished uploading the data for POST Q_ASSERT(uploadDevice); + + if (uploadDevice->eof) + return; // received a 2nd time. should fix 257662 and 256369 + uploadDevice->eof = true; emit uploadDevice->readChannelFinished(); } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 63a9c2d..98944fd 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -92,6 +92,9 @@ void QNetworkReplyImplPrivate::_q_startOperation() void QNetworkReplyImplPrivate::_q_sourceReadyRead() { + if (state != Working) + return; + // read data from the outgoingData QIODevice into our internal buffer enum { DesiredBufferSize = 32 * 1024 }; @@ -131,6 +134,8 @@ void QNetworkReplyImplPrivate::_q_sourceReadChannelFinished() void QNetworkReplyImplPrivate::_q_copyReadyRead() { Q_Q(QNetworkReplyImpl); + if (state != Working) + return; if (!copyDevice || !q->isOpen()) return; -- cgit v0.12 From 3af223d89836fbde213aa2f54d775c9cd840f693 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Mon, 13 Jul 2009 13:37:23 +0200 Subject: Fix font propagation issues with QComboBox and the popup menu. This has always been a bit bumpy, the problem is that the popup normally has its own styling from the desktop, plus it's its own top-level and that is normally a boundary for propagation. Of course, people are surprised by this (especially when it works for editable). So, we need to be a bit better propagating the info. Also the QStyleOptionMenuItem has the correct font, but if it's set on a window, by the time it reaches the popup, its resolve mask is very weak, so it will fail to resolve at all. Setting the point size allows the font to have a bit of strength. Task-number: 257486 Reviewed-by: Jens Bache-Wiig --- src/gui/styles/qcleanlooksstyle.cpp | 6 ++++++ src/gui/styles/qmacstyle_mac.mm | 8 ++++++-- src/gui/widgets/qcombobox.cpp | 6 ++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 3855ba7..01f19c6 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -2042,6 +2042,12 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o s = s.left(t); } QFont font = menuitem->font; + // font may not have any "hard" flags set. We override + // the point size so that when it is resolved against the device, this font will win. + // This is mainly to handle cases where someone sets the font on the window + // and then the combo inherits it and passes it onward. At that point the resolve mask + // is very, very weak. This makes it stonger. + font.setPointSizeF(menuItem->font.pointSizeF()); if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index b20db5b..c08009b 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3991,8 +3991,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter const int xm = macItemFrame + maxpmw + macItemHMargin; QFont myFont = mi->font; - if (mi->state & QStyle::State_Mini) - myFont.setPointSize(mi->font.pointSize()); + // myFont may not have any "hard" flags set. We override + // the point size so that when it is resolved against the device, this font will win. + // This is mainly to handle cases where someone sets the font on the window + // and then the combo inherits it and passes it onward. At that point the resolve mask + // is very, very weak. This makes it stonger. + myFont.setPointSizeF(mi->font.pointSizeF()); p->setFont(myFont); p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1, contentRect.height(), text_flags ^ Qt::AlignRight, s); diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 1ca878d..097f3d0 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -148,8 +148,10 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt menuOption.rect = option.rect; // Make sure fonts set on the combo box also overrides the font for the popup menu. - if (mCombo->testAttribute(Qt::WA_SetFont) || mCombo->testAttribute(Qt::WA_MacSmallSize) - || mCombo->testAttribute(Qt::WA_MacMiniSize)) + if (mCombo->testAttribute(Qt::WA_SetFont) + || mCombo->testAttribute(Qt::WA_MacSmallSize) + || mCombo->testAttribute(Qt::WA_MacMiniSize) + || mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont())) menuOption.font = mCombo->font(); else menuOption.font = qt_app_fonts_hash()->value("QComboMenuItem", mCombo->font()); -- cgit v0.12 From 85fbffa12bcd38b08030561335305c3226312bc6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Jul 2009 13:46:46 +0200 Subject: Doc: Explicitly declare the module for each namespace to prevent strange omissions when qdoc is used in certain Windows environments. Task-number: 256415 Reviewed-by: Trust Me --- doc/src/qnamespace.qdoc | 1 + doc/src/qsql.qdoc | 2 +- src/corelib/concurrent/qtconcurrentmap.cpp | 1 + src/opengl/qgl.cpp | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index b691ac7..d509912 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -41,6 +41,7 @@ /*! \namespace Qt + \inmodule QtCore \brief The Qt namespace contains miscellaneous identifiers used throughout the Qt library. diff --git a/doc/src/qsql.qdoc b/doc/src/qsql.qdoc index 5315413..0f690e8 100644 --- a/doc/src/qsql.qdoc +++ b/doc/src/qsql.qdoc @@ -41,12 +41,12 @@ /*! \namespace QSql + \inmodule QtSql \brief The QSql namespace contains miscellaneous identifiers used throughout the Qt SQL library. \ingroup database \mainclass - \omit ### \module sql \endomit \sa {QtSql Module} */ diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp index b8c753a..46d2400 100644 --- a/src/corelib/concurrent/qtconcurrentmap.cpp +++ b/src/corelib/concurrent/qtconcurrentmap.cpp @@ -41,6 +41,7 @@ /*! \namespace QtConcurrent + \inmodule QtCore \since 4.4 \brief The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded programs without using low-level diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index a9f8ede..0169ea2 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -142,6 +142,7 @@ QGLSignalProxy *QGLSignalProxy::instance() /*! \namespace QGL + \inmodule QtOpenGL \brief The QGL namespace specifies miscellaneous identifiers used in the Qt OpenGL module. -- cgit v0.12 From cb3bddc9a5e4a664500eec3997dedadd67de3652 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 13 Jul 2009 13:47:50 +0200 Subject: tst_qnetworkreply: qDebug instead of qWarning --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 18919a7..ff315de 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3186,7 +3186,7 @@ void tst_QNetworkReply::httpDownloadPerformance() QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); - qWarning() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " + qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; delete reply; -- cgit v0.12 From d54224252d56a50b42c8991308840ea1acde8f30 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 13 Jul 2009 13:51:25 +0200 Subject: tst_qnetworkreply: qDebug instead of qWarning --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 8318b60..cb1cb9b 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3185,7 +3185,7 @@ void tst_QNetworkReply::httpUploadPerformance() QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); - qWarning() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " + qDebug() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; reader.exit(); @@ -3815,7 +3815,7 @@ void tst_QNetworkReply::httpDownloadPerformance() QVERIFY(!QTestEventLoop::instance().timeout()); qint64 elapsed = time.elapsed(); - qWarning() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " + qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; delete reply; -- cgit v0.12 From 32182d107fa75e5619ecc91a81f50626f429ebe1 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 13 Jul 2009 14:03:39 +0200 Subject: QTreeView: now dragging lots of items is fast --- src/corelib/kernel/qabstractitemmodel.cpp | 2 +- src/corelib/kernel/qmimedata.cpp | 2 +- src/corelib/kernel/qvariant.cpp | 4 +-- src/gui/itemviews/qabstractitemview.cpp | 2 +- src/gui/itemviews/qlistview.cpp | 1 - src/gui/itemviews/qtreeview.cpp | 44 +++++++++++++++++++++++++++++++ src/gui/itemviews/qtreeview_p.h | 2 ++ 7 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 914f44f..1c3371f 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1407,7 +1407,7 @@ QMap QAbstractItemModel::itemData(const QModelIndex &index) const QMap roles; for (int i = 0; i < Qt::UserRole; ++i) { QVariant variantData = data(index, i); - if (variantData.type() != QVariant::Invalid) + if (variantData.isValid()) roles.insert(i, variantData); } return roles; diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index 3d2a7cb..4a1ba9f 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -105,7 +105,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty Q_Q(const QMimeData); QVariant data = q->retrieveData(format, type); - if (data.type() == type || data.type() == QVariant::Invalid) + if (data.type() == type || !data.isValid()) return data; // provide more conversion possiblities than just what QVariant provides diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 8bf70cb..2ef9de4 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1905,7 +1905,7 @@ void QVariant::load(QDataStream &s) create(static_cast(u), 0); d.is_null = is_null; - if (d.type == QVariant::Invalid) { + if (!isValid()) { // Since we wrote something, we should read something QString x; s >> x; @@ -1949,7 +1949,7 @@ void QVariant::save(QDataStream &s) const s << QMetaType::typeName(userType()); } - if (d.type == QVariant::Invalid) { + if (!isValid()) { s << QString(); return; } diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index a4a69c3..8887977 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -3918,7 +3918,7 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QStyleOptionViewItemV4 option = viewOptionsV4(); option.state |= QStyle::State_Selected; for (int j = 0; j < paintPairs.count(); ++j) { - option.rect = paintPairs.at(j).first.translated(r->topLeft()); + option.rect = paintPairs.at(j).first.translated(-r->topLeft()); const QModelIndex ¤t = paintPairs.at(j).second; delegateForIndex(current)->paint(&painter, option, current); } diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 9a94b31..40f28d4 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -722,7 +722,6 @@ QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList QRect &rect = *r; const QRect viewportRect = viewport->rect(); QItemViewPaintPairs ret; - intersectingSet(viewportRect); const QSet visibleIndexes = intersectingSet(viewportRect).toList().toSet(); for (int i = 0; i < indexes.count(); ++i) { const QModelIndex &index = indexes.at(i); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index f13ff0c..7084e6d 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1321,6 +1321,50 @@ void QTreeViewPrivate::_q_modelDestroyed() } /*! + \reimp + + We have a QTreeView way of knowing what elements are on the viewport +*/ +QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const +{ + Q_ASSERT(r); + return QAbstractItemViewPrivate::draggablePaintPairs(indexes, r); + Q_Q(const QTreeView); + QRect &rect = *r; + const QRect viewportRect = viewport->rect(); + int itemOffset = 0; + int row = firstVisibleItem(&itemOffset); + QPair startEnd = startAndEndColumns(viewportRect); + QVector columns; + for (int i = startEnd.first; i <= startEnd.second; ++i) { + int logical = header->logicalIndex(i); + if (!header->isSectionHidden(logical)) + columns += logical; + } + QSet visibleIndexes; + for (; itemOffset < viewportRect.bottom() && row < viewItems.count(); ++row) { + const QModelIndex &index = viewItems.at(row).index; + for (int colIndex = 0; colIndex < columns.count(); ++colIndex) + visibleIndexes += index.sibling(index.row(), columns.at(colIndex)); + itemOffset += itemHeight(row); + } + + //now that we have the visible indexes, we can try to find those which are selected + QItemViewPaintPairs ret; + for (int i = 0; i < indexes.count(); ++i) { + const QModelIndex &index = indexes.at(i); + if (visibleIndexes.contains(index)) { + const QRect current = q->visualRect(index); + ret += qMakePair(current, index); + rect |= current; + } + } + rect &= viewportRect; + return ret; +} + + +/*! \since 4.2 Draws the part of the tree intersecting the given \a region using the specified \a painter. diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index 6fb2e41..546dc75 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -89,6 +89,8 @@ public: ~QTreeViewPrivate() {} void initialize(); + QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; + #ifndef QT_NO_ANIMATION struct AnimatedOperation : public QVariantAnimation { -- cgit v0.12 From eb594be13ae17361c1de3539e34e84a1d8c324c5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 13 Jul 2009 15:14:19 +0200 Subject: fix bug in qmake DEPLOYMENT variable The documentation states "The default deployment target path for Windows CE is %CSIDL_PROGRAM_FILES%\target, which usually gets expanded to \Program Files\target." Now this statement is true. Task-number: 257053 Reviewed-by: mauricek --- qmake/generators/win32/msvc_vcproj.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 50f78d7..5f250bf 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1239,9 +1239,8 @@ void VcprojGenerator::initDeploymentTool() foreach(QString item, project->values("DEPLOYMENT")) { // get item.path QString devicePath = project->first(item + ".path"); - // if the path does not exist, skip it if (devicePath.isEmpty()) - continue; + devicePath = targetPath; // check if item.path is relative (! either /,\ or %) if (!(devicePath.at(0) == QLatin1Char('/') || devicePath.at(0) == QLatin1Char('\\') -- cgit v0.12 From f7a11ee28484320129fec25c00e0f616ff6751bc Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Jul 2009 15:29:37 +0200 Subject: doc: Use \inheaderfile to show which include file to include. Letting qdoc output it automatically produces the wrong header file name. Task-number: 217268 210171 220664 --- doc/src/qsql.qdoc | 1 + src/corelib/concurrent/qtconcurrentmap.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/src/qsql.qdoc b/doc/src/qsql.qdoc index 0f690e8..bb8f090 100644 --- a/doc/src/qsql.qdoc +++ b/doc/src/qsql.qdoc @@ -45,6 +45,7 @@ \brief The QSql namespace contains miscellaneous identifiers used throughout the Qt SQL library. + \inheaderfile QtSql \ingroup database \mainclass diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp index 46d2400..797f335 100644 --- a/src/corelib/concurrent/qtconcurrentmap.cpp +++ b/src/corelib/concurrent/qtconcurrentmap.cpp @@ -48,7 +48,7 @@ threading primitives. See the \l {threads.html#qtconcurrent-intro}{Qt Concurrent} section in the \l{threads.html}{threading} documentation. - + \inheaderfile QtCore \ingroup thread */ -- cgit v0.12 From 45efa082135cbf97820a5ce7025685d22bd926ce Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 10 Jul 2009 22:19:46 +0200 Subject: factor out linguist-specific part it is simpler to keep it in sync with creator then. --- tools/linguist/lrelease/main.cpp | 2 +- tools/linguist/lupdate/main.cpp | 1 + tools/linguist/shared/profileevaluator.cpp | 60 ---------------- tools/linguist/shared/profileevaluator.h | 6 -- tools/linguist/shared/proparser.pri | 2 + tools/linguist/shared/proreader.cpp | 108 +++++++++++++++++++++++++++++ tools/linguist/shared/proreader.h | 56 +++++++++++++++ 7 files changed, 168 insertions(+), 67 deletions(-) create mode 100644 tools/linguist/shared/proreader.cpp create mode 100644 tools/linguist/shared/proreader.h diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 905a399..845dcb8 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -41,7 +41,7 @@ #include "translator.h" #include "translatortools.h" -#include "profileevaluator.h" +#include "proreader.h" #include #include diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 52a57fb..6e8b941 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -42,6 +42,7 @@ #include "translator.h" #include "translatortools.h" #include "profileevaluator.h" +#include "proreader.h" #include #include diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 4ea9c10..54c5d9a 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -1726,64 +1726,4 @@ void ProFileEvaluator::setVerbose(bool on) d->m_verbose = on; } -void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap) -{ - QStringList sourceFiles; - QString codecForTr; - QString codecForSource; - QStringList tsFileNames; - - // app/lib template - sourceFiles += visitor.values(QLatin1String("SOURCES")); - sourceFiles += visitor.values(QLatin1String("HEADERS")); - tsFileNames = visitor.values(QLatin1String("TRANSLATIONS")); - - QStringList trcodec = visitor.values(QLatin1String("CODEC")) - + visitor.values(QLatin1String("DEFAULTCODEC")) - + visitor.values(QLatin1String("CODECFORTR")); - if (!trcodec.isEmpty()) - codecForTr = trcodec.last(); - - QStringList srccodec = visitor.values(QLatin1String("CODECFORSRC")); - if (!srccodec.isEmpty()) - codecForSource = srccodec.last(); - - QStringList forms = visitor.values(QLatin1String("INTERFACES")) - + visitor.values(QLatin1String("FORMS")) - + visitor.values(QLatin1String("FORMS3")); - sourceFiles << forms; - - sourceFiles.sort(); - sourceFiles.removeDuplicates(); - tsFileNames.sort(); - tsFileNames.removeDuplicates(); - - varMap->insert("SOURCES", sourceFiles); - varMap->insert("CODECFORTR", QStringList() << codecForTr); - varMap->insert("CODECFORSRC", QStringList() << codecForSource); - varMap->insert("TRANSLATIONS", tsFileNames); -} - -bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap) -{ - QFileInfo fi(fileName); - if (!fi.exists()) - return false; - - ProFile pro(fi.absoluteFilePath()); - - ProFileEvaluator visitor; - visitor.setVerbose(verbose); - - if (!visitor.queryProFile(&pro)) - return false; - - if (!visitor.accept(&pro)) - return false; - - evaluateProFile(visitor, varMap); - - return true; -} - QT_END_NAMESPACE diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h index 5f35ea8..78d8fce 100644 --- a/tools/linguist/shared/profileevaluator.h +++ b/tools/linguist/shared/profileevaluator.h @@ -52,12 +52,6 @@ QT_BEGIN_NAMESPACE -class ProFile; -class ProFileEvaluator; - -void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap); -bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap); - class ProFileEvaluator { public: diff --git a/tools/linguist/shared/proparser.pri b/tools/linguist/shared/proparser.pri index 372247e..99d32e7 100644 --- a/tools/linguist/shared/proparser.pri +++ b/tools/linguist/shared/proparser.pri @@ -2,11 +2,13 @@ INCLUDEPATH *= $$PWD HEADERS += \ + $$PWD/proreader.h \ $$PWD/abstractproitemvisitor.h \ $$PWD/proitems.h \ $$PWD/profileevaluator.h \ $$PWD/proparserutils.h SOURCES += \ + $$PWD/proreader.cpp \ $$PWD/proitems.cpp \ $$PWD/profileevaluator.cpp diff --git a/tools/linguist/shared/proreader.cpp b/tools/linguist/shared/proreader.cpp new file mode 100644 index 0000000..492c2ef --- /dev/null +++ b/tools/linguist/shared/proreader.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "profileevaluator.h" + +#include + +QT_BEGIN_NAMESPACE + +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap) +{ + QStringList sourceFiles; + QString codecForTr; + QString codecForSource; + QStringList tsFileNames; + + // app/lib template + sourceFiles += visitor.values(QLatin1String("SOURCES")); + sourceFiles += visitor.values(QLatin1String("HEADERS")); + tsFileNames = visitor.values(QLatin1String("TRANSLATIONS")); + + QStringList trcodec = visitor.values(QLatin1String("CODEC")) + + visitor.values(QLatin1String("DEFAULTCODEC")) + + visitor.values(QLatin1String("CODECFORTR")); + if (!trcodec.isEmpty()) + codecForTr = trcodec.last(); + + QStringList srccodec = visitor.values(QLatin1String("CODECFORSRC")); + if (!srccodec.isEmpty()) + codecForSource = srccodec.last(); + + QStringList forms = visitor.values(QLatin1String("INTERFACES")) + + visitor.values(QLatin1String("FORMS")) + + visitor.values(QLatin1String("FORMS3")); + sourceFiles << forms; + + sourceFiles.sort(); + sourceFiles.removeDuplicates(); + tsFileNames.sort(); + tsFileNames.removeDuplicates(); + + varMap->insert("SOURCES", sourceFiles); + varMap->insert("CODECFORTR", QStringList() << codecForTr); + varMap->insert("CODECFORSRC", QStringList() << codecForSource); + varMap->insert("TRANSLATIONS", tsFileNames); +} + +bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap) +{ + QFileInfo fi(fileName); + if (!fi.exists()) + return false; + + ProFile pro(fi.absoluteFilePath()); + + ProFileEvaluator visitor; + visitor.setVerbose(verbose); + + if (!visitor.queryProFile(&pro)) + return false; + + if (!visitor.accept(&pro)) + return false; + + evaluateProFile(visitor, varMap); + + return true; +} + +QT_END_NAMESPACE diff --git a/tools/linguist/shared/proreader.h b/tools/linguist/shared/proreader.h new file mode 100644 index 0000000..31e2e6f --- /dev/null +++ b/tools/linguist/shared/proreader.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Linguist of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PROREADER_H +#define PROREADER_H + +#include + +QT_BEGIN_NAMESPACE + +class ProFileEvaluator; + +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap); +bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap); + +QT_END_NAMESPACE + +#endif // PROREADER_H -- cgit v0.12 From e2f381365bf2158095c5c7236fc4b2f842b9fa8c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 13 Jul 2009 16:20:44 +0200 Subject: implement proper vpath handling this also removes the bogus special casing of various filename-containing variables inside the pro parser. while this is a feature as such, it restores backwards compatibility without damaging the correct behavior again, so it qualifies for 4.5. based on a2f40fce2a1cf3c19a13fa27eea08192493ab76e from creator Task-number: 254098 --- .../testdata/good/proparsingpaths/file1.cpp | 9 ++ .../testdata/good/proparsingpaths/filter.cpp | 9 ++ .../testdata/good/proparsingpaths/project.pro | 10 ++ .../good/proparsingpaths/project.ts.result | 31 +++++ .../testdata/good/proparsingpaths/sub/sub.pri | 3 + .../testdata/good/proparsingpaths/sub/subfile1.cpp | 9 ++ .../good/proparsingpaths/sub/subfilter.cpp | 9 ++ tools/linguist/lupdate/main.cpp | 2 +- tools/linguist/shared/profileevaluator.cpp | 155 +++++++-------------- tools/linguist/shared/profileevaluator.h | 4 + tools/linguist/shared/proreader.cpp | 43 ++++-- tools/linguist/shared/proreader.h | 3 +- 12 files changed, 173 insertions(+), 114 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp new file mode 100644 index 0000000..ad87e70 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/file1.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "top-level wildcard"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp new file mode 100644 index 0000000..912963d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/filter.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "top-level direct"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro new file mode 100644 index 0000000..820b4fa --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.pro @@ -0,0 +1,10 @@ +SOURCES += file*.cpp filter.cpp non-existing.cpp + +include(sub/sub.pri) + +TRANSLATIONS = project.ts + +exists( $$TRANSLATIONS ) { + win32: system(del $$TRANSLATIONS) + unix: system(rm -f $$TRANSLATIONS) +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result new file mode 100644 index 0000000..470d6eb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/project.ts.result @@ -0,0 +1,31 @@ + + + + + QApplication + + + Hello world + top-level wildcard + + + + + Hello world + top-level direct + + + + + Hello world + nested wildcard + + + + + Hello world + nested direct + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri new file mode 100644 index 0000000..a6079f9 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/sub.pri @@ -0,0 +1,3 @@ +VPATH += $$PWD + +SOURCES += sub/subfile?.cpp subfilter.cpp diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp new file mode 100644 index 0000000..807d296 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfile1.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "nested wildcard"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp new file mode 100644 index 0000000..6e5dd25 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsingpaths/sub/subfilter.cpp @@ -0,0 +1,9 @@ +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world", "nested direct"); +} + + diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 6e8b941..78e5b5f 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -452,7 +452,7 @@ int main(int argc, char **argv) continue; } - evaluateProFile(visitor, &variables); + evaluateProFile(visitor, &variables, pfi.absolutePath()); sourceFiles = variables.value("SOURCES"); diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 54c5d9a..3b8a1b8 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -107,9 +107,6 @@ public: QString propertyValue(const QString &val) const; bool isActiveConfig(const QString &config, bool regex = false); - QStringList expandPattern(const QString &pattern); - void expandPatternHelper(const QString &relName, const QString &absName, - QStringList &sources_out); QStringList expandVariableReferences(const QString &value); QStringList evaluateExpandFunction(const QString &function, const QString &arguments); QString format(const char *format) const; @@ -559,29 +556,6 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) m_prevLineNo = m_lineNo; m_prevProFile = currentProFile(); - // The following two blocks fix bug 180128 by making all "interesting" - // file name absolute in each .pro file, not just the top most one - if (varName == QLatin1String("SOURCES") - || varName == QLatin1String("HEADERS") - || varName == QLatin1String("INTERFACES") - || varName == QLatin1String("FORMS") - || varName == QLatin1String("FORMS3") - || varName == QLatin1String("RESOURCES")) { - // matches only existent files, expand certain(?) patterns - QStringList vv; - for (int i = v.count(); --i >= 0; ) - vv << expandPattern(v[i]); - v = vv; - } - - if (varName == QLatin1String("TRANSLATIONS")) { - // also matches non-existent files, but does not expand pattern - QString dir = QFileInfo(currentFileName()).absolutePath(); - dir += QLatin1Char('/'); - for (int i = v.count(); --i >= 0; ) - v[i] = QFileInfo(dir, v[i]).absoluteFilePath(); - } - switch (m_variableOperator) { case ProVariable::UniqueAddOperator: // * insertUnique(&m_valuemap, varName, v, true); @@ -1537,82 +1511,6 @@ bool ProFileEvaluator::Private::evaluateFeatureFile(const QString &fileName, boo return fn.isEmpty() ? false : evaluateFile(fn, result); } -void ProFileEvaluator::Private::expandPatternHelper(const QString &relName, const QString &absName, - QStringList &sources_out) -{ - const QStringList vpaths = values(QLatin1String("VPATH")) - + values(QLatin1String("QMAKE_ABSOLUTE_SOURCE_PATH")) - + values(QLatin1String("DEPENDPATH")) - + values(QLatin1String("VPATH_SOURCES")); - - QFileInfo fi(absName); - bool found = fi.exists(); - // Search in all vpaths - if (!found) { - foreach (const QString &vpath, vpaths) { - fi.setFile(vpath + QDir::separator() + relName); - if (fi.exists()) { - found = true; - break; - } - } - } - - if (found) { - sources_out += fi.absoluteFilePath(); // Not resolving symlinks - } else { - QString val = relName; - QString dir; - QString wildcard = val; - QString real_dir; - if (wildcard.lastIndexOf(QLatin1Char('/')) != -1) { - dir = wildcard.left(wildcard.lastIndexOf(QLatin1Char('/')) + 1); - real_dir = dir; - wildcard = wildcard.right(wildcard.length() - dir.length()); - } - - if (real_dir.isEmpty() || QFileInfo(real_dir).exists()) { - QStringList files = QDir(real_dir).entryList(QStringList(wildcard)); - if (files.isEmpty()) { - q->logMessage(format("Failure to find %1").arg(val)); - } else { - QString a; - for (int i = files.count() - 1; i >= 0; --i) { - if (files[i] == QLatin1String(".") || files[i] == QLatin1String("..")) - continue; - a = dir + files[i]; - sources_out += a; - } - } - } else { - q->logMessage(format("Cannot match %1/%2, as %3 does not exist.") - .arg(real_dir).arg(wildcard).arg(real_dir)); - } - } -} - - -/* - * Lookup of files are done in this order: - * 1. look in pwd - * 2. look in vpaths - * 3. expand wild card files relative from the profiles folder - **/ - -// FIXME: This code supports something that I'd consider a flaw in .pro file syntax -// which is not even documented. So arguably this can be ditched completely... -QStringList ProFileEvaluator::Private::expandPattern(const QString& pattern) -{ - if (!currentProFile()) - return QStringList(); - - QStringList sources_out; - const QString absName = QDir::cleanPath(QDir::current().absoluteFilePath(pattern)); - - expandPatternHelper(pattern, absName, sources_out); - return sources_out; -} - QString ProFileEvaluator::Private::format(const char *fmt) const { ProFile *pro = currentProFile(); @@ -1654,6 +1552,59 @@ QStringList ProFileEvaluator::values(const QString &variableName, const ProFile return d->values(variableName, pro); } +QStringList ProFileEvaluator::absolutePathValues( + const QString &variable, const QString &baseDirectory) const +{ + QStringList result; + foreach (const QString &el, values(variable)) { + const QFileInfo info = QFileInfo(baseDirectory, el); + if (info.isDir()) + result << QDir::cleanPath(info.absoluteFilePath()); + } + return result; +} + +QStringList ProFileEvaluator::absoluteFileValues( + const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, + const ProFile *pro) const +{ + QStringList result; + foreach (const QString &el, pro ? values(variable, pro) : values(variable)) { + QFileInfo info(el); + if (info.isAbsolute()) { + if (info.exists()) { + result << QDir::cleanPath(el); + goto next; + } + } else { + foreach (const QString &dir, searchDirs) { + QFileInfo info(dir, el); + if (info.isFile()) { + result << QDir::cleanPath(info.filePath()); + goto next; + } + } + if (baseDirectory.isEmpty()) + goto next; + info = QFileInfo(baseDirectory, el); + } + { + QFileInfo baseInfo(info.absolutePath()); + if (baseInfo.exists()) { + QString wildcard = info.fileName(); + if (wildcard.contains(QLatin1Char('*')) || wildcard.contains(QLatin1Char('?'))) { + QDir theDir(QDir::cleanPath(baseInfo.filePath())); + foreach (const QString &fn, theDir.entryList(QStringList(wildcard))) + if (fn != QLatin1String(".") && fn != QLatin1String("..")) + result << theDir.absoluteFilePath(fn); + } + } + } + next: ; + } + return result; +} + ProFileEvaluator::TemplateType ProFileEvaluator::templateType() { QStringList templ = values(QLatin1String("TEMPLATE")); diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h index 78d8fce..ae09a59 100644 --- a/tools/linguist/shared/profileevaluator.h +++ b/tools/linguist/shared/profileevaluator.h @@ -76,6 +76,10 @@ public: void addProperties(const QHash &properties); QStringList values(const QString &variableName) const; QStringList values(const QString &variableName, const ProFile *pro) const; + QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const; + QStringList absoluteFileValues( + const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, + const ProFile *pro) const; QString propertyValue(const QString &val) const; // for our descendents diff --git a/tools/linguist/shared/proreader.cpp b/tools/linguist/shared/proreader.cpp index 492c2ef..3400f20 100644 --- a/tools/linguist/shared/proreader.cpp +++ b/tools/linguist/shared/proreader.cpp @@ -41,21 +41,49 @@ #include "profileevaluator.h" +#include #include QT_BEGIN_NAMESPACE -void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap) +static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths, + const QString &projectDir, const ProFileEvaluator &visitor) { + QStringList vPaths = + visitor.absolutePathValues(QLatin1String(vvar), projectDir); + vPaths += baseVPaths; + vPaths.removeDuplicates(); + return visitor.absoluteFileValues(QLatin1String(var), projectDir, vPaths, 0); +} + +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap, + const QString &projectDir) +{ + QStringList baseVPaths; + baseVPaths += visitor.absolutePathValues(QLatin1String("VPATH"), projectDir); + baseVPaths << projectDir; // QMAKE_ABSOLUTE_SOURCE_PATH + baseVPaths += visitor.absolutePathValues(QLatin1String("DEPENDPATH"), projectDir); + baseVPaths.removeDuplicates(); + QStringList sourceFiles; QString codecForTr; QString codecForSource; QStringList tsFileNames; // app/lib template - sourceFiles += visitor.values(QLatin1String("SOURCES")); - sourceFiles += visitor.values(QLatin1String("HEADERS")); - tsFileNames = visitor.values(QLatin1String("TRANSLATIONS")); + sourceFiles += getSources("SOURCES", "VPATH_SOURCES", baseVPaths, projectDir, visitor); + + sourceFiles += getSources("FORMS", "VPATH_FORMS", baseVPaths, projectDir, visitor); + sourceFiles += getSources("FORMS3", "VPATH_FORMS3", baseVPaths, projectDir, visitor); + + QStringList vPathsInc = baseVPaths; + vPathsInc += visitor.absolutePathValues(QLatin1String("INCLUDEPATH"), projectDir); + vPathsInc.removeDuplicates(); + sourceFiles += visitor.absoluteFileValues(QLatin1String("HEADERS"), projectDir, vPathsInc, 0); + + QDir proDir(projectDir); + foreach (const QString &tsFile, visitor.values(QLatin1String("TRANSLATIONS"))) + tsFileNames << QFileInfo(proDir, tsFile).filePath(); QStringList trcodec = visitor.values(QLatin1String("CODEC")) + visitor.values(QLatin1String("DEFAULTCODEC")) @@ -67,11 +95,6 @@ void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap); +void evaluateProFile(const ProFileEvaluator &visitor, QHash *varMap, + const QString &projectDir); bool evaluateProFile(const QString &fileName, bool verbose, QHash *varMap); QT_END_NAMESPACE -- cgit v0.12 From 8f65472671406ad5881b119ba32b075b828bbb1a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 16:57:38 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( eb4957a561d3f85d4cd5602832375c66f378b521 ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit since the last update: ++ b/LayoutTests/ChangeLog 2009-06-04 Ariya Hidayat Rubber-stamped by Tor Arne Vestbø. Added Qt-specific expected result for Canvas pointInPath's test. Qt's QPainterPath::contains(point) returns false if the point is exactly along one of the edges (except the origin). Until we find a workaround for this, compensate it in the expected result. * platform/qt/fast/canvas/pointInPath-expected.txt: Added. 2009-01-11 Simon Fraser Reviewed by Oliver Hunt https://bugs.webkit.org/show_bug.cgi?id=23242 Add testcase for incremental repaint after use of ctx.transform(), and enhanced isPointInPath testcase to do testing after use of ctx.transform(). * fast/canvas/canvas-incremental-repaint-2.html: Added. * fast/canvas/pointInPath-expected.txt: * fast/canvas/pointInPath.js: * platform/mac/fast/canvas/canvas-incremental-repaint-2-expected.checksum: Added. * platform/mac/fast/canvas/canvas-incremental-repaint-2-expected.png: Added. * platform/mac/fast/canvas/canvas-incremental-repaint-2-expected.txt: Added. ++ b/WebCore/ChangeLog 2008-12-18 Bernhard Rosenkraenzer Reviewed by Darin Adler. https://bugs.webkit.org/show_bug.cgi?id=22205 Fix compatibility with bison 2.4, partially based on older patch by Priit Laes * WebCore/css/CSSGrammar.y: Made compatible with bison 2.4 2009-07-13 Cédric Luthi Reviewed by Tor Arne Vestbø. Fix NPWindow clip rect in PluginViewMac The rect should be in window-coordinates. This bug can be observed with Flash 10 here: http://www.permadi.com/tutorial/cursorTracker/ * plugins/mac/PluginViewMac.cpp: 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix Qt implementation of WebCore::directoryName to return the absolute directory name instead of the base file name. * platform/qt/FileSystemQt.cpp: (WebCore::directoryName): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix WebCore::Path::isEmpty() for the Qt port to return true if there is no element in the path. QPainterPath::isEmpty() returns also true if there is one single MoveTo element inside, which makes sense but doesn't patch Webcore's is-empty definition. * platform/graphics/qt/PathQt.cpp: (WebCore::Path::isEmpty): Use elementCount() == 0. 2009-01-11 Simon Fraser Reviewed by Oliver Hunt https://bugs.webkit.org/show_bug.cgi?id=23242 Fix CanvasRenderingContext2D::transform to do a pre-multiply, rather than a post-multiply into m_transform. This bug did not affect drawing, but did cause m_transform to be incorrect, which impacted willDraw(), and isPointInPath. Test: fast/canvas/canvas-incremental-repaint-2.html * html/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::transform): 2009-07-04 Sriram Yadavalli Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=26439 QtWebKit fails in loading www.nytimes.com in Windows/Linux QNetworkReplyHandler is ignoring content associated with 401 error. This causes the XHR response handling to fail. Simon: Added also ProxyAuthenticationRequiredError, to handle the same case when going through proxies, as suggested by Prasanth. * platform/network/qt/QNetworkReplyHandler.cpp: (WebCore::QNetworkReplyHandler::finish): ++ b/WebKit/qt/ChangeLog Fix crash with plugins when the plugin stream is cancelled. Similar to r26667 handle the case where didReceiveResponse on the plugin view results in failure to set up the stream and setMainDocumentError being called instead. This will set the m_pluginView back to 0 and we need check for it before calling didReceiveData. This was triggered by consecutive execution of LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::committedLoad): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. --- .../webkit/JavaScriptCore/generated/Grammar.cpp | 1002 ++++++--- .../webkit/JavaScriptCore/generated/Grammar.h | 109 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 78 + src/3rdparty/webkit/WebCore/css/CSSGrammar.y | 10 +- .../webkit/WebCore/generated/CSSGrammar.cpp | 2342 ++++++++++++-------- src/3rdparty/webkit/WebCore/generated/CSSGrammar.h | 231 +- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 1002 ++++++--- src/3rdparty/webkit/WebCore/generated/Grammar.h | 109 +- .../webkit/WebCore/generated/XPathGrammar.cpp | 418 ++-- .../webkit/WebCore/generated/XPathGrammar.h | 64 +- .../WebCore/html/CanvasRenderingContext2D.cpp | 4 +- .../webkit/WebCore/platform/graphics/qt/PathQt.cpp | 4 +- .../platform/network/qt/QNetworkReplyHandler.cpp | 6 +- .../webkit/WebCore/platform/qt/FileSystemQt.cpp | 2 +- .../webkit/WebCore/plugins/mac/PluginViewMac.cpp | 8 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 19 + .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 5 + 18 files changed, 3375 insertions(+), 2040 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp index 1652b24..d25683a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,159 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse jscyyparse -#define yylex jscyylex -#define yyerror jscyyerror -#define yylval jscyylval -#define yychar jscyychar -#define yydebug jscyydebug -#define yynerrs jscyynerrs -#define yylloc jscyylloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - NULLTOKEN = 258, - TRUETOKEN = 259, - FALSETOKEN = 260, - BREAK = 261, - CASE = 262, - DEFAULT = 263, - FOR = 264, - NEW = 265, - VAR = 266, - CONSTTOKEN = 267, - CONTINUE = 268, - FUNCTION = 269, - RETURN = 270, - VOIDTOKEN = 271, - DELETETOKEN = 272, - IF = 273, - THISTOKEN = 274, - DO = 275, - WHILE = 276, - INTOKEN = 277, - INSTANCEOF = 278, - TYPEOF = 279, - SWITCH = 280, - WITH = 281, - RESERVED = 282, - THROW = 283, - TRY = 284, - CATCH = 285, - FINALLY = 286, - DEBUGGER = 287, - IF_WITHOUT_ELSE = 288, - ELSE = 289, - EQEQ = 290, - NE = 291, - STREQ = 292, - STRNEQ = 293, - LE = 294, - GE = 295, - OR = 296, - AND = 297, - PLUSPLUS = 298, - MINUSMINUS = 299, - LSHIFT = 300, - RSHIFT = 301, - URSHIFT = 302, - PLUSEQUAL = 303, - MINUSEQUAL = 304, - MULTEQUAL = 305, - DIVEQUAL = 306, - LSHIFTEQUAL = 307, - RSHIFTEQUAL = 308, - URSHIFTEQUAL = 309, - ANDEQUAL = 310, - MODEQUAL = 311, - XOREQUAL = 312, - OREQUAL = 313, - OPENBRACE = 314, - CLOSEBRACE = 315, - NUMBER = 316, - IDENT = 317, - STRING = 318, - AUTOPLUSPLUS = 319, - AUTOMINUSMINUS = 320 - }; -#endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - - - +#define yyparse jscyyparse +#define yylex jscyylex +#define yyerror jscyyerror +#define yylval jscyylval +#define yychar jscyychar +#define yydebug jscyydebug +#define yynerrs jscyynerrs +#define yylloc jscyylloc /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 3 "../parser/Grammar.y" @@ -363,6 +231,9 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD +/* Line 189 of yacc.c */ +#line 236 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -381,10 +252,88 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NULLTOKEN = 258, + TRUETOKEN = 259, + FALSETOKEN = 260, + BREAK = 261, + CASE = 262, + DEFAULT = 263, + FOR = 264, + NEW = 265, + VAR = 266, + CONSTTOKEN = 267, + CONTINUE = 268, + FUNCTION = 269, + RETURN = 270, + VOIDTOKEN = 271, + DELETETOKEN = 272, + IF = 273, + THISTOKEN = 274, + DO = 275, + WHILE = 276, + INTOKEN = 277, + INSTANCEOF = 278, + TYPEOF = 279, + SWITCH = 280, + WITH = 281, + RESERVED = 282, + THROW = 283, + TRY = 284, + CATCH = 285, + FINALLY = 286, + DEBUGGER = 287, + IF_WITHOUT_ELSE = 288, + ELSE = 289, + EQEQ = 290, + NE = 291, + STREQ = 292, + STRNEQ = 293, + LE = 294, + GE = 295, + OR = 296, + AND = 297, + PLUSPLUS = 298, + MINUSMINUS = 299, + LSHIFT = 300, + RSHIFT = 301, + URSHIFT = 302, + PLUSEQUAL = 303, + MINUSEQUAL = 304, + MULTEQUAL = 305, + DIVEQUAL = 306, + LSHIFTEQUAL = 307, + RSHIFTEQUAL = 308, + URSHIFTEQUAL = 309, + ANDEQUAL = 310, + MODEQUAL = 311, + XOREQUAL = 312, + OREQUAL = 313, + OPENBRACE = 314, + CLOSEBRACE = 315, + NUMBER = 316, + IDENT = 317, + STRING = 318, + AUTOPLUSPLUS = 319, + AUTOMINUSMINUS = 320 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../parser/Grammar.y" { + +/* Line 214 of yacc.c */ +#line 157 "../parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -414,13 +363,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 187 of yacc.c. */ -#line 420 "Grammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 371 "Grammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -440,8 +391,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 445 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 396 "Grammar.tab.c" #ifdef short # undef short @@ -516,14 +467,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -605,9 +556,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -642,12 +593,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -2361,17 +2312,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -2406,11 +2360,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -2692,10 +2646,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -2714,10 +2666,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -2741,88 +2692,97 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Number of syntax errors so far. */ + int yynerrs; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -2861,6 +2821,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -2882,9 +2843,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2905,6 +2866,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2913,16 +2877,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2954,20 +2918,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -3008,31 +2968,43 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 290 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NullNode(GLOBAL_DATA), 0, 1); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 291 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, true), 0, 1); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 292 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, false), 0, 1); ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 293 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 294 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;} break; case 7: + +/* Line 1455 of yacc.c */ #line 295 "../parser/Grammar.y" { Lexer& l = *LEXER; @@ -3046,6 +3018,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 304 "../parser/Grammar.y" { Lexer& l = *LEXER; @@ -3059,26 +3033,36 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 316 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 10: + +/* Line 1455 of yacc.c */ #line 317 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 11: + +/* Line 1455 of yacc.c */ #line 318 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from((yyvsp[(1) - (3)].doubleValue))), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 12: + +/* Line 1455 of yacc.c */ #line 319 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;} break; case 13: + +/* Line 1455 of yacc.c */ #line 321 "../parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -3091,6 +3075,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 332 "../parser/Grammar.y" { (yyval.propertyList).m_node.head = new PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node); (yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head; @@ -3099,6 +3085,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 336 "../parser/Grammar.y" { (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head; (yyval.propertyList).m_node.tail = new PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail); @@ -3107,51 +3095,71 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 344 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;} break; case 18: + +/* Line 1455 of yacc.c */ #line 345 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;} break; case 19: + +/* Line 1455 of yacc.c */ #line 347 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 351 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ThisNode(GLOBAL_DATA), ThisFeature, 0); ;} break; case 23: + +/* Line 1455 of yacc.c */ #line 354 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 24: + +/* Line 1455 of yacc.c */ #line 355 "../parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;} break; case 25: + +/* Line 1455 of yacc.c */ #line 359 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;} break; case 26: + +/* Line 1455 of yacc.c */ #line 360 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;} break; case 27: + +/* Line 1455 of yacc.c */ #line 361 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;} break; case 28: + +/* Line 1455 of yacc.c */ #line 365 "../parser/Grammar.y" { (yyval.elementList).m_node.head = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node); (yyval.elementList).m_node.tail = (yyval.elementList).m_node.head; @@ -3160,6 +3168,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 370 "../parser/Grammar.y" { (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head; (yyval.elementList).m_node.tail = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node); @@ -3168,26 +3178,36 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 377 "../parser/Grammar.y" { (yyval.intValue) = 0; ;} break; case 32: + +/* Line 1455 of yacc.c */ #line 382 "../parser/Grammar.y" { (yyval.intValue) = 1; ;} break; case 33: + +/* Line 1455 of yacc.c */ #line 383 "../parser/Grammar.y" { (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;} break; case 35: + +/* Line 1455 of yacc.c */ #line 388 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;} break; case 36: + +/* Line 1455 of yacc.c */ #line 389 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3196,6 +3216,8 @@ yyreduce: break; case 37: + +/* Line 1455 of yacc.c */ #line 393 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3204,6 +3226,8 @@ yyreduce: break; case 38: + +/* Line 1455 of yacc.c */ #line 397 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3212,6 +3236,8 @@ yyreduce: break; case 40: + +/* Line 1455 of yacc.c */ #line 405 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3220,6 +3246,8 @@ yyreduce: break; case 41: + +/* Line 1455 of yacc.c */ #line 409 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3228,6 +3256,8 @@ yyreduce: break; case 42: + +/* Line 1455 of yacc.c */ #line 413 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3236,6 +3266,8 @@ yyreduce: break; case 44: + +/* Line 1455 of yacc.c */ #line 421 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3244,6 +3276,8 @@ yyreduce: break; case 46: + +/* Line 1455 of yacc.c */ #line 429 "../parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3252,16 +3286,22 @@ yyreduce: break; case 47: + +/* Line 1455 of yacc.c */ #line 436 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 48: + +/* Line 1455 of yacc.c */ #line 437 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 49: + +/* Line 1455 of yacc.c */ #line 438 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3270,6 +3310,8 @@ yyreduce: break; case 50: + +/* Line 1455 of yacc.c */ #line 442 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3277,16 +3319,22 @@ yyreduce: break; case 51: + +/* Line 1455 of yacc.c */ #line 448 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 52: + +/* Line 1455 of yacc.c */ #line 449 "../parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 53: + +/* Line 1455 of yacc.c */ #line 450 "../parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3295,6 +3343,8 @@ yyreduce: break; case 54: + +/* Line 1455 of yacc.c */ #line 454 "../parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3303,16 +3353,22 @@ yyreduce: break; case 55: + +/* Line 1455 of yacc.c */ #line 461 "../parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA), 0, 0); ;} break; case 56: + +/* Line 1455 of yacc.c */ #line 462 "../parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;} break; case 57: + +/* Line 1455 of yacc.c */ #line 466 "../parser/Grammar.y" { (yyval.argumentList).m_node.head = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node); (yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head; @@ -3321,6 +3377,8 @@ yyreduce: break; case 58: + +/* Line 1455 of yacc.c */ #line 470 "../parser/Grammar.y" { (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head; (yyval.argumentList).m_node.tail = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node); @@ -3329,181 +3387,253 @@ yyreduce: break; case 64: + +/* Line 1455 of yacc.c */ #line 488 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 65: + +/* Line 1455 of yacc.c */ #line 489 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 67: + +/* Line 1455 of yacc.c */ #line 494 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 68: + +/* Line 1455 of yacc.c */ #line 495 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 69: + +/* Line 1455 of yacc.c */ #line 499 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 70: + +/* Line 1455 of yacc.c */ #line 500 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;} break; case 71: + +/* Line 1455 of yacc.c */ #line 501 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 72: + +/* Line 1455 of yacc.c */ #line 502 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 73: + +/* Line 1455 of yacc.c */ #line 503 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 74: + +/* Line 1455 of yacc.c */ #line 504 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 75: + +/* Line 1455 of yacc.c */ #line 505 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 76: + +/* Line 1455 of yacc.c */ #line 506 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 77: + +/* Line 1455 of yacc.c */ #line 507 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 78: + +/* Line 1455 of yacc.c */ #line 508 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 79: + +/* Line 1455 of yacc.c */ #line 509 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 85: + +/* Line 1455 of yacc.c */ #line 523 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 86: + +/* Line 1455 of yacc.c */ #line 524 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 87: + +/* Line 1455 of yacc.c */ #line 525 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 89: + +/* Line 1455 of yacc.c */ #line 531 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 90: + +/* Line 1455 of yacc.c */ #line 533 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 91: + +/* Line 1455 of yacc.c */ #line 535 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 93: + +/* Line 1455 of yacc.c */ #line 540 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 94: + +/* Line 1455 of yacc.c */ #line 541 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 96: + +/* Line 1455 of yacc.c */ #line 547 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 97: + +/* Line 1455 of yacc.c */ #line 549 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 99: + +/* Line 1455 of yacc.c */ #line 554 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 100: + +/* Line 1455 of yacc.c */ #line 555 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 101: + +/* Line 1455 of yacc.c */ #line 556 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 103: + +/* Line 1455 of yacc.c */ #line 561 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 104: + +/* Line 1455 of yacc.c */ #line 562 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 105: + +/* Line 1455 of yacc.c */ #line 563 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 107: + +/* Line 1455 of yacc.c */ #line 568 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 108: + +/* Line 1455 of yacc.c */ #line 569 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 109: + +/* Line 1455 of yacc.c */ #line 570 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 110: + +/* Line 1455 of yacc.c */ #line 571 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 111: + +/* Line 1455 of yacc.c */ #line 572 "../parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3511,6 +3641,8 @@ yyreduce: break; case 112: + +/* Line 1455 of yacc.c */ #line 575 "../parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3518,26 +3650,36 @@ yyreduce: break; case 114: + +/* Line 1455 of yacc.c */ #line 582 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 115: + +/* Line 1455 of yacc.c */ #line 583 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 116: + +/* Line 1455 of yacc.c */ #line 584 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 117: + +/* Line 1455 of yacc.c */ #line 585 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 118: + +/* Line 1455 of yacc.c */ #line 587 "../parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3545,26 +3687,36 @@ yyreduce: break; case 120: + +/* Line 1455 of yacc.c */ #line 594 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 121: + +/* Line 1455 of yacc.c */ #line 595 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 122: + +/* Line 1455 of yacc.c */ #line 596 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 123: + +/* Line 1455 of yacc.c */ #line 597 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 124: + +/* Line 1455 of yacc.c */ #line 599 "../parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3572,6 +3724,8 @@ yyreduce: break; case 125: + +/* Line 1455 of yacc.c */ #line 603 "../parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3579,156 +3733,218 @@ yyreduce: break; case 127: + +/* Line 1455 of yacc.c */ #line 610 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 128: + +/* Line 1455 of yacc.c */ #line 611 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 129: + +/* Line 1455 of yacc.c */ #line 612 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 130: + +/* Line 1455 of yacc.c */ #line 613 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 132: + +/* Line 1455 of yacc.c */ #line 619 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 133: + +/* Line 1455 of yacc.c */ #line 621 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 134: + +/* Line 1455 of yacc.c */ #line 623 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 135: + +/* Line 1455 of yacc.c */ #line 625 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 137: + +/* Line 1455 of yacc.c */ #line 631 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 138: + +/* Line 1455 of yacc.c */ #line 632 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 139: + +/* Line 1455 of yacc.c */ #line 634 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 140: + +/* Line 1455 of yacc.c */ #line 636 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 142: + +/* Line 1455 of yacc.c */ #line 641 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 144: + +/* Line 1455 of yacc.c */ #line 647 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 652 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 657 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 150: + +/* Line 1455 of yacc.c */ #line 663 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 152: + +/* Line 1455 of yacc.c */ #line 669 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 154: + +/* Line 1455 of yacc.c */ #line 674 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 156: + +/* Line 1455 of yacc.c */ #line 680 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 158: + +/* Line 1455 of yacc.c */ #line 686 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 160: + +/* Line 1455 of yacc.c */ #line 691 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 162: + +/* Line 1455 of yacc.c */ #line 697 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 164: + +/* Line 1455 of yacc.c */ #line 703 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 166: + +/* Line 1455 of yacc.c */ #line 708 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 168: + +/* Line 1455 of yacc.c */ #line 714 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 170: + +/* Line 1455 of yacc.c */ #line 719 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 172: + +/* Line 1455 of yacc.c */ #line 725 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 174: + +/* Line 1455 of yacc.c */ #line 731 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 176: + +/* Line 1455 of yacc.c */ #line 737 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 178: + +/* Line 1455 of yacc.c */ #line 743 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3736,6 +3952,8 @@ yyreduce: break; case 180: + +/* Line 1455 of yacc.c */ #line 751 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3743,6 +3961,8 @@ yyreduce: break; case 182: + +/* Line 1455 of yacc.c */ #line 759 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3750,99 +3970,137 @@ yyreduce: break; case 183: + +/* Line 1455 of yacc.c */ #line 765 "../parser/Grammar.y" { (yyval.op) = OpEqual; ;} break; case 184: + +/* Line 1455 of yacc.c */ #line 766 "../parser/Grammar.y" { (yyval.op) = OpPlusEq; ;} break; case 185: + +/* Line 1455 of yacc.c */ #line 767 "../parser/Grammar.y" { (yyval.op) = OpMinusEq; ;} break; case 186: + +/* Line 1455 of yacc.c */ #line 768 "../parser/Grammar.y" { (yyval.op) = OpMultEq; ;} break; case 187: + +/* Line 1455 of yacc.c */ #line 769 "../parser/Grammar.y" { (yyval.op) = OpDivEq; ;} break; case 188: + +/* Line 1455 of yacc.c */ #line 770 "../parser/Grammar.y" { (yyval.op) = OpLShift; ;} break; case 189: + +/* Line 1455 of yacc.c */ #line 771 "../parser/Grammar.y" { (yyval.op) = OpRShift; ;} break; case 190: + +/* Line 1455 of yacc.c */ #line 772 "../parser/Grammar.y" { (yyval.op) = OpURShift; ;} break; case 191: + +/* Line 1455 of yacc.c */ #line 773 "../parser/Grammar.y" { (yyval.op) = OpAndEq; ;} break; case 192: + +/* Line 1455 of yacc.c */ #line 774 "../parser/Grammar.y" { (yyval.op) = OpXOrEq; ;} break; case 193: + +/* Line 1455 of yacc.c */ #line 775 "../parser/Grammar.y" { (yyval.op) = OpOrEq; ;} break; case 194: + +/* Line 1455 of yacc.c */ #line 776 "../parser/Grammar.y" { (yyval.op) = OpModEq; ;} break; case 196: + +/* Line 1455 of yacc.c */ #line 781 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 198: + +/* Line 1455 of yacc.c */ #line 786 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 200: + +/* Line 1455 of yacc.c */ #line 791 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 218: + +/* Line 1455 of yacc.c */ #line 815 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 219: + +/* Line 1455 of yacc.c */ #line 817 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 220: + +/* Line 1455 of yacc.c */ #line 822 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 221: + +/* Line 1455 of yacc.c */ #line 824 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); @@ -3850,6 +4108,8 @@ yyreduce: break; case 222: + +/* Line 1455 of yacc.c */ #line 830 "../parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3861,6 +4121,8 @@ yyreduce: break; case 223: + +/* Line 1455 of yacc.c */ #line 837 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3874,6 +4136,8 @@ yyreduce: break; case 224: + +/* Line 1455 of yacc.c */ #line 847 "../parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3885,6 +4149,8 @@ yyreduce: break; case 225: + +/* Line 1455 of yacc.c */ #line 855 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3898,6 +4164,8 @@ yyreduce: break; case 226: + +/* Line 1455 of yacc.c */ #line 867 "../parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3909,6 +4177,8 @@ yyreduce: break; case 227: + +/* Line 1455 of yacc.c */ #line 874 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3922,6 +4192,8 @@ yyreduce: break; case 228: + +/* Line 1455 of yacc.c */ #line 884 "../parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3933,6 +4205,8 @@ yyreduce: break; case 229: + +/* Line 1455 of yacc.c */ #line 892 "../parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3946,18 +4220,24 @@ yyreduce: break; case 230: + +/* Line 1455 of yacc.c */ #line 904 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 231: + +/* Line 1455 of yacc.c */ #line 907 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 232: + +/* Line 1455 of yacc.c */ #line 912 "../parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node; (yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head; @@ -3970,6 +4250,8 @@ yyreduce: break; case 233: + +/* Line 1455 of yacc.c */ #line 921 "../parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head; (yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node; @@ -3982,49 +4264,67 @@ yyreduce: break; case 234: + +/* Line 1455 of yacc.c */ #line 932 "../parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 235: + +/* Line 1455 of yacc.c */ #line 933 "../parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 236: + +/* Line 1455 of yacc.c */ #line 937 "../parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 237: + +/* Line 1455 of yacc.c */ #line 941 "../parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 238: + +/* Line 1455 of yacc.c */ #line 945 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;} break; case 239: + +/* Line 1455 of yacc.c */ #line 949 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 240: + +/* Line 1455 of yacc.c */ #line 951 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 241: + +/* Line 1455 of yacc.c */ #line 957 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 242: + +/* Line 1455 of yacc.c */ #line 960 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations), @@ -4034,24 +4334,32 @@ yyreduce: break; case 243: + +/* Line 1455 of yacc.c */ #line 968 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 244: + +/* Line 1455 of yacc.c */ #line 970 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 245: + +/* Line 1455 of yacc.c */ #line 972 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 246: + +/* Line 1455 of yacc.c */ #line 975 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations, (yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features, @@ -4061,6 +4369,8 @@ yyreduce: break; case 247: + +/* Line 1455 of yacc.c */ #line 981 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true), mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations), @@ -4071,6 +4381,8 @@ yyreduce: break; case 248: + +/* Line 1455 of yacc.c */ #line 988 "../parser/Grammar.y" { ForInNode* node = new ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node); @@ -4083,6 +4395,8 @@ yyreduce: break; case 249: + +/* Line 1455 of yacc.c */ #line 997 "../parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column); @@ -4092,6 +4406,8 @@ yyreduce: break; case 250: + +/* Line 1455 of yacc.c */ #line 1003 "../parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column); @@ -4103,16 +4419,22 @@ yyreduce: break; case 251: + +/* Line 1455 of yacc.c */ #line 1013 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 253: + +/* Line 1455 of yacc.c */ #line 1018 "../parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 255: + +/* Line 1455 of yacc.c */ #line 1023 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4121,6 +4443,8 @@ yyreduce: break; case 256: + +/* Line 1455 of yacc.c */ #line 1027 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4129,6 +4453,8 @@ yyreduce: break; case 257: + +/* Line 1455 of yacc.c */ #line 1031 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4137,6 +4463,8 @@ yyreduce: break; case 258: + +/* Line 1455 of yacc.c */ #line 1035 "../parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4145,6 +4473,8 @@ yyreduce: break; case 259: + +/* Line 1455 of yacc.c */ #line 1042 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4152,6 +4482,8 @@ yyreduce: break; case 260: + +/* Line 1455 of yacc.c */ #line 1045 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4159,6 +4491,8 @@ yyreduce: break; case 261: + +/* Line 1455 of yacc.c */ #line 1048 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4166,6 +4500,8 @@ yyreduce: break; case 262: + +/* Line 1455 of yacc.c */ #line 1051 "../parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4173,6 +4509,8 @@ yyreduce: break; case 263: + +/* Line 1455 of yacc.c */ #line 1057 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4180,6 +4518,8 @@ yyreduce: break; case 264: + +/* Line 1455 of yacc.c */ #line 1060 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4187,6 +4527,8 @@ yyreduce: break; case 265: + +/* Line 1455 of yacc.c */ #line 1063 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4194,6 +4536,8 @@ yyreduce: break; case 266: + +/* Line 1455 of yacc.c */ #line 1066 "../parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4201,6 +4545,8 @@ yyreduce: break; case 267: + +/* Line 1455 of yacc.c */ #line 1072 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); @@ -4208,6 +4554,8 @@ yyreduce: break; case 268: + +/* Line 1455 of yacc.c */ #line 1078 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants); @@ -4215,11 +4563,15 @@ yyreduce: break; case 269: + +/* Line 1455 of yacc.c */ #line 1084 "../parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;} break; case 270: + +/* Line 1455 of yacc.c */ #line 1086 "../parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations), @@ -4229,11 +4581,15 @@ yyreduce: break; case 271: + +/* Line 1455 of yacc.c */ #line 1094 "../parser/Grammar.y" { (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;} break; case 273: + +/* Line 1455 of yacc.c */ #line 1099 "../parser/Grammar.y" { (yyval.clauseList).m_node.head = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node); (yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head; @@ -4244,6 +4600,8 @@ yyreduce: break; case 274: + +/* Line 1455 of yacc.c */ #line 1105 "../parser/Grammar.y" { (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head; (yyval.clauseList).m_node.tail = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node); @@ -4255,26 +4613,36 @@ yyreduce: break; case 275: + +/* Line 1455 of yacc.c */ #line 1115 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;} break; case 276: + +/* Line 1455 of yacc.c */ #line 1116 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;} break; case 277: + +/* Line 1455 of yacc.c */ #line 1120 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;} break; case 278: + +/* Line 1455 of yacc.c */ #line 1121 "../parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;} break; case 279: + +/* Line 1455 of yacc.c */ #line 1125 "../parser/Grammar.y" { LabelNode* node = new LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4282,6 +4650,8 @@ yyreduce: break; case 280: + +/* Line 1455 of yacc.c */ #line 1131 "../parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4290,6 +4660,8 @@ yyreduce: break; case 281: + +/* Line 1455 of yacc.c */ #line 1135 "../parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4298,6 +4670,8 @@ yyreduce: break; case 282: + +/* Line 1455 of yacc.c */ #line 1142 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node), mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations), @@ -4308,6 +4682,8 @@ yyreduce: break; case 283: + +/* Line 1455 of yacc.c */ #line 1148 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0), mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), @@ -4318,6 +4694,8 @@ yyreduce: break; case 284: + +/* Line 1455 of yacc.c */ #line 1155 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations), @@ -4328,23 +4706,31 @@ yyreduce: break; case 285: + +/* Line 1455 of yacc.c */ #line 1164 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 286: + +/* Line 1455 of yacc.c */ #line 1166 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 287: + +/* Line 1455 of yacc.c */ #line 1171 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast((yyval.statementNode).m_node)); ;} break; case 288: + +/* Line 1455 of yacc.c */ #line 1173 "../parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4356,11 +4742,15 @@ yyreduce: break; case 289: + +/* Line 1455 of yacc.c */ #line 1183 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), LEXER->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;} break; case 290: + +/* Line 1455 of yacc.c */ #line 1185 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0); @@ -4371,11 +4761,15 @@ yyreduce: break; case 291: + +/* Line 1455 of yacc.c */ #line 1191 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;} break; case 292: + +/* Line 1455 of yacc.c */ #line 1193 "../parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4386,6 +4780,8 @@ yyreduce: break; case 293: + +/* Line 1455 of yacc.c */ #line 1202 "../parser/Grammar.y" { (yyval.parameterList).m_node.head = new ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)); (yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; @@ -4393,6 +4789,8 @@ yyreduce: break; case 294: + +/* Line 1455 of yacc.c */ #line 1205 "../parser/Grammar.y" { (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head; (yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); @@ -4400,27 +4798,37 @@ yyreduce: break; case 295: + +/* Line 1455 of yacc.c */ #line 1211 "../parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 296: + +/* Line 1455 of yacc.c */ #line 1212 "../parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 297: + +/* Line 1455 of yacc.c */ #line 1216 "../parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing(new SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;} break; case 298: + +/* Line 1455 of yacc.c */ #line 1217 "../parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features, (yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;} break; case 299: + +/* Line 1455 of yacc.c */ #line 1222 "../parser/Grammar.y" { (yyval.sourceElements).m_node = new SourceElements(GLOBAL_DATA); (yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node); @@ -4432,6 +4840,8 @@ yyreduce: break; case 300: + +/* Line 1455 of yacc.c */ #line 1229 "../parser/Grammar.y" { (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node); (yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations); @@ -4442,188 +4852,261 @@ yyreduce: break; case 304: + +/* Line 1455 of yacc.c */ #line 1243 "../parser/Grammar.y" { ;} break; case 305: + +/* Line 1455 of yacc.c */ #line 1244 "../parser/Grammar.y" { ;} break; case 306: + +/* Line 1455 of yacc.c */ #line 1245 "../parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 307: + +/* Line 1455 of yacc.c */ #line 1246 "../parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 308: + +/* Line 1455 of yacc.c */ #line 1250 "../parser/Grammar.y" { ;} break; case 309: + +/* Line 1455 of yacc.c */ #line 1251 "../parser/Grammar.y" { ;} break; case 310: + +/* Line 1455 of yacc.c */ #line 1252 "../parser/Grammar.y" { ;} break; case 311: + +/* Line 1455 of yacc.c */ #line 1253 "../parser/Grammar.y" { if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;} break; case 312: + +/* Line 1455 of yacc.c */ #line 1254 "../parser/Grammar.y" { if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;} break; case 316: + +/* Line 1455 of yacc.c */ #line 1264 "../parser/Grammar.y" { ;} break; case 317: + +/* Line 1455 of yacc.c */ #line 1265 "../parser/Grammar.y" { ;} break; case 318: + +/* Line 1455 of yacc.c */ #line 1267 "../parser/Grammar.y" { ;} break; case 322: + +/* Line 1455 of yacc.c */ #line 1274 "../parser/Grammar.y" { ;} break; case 517: + +/* Line 1455 of yacc.c */ #line 1642 "../parser/Grammar.y" { ;} break; case 518: + +/* Line 1455 of yacc.c */ #line 1643 "../parser/Grammar.y" { ;} break; case 520: + +/* Line 1455 of yacc.c */ #line 1648 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 521: + +/* Line 1455 of yacc.c */ #line 1652 "../parser/Grammar.y" { ;} break; case 522: + +/* Line 1455 of yacc.c */ #line 1653 "../parser/Grammar.y" { ;} break; case 525: + +/* Line 1455 of yacc.c */ #line 1659 "../parser/Grammar.y" { ;} break; case 526: + +/* Line 1455 of yacc.c */ #line 1660 "../parser/Grammar.y" { ;} break; case 530: + +/* Line 1455 of yacc.c */ #line 1667 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 533: + +/* Line 1455 of yacc.c */ #line 1676 "../parser/Grammar.y" { ;} break; case 534: + +/* Line 1455 of yacc.c */ #line 1677 "../parser/Grammar.y" { ;} break; case 539: + +/* Line 1455 of yacc.c */ #line 1694 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 555: + +/* Line 1455 of yacc.c */ #line 1725 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 557: + +/* Line 1455 of yacc.c */ #line 1727 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 559: + +/* Line 1455 of yacc.c */ #line 1732 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 561: + +/* Line 1455 of yacc.c */ #line 1734 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 563: + +/* Line 1455 of yacc.c */ #line 1739 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 565: + +/* Line 1455 of yacc.c */ #line 1741 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 568: + +/* Line 1455 of yacc.c */ #line 1753 "../parser/Grammar.y" { ;} break; case 569: + +/* Line 1455 of yacc.c */ #line 1754 "../parser/Grammar.y" { ;} break; case 578: + +/* Line 1455 of yacc.c */ #line 1778 "../parser/Grammar.y" { ;} break; case 580: + +/* Line 1455 of yacc.c */ #line 1783 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 585: + +/* Line 1455 of yacc.c */ #line 1794 "../parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 592: + +/* Line 1455 of yacc.c */ #line 1810 "../parser/Grammar.y" { ;} break; -/* Line 1267 of yacc.c. */ -#line 4627 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 5110 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4699,7 +5182,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -4716,7 +5199,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4774,14 +5257,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -4806,7 +5286,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4817,7 +5297,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered @@ -4843,6 +5323,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 1826 "../parser/Grammar.y" diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h index 99dbd4c..293aa73 100644 --- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h +++ b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -104,78 +104,16 @@ AUTOMINUSMINUS = 320 }; #endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../parser/Grammar.y" { + +/* Line 1676 of yacc.c */ +#line 157 "../parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -205,13 +143,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 1489 of yacc.c. */ -#line 211 "Grammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 151 "Grammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -230,3 +170,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index e084e27..368d2b5 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - e65b4879116f4a8b0ee8b09607eef666c68c61d6 + eb4957a561d3f85d4cd5602832375c66f378b521 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index c3b6c37..be6922f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,81 @@ +2008-12-18 Bernhard Rosenkraenzer + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=22205 + Fix compatibility with bison 2.4, partially based on older patch by + Priit Laes + + * WebCore/css/CSSGrammar.y: Made compatible with bison 2.4 + +2009-07-13 Cédric Luthi + + Reviewed by Tor Arne Vestbø. + + Fix NPWindow clip rect in PluginViewMac + + The rect should be in window-coordinates. This bug can be observed + with Flash 10 here: http://www.permadi.com/tutorial/cursorTracker/ + + * plugins/mac/PluginViewMac.cpp: + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + + Fix Qt implementation of WebCore::directoryName to return the absolute + directory name instead of the base file name. + + * platform/qt/FileSystemQt.cpp: + (WebCore::directoryName): + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + + Fix WebCore::Path::isEmpty() for the Qt port to return true + if there is no element in the path. + + QPainterPath::isEmpty() returns also true if there is one single + MoveTo element inside, which makes sense but doesn't patch Webcore's + is-empty definition. + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::isEmpty): Use elementCount() == 0. + +2009-01-11 Simon Fraser + + Reviewed by Oliver Hunt + + https://bugs.webkit.org/show_bug.cgi?id=23242 + + Fix CanvasRenderingContext2D::transform to do a pre-multiply, + rather than a post-multiply into m_transform. This bug did not affect + drawing, but did cause m_transform to be incorrect, which impacted + willDraw(), and isPointInPath. + + Test: fast/canvas/canvas-incremental-repaint-2.html + + * html/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::transform): + +2009-07-04 Sriram Yadavalli + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=26439 + + QtWebKit fails in loading www.nytimes.com in Windows/Linux + + QNetworkReplyHandler is ignoring content associated with 401 error. + This causes the XHR response handling to fail. + + Simon: Added also ProxyAuthenticationRequiredError, to handle the same + case when going through proxies, as suggested by Prasanth. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::finish): + 2009-06-25 Simon Hausmann Reviewed by and done with Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y index 9ee9c93..31f1c8b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y +++ b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y @@ -94,6 +94,8 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %expect 49 +%nonassoc LOWEST_PREC + %left UNIMPORTANT_TOK %token WHITESPACE SGML_CD @@ -349,7 +351,7 @@ maybe_charset: closing_brace: '}' - | %prec maybe_sgml TOKEN_EOF + | %prec LOWEST_PREC TOKEN_EOF ; charset: @@ -1355,10 +1357,10 @@ term: $$.string = $1; } /* We might need to actually parse the number from a dimension, but we can't just put something that uses $$.string into unary_term. */ - | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION } - | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION } + | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } + | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_URI; } - | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE } + | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } | hexcolor { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */ diff --git a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp index b980a0a..03a7829 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp +++ b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,157 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse cssyyparse -#define yylex cssyylex -#define yyerror cssyyerror -#define yylval cssyylval -#define yychar cssyychar -#define yydebug cssyydebug -#define yynerrs cssyynerrs - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOKEN_EOF = 0, - UNIMPORTANT_TOK = 258, - WHITESPACE = 259, - SGML_CD = 260, - INCLUDES = 261, - DASHMATCH = 262, - BEGINSWITH = 263, - ENDSWITH = 264, - CONTAINS = 265, - STRING = 266, - IDENT = 267, - NTH = 268, - HEX = 269, - IDSEL = 270, - IMPORT_SYM = 271, - PAGE_SYM = 272, - MEDIA_SYM = 273, - FONT_FACE_SYM = 274, - CHARSET_SYM = 275, - NAMESPACE_SYM = 276, - WEBKIT_RULE_SYM = 277, - WEBKIT_DECLS_SYM = 278, - WEBKIT_KEYFRAME_RULE_SYM = 279, - WEBKIT_KEYFRAMES_SYM = 280, - WEBKIT_VALUE_SYM = 281, - WEBKIT_MEDIAQUERY_SYM = 282, - WEBKIT_SELECTOR_SYM = 283, - WEBKIT_VARIABLES_SYM = 284, - WEBKIT_DEFINE_SYM = 285, - VARIABLES_FOR = 286, - WEBKIT_VARIABLES_DECLS_SYM = 287, - ATKEYWORD = 288, - IMPORTANT_SYM = 289, - MEDIA_ONLY = 290, - MEDIA_NOT = 291, - MEDIA_AND = 292, - QEMS = 293, - EMS = 294, - EXS = 295, - PXS = 296, - CMS = 297, - MMS = 298, - INS = 299, - PTS = 300, - PCS = 301, - DEGS = 302, - RADS = 303, - GRADS = 304, - TURNS = 305, - MSECS = 306, - SECS = 307, - HERZ = 308, - KHERZ = 309, - DIMEN = 310, - PERCENTAGE = 311, - FLOATTOKEN = 312, - INTEGER = 313, - URI = 314, - FUNCTION = 315, - NOTFUNCTION = 316, - UNICODERANGE = 317, - VARCALL = 318 - }; -#endif -/* Tokens. */ -#define TOKEN_EOF 0 -#define UNIMPORTANT_TOK 258 -#define WHITESPACE 259 -#define SGML_CD 260 -#define INCLUDES 261 -#define DASHMATCH 262 -#define BEGINSWITH 263 -#define ENDSWITH 264 -#define CONTAINS 265 -#define STRING 266 -#define IDENT 267 -#define NTH 268 -#define HEX 269 -#define IDSEL 270 -#define IMPORT_SYM 271 -#define PAGE_SYM 272 -#define MEDIA_SYM 273 -#define FONT_FACE_SYM 274 -#define CHARSET_SYM 275 -#define NAMESPACE_SYM 276 -#define WEBKIT_RULE_SYM 277 -#define WEBKIT_DECLS_SYM 278 -#define WEBKIT_KEYFRAME_RULE_SYM 279 -#define WEBKIT_KEYFRAMES_SYM 280 -#define WEBKIT_VALUE_SYM 281 -#define WEBKIT_MEDIAQUERY_SYM 282 -#define WEBKIT_SELECTOR_SYM 283 -#define WEBKIT_VARIABLES_SYM 284 -#define WEBKIT_DEFINE_SYM 285 -#define VARIABLES_FOR 286 -#define WEBKIT_VARIABLES_DECLS_SYM 287 -#define ATKEYWORD 288 -#define IMPORTANT_SYM 289 -#define MEDIA_ONLY 290 -#define MEDIA_NOT 291 -#define MEDIA_AND 292 -#define QEMS 293 -#define EMS 294 -#define EXS 295 -#define PXS 296 -#define CMS 297 -#define MMS 298 -#define INS 299 -#define PTS 300 -#define PCS 301 -#define DEGS 302 -#define RADS 303 -#define GRADS 304 -#define TURNS 305 -#define MSECS 306 -#define SECS 307 -#define HERZ 308 -#define KHERZ 309 -#define DIMEN 310 -#define PERCENTAGE 311 -#define FLOATTOKEN 312 -#define INTEGER 313 -#define URI 314 -#define FUNCTION 315 -#define NOTFUNCTION 316 -#define UNICODERANGE 317 -#define VARCALL 318 - - +#define yyparse cssyyparse +#define yylex cssyylex +#define yyerror cssyyerror +#define yylval cssyylval +#define yychar cssyychar +#define yydebug cssyydebug +#define yynerrs cssyynerrs /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "../css/CSSGrammar.y" @@ -261,6 +131,9 @@ using namespace HTMLNames; +/* Line 189 of yacc.c */ +#line 136 "WebCore/tmp/../generated/CSSGrammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -279,10 +152,88 @@ using namespace HTMLNames; # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOKEN_EOF = 0, + LOWEST_PREC = 258, + UNIMPORTANT_TOK = 259, + WHITESPACE = 260, + SGML_CD = 261, + INCLUDES = 262, + DASHMATCH = 263, + BEGINSWITH = 264, + ENDSWITH = 265, + CONTAINS = 266, + STRING = 267, + IDENT = 268, + NTH = 269, + HEX = 270, + IDSEL = 271, + IMPORT_SYM = 272, + PAGE_SYM = 273, + MEDIA_SYM = 274, + FONT_FACE_SYM = 275, + CHARSET_SYM = 276, + NAMESPACE_SYM = 277, + WEBKIT_RULE_SYM = 278, + WEBKIT_DECLS_SYM = 279, + WEBKIT_KEYFRAME_RULE_SYM = 280, + WEBKIT_KEYFRAMES_SYM = 281, + WEBKIT_VALUE_SYM = 282, + WEBKIT_MEDIAQUERY_SYM = 283, + WEBKIT_SELECTOR_SYM = 284, + WEBKIT_VARIABLES_SYM = 285, + WEBKIT_DEFINE_SYM = 286, + VARIABLES_FOR = 287, + WEBKIT_VARIABLES_DECLS_SYM = 288, + ATKEYWORD = 289, + IMPORTANT_SYM = 290, + MEDIA_ONLY = 291, + MEDIA_NOT = 292, + MEDIA_AND = 293, + QEMS = 294, + EMS = 295, + EXS = 296, + PXS = 297, + CMS = 298, + MMS = 299, + INS = 300, + PTS = 301, + PCS = 302, + DEGS = 303, + RADS = 304, + GRADS = 305, + TURNS = 306, + MSECS = 307, + SECS = 308, + HERZ = 309, + KHERZ = 310, + DIMEN = 311, + PERCENTAGE = 312, + FLOATTOKEN = 313, + INTEGER = 314, + URI = 315, + FUNCTION = 316, + NOTFUNCTION = 317, + UNICODERANGE = 318, + VARCALL = 319 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 57 "../css/CSSGrammar.y" { + +/* Line 214 of yacc.c */ +#line 57 "../css/CSSGrammar.y" + bool boolean; char character; int integer; @@ -304,18 +255,21 @@ typedef union YYSTYPE WebKitCSSKeyframeRule* keyframeRule; WebKitCSSKeyframesRule* keyframesRule; float val; -} -/* Line 187 of yacc.c. */ -#line 310 "WebCore/tmp/../generated/CSSGrammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 263 "WebCore/tmp/../generated/CSSGrammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ + +/* Line 264 of yacc.c */ #line 81 "../css/CSSGrammar.y" @@ -331,8 +285,8 @@ static int cssyylex(YYSTYPE* yylval, void* parser) -/* Line 216 of yacc.c. */ -#line 336 "WebCore/tmp/../generated/CSSGrammar.tab.c" +/* Line 264 of yacc.c */ +#line 290 "WebCore/tmp/../generated/CSSGrammar.tab.c" #ifdef short # undef short @@ -407,14 +361,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -495,9 +449,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -531,12 +485,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -547,10 +501,10 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 28 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1274 +#define YYLAST 1315 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 84 +#define YYNTOKENS 85 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 90 /* YYNRULES -- Number of rules. */ @@ -560,7 +514,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 318 +#define YYMAXUTOK 319 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -571,16 +525,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 82, 2, 83, 2, 2, - 72, 73, 19, 75, 74, 78, 17, 81, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 16, 71, - 2, 80, 77, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 83, 2, 84, 2, 2, + 73, 74, 20, 76, 75, 79, 18, 82, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 17, 72, + 2, 81, 78, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 18, 2, 79, 2, 2, 2, 2, 2, 2, + 2, 19, 2, 80, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 69, 20, 70, 76, 2, 2, 2, + 2, 2, 2, 70, 21, 71, 77, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -595,11 +549,11 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 15, 16, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68 + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69 }; #if YYDEBUG @@ -639,130 +593,130 @@ static const yytype_uint16 yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 85, 0, -1, 96, 95, 99, 100, 101, 102, -1, - 87, 94, -1, 89, 94, -1, 91, 94, -1, 92, - 94, -1, 93, 94, -1, 90, 94, -1, 88, 94, - -1, 103, -1, 108, -1, 27, 69, 94, 86, 94, - 70, -1, 29, 69, 94, 132, 94, 70, -1, 28, - 69, 94, 154, 70, -1, 37, 69, 94, 111, 70, - -1, 31, 69, 94, 159, 70, -1, 32, 4, 94, - 124, 70, -1, 33, 69, 94, 140, 70, -1, -1, - 94, 4, -1, -1, 95, 5, -1, 95, 4, -1, - -1, 98, -1, 70, -1, 0, -1, 25, 94, 11, - 94, 71, -1, 25, 1, 172, -1, 25, 1, 71, - -1, -1, 99, 108, 95, -1, 168, -1, -1, 100, - 109, 95, -1, -1, 101, 115, 95, -1, -1, 102, - 104, 95, -1, 139, -1, 127, -1, 135, -1, 136, - -1, 129, -1, 103, -1, 171, -1, 167, -1, 169, - -1, -1, 105, 107, 95, -1, 139, -1, 135, -1, - 136, -1, 129, -1, 106, -1, 171, -1, 167, -1, - 169, -1, 170, -1, 21, 94, 117, 94, 125, 71, - -1, 21, 94, 117, 94, 125, 172, -1, 21, 1, - 71, -1, 21, 1, 172, -1, 34, 94, 125, 69, - 94, 111, 70, -1, 35, 94, 110, 69, 94, 111, - 70, -1, -1, 36, 4, 126, -1, 113, -1, 112, - 113, -1, 112, -1, 1, 173, 1, -1, 1, -1, - 112, 1, -1, 113, 71, 94, -1, 113, 173, 71, - 94, -1, 1, 71, 94, -1, 1, 173, 1, 71, - 94, -1, 112, 113, 71, 94, -1, 112, 1, 71, - 94, -1, 112, 1, 173, 1, 71, 94, -1, 114, - 16, 94, 159, -1, 114, 94, 69, 94, 154, 70, - 94, -1, 114, 1, -1, 114, 16, 94, 1, 159, - -1, 114, 16, 94, -1, 114, 16, 94, 1, -1, - 12, 94, -1, 26, 94, 116, 117, 94, 71, -1, - 26, 1, 172, -1, 26, 1, 71, -1, -1, 12, - 4, -1, 11, -1, 64, -1, 12, 94, -1, -1, - 16, 94, 159, 94, -1, 72, 94, 118, 94, 119, - 73, 94, -1, 120, -1, 121, 94, 42, 94, 120, - -1, -1, 42, 94, 121, -1, -1, 40, -1, 41, - -1, 121, -1, 123, 94, 128, 122, -1, -1, 126, - -1, 124, -1, 126, 74, 94, 124, -1, 126, 1, - -1, 23, 94, 126, 69, 94, 105, 166, -1, 23, - 94, 69, 94, 105, 166, -1, 12, 94, -1, 30, - 94, 130, 94, 69, 94, 131, 70, -1, 12, -1, - 11, -1, -1, 131, 132, 94, -1, 133, 94, 69, - 94, 154, 70, -1, 134, -1, 133, 94, 74, 94, - 134, -1, 61, -1, 12, -1, 22, 1, 172, -1, - 22, 1, 71, -1, 24, 94, 69, 94, 154, 70, - 94, -1, 24, 1, 172, -1, 24, 1, 71, -1, - 75, 94, -1, 76, 94, -1, 77, 94, -1, 78, - -1, 75, -1, 140, 69, 94, 154, 97, -1, 142, - -1, 140, 74, 94, 142, -1, 140, 1, -1, 142, - 4, -1, 144, -1, 141, -1, 141, 144, -1, 142, - 137, 144, -1, 142, 1, -1, 20, -1, 19, 20, - -1, 12, 20, -1, 145, -1, 145, 146, -1, 146, - -1, 143, 145, -1, 143, 145, 146, -1, 143, 146, - -1, 12, -1, 19, -1, 147, -1, 146, 147, -1, - 146, 1, -1, 15, -1, 14, -1, 148, -1, 150, - -1, 153, -1, 17, 12, -1, 12, 94, -1, 18, - 94, 149, 79, -1, 18, 94, 149, 151, 94, 152, - 94, 79, -1, 18, 94, 143, 149, 79, -1, 18, - 94, 143, 149, 151, 94, 152, 94, 79, -1, 80, - -1, 6, -1, 7, -1, 8, -1, 9, -1, 10, - -1, 12, -1, 11, -1, 16, 12, -1, 16, 16, - 12, -1, 16, 65, 13, 73, -1, 16, 65, 63, - 73, -1, 16, 65, 12, 73, -1, 16, 66, 94, - 144, 94, 73, -1, 156, -1, 155, 156, -1, 155, - -1, 1, 173, 1, -1, 1, -1, 155, 1, -1, - 155, 173, -1, 156, 71, 94, -1, 156, 173, 71, - 94, -1, 1, 71, 94, -1, 1, 173, 1, 71, - 94, -1, 155, 156, 71, 94, -1, 155, 1, 71, - 94, -1, 155, 1, 173, 1, 71, 94, -1, 157, - 16, 94, 159, 158, -1, 163, 94, -1, 157, 1, - -1, 157, 16, 94, 1, 159, 158, -1, 157, 16, - 94, 159, 158, 1, -1, 39, 94, -1, 157, 16, - 94, -1, 157, 16, 94, 1, -1, 157, 172, -1, - 12, 94, -1, 39, 94, -1, -1, 161, -1, 159, - 160, 161, -1, 159, 1, -1, 81, 94, -1, 74, - 94, -1, -1, 162, -1, 138, 162, -1, 11, 94, - -1, 12, 94, -1, 60, 94, -1, 138, 60, 94, - -1, 64, 94, -1, 67, 94, -1, 165, -1, 82, - 94, -1, 164, -1, 163, 94, -1, 83, 94, -1, - 63, 94, -1, 62, 94, -1, 61, 94, -1, 46, - 94, -1, 47, 94, -1, 48, 94, -1, 49, 94, - -1, 50, 94, -1, 51, 94, -1, 52, 94, -1, - 53, 94, -1, 54, 94, -1, 55, 94, -1, 56, - 94, -1, 57, 94, -1, 58, 94, -1, 59, 94, - -1, 44, 94, -1, 43, 94, -1, 45, 94, -1, - 68, -1, 65, 94, 159, 73, 94, -1, 65, 94, - 1, -1, 14, 94, -1, 15, 94, -1, 97, -1, - 1, 97, -1, 38, 1, 172, -1, 38, 1, 71, - -1, 167, 95, -1, 168, 167, 95, -1, 108, -1, - 127, -1, 1, 172, -1, 69, 1, 173, 1, 97, - -1, 69, 1, 97, -1, 172, -1, 173, 1, 172, + 86, 0, -1, 97, 96, 100, 101, 102, 103, -1, + 88, 95, -1, 90, 95, -1, 92, 95, -1, 93, + 95, -1, 94, 95, -1, 91, 95, -1, 89, 95, + -1, 104, -1, 109, -1, 28, 70, 95, 87, 95, + 71, -1, 30, 70, 95, 133, 95, 71, -1, 29, + 70, 95, 155, 71, -1, 38, 70, 95, 112, 71, + -1, 32, 70, 95, 160, 71, -1, 33, 5, 95, + 125, 71, -1, 34, 70, 95, 141, 71, -1, -1, + 95, 5, -1, -1, 96, 6, -1, 96, 5, -1, + -1, 99, -1, 71, -1, 0, -1, 26, 95, 12, + 95, 72, -1, 26, 1, 173, -1, 26, 1, 72, + -1, -1, 100, 109, 96, -1, 169, -1, -1, 101, + 110, 96, -1, -1, 102, 116, 96, -1, -1, 103, + 105, 96, -1, 140, -1, 128, -1, 136, -1, 137, + -1, 130, -1, 104, -1, 172, -1, 168, -1, 170, + -1, -1, 106, 108, 96, -1, 140, -1, 136, -1, + 137, -1, 130, -1, 107, -1, 172, -1, 168, -1, + 170, -1, 171, -1, 22, 95, 118, 95, 126, 72, + -1, 22, 95, 118, 95, 126, 173, -1, 22, 1, + 72, -1, 22, 1, 173, -1, 35, 95, 126, 70, + 95, 112, 71, -1, 36, 95, 111, 70, 95, 112, + 71, -1, -1, 37, 5, 127, -1, 114, -1, 113, + 114, -1, 113, -1, 1, 174, 1, -1, 1, -1, + 113, 1, -1, 114, 72, 95, -1, 114, 174, 72, + 95, -1, 1, 72, 95, -1, 1, 174, 1, 72, + 95, -1, 113, 114, 72, 95, -1, 113, 1, 72, + 95, -1, 113, 1, 174, 1, 72, 95, -1, 115, + 17, 95, 160, -1, 115, 95, 70, 95, 155, 71, + 95, -1, 115, 1, -1, 115, 17, 95, 1, 160, + -1, 115, 17, 95, -1, 115, 17, 95, 1, -1, + 13, 95, -1, 27, 95, 117, 118, 95, 72, -1, + 27, 1, 173, -1, 27, 1, 72, -1, -1, 13, + 5, -1, 12, -1, 65, -1, 13, 95, -1, -1, + 17, 95, 160, 95, -1, 73, 95, 119, 95, 120, + 74, 95, -1, 121, -1, 122, 95, 43, 95, 121, + -1, -1, 43, 95, 122, -1, -1, 41, -1, 42, + -1, 122, -1, 124, 95, 129, 123, -1, -1, 127, + -1, 125, -1, 127, 75, 95, 125, -1, 127, 1, + -1, 24, 95, 127, 70, 95, 106, 167, -1, 24, + 95, 70, 95, 106, 167, -1, 13, 95, -1, 31, + 95, 131, 95, 70, 95, 132, 71, -1, 13, -1, + 12, -1, -1, 132, 133, 95, -1, 134, 95, 70, + 95, 155, 71, -1, 135, -1, 134, 95, 75, 95, + 135, -1, 62, -1, 13, -1, 23, 1, 173, -1, + 23, 1, 72, -1, 25, 95, 70, 95, 155, 71, + 95, -1, 25, 1, 173, -1, 25, 1, 72, -1, + 76, 95, -1, 77, 95, -1, 78, 95, -1, 79, + -1, 76, -1, 141, 70, 95, 155, 98, -1, 143, + -1, 141, 75, 95, 143, -1, 141, 1, -1, 143, + 5, -1, 145, -1, 142, -1, 142, 145, -1, 143, + 138, 145, -1, 143, 1, -1, 21, -1, 20, 21, + -1, 13, 21, -1, 146, -1, 146, 147, -1, 147, + -1, 144, 146, -1, 144, 146, 147, -1, 144, 147, + -1, 13, -1, 20, -1, 148, -1, 147, 148, -1, + 147, 1, -1, 16, -1, 15, -1, 149, -1, 151, + -1, 154, -1, 18, 13, -1, 13, 95, -1, 19, + 95, 150, 80, -1, 19, 95, 150, 152, 95, 153, + 95, 80, -1, 19, 95, 144, 150, 80, -1, 19, + 95, 144, 150, 152, 95, 153, 95, 80, -1, 81, + -1, 7, -1, 8, -1, 9, -1, 10, -1, 11, + -1, 13, -1, 12, -1, 17, 13, -1, 17, 17, + 13, -1, 17, 66, 14, 74, -1, 17, 66, 64, + 74, -1, 17, 66, 13, 74, -1, 17, 67, 95, + 145, 95, 74, -1, 157, -1, 156, 157, -1, 156, + -1, 1, 174, 1, -1, 1, -1, 156, 1, -1, + 156, 174, -1, 157, 72, 95, -1, 157, 174, 72, + 95, -1, 1, 72, 95, -1, 1, 174, 1, 72, + 95, -1, 156, 157, 72, 95, -1, 156, 1, 72, + 95, -1, 156, 1, 174, 1, 72, 95, -1, 158, + 17, 95, 160, 159, -1, 164, 95, -1, 158, 1, + -1, 158, 17, 95, 1, 160, 159, -1, 158, 17, + 95, 160, 159, 1, -1, 40, 95, -1, 158, 17, + 95, -1, 158, 17, 95, 1, -1, 158, 173, -1, + 13, 95, -1, 40, 95, -1, -1, 162, -1, 160, + 161, 162, -1, 160, 1, -1, 82, 95, -1, 75, + 95, -1, -1, 163, -1, 139, 163, -1, 12, 95, + -1, 13, 95, -1, 61, 95, -1, 139, 61, 95, + -1, 65, 95, -1, 68, 95, -1, 166, -1, 83, + 95, -1, 165, -1, 164, 95, -1, 84, 95, -1, + 64, 95, -1, 63, 95, -1, 62, 95, -1, 47, + 95, -1, 48, 95, -1, 49, 95, -1, 50, 95, + -1, 51, 95, -1, 52, 95, -1, 53, 95, -1, + 54, 95, -1, 55, 95, -1, 56, 95, -1, 57, + 95, -1, 58, 95, -1, 59, 95, -1, 60, 95, + -1, 45, 95, -1, 44, 95, -1, 46, 95, -1, + 69, -1, 66, 95, 160, 74, 95, -1, 66, 95, + 1, -1, 15, 95, -1, 16, 95, -1, 98, -1, + 1, 98, -1, 39, 1, 173, -1, 39, 1, 72, + -1, 168, 96, -1, 169, 168, 96, -1, 109, -1, + 128, -1, 1, 173, -1, 70, 1, 174, 1, 98, + -1, 70, 1, 98, -1, 173, -1, 174, 1, 173, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 263, 263, 264, 265, 266, 267, 268, 269, 270, - 274, 275, 279, 285, 291, 297, 303, 317, 324, 334, - 335, 338, 340, 341, 344, 346, 351, 352, 356, 362, - 364, 368, 370, 375, 379, 381, 388, 390, 393, 395, - 403, 404, 405, 406, 407, 411, 412, 413, 414, 418, - 419, 430, 431, 432, 433, 437, 438, 439, 440, 441, - 446, 449, 452, 455, 461, 465, 471, 475, 481, 484, - 489, 492, 495, 498, 504, 507, 510, 513, 516, 521, - 524, 530, 534, 538, 542, 546, 551, 558, 564, 569, - 570, 574, 575, 579, 580, 584, 590, 593, 599, 606, - 611, 618, 621, 627, 630, 633, 639, 644, 652, 655, - 659, 664, 669, 675, 678, 684, 690, 697, 698, 702, - 703, 711, 717, 722, 731, 732, 756, 759, 765, 769, - 772, 778, 779, 780, 784, 785, 789, 795, 804, 812, - 818, 824, 827, 831, 847, 867, 873, 874, 875, 879, - 884, 891, 897, 907, 919, 932, 940, 948, 951, 964, - 970, 978, 990, 991, 992, 996, 1007, 1018, 1023, 1029, - 1037, 1049, 1052, 1055, 1058, 1061, 1064, 1070, 1071, 1075, - 1100, 1115, 1133, 1151, 1170, 1185, 1188, 1193, 1196, 1199, - 1202, 1205, 1211, 1214, 1217, 1220, 1223, 1228, 1231, 1237, - 1251, 1263, 1267, 1274, 1279, 1284, 1289, 1294, 1301, 1307, - 1308, 1312, 1317, 1331, 1337, 1340, 1343, 1349, 1350, 1351, - 1352, 1358, 1359, 1360, 1361, 1362, 1363, 1365, 1368, 1371, - 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, - 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, - 1398, 1406, 1415, 1431, 1432, 1439, 1442, 1448, 1451, 1457, - 1458, 1462, 1468, 1474, 1492, 1493, 1497, 1498 + 0, 265, 265, 266, 267, 268, 269, 270, 271, 272, + 276, 277, 281, 287, 293, 299, 305, 319, 326, 336, + 337, 340, 342, 343, 346, 348, 353, 354, 358, 364, + 366, 370, 372, 377, 381, 383, 390, 392, 395, 397, + 405, 406, 407, 408, 409, 413, 414, 415, 416, 420, + 421, 432, 433, 434, 435, 439, 440, 441, 442, 443, + 448, 451, 454, 457, 463, 467, 473, 477, 483, 486, + 491, 494, 497, 500, 506, 509, 512, 515, 518, 523, + 526, 532, 536, 540, 544, 548, 553, 560, 566, 571, + 572, 576, 577, 581, 582, 586, 592, 595, 601, 608, + 613, 620, 623, 629, 632, 635, 641, 646, 654, 657, + 661, 666, 671, 677, 680, 686, 692, 699, 700, 704, + 705, 713, 719, 724, 733, 734, 758, 761, 767, 771, + 774, 780, 781, 782, 786, 787, 791, 797, 806, 814, + 820, 826, 829, 833, 849, 869, 875, 876, 877, 881, + 886, 893, 899, 909, 921, 934, 942, 950, 953, 966, + 972, 980, 992, 993, 994, 998, 1009, 1020, 1025, 1031, + 1039, 1051, 1054, 1057, 1060, 1063, 1066, 1072, 1073, 1077, + 1102, 1117, 1135, 1153, 1172, 1187, 1190, 1195, 1198, 1201, + 1204, 1207, 1213, 1216, 1219, 1222, 1225, 1230, 1233, 1239, + 1253, 1265, 1269, 1276, 1281, 1286, 1291, 1296, 1303, 1309, + 1310, 1314, 1319, 1333, 1339, 1342, 1345, 1351, 1352, 1353, + 1354, 1360, 1361, 1362, 1363, 1364, 1365, 1367, 1370, 1373, + 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, + 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, + 1400, 1408, 1417, 1433, 1434, 1441, 1444, 1450, 1453, 1459, + 1460, 1464, 1470, 1476, 1494, 1495, 1499, 1500 }; #endif @@ -771,27 +725,28 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "TOKEN_EOF", "error", "$undefined", "UNIMPORTANT_TOK", "WHITESPACE", - "SGML_CD", "INCLUDES", "DASHMATCH", "BEGINSWITH", "ENDSWITH", "CONTAINS", - "STRING", "IDENT", "NTH", "HEX", "IDSEL", "':'", "'.'", "'['", "'*'", - "'|'", "IMPORT_SYM", "PAGE_SYM", "MEDIA_SYM", "FONT_FACE_SYM", - "CHARSET_SYM", "NAMESPACE_SYM", "WEBKIT_RULE_SYM", "WEBKIT_DECLS_SYM", - "WEBKIT_KEYFRAME_RULE_SYM", "WEBKIT_KEYFRAMES_SYM", "WEBKIT_VALUE_SYM", - "WEBKIT_MEDIAQUERY_SYM", "WEBKIT_SELECTOR_SYM", "WEBKIT_VARIABLES_SYM", - "WEBKIT_DEFINE_SYM", "VARIABLES_FOR", "WEBKIT_VARIABLES_DECLS_SYM", - "ATKEYWORD", "IMPORTANT_SYM", "MEDIA_ONLY", "MEDIA_NOT", "MEDIA_AND", - "QEMS", "EMS", "EXS", "PXS", "CMS", "MMS", "INS", "PTS", "PCS", "DEGS", - "RADS", "GRADS", "TURNS", "MSECS", "SECS", "HERZ", "KHERZ", "DIMEN", - "PERCENTAGE", "FLOATTOKEN", "INTEGER", "URI", "FUNCTION", "NOTFUNCTION", - "UNICODERANGE", "VARCALL", "'{'", "'}'", "';'", "'('", "')'", "','", - "'+'", "'~'", "'>'", "'-'", "']'", "'='", "'/'", "'#'", "'%'", "$accept", - "stylesheet", "valid_rule_or_import", "webkit_rule", - "webkit_keyframe_rule", "webkit_decls", "webkit_variables_decls", - "webkit_value", "webkit_mediaquery", "webkit_selector", "maybe_space", - "maybe_sgml", "maybe_charset", "closing_brace", "charset", "import_list", - "variables_list", "namespace_list", "rule_list", "valid_rule", "rule", - "block_rule_list", "block_valid_rule", "block_rule", "import", - "variables_rule", "variables_media_list", "variables_declaration_list", + "TOKEN_EOF", "error", "$undefined", "LOWEST_PREC", "UNIMPORTANT_TOK", + "WHITESPACE", "SGML_CD", "INCLUDES", "DASHMATCH", "BEGINSWITH", + "ENDSWITH", "CONTAINS", "STRING", "IDENT", "NTH", "HEX", "IDSEL", "':'", + "'.'", "'['", "'*'", "'|'", "IMPORT_SYM", "PAGE_SYM", "MEDIA_SYM", + "FONT_FACE_SYM", "CHARSET_SYM", "NAMESPACE_SYM", "WEBKIT_RULE_SYM", + "WEBKIT_DECLS_SYM", "WEBKIT_KEYFRAME_RULE_SYM", "WEBKIT_KEYFRAMES_SYM", + "WEBKIT_VALUE_SYM", "WEBKIT_MEDIAQUERY_SYM", "WEBKIT_SELECTOR_SYM", + "WEBKIT_VARIABLES_SYM", "WEBKIT_DEFINE_SYM", "VARIABLES_FOR", + "WEBKIT_VARIABLES_DECLS_SYM", "ATKEYWORD", "IMPORTANT_SYM", "MEDIA_ONLY", + "MEDIA_NOT", "MEDIA_AND", "QEMS", "EMS", "EXS", "PXS", "CMS", "MMS", + "INS", "PTS", "PCS", "DEGS", "RADS", "GRADS", "TURNS", "MSECS", "SECS", + "HERZ", "KHERZ", "DIMEN", "PERCENTAGE", "FLOATTOKEN", "INTEGER", "URI", + "FUNCTION", "NOTFUNCTION", "UNICODERANGE", "VARCALL", "'{'", "'}'", + "';'", "'('", "')'", "','", "'+'", "'~'", "'>'", "'-'", "']'", "'='", + "'/'", "'#'", "'%'", "$accept", "stylesheet", "valid_rule_or_import", + "webkit_rule", "webkit_keyframe_rule", "webkit_decls", + "webkit_variables_decls", "webkit_value", "webkit_mediaquery", + "webkit_selector", "maybe_space", "maybe_sgml", "maybe_charset", + "closing_brace", "charset", "import_list", "variables_list", + "namespace_list", "rule_list", "valid_rule", "rule", "block_rule_list", + "block_valid_rule", "block_rule", "import", "variables_rule", + "variables_media_list", "variables_declaration_list", "variables_decl_list", "variables_declaration", "variable_name", "namespace", "maybe_ns_prefix", "string_or_uri", "media_feature", "maybe_media_value", "media_query_exp", "media_query_exp_list", @@ -816,47 +771,47 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 58, 46, 91, 42, - 124, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 265, 266, 267, 268, 269, 270, 271, 58, 46, 91, + 42, 124, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 123, - 125, 59, 40, 41, 44, 43, 126, 62, 45, 93, - 61, 47, 35, 37 + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 123, 125, 59, 40, 41, 44, 43, 126, 62, 45, + 93, 61, 47, 35, 37 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 84, 85, 85, 85, 85, 85, 85, 85, 85, - 86, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 94, 95, 95, 95, 96, 96, 97, 97, 98, 98, - 98, 99, 99, 99, 100, 100, 101, 101, 102, 102, - 103, 103, 103, 103, 103, 104, 104, 104, 104, 105, - 105, 106, 106, 106, 106, 107, 107, 107, 107, 107, - 108, 108, 108, 108, 109, 109, 110, 110, 111, 111, - 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, - 112, 113, 113, 113, 113, 113, 113, 114, 115, 115, - 115, 116, 116, 117, 117, 118, 119, 119, 120, 121, - 121, 122, 122, 123, 123, 123, 124, 124, 125, 125, - 126, 126, 126, 127, 127, 128, 129, 130, 130, 131, - 131, 132, 133, 133, 134, 134, 135, 135, 136, 136, - 136, 137, 137, 137, 138, 138, 139, 140, 140, 140, - 141, 142, 142, 142, 142, 142, 143, 143, 143, 144, - 144, 144, 144, 144, 144, 145, 145, 146, 146, 146, - 147, 147, 147, 147, 147, 148, 149, 150, 150, 150, - 150, 151, 151, 151, 151, 151, 151, 152, 152, 153, - 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, - 154, 154, 155, 155, 155, 155, 155, 155, 155, 156, - 156, 156, 156, 156, 156, 156, 156, 156, 157, 158, - 158, 159, 159, 159, 160, 160, 160, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 0, 85, 86, 86, 86, 86, 86, 86, 86, 86, + 87, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, + 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, + 104, 104, 104, 104, 104, 105, 105, 105, 105, 106, + 106, 107, 107, 107, 107, 108, 108, 108, 108, 108, + 109, 109, 109, 109, 110, 110, 111, 111, 112, 112, + 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, + 113, 114, 114, 114, 114, 114, 114, 115, 116, 116, + 116, 117, 117, 118, 118, 119, 120, 120, 121, 122, + 122, 123, 123, 124, 124, 124, 125, 125, 126, 126, + 127, 127, 127, 128, 128, 129, 130, 131, 131, 132, + 132, 133, 134, 134, 135, 135, 136, 136, 137, 137, + 137, 138, 138, 138, 139, 139, 140, 141, 141, 141, + 142, 143, 143, 143, 143, 143, 144, 144, 144, 145, + 145, 145, 145, 145, 145, 146, 146, 147, 147, 147, + 148, 148, 148, 148, 148, 149, 150, 151, 151, 151, + 151, 152, 152, 152, 152, 152, 152, 153, 153, 154, + 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, + 155, 155, 156, 156, 156, 156, 156, 156, 156, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 158, 159, + 159, 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 163, 164, 164, 165, 165, 166, 166, 167, 167, 168, - 168, 169, 170, 171, 172, 172, 173, 173 + 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, + 164, 165, 165, 166, 166, 167, 167, 168, 168, 169, + 169, 170, 171, 172, 173, 173, 174, 174 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -966,75 +921,75 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -299 +#define YYPACT_NINF -435 static const yytype_int16 yypact[] = { - 466, 425, -26, -20, 75, 118, 189, 139, 151, 263, - -299, -299, -299, -299, -299, -299, -299, -299, -299, 359, - 300, -299, -299, -299, -299, -299, -299, -299, -299, 278, - 278, 278, 278, 278, 278, 278, 33, 338, -299, -299, - -299, -299, 749, 313, 32, 1074, 12, 545, 44, -299, - -299, 345, 346, -299, 335, 223, 194, 354, -299, -299, - 419, 380, -299, 383, -299, 403, 408, -299, 163, -299, - -299, -299, -299, -299, -299, -299, -299, -299, 86, 561, - 199, 620, -299, 626, 161, -299, -299, -299, -299, 374, - -299, -299, -299, 351, 239, 378, 179, -299, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, -299, -299, -299, -299, 645, 882, -299, -299, -299, - -299, -299, -299, -299, -299, -299, 30, -299, 363, 82, - 402, -299, 364, 185, 410, 190, 421, 28, -299, 301, - -299, -299, -299, -299, -299, 423, -299, -299, -299, 426, - 337, -299, -299, 35, -299, 542, 397, 640, 1, 691, - 26, 448, 220, -299, -299, -299, -299, -299, -299, -299, - -299, -299, 561, -299, -299, 626, 343, 381, -299, -299, - -299, 443, 278, 278, -299, 705, 377, 27, -299, 59, - -299, -299, -299, 278, 242, 178, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - 278, 278, 1012, 278, 278, 278, -299, -299, -299, -299, - -299, -299, 1132, 278, 201, 368, 312, -299, -299, -299, - 464, 278, -299, 706, 395, -299, 87, -299, -299, 188, - -299, -299, -299, -299, 442, -299, 301, 301, 223, -299, - 409, 413, 414, 545, 354, 383, 488, 69, -299, -299, - -299, -299, -299, -299, -299, -299, -299, 135, -299, -299, - -299, -299, -299, -299, -299, 313, 545, 278, 278, 278, - -299, 554, 278, 709, -299, 475, -299, 432, 278, -299, - 539, -299, -299, -299, -299, 947, 278, 278, 278, -299, - -299, -299, -299, -299, 462, 278, 712, -299, 528, -299, - 278, -299, 744, -299, 294, 165, 382, 1229, -299, 301, - -299, -299, -299, -299, -299, -299, 278, -299, 209, -299, - -299, -299, -299, -299, -299, -299, -299, 339, 278, -299, - -299, -299, 313, 257, 174, 210, -299, 278, 713, 278, - 278, 1132, 463, 313, 32, -299, 278, 42, 181, 278, - -299, -299, -299, 278, 754, 278, 278, 1132, 604, 313, - 467, 97, 531, 473, 764, 329, 432, -299, -299, -299, - -299, -299, -299, 301, 61, -299, -299, 458, 765, 1204, - 278, 12, 477, -299, -299, 278, -299, 463, -299, 172, - 478, -299, 278, -299, 479, -299, 181, 278, -299, 669, - 486, -299, 10, -299, -299, -299, 562, 217, -299, 301, - -299, 458, -299, -299, -299, -299, -299, 223, -299, -299, - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -299, 1204, -299, -299, 278, 278, -299, 278, -299, -299, - 1074, -299, 30, 278, -299, 44, 152, 44, -299, -299, - -299, 2, -299, 301, -299, 278, 307, 817, 278, 278, - 497, 504, 225, 15, -299, -299, -299, 278, -299, -299, - -299, -299, 278 + 818, 44, -36, -18, 112, 127, 66, 141, 162, 243, + -435, -435, -435, -435, -435, -435, -435, -435, -435, 239, + 43, -435, -435, -435, -435, -435, -435, -435, -435, 250, + 250, 250, 250, 250, 250, 250, 37, 304, -435, -435, + -435, -435, 763, 354, 31, 1114, 144, 622, 49, -435, + -435, 346, 344, -435, 332, 27, 23, 358, -435, -435, + 401, 370, -435, 371, -435, 381, 406, -435, 193, -435, + -435, -435, -435, -435, -435, -435, -435, -435, 171, 702, + 143, 631, -435, 756, 159, -435, -435, -435, -435, 240, + -435, -435, -435, 329, 303, 254, 199, -435, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, -435, -435, -435, -435, 949, 903, -435, -435, -435, + -435, -435, -435, -435, -435, -435, 34, -435, 342, 4, + 274, -435, 353, 59, 291, 223, 331, 395, -435, 438, + -435, -435, -435, -435, -435, 437, -435, -435, -435, 448, + 24, -435, -435, 415, -435, 349, 295, 377, 375, 399, + 198, 421, 190, -435, -435, -435, -435, -435, -435, -435, + -435, -435, 702, -435, -435, 756, 334, 380, -435, -435, + -435, 463, 250, 250, -435, 409, 398, 180, -435, 15, + -435, -435, -435, 250, 221, 182, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 1052, 250, 250, 250, -435, -435, -435, -435, + -435, -435, 1172, 250, 188, 166, 301, -435, -435, -435, + 472, 250, -435, 412, 404, -435, 62, -435, -435, 220, + -435, -435, -435, -435, 458, -435, 438, 438, 27, -435, + 413, 417, 430, 622, 358, 371, 473, 158, -435, -435, + -435, -435, -435, -435, -435, -435, -435, 172, -435, -435, + -435, -435, -435, -435, -435, 354, 622, 250, 250, 250, + -435, 555, 250, 420, -435, 502, -435, 459, 250, -435, + 535, -435, -435, -435, -435, 976, 250, 250, 250, -435, + -435, -435, -435, -435, 496, 250, 423, -435, 541, -435, + 250, -435, 754, -435, 424, 36, 552, 685, -435, 438, + -435, -435, -435, -435, -435, -435, 250, -435, 277, -435, + -435, -435, -435, -435, -435, -435, -435, 856, 250, -435, + -435, -435, 354, 226, 65, 203, -435, 250, 428, 250, + 250, 1172, 462, 354, 31, -435, 250, 53, 186, 250, + -435, -435, -435, 250, 429, 250, 250, 1172, 608, 354, + 479, 83, 538, 485, 482, 320, 459, -435, -435, -435, + -435, -435, -435, 438, 78, -435, -435, 447, 489, 1244, + 250, 144, 487, -435, -435, 250, -435, 462, -435, 205, + 491, -435, 250, -435, 492, -435, 186, 250, -435, 681, + 497, -435, 5, -435, -435, -435, 558, 150, -435, 438, + -435, 447, -435, -435, -435, -435, -435, 27, -435, -435, + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -435, 1244, -435, -435, 250, 250, -435, 250, -435, -435, + 1114, -435, 34, 250, -435, 49, 178, 49, -435, -435, + -435, 1, -435, 438, -435, 250, 306, 827, 250, 250, + 498, 504, 151, 14, -435, -435, -435, 250, -435, -435, + -435, -435, 250 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, - -1, -21, -299, -51, -299, -299, -299, -299, -299, 265, - -299, 200, -299, -299, 258, -299, -299, 352, -299, 472, - -299, -299, -299, 186, -299, -299, 238, 240, -299, -299, - -45, 279, -176, -238, -299, -194, -299, -299, 149, -299, - 293, -116, -66, -299, -299, -48, 663, -299, 429, 568, - -61, 661, -50, -55, -299, 460, -299, 391, 303, -299, - -298, -299, 692, -299, 330, -185, -299, 533, 675, -35, - -299, -299, 349, -19, -299, 469, -299, 470, -16, -3 + -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, + -1, -21, -435, -51, -435, -435, -435, -435, -435, 229, + -435, 147, -435, -435, 256, -435, -435, -434, -435, 425, + -435, -435, -435, 130, -435, -435, 214, 174, -435, -435, + -45, 241, -176, -389, -435, -227, -435, -435, 116, -435, + 231, -154, -137, -435, -435, -130, 566, -435, 310, 449, + -61, 547, -50, -55, -435, 348, -435, 278, 194, -435, + -298, -435, 581, -435, 261, -185, -435, 443, 546, -35, + -435, -435, 218, -19, -435, 352, -435, 364, -16, -3 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1044,324 +999,332 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -217 static const yytype_int16 yytable[] = { - 20, 148, 297, 39, 163, 40, 40, 374, 97, 29, - 30, 31, 32, 33, 34, 35, 40, 53, 186, 40, - 42, 43, 44, 45, 46, 47, 48, -191, 317, 199, - 40, 196, 159, 197, -19, 160, 40, 49, 50, 40, - 56, 142, 143, 21, 98, 150, 40, 284, 40, 22, - 142, 143, 142, 143, 285, 64, 151, 325, 433, 97, - 317, 173, 272, 273, 176, 40, 178, 180, 181, 182, - 295, 51, -19, 144, 422, 359, 360, 361, 362, 363, - 212, 504, 144, 183, 144, 430, 201, 183, 317, 202, - 203, 207, 209, 99, 511, 300, 213, -191, 369, 214, + 20, 148, 297, 39, 163, 183, 40, 374, 97, 29, + 30, 31, 32, 33, 34, 35, 317, 53, 186, 40, + 42, 43, 44, 45, 46, 47, 48, 161, 40, 199, + 461, 196, 159, 197, 21, 160, 40, 280, 281, -19, + 56, 40, 49, 50, 98, 19, 142, 143, 40, -19, + 150, 500, 22, 501, 40, 41, -19, 325, 40, 97, + 263, 173, 151, 317, 176, 161, 178, 180, 181, 182, + 433, 25, 151, 402, 422, 258, 51, -19, 144, 185, + 212, 504, 461, 40, 369, 430, 201, 319, 282, 202, + 203, 207, 209, 99, 511, 166, 213, 37, 162, 214, 215, 440, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 319, 310, 244, 245, 450, 382, 369, 276, 253, 277, - 271, 199, 199, 254, 23, 311, 256, 260, 364, 365, - 261, 266, 258, 369, 269, 184, 185, 398, 341, 289, - 185, 294, 198, 299, 179, -151, -109, -19, -109, 40, - 283, 371, -199, 478, 161, 58, 59, 60, 61, 62, - 210, 461, 40, 305, 306, 40, 263, 24, 307, 308, - 309, 267, 40, 25, -19, 211, 427, 151, 40, 312, - 187, 402, 315, 188, 370, 40, 268, 318, 26, 371, - 320, 187, 439, 330, 188, 359, 360, 361, 362, 363, - 27, -67, 355, 161, 40, 462, 371, 350, 290, 40, - -151, -151, -19, 461, -151, -151, -151, -151, -151, -187, - 205, -199, -199, -199, 162, 326, 40, 322, 37, 327, - 328, 90, 323, 144, 349, -70, 199, 343, 335, -19, - 338, 40, 351, 28, 340, 166, 486, 342, -137, -137, - 97, 344, 345, -137, 189, 190, 191, 462, 91, -138, - -138, 291, 40, 356, -138, 189, 190, 191, 415, 365, - 304, 367, 37, 162, 368, 497, 510, 351, 40, 372, - 72, 351, 373, 463, 40, 49, 50, 92, 37, -187, - 158, 41, 321, 377, 89, 379, 40, 40, 380, 98, - 351, 383, 384, 424, 333, 90, 423, 413, 410, 386, - 387, 388, 389, 40, 142, 143, 393, 97, 395, 55, - 396, 446, 399, 40, 198, 405, 156, -154, 97, 280, - 281, -103, 91, 464, 414, 463, 356, 58, 59, 60, - 61, 62, 351, -108, 97, 417, 144, 65, 99, 420, - 421, 465, 40, 51, 167, 425, 472, 505, 351, 142, - 143, 92, 198, 404, 432, -150, -19, 449, 445, 436, - 448, 437, 172, -19, -19, 58, 59, 60, 61, 62, - 282, 40, 456, 174, 175, 464, 492, -19, 290, 177, - 332, 144, -154, -154, -19, 451, -154, -154, -154, -154, - -154, 204, 474, 465, 278, 475, 19, 477, 37, -19, - 38, 168, 480, 257, 262, 169, -19, 483, 279, 493, - 485, 448, 487, 37, 313, 200, -19, 37, 316, 208, - -150, -150, 40, 491, -150, -150, -150, -150, -150, 301, - 302, 291, 40, -210, 248, 336, 339, -19, 346, 452, - 453, 37, 495, 259, -216, -216, 378, -216, -216, 37, - 498, 265, 352, 499, 170, 171, 353, 354, 502, 503, - 37, 1, 270, 2, 3, 4, 507, 5, 6, 7, - 357, 37, 428, 8, 390, 512, -216, -216, -216, -216, + -70, 310, 244, 245, 341, 382, 162, 276, 253, 277, + 271, 199, 199, 254, 187, 311, 256, 260, 188, 40, + 261, 266, 450, -109, 269, -109, 40, 398, 371, 289, + 198, 294, 290, 299, -151, 359, 360, 361, 362, 363, + 283, 40, 183, 369, 58, 59, 60, 61, 62, 369, + -191, 317, 23, 305, 306, 142, 143, 40, 307, 308, + 309, 40, 462, 40, 179, 40, 427, 24, -19, 312, + 210, 330, 315, 40, 187, -199, 478, 318, 188, 332, + 320, 26, 439, -137, -137, 291, 211, 144, -137, 189, + 190, 191, 355, 510, 267, 40, 40, 350, -19, -151, + -151, 40, 27, -151, -151, -151, -151, -151, 364, 365, + 268, 184, 370, 28, 462, 326, 185, 371, -67, 327, + 328, -191, 322, 371, 349, 40, 199, 323, 335, 144, + 338, 304, 351, -19, 340, 463, 486, 342, 300, 37, + 97, 344, 345, -138, -138, -199, -199, -199, -138, 189, + 190, 191, 464, 356, 359, 360, 361, 362, 363, 465, + 343, 367, 321, -19, 368, 497, 423, 351, 72, 372, + 40, 351, 373, -187, 205, 55, 40, 290, 158, 37, + 37, 38, 200, 377, 333, 379, 90, 463, 380, 98, + 351, 383, 384, 424, 37, 40, 208, 413, 410, 386, + 387, 388, 389, 446, 464, 198, 393, 97, 395, -154, + 396, 465, 399, 91, 37, 405, 259, 156, 97, 58, + 59, 60, 61, 62, 414, 89, 356, 415, 365, 40, + 291, 37, 351, 265, 97, 417, 65, 90, 99, 420, + 421, 51, 92, 37, -187, 425, 472, 505, 351, 167, + 40, 198, 175, 172, 432, -150, -19, 449, 445, 436, + 448, 437, 174, -19, 91, 58, 59, 60, 61, 62, + 204, 37, 456, 270, -154, -154, 492, 177, -154, -154, + -154, -154, -154, 257, 168, 451, 142, 143, 169, 37, + 40, 288, 474, 92, 262, 475, 40, 477, 284, 40, + 272, 273, 480, 301, 302, 285, 64, 483, 278, 493, + 485, 448, 487, 49, 50, 295, -19, 37, 144, 293, + -150, -150, 40, 491, -150, -150, -150, -150, -150, 452, + 453, 279, -210, 248, 313, 142, 143, 170, 171, 37, + 316, 298, 495, 336, -216, -216, 339, -216, -216, 37, + 498, 314, 37, 499, 337, 346, 357, 352, 502, 503, + 37, 353, 376, 37, -108, 392, 507, 144, 37, 37, + 426, 438, 428, 378, 354, 512, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, -216, -216, -216, -216, 394, - -216, -216, -210, -210, -210, 442, 441, 250, -216, -205, - 381, -216, 443, 40, 251, -216, -216, 473, 479, 40, - 103, 104, 481, 105, 106, 198, 484, 57, -153, 58, - 59, 60, 61, 62, 63, 64, 488, 508, 58, 59, - 60, 61, 62, 57, 509, 58, 59, 60, 61, 62, - 63, 64, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 248, 130, 92, -205, -205, - -205, 37, 407, 288, 131, -216, -216, 132, -216, -216, - 471, 133, 134, -153, -153, 264, 435, -153, -153, -153, - -153, -153, 193, 489, 58, 59, 60, 61, 62, 194, - 58, 59, 60, 61, 62, 506, 418, -216, -216, -216, + -216, -216, -216, -216, -216, -216, -216, -216, -216, 37, + -216, -216, -210, -210, -210, -205, 381, 250, -216, 390, + 40, -216, 394, 442, 251, -216, -216, 103, 104, 441, + 105, 106, 37, 404, 444, 443, 198, -19, 473, 37, + -153, 455, 479, 488, -19, -19, 481, 471, 484, 508, + 58, 59, 60, 61, 62, 509, 407, 489, 264, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 435, 130, 92, -205, -205, -205, 418, 248, + 482, 131, 506, 149, 132, 431, 375, -19, 133, 134, + -216, -216, 286, -216, -216, -153, -153, 40, 195, -153, + -153, -153, -153, -153, 358, 57, 416, 58, 59, 60, + 61, 62, 63, 64, 193, 490, 58, 59, 60, 61, + 62, 194, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, + -216, -216, -216, -216, -216, 206, -216, -216, -81, -81, + -81, 247, 248, 250, -216, -2, 406, -216, 476, 494, + 251, -216, -216, -216, -216, 329, -216, -216, 57, 411, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 412, 0, 0, 0, 57, 69, 58, 59, 60, + 61, 62, 63, 64, 51, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - 248, -216, -216, -81, -81, -81, 482, 431, 250, -216, - -216, -216, -216, -216, -216, 251, -216, -216, 107, 108, + -216, -216, -216, -216, -216, -216, -216, -216, 0, -216, + -216, -84, -84, -84, 0, 397, 250, -216, 0, 40, + -216, 0, 0, 251, -216, -216, 103, 104, 40, 105, + 106, 58, 59, 60, 61, 62, 57, 0, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 0, + 0, 0, 0, 0, 69, 0, 0, 0, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 246, 125, 126, 127, 37, - 149, 293, -216, -216, -216, -216, -216, -216, -216, -216, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 92, -85, -85, -85, 0, 248, 0, + 131, 0, -19, 132, 0, 0, 0, 133, 134, -216, + -216, 0, -216, -216, 1, 0, 2, 3, 4, 0, + 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 0, 0, -103, + 0, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, 375, -216, -216, -84, -84, - -84, 286, 195, 250, -216, 397, 358, -216, 40, 416, - 251, -216, -216, 40, 490, 103, 104, 476, 105, 106, - 37, 57, 298, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 37, 37, 314, 337, 37, 69, - 376, 37, 37, 392, 426, 329, 206, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 247, 130, 92, -85, -85, -85, 411, 412, 248, 131, - 494, -19, 132, 37, 0, 438, 133, 134, -216, -216, - 0, -216, -216, 37, 37, 444, 455, 500, 0, 501, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -216, -216, -216, -216, 0, -216, -216, 142, 143, 0, + 0, -19, 250, -216, 248, 0, -216, 0, 0, 251, + -216, -216, 0, 0, 0, -216, -216, 0, -216, -216, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, 248, -216, -216, 0, 0, 0, 0, - -19, 250, -216, -216, -216, -216, -216, -216, 251, -216, - -216, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -216, -216, -216, -216, -216, + 0, -216, -216, 0, 249, 0, 0, 248, 250, -216, + 0, 0, -216, 0, 0, 251, -216, -216, -216, -216, + 0, -216, -216, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 246, 125, 126, 127, 0, 0, 0, 0, 0, 0, + -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, -216, -216, -216, 248, -216, - -216, 0, 249, 0, 0, 0, 250, -216, -216, -216, - -216, -216, -216, 251, -216, -216, 0, 0, 0, 0, + -216, -216, -216, 0, -216, -216, 0, 0, 0, 0, + 385, 250, -216, 324, 0, -216, 0, 40, 251, -216, + -216, 0, 0, 0, 103, 104, 0, 105, 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, - -216, -216, -216, 324, -216, -216, 40, 0, 0, 0, - 385, 250, -216, 103, 104, -216, 105, 106, 251, -216, - -216, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 40, + 130, 92, 0, 0, 0, 0, 103, 104, 131, 105, + 106, 132, 0, 0, 0, 133, 134, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 92, 103, 104, 0, 105, 106, 0, + 131, 0, 0, 132, 0, 0, 0, 133, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 40, 130, - 92, 0, 0, 0, 0, 103, 104, 131, 105, 106, - 132, 0, 0, 0, 133, 134, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 0, + 130, 92, 0, 0, 161, 457, 0, 0, 131, 0, + 0, 132, 0, 0, 0, 133, 134, 57, 0, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, + 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 92, 103, 104, 0, 105, 106, 0, 131, - 0, 0, 132, 0, 0, 0, 133, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, - 92, 0, 0, 0, 161, 457, 0, 131, 0, 0, - 132, 0, 0, 0, 133, 134, 57, 0, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, -2, - 406, 0, 0, 0, 69, 0, 0, 0, 0, 0, - 0, 57, 51, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 0, 0, 0, 0, 0, 69, - 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, - 0, 0, 0, 0, 162 + 0, 0, 0, 0, 0, 162 }; static const yytype_int16 yycheck[] = { - 1, 46, 178, 19, 55, 4, 4, 305, 43, 10, - 11, 12, 13, 14, 15, 16, 4, 36, 79, 4, - 21, 22, 23, 24, 25, 26, 27, 0, 1, 84, - 4, 81, 53, 83, 4, 54, 4, 4, 5, 4, - 41, 40, 41, 69, 12, 1, 4, 12, 4, 69, - 40, 41, 40, 41, 19, 20, 12, 242, 16, 94, - 1, 62, 34, 35, 65, 4, 67, 68, 69, 70, - 69, 38, 42, 72, 372, 6, 7, 8, 9, 10, - 96, 79, 72, 1, 72, 383, 89, 1, 1, 90, - 91, 94, 95, 61, 79, 69, 97, 70, 1, 100, + 1, 46, 178, 19, 55, 1, 5, 305, 43, 10, + 11, 12, 13, 14, 15, 16, 1, 36, 79, 5, + 21, 22, 23, 24, 25, 26, 27, 0, 5, 84, + 419, 81, 53, 83, 70, 54, 5, 13, 14, 5, + 41, 5, 5, 6, 13, 1, 41, 42, 5, 5, + 1, 485, 70, 487, 5, 12, 12, 242, 5, 94, + 1, 62, 13, 1, 65, 0, 67, 68, 69, 70, + 17, 5, 13, 37, 372, 71, 39, 43, 73, 75, + 96, 80, 471, 5, 1, 383, 89, 72, 64, 90, + 91, 94, 95, 62, 80, 72, 97, 70, 71, 100, 101, 399, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 71, 192, 133, 134, 73, 320, 1, 158, 139, 160, - 156, 196, 197, 144, 69, 195, 147, 150, 79, 80, - 151, 154, 70, 1, 155, 69, 74, 342, 71, 175, - 74, 177, 1, 179, 1, 4, 69, 4, 71, 4, - 171, 74, 0, 1, 0, 14, 15, 16, 17, 18, - 1, 419, 4, 184, 185, 4, 1, 69, 189, 190, - 191, 1, 4, 4, 4, 16, 381, 12, 4, 200, - 1, 36, 205, 4, 69, 4, 16, 208, 69, 74, - 211, 1, 397, 12, 4, 6, 7, 8, 9, 10, - 69, 69, 283, 0, 4, 419, 74, 278, 11, 4, - 69, 70, 69, 471, 73, 74, 75, 76, 77, 0, - 1, 69, 70, 71, 70, 246, 4, 69, 69, 250, - 251, 12, 74, 72, 275, 70, 311, 69, 259, 69, - 263, 4, 278, 0, 265, 71, 442, 268, 69, 70, - 305, 272, 273, 74, 75, 76, 77, 471, 39, 69, - 70, 64, 4, 284, 74, 75, 76, 77, 79, 80, - 70, 292, 69, 70, 295, 480, 71, 313, 4, 300, - 42, 317, 303, 419, 4, 4, 5, 68, 69, 70, - 52, 11, 70, 314, 1, 316, 4, 4, 319, 12, - 336, 322, 323, 374, 12, 12, 69, 348, 347, 330, - 331, 332, 333, 4, 40, 41, 337, 372, 339, 1, - 341, 12, 343, 4, 1, 346, 1, 4, 383, 12, - 13, 12, 39, 419, 355, 471, 357, 14, 15, 16, - 17, 18, 378, 69, 399, 366, 72, 21, 61, 370, - 371, 419, 4, 38, 20, 376, 421, 70, 394, 40, - 41, 68, 1, 1, 385, 4, 4, 408, 404, 390, - 406, 392, 12, 11, 12, 14, 15, 16, 17, 18, - 63, 4, 418, 20, 1, 471, 457, 4, 11, 1, - 42, 72, 69, 70, 11, 416, 73, 74, 75, 76, - 77, 70, 423, 471, 1, 426, 1, 428, 69, 4, - 71, 12, 433, 70, 70, 16, 11, 438, 12, 460, - 441, 457, 443, 69, 1, 71, 64, 69, 71, 71, - 69, 70, 4, 454, 73, 74, 75, 76, 77, 11, - 12, 64, 4, 0, 1, 1, 71, 64, 26, 11, - 12, 69, 473, 71, 11, 12, 1, 14, 15, 69, - 481, 71, 73, 484, 65, 66, 73, 73, 489, 490, - 69, 25, 71, 27, 28, 29, 497, 31, 32, 33, - 12, 69, 39, 37, 42, 506, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 1, - 67, 68, 69, 70, 71, 4, 69, 74, 75, 0, - 1, 78, 69, 4, 81, 82, 83, 70, 70, 4, - 11, 12, 73, 14, 15, 1, 70, 12, 4, 14, - 15, 16, 17, 18, 19, 20, 4, 70, 14, 15, - 16, 17, 18, 12, 70, 14, 15, 16, 17, 18, - 19, 20, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 1, 67, 68, 69, 70, - 71, 69, 347, 71, 75, 11, 12, 78, 14, 15, - 420, 82, 83, 69, 70, 153, 388, 73, 74, 75, - 76, 77, 12, 447, 14, 15, 16, 17, 18, 19, - 14, 15, 16, 17, 18, 496, 367, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 1, 67, 68, 69, 70, 71, 436, 384, 74, 75, - 11, 12, 78, 14, 15, 81, 82, 83, 43, 44, + 71, 192, 133, 134, 72, 320, 71, 158, 139, 160, + 156, 196, 197, 144, 1, 195, 147, 150, 5, 5, + 151, 154, 74, 70, 155, 72, 5, 342, 75, 175, + 1, 177, 12, 179, 5, 7, 8, 9, 10, 11, + 171, 5, 1, 1, 15, 16, 17, 18, 19, 1, + 0, 1, 70, 184, 185, 41, 42, 5, 189, 190, + 191, 5, 419, 5, 1, 5, 381, 70, 5, 200, + 1, 13, 205, 5, 1, 0, 1, 208, 5, 43, + 211, 70, 397, 70, 71, 65, 17, 73, 75, 76, + 77, 78, 283, 72, 1, 5, 5, 278, 5, 70, + 71, 5, 70, 74, 75, 76, 77, 78, 80, 81, + 17, 70, 70, 0, 471, 246, 75, 75, 70, 250, + 251, 71, 70, 75, 275, 5, 311, 75, 259, 73, + 263, 71, 278, 70, 265, 419, 442, 268, 70, 70, + 305, 272, 273, 70, 71, 70, 71, 72, 75, 76, + 77, 78, 419, 284, 7, 8, 9, 10, 11, 419, + 70, 292, 71, 70, 295, 480, 70, 313, 42, 300, + 5, 317, 303, 0, 1, 1, 5, 12, 52, 70, + 70, 72, 72, 314, 13, 316, 13, 471, 319, 13, + 336, 322, 323, 374, 70, 5, 72, 348, 347, 330, + 331, 332, 333, 13, 471, 1, 337, 372, 339, 5, + 341, 471, 343, 40, 70, 346, 72, 1, 383, 15, + 16, 17, 18, 19, 355, 1, 357, 80, 81, 5, + 65, 70, 378, 72, 399, 366, 22, 13, 62, 370, + 371, 39, 69, 70, 71, 376, 421, 71, 394, 21, + 5, 1, 1, 13, 385, 5, 5, 408, 404, 390, + 406, 392, 21, 12, 40, 15, 16, 17, 18, 19, + 71, 70, 418, 72, 70, 71, 457, 1, 74, 75, + 76, 77, 78, 71, 13, 416, 41, 42, 17, 70, + 5, 72, 423, 69, 71, 426, 5, 428, 13, 5, + 35, 36, 433, 12, 13, 20, 21, 438, 1, 460, + 441, 457, 443, 5, 6, 70, 65, 70, 73, 72, + 70, 71, 5, 454, 74, 75, 76, 77, 78, 12, + 13, 13, 0, 1, 1, 41, 42, 66, 67, 70, + 72, 72, 473, 1, 12, 13, 72, 15, 16, 70, + 481, 72, 70, 484, 72, 27, 13, 74, 489, 490, + 70, 74, 72, 70, 70, 72, 497, 73, 70, 70, + 72, 72, 40, 1, 74, 506, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 70, + 68, 69, 70, 71, 72, 0, 1, 75, 76, 43, + 5, 79, 1, 5, 82, 83, 84, 12, 13, 70, + 15, 16, 70, 1, 72, 70, 1, 5, 71, 70, + 5, 72, 71, 5, 12, 13, 74, 420, 71, 71, + 15, 16, 17, 18, 19, 71, 347, 447, 153, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 69, - 47, 71, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 306, 67, 68, 69, 70, - 71, 173, 81, 74, 75, 1, 286, 78, 4, 358, - 81, 82, 83, 4, 451, 11, 12, 427, 14, 15, - 69, 12, 71, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 69, 69, 71, 71, 69, 30, - 71, 69, 69, 71, 71, 252, 94, 43, 44, 45, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 388, 68, 69, 70, 71, 72, 367, 1, + 436, 76, 496, 47, 79, 384, 306, 65, 83, 84, + 12, 13, 173, 15, 16, 70, 71, 5, 81, 74, + 75, 76, 77, 78, 286, 13, 358, 15, 16, 17, + 18, 19, 20, 21, 13, 451, 15, 16, 17, 18, + 19, 20, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 94, 68, 69, 70, 71, + 72, 135, 1, 75, 76, 0, 1, 79, 427, 471, + 82, 83, 84, 12, 13, 252, 15, 16, 13, 347, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 347, -1, -1, -1, 13, 31, 15, 16, 17, + 18, 19, 20, 21, 39, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, + 69, 70, 71, 72, -1, 1, 75, 76, -1, 5, + 79, -1, -1, 82, 83, 84, 12, 13, 5, 15, + 16, 15, 16, 17, 18, 19, 13, -1, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, + -1, -1, -1, -1, 31, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 135, 67, 68, 69, 70, 71, 347, 347, 1, 75, - 471, 4, 78, 69, -1, 71, 82, 83, 11, 12, - -1, 14, 15, 69, 69, 71, 71, 485, -1, 487, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 66, -1, 68, 69, 70, 71, 72, -1, 1, -1, + 76, -1, 5, 79, -1, -1, -1, 83, 84, 12, + 13, -1, 15, 16, 26, -1, 28, 29, 30, -1, + 32, 33, 34, -1, -1, -1, 38, -1, -1, -1, + -1, 5, -1, -1, -1, -1, -1, -1, -1, 13, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 1, 67, 68, -1, -1, -1, -1, - 73, 74, 75, 11, 12, 78, 14, 15, 81, 82, - 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 1, 67, - 68, -1, 70, -1, -1, -1, 74, 75, 11, 12, - 78, 14, 15, 81, 82, 83, -1, -1, -1, -1, + 63, 64, 65, 66, -1, 68, 69, 41, 42, -1, + -1, 74, 75, 76, 1, -1, 79, -1, -1, 82, + 83, 84, -1, -1, -1, 12, 13, -1, 15, 16, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + -1, 68, 69, -1, 71, -1, -1, 1, 75, 76, + -1, -1, 79, -1, -1, 82, 83, 84, 12, 13, + -1, 15, 16, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, -1, 68, 69, -1, -1, -1, -1, + 74, 75, 76, 1, -1, 79, -1, 5, 82, 83, + 84, -1, -1, -1, 12, 13, -1, 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 1, 67, 68, 4, -1, -1, -1, - 73, 74, 75, 11, 12, 78, 14, 15, 81, 82, - 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 4, 67, - 68, -1, -1, -1, -1, 11, 12, 75, 14, 15, - 78, -1, -1, -1, 82, 83, -1, -1, -1, -1, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 5, + 68, 69, -1, -1, -1, -1, 12, 13, 76, 15, + 16, 79, -1, -1, -1, 83, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 43, 44, 45, + -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - -1, 67, 68, 11, 12, -1, 14, 15, -1, 75, - -1, -1, 78, -1, -1, -1, 82, 83, -1, -1, + 66, -1, 68, 69, 12, 13, -1, 15, 16, -1, + 76, -1, -1, 79, -1, -1, -1, 83, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, -1, 67, - 68, -1, -1, -1, 0, 1, -1, 75, -1, -1, - 78, -1, -1, -1, 82, 83, 12, -1, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, - 1, -1, -1, -1, 30, -1, -1, -1, -1, -1, - -1, 12, 38, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, -1, -1, -1, -1, -1, 30, - -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, - -1, -1, -1, -1, 70 + 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, + 68, 69, -1, -1, 0, 1, -1, -1, 76, -1, + -1, 79, -1, -1, -1, 83, 84, 13, -1, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, + -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 71 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 25, 27, 28, 29, 31, 32, 33, 37, 85, - 87, 88, 89, 90, 91, 92, 93, 96, 98, 1, - 94, 69, 69, 69, 69, 4, 69, 69, 0, 94, - 94, 94, 94, 94, 94, 94, 95, 69, 71, 172, - 4, 11, 94, 94, 94, 94, 94, 94, 94, 4, - 5, 38, 99, 167, 168, 1, 94, 12, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 30, - 86, 103, 108, 127, 129, 135, 136, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 150, 153, 1, - 12, 39, 68, 154, 155, 156, 157, 163, 12, 61, - 132, 133, 134, 11, 12, 14, 15, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 67, 75, 78, 82, 83, 138, 159, 161, 162, 163, - 164, 165, 40, 41, 72, 120, 121, 123, 124, 140, - 1, 12, 111, 112, 113, 114, 1, 100, 108, 95, - 167, 0, 70, 97, 172, 173, 71, 20, 12, 16, - 65, 66, 12, 94, 20, 1, 94, 1, 94, 1, - 94, 94, 94, 1, 69, 74, 144, 1, 4, 75, - 76, 77, 137, 12, 19, 145, 146, 146, 1, 147, - 71, 173, 94, 94, 70, 1, 156, 173, 71, 173, - 1, 16, 172, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 94, 60, 162, 1, 70, - 74, 81, 160, 94, 94, 94, 94, 70, 70, 71, - 173, 94, 70, 1, 113, 71, 173, 1, 16, 94, - 71, 172, 34, 35, 101, 109, 95, 95, 1, 12, - 12, 13, 63, 94, 12, 19, 143, 149, 71, 172, - 11, 64, 117, 71, 172, 69, 124, 126, 71, 172, - 69, 11, 12, 130, 70, 94, 94, 94, 94, 94, - 144, 146, 94, 1, 71, 173, 71, 1, 94, 71, - 94, 70, 69, 74, 1, 159, 94, 94, 94, 161, - 12, 118, 42, 12, 128, 94, 1, 71, 173, 71, - 94, 71, 94, 69, 94, 94, 26, 102, 115, 95, - 97, 172, 73, 73, 73, 144, 94, 12, 149, 6, - 7, 8, 9, 10, 79, 80, 151, 94, 94, 1, - 69, 74, 94, 94, 154, 142, 71, 94, 1, 94, - 94, 1, 159, 94, 94, 73, 94, 94, 94, 94, - 42, 122, 71, 94, 1, 94, 94, 1, 159, 94, - 125, 126, 36, 110, 1, 94, 1, 103, 104, 108, - 167, 169, 171, 95, 94, 79, 151, 94, 125, 105, - 94, 94, 154, 69, 97, 94, 71, 159, 39, 158, - 154, 134, 94, 16, 119, 120, 94, 94, 71, 159, - 154, 69, 4, 69, 71, 172, 12, 116, 172, 95, - 73, 94, 11, 12, 152, 71, 172, 1, 97, 106, - 107, 127, 129, 135, 136, 139, 166, 167, 169, 170, - 171, 105, 124, 70, 94, 94, 158, 94, 1, 70, - 94, 73, 121, 94, 70, 94, 126, 94, 4, 117, - 152, 94, 97, 95, 166, 94, 131, 159, 94, 94, - 111, 111, 94, 94, 79, 70, 132, 94, 70, 70, - 71, 79, 94 + 0, 26, 28, 29, 30, 32, 33, 34, 38, 86, + 88, 89, 90, 91, 92, 93, 94, 97, 99, 1, + 95, 70, 70, 70, 70, 5, 70, 70, 0, 95, + 95, 95, 95, 95, 95, 95, 96, 70, 72, 173, + 5, 12, 95, 95, 95, 95, 95, 95, 95, 5, + 6, 39, 100, 168, 169, 1, 95, 13, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 31, + 87, 104, 109, 128, 130, 136, 137, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 151, 154, 1, + 13, 40, 69, 155, 156, 157, 158, 164, 13, 62, + 133, 134, 135, 12, 13, 15, 16, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 68, 76, 79, 83, 84, 139, 160, 162, 163, 164, + 165, 166, 41, 42, 73, 121, 122, 124, 125, 141, + 1, 13, 112, 113, 114, 115, 1, 101, 109, 96, + 168, 0, 71, 98, 173, 174, 72, 21, 13, 17, + 66, 67, 13, 95, 21, 1, 95, 1, 95, 1, + 95, 95, 95, 1, 70, 75, 145, 1, 5, 76, + 77, 78, 138, 13, 20, 146, 147, 147, 1, 148, + 72, 174, 95, 95, 71, 1, 157, 174, 72, 174, + 1, 17, 173, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 61, 163, 1, 71, + 75, 82, 161, 95, 95, 95, 95, 71, 71, 72, + 174, 95, 71, 1, 114, 72, 174, 1, 17, 95, + 72, 173, 35, 36, 102, 110, 96, 96, 1, 13, + 13, 14, 64, 95, 13, 20, 144, 150, 72, 173, + 12, 65, 118, 72, 173, 70, 125, 127, 72, 173, + 70, 12, 13, 131, 71, 95, 95, 95, 95, 95, + 145, 147, 95, 1, 72, 174, 72, 1, 95, 72, + 95, 71, 70, 75, 1, 160, 95, 95, 95, 162, + 13, 119, 43, 13, 129, 95, 1, 72, 174, 72, + 95, 72, 95, 70, 95, 95, 27, 103, 116, 96, + 98, 173, 74, 74, 74, 145, 95, 13, 150, 7, + 8, 9, 10, 11, 80, 81, 152, 95, 95, 1, + 70, 75, 95, 95, 155, 143, 72, 95, 1, 95, + 95, 1, 160, 95, 95, 74, 95, 95, 95, 95, + 43, 123, 72, 95, 1, 95, 95, 1, 160, 95, + 126, 127, 37, 111, 1, 95, 1, 104, 105, 109, + 168, 170, 172, 96, 95, 80, 152, 95, 126, 106, + 95, 95, 155, 70, 98, 95, 72, 160, 40, 159, + 155, 135, 95, 17, 120, 121, 95, 95, 72, 160, + 155, 70, 5, 70, 72, 173, 13, 117, 173, 96, + 74, 95, 12, 13, 153, 72, 173, 1, 98, 107, + 108, 128, 130, 136, 137, 140, 167, 168, 170, 171, + 172, 106, 125, 71, 95, 95, 159, 95, 1, 71, + 95, 74, 122, 95, 71, 95, 127, 95, 5, 118, + 153, 95, 98, 96, 167, 95, 132, 160, 95, 95, + 112, 112, 95, 95, 80, 71, 133, 95, 71, 71, + 72, 80, 95 }; #define yyerrok (yyerrstatus = 0) @@ -1546,17 +1509,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1590,11 +1556,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1874,10 +1840,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1896,10 +1860,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1923,74 +1886,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -2020,7 +1984,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -2028,7 +1991,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -2051,9 +2013,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2064,7 +2025,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -2074,6 +2034,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2082,16 +2045,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2123,20 +2086,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2176,35 +2135,45 @@ yyreduce: switch (yyn) { case 12: -#line 279 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 281 "../css/CSSGrammar.y" { static_cast(parser)->m_rule = (yyvsp[(4) - (6)].rule); ;} break; case 13: -#line 285 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 287 "../css/CSSGrammar.y" { static_cast(parser)->m_keyframe = (yyvsp[(4) - (6)].keyframeRule); ;} break; case 14: -#line 291 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 293 "../css/CSSGrammar.y" { /* can be empty */ ;} break; case 15: -#line 297 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 299 "../css/CSSGrammar.y" { /* can be empty */ ;} break; case 16: -#line 303 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 305 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(4) - (5)].valueList)) { @@ -2219,7 +2188,9 @@ yyreduce: break; case 17: -#line 317 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 319 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); p->m_mediaQuery = p->sinkFloatingMediaQuery((yyvsp[(4) - (5)].mediaQuery)); @@ -2227,7 +2198,9 @@ yyreduce: break; case 18: -#line 324 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 326 "../css/CSSGrammar.y" { if ((yyvsp[(4) - (5)].selectorList)) { CSSParser* p = static_cast(parser); @@ -2238,13 +2211,17 @@ yyreduce: break; case 25: -#line 346 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 348 "../css/CSSGrammar.y" { ;} break; case 28: -#line 356 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 358 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.rule) = static_cast(parser)->createCharsetRule((yyvsp[(3) - (5)].string)); @@ -2254,19 +2231,25 @@ yyreduce: break; case 29: -#line 362 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 364 "../css/CSSGrammar.y" { ;} break; case 30: -#line 364 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 366 "../css/CSSGrammar.y" { ;} break; case 32: -#line 370 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 372 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(2) - (3)].rule) && p->m_styleSheet) @@ -2275,13 +2258,17 @@ yyreduce: break; case 33: -#line 375 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 377 "../css/CSSGrammar.y" { ;} break; case 35: -#line 381 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 383 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(2) - (3)].rule) && p->m_styleSheet) @@ -2290,7 +2277,9 @@ yyreduce: break; case 39: -#line 395 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 397 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if ((yyvsp[(2) - (3)].rule) && p->m_styleSheet) @@ -2299,12 +2288,16 @@ yyreduce: break; case 49: -#line 418 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 420 "../css/CSSGrammar.y" { (yyval.ruleList) = 0; ;} break; case 50: -#line 419 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 421 "../css/CSSGrammar.y" { (yyval.ruleList) = (yyvsp[(1) - (3)].ruleList); if ((yyvsp[(2) - (3)].rule)) { @@ -2316,70 +2309,90 @@ yyreduce: break; case 60: -#line 446 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 448 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createImportRule((yyvsp[(3) - (6)].string), (yyvsp[(5) - (6)].mediaList)); ;} break; case 61: -#line 449 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 451 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 62: -#line 452 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 454 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 63: -#line 455 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 457 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 64: -#line 461 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 463 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createVariablesRule((yyvsp[(3) - (7)].mediaList), true); ;} break; case 65: -#line 465 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 467 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createVariablesRule((yyvsp[(3) - (7)].mediaList), false); ;} break; case 66: -#line 471 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 473 "../css/CSSGrammar.y" { (yyval.mediaList) = static_cast(parser)->createMediaList(); ;} break; case 67: -#line 475 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 477 "../css/CSSGrammar.y" { (yyval.mediaList) = (yyvsp[(3) - (3)].mediaList); ;} break; case 68: -#line 481 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 483 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 69: -#line 484 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 486 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); if ((yyvsp[(2) - (2)].boolean)) @@ -2388,63 +2401,81 @@ yyreduce: break; case 70: -#line 489 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 491 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 71: -#line 492 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 494 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 72: -#line 495 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 497 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 73: -#line 498 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 500 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); ;} break; case 74: -#line 504 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 506 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (3)].boolean); ;} break; case 75: -#line 507 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 509 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 76: -#line 510 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 512 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 77: -#line 513 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 515 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 78: -#line 516 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 518 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); if ((yyvsp[(2) - (4)].boolean)) @@ -2453,49 +2484,63 @@ yyreduce: break; case 79: -#line 521 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 523 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); ;} break; case 80: -#line 524 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 526 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (6)].boolean); ;} break; case 81: -#line 530 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 532 "../css/CSSGrammar.y" { (yyval.boolean) = static_cast(parser)->addVariable((yyvsp[(1) - (4)].string), (yyvsp[(4) - (4)].valueList)); ;} break; case 82: -#line 534 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 536 "../css/CSSGrammar.y" { (yyval.boolean) = static_cast(parser)->addVariableDeclarationBlock((yyvsp[(1) - (7)].string)); ;} break; case 83: -#line 538 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 540 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 84: -#line 542 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 544 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 85: -#line 546 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 548 "../css/CSSGrammar.y" { /* @variables { varname: } Just reduce away this variable with no value. */ (yyval.boolean) = false; @@ -2503,7 +2548,9 @@ yyreduce: break; case 86: -#line 551 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 553 "../css/CSSGrammar.y" { /* if we come across rules with invalid values like this case: @variables { varname: *; }, just discard the property/value pair */ (yyval.boolean) = false; @@ -2511,14 +2558,18 @@ yyreduce: break; case 87: -#line 558 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 560 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 88: -#line 564 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 566 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); if (p->m_styleSheet) @@ -2527,38 +2578,50 @@ yyreduce: break; case 91: -#line 574 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 576 "../css/CSSGrammar.y" { (yyval.string).characters = 0; ;} break; case 92: -#line 575 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 577 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 95: -#line 584 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 586 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 96: -#line 590 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 592 "../css/CSSGrammar.y" { (yyval.valueList) = 0; ;} break; case 97: -#line 593 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 595 "../css/CSSGrammar.y" { (yyval.valueList) = (yyvsp[(3) - (4)].valueList); ;} break; case 98: -#line 599 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 601 "../css/CSSGrammar.y" { (yyvsp[(3) - (7)].string).lower(); (yyval.mediaQueryExp) = static_cast(parser)->createFloatingMediaQueryExp((yyvsp[(3) - (7)].string), (yyvsp[(5) - (7)].valueList)); @@ -2566,7 +2629,9 @@ yyreduce: break; case 99: -#line 606 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 608 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.mediaQueryExpList) = p->createFloatingMediaQueryExpList(); @@ -2575,7 +2640,9 @@ yyreduce: break; case 100: -#line 611 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 613 "../css/CSSGrammar.y" { (yyval.mediaQueryExpList) = (yyvsp[(1) - (5)].mediaQueryExpList); (yyval.mediaQueryExpList)->append(static_cast(parser)->sinkFloatingMediaQueryExp((yyvsp[(5) - (5)].mediaQueryExp))); @@ -2583,42 +2650,54 @@ yyreduce: break; case 101: -#line 618 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 620 "../css/CSSGrammar.y" { (yyval.mediaQueryExpList) = static_cast(parser)->createFloatingMediaQueryExpList(); ;} break; case 102: -#line 621 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 623 "../css/CSSGrammar.y" { (yyval.mediaQueryExpList) = (yyvsp[(3) - (3)].mediaQueryExpList); ;} break; case 103: -#line 627 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 629 "../css/CSSGrammar.y" { (yyval.mediaQueryRestrictor) = MediaQuery::None; ;} break; case 104: -#line 630 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 632 "../css/CSSGrammar.y" { (yyval.mediaQueryRestrictor) = MediaQuery::Only; ;} break; case 105: -#line 633 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 635 "../css/CSSGrammar.y" { (yyval.mediaQueryRestrictor) = MediaQuery::Not; ;} break; case 106: -#line 639 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 641 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.mediaQuery) = p->createFloatingMediaQuery(p->sinkFloatingMediaQueryExpList((yyvsp[(1) - (1)].mediaQueryExpList))); @@ -2626,7 +2705,9 @@ yyreduce: break; case 107: -#line 644 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 646 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyvsp[(3) - (4)].string).lower(); @@ -2635,14 +2716,18 @@ yyreduce: break; case 108: -#line 652 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 654 "../css/CSSGrammar.y" { (yyval.mediaList) = static_cast(parser)->createMediaList(); ;} break; case 110: -#line 659 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 661 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.mediaList) = p->createMediaList(); @@ -2651,7 +2736,9 @@ yyreduce: break; case 111: -#line 664 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 666 "../css/CSSGrammar.y" { (yyval.mediaList) = (yyvsp[(1) - (4)].mediaList); if ((yyval.mediaList)) @@ -2660,35 +2747,45 @@ yyreduce: break; case 112: -#line 669 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 671 "../css/CSSGrammar.y" { (yyval.mediaList) = 0; ;} break; case 113: -#line 675 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 677 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createMediaRule((yyvsp[(3) - (7)].mediaList), (yyvsp[(6) - (7)].ruleList)); ;} break; case 114: -#line 678 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 680 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createMediaRule(0, (yyvsp[(5) - (6)].ruleList)); ;} break; case 115: -#line 684 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 686 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 116: -#line 690 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 692 "../css/CSSGrammar.y" { (yyval.rule) = (yyvsp[(7) - (8)].keyframesRule); (yyvsp[(7) - (8)].keyframesRule)->setNameInternal((yyvsp[(3) - (8)].string)); @@ -2696,12 +2793,16 @@ yyreduce: break; case 119: -#line 702 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 704 "../css/CSSGrammar.y" { (yyval.keyframesRule) = static_cast(parser)->createKeyframesRule(); ;} break; case 120: -#line 703 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 705 "../css/CSSGrammar.y" { (yyval.keyframesRule) = (yyvsp[(1) - (3)].keyframesRule); if ((yyvsp[(2) - (3)].keyframeRule)) @@ -2710,14 +2811,18 @@ yyreduce: break; case 121: -#line 711 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 713 "../css/CSSGrammar.y" { (yyval.keyframeRule) = static_cast(parser)->createKeyframeRule((yyvsp[(1) - (6)].valueList)); ;} break; case 122: -#line 717 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 719 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = p->createFloatingValueList(); @@ -2726,7 +2831,9 @@ yyreduce: break; case 123: -#line 722 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 724 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = (yyvsp[(1) - (5)].valueList); @@ -2736,12 +2843,16 @@ yyreduce: break; case 124: -#line 731 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 733 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).fValue = (yyvsp[(1) - (1)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;} break; case 125: -#line 732 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 734 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; CSSParserString& str = (yyvsp[(1) - (1)].string); @@ -2755,74 +2866,98 @@ yyreduce: break; case 126: -#line 756 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 758 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 127: -#line 759 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 761 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 128: -#line 766 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 768 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createFontFaceRule(); ;} break; case 129: -#line 769 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 771 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 130: -#line 772 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 774 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 131: -#line 778 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 780 "../css/CSSGrammar.y" { (yyval.relation) = CSSSelector::DirectAdjacent; ;} break; case 132: -#line 779 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 781 "../css/CSSGrammar.y" { (yyval.relation) = CSSSelector::IndirectAdjacent; ;} break; case 133: -#line 780 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 782 "../css/CSSGrammar.y" { (yyval.relation) = CSSSelector::Child; ;} break; case 134: -#line 784 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 786 "../css/CSSGrammar.y" { (yyval.integer) = -1; ;} break; case 135: -#line 785 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 787 "../css/CSSGrammar.y" { (yyval.integer) = 1; ;} break; case 136: -#line 789 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 791 "../css/CSSGrammar.y" { (yyval.rule) = static_cast(parser)->createStyleRule((yyvsp[(1) - (5)].selectorList)); ;} break; case 137: -#line 795 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 797 "../css/CSSGrammar.y" { if ((yyvsp[(1) - (1)].selector)) { CSSParser* p = static_cast(parser); @@ -2835,7 +2970,9 @@ yyreduce: break; case 138: -#line 804 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 806 "../css/CSSGrammar.y" { if ((yyvsp[(1) - (4)].selectorList) && (yyvsp[(4) - (4)].selector)) { CSSParser* p = static_cast(parser); @@ -2847,35 +2984,45 @@ yyreduce: break; case 139: -#line 812 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 814 "../css/CSSGrammar.y" { (yyval.selectorList) = 0; ;} break; case 140: -#line 818 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 820 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (2)].selector); ;} break; case 141: -#line 824 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 826 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); ;} break; case 142: -#line 828 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 830 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); ;} break; case 143: -#line 832 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 834 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(2) - (2)].selector); if (!(yyvsp[(1) - (2)].selector)) @@ -2894,7 +3041,9 @@ yyreduce: break; case 144: -#line 847 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 849 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(3) - (3)].selector); if (!(yyvsp[(1) - (3)].selector)) @@ -2918,29 +3067,39 @@ yyreduce: break; case 145: -#line 867 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 869 "../css/CSSGrammar.y" { (yyval.selector) = 0; ;} break; case 146: -#line 873 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 875 "../css/CSSGrammar.y" { (yyval.string).characters = 0; (yyval.string).length = 0; ;} break; case 147: -#line 874 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 876 "../css/CSSGrammar.y" { static UChar star = '*'; (yyval.string).characters = ☆ (yyval.string).length = 1; ;} break; case 148: -#line 875 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 877 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 149: -#line 879 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 881 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -2949,7 +3108,9 @@ yyreduce: break; case 150: -#line 884 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 886 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(2) - (2)].selector); if ((yyval.selector)) { @@ -2960,7 +3121,9 @@ yyreduce: break; case 151: -#line 891 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 893 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); CSSParser* p = static_cast(parser); @@ -2970,7 +3133,9 @@ yyreduce: break; case 152: -#line 897 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 899 "../css/CSSGrammar.y" { AtomicString namespacePrefix = (yyvsp[(1) - (2)].string); CSSParser* p = static_cast(parser); @@ -2984,7 +3149,9 @@ yyreduce: break; case 153: -#line 907 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 909 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(3) - (3)].selector); if ((yyval.selector)) { @@ -3000,7 +3167,9 @@ yyreduce: break; case 154: -#line 919 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 921 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(2) - (2)].selector); if ((yyval.selector)) { @@ -3014,7 +3183,9 @@ yyreduce: break; case 155: -#line 932 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 934 "../css/CSSGrammar.y" { CSSParserString& str = (yyvsp[(1) - (1)].string); CSSParser* p = static_cast(parser); @@ -3026,7 +3197,9 @@ yyreduce: break; case 156: -#line 940 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 942 "../css/CSSGrammar.y" { static UChar star = '*'; (yyval.string).characters = ☆ @@ -3035,14 +3208,18 @@ yyreduce: break; case 157: -#line 948 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 950 "../css/CSSGrammar.y" { (yyval.selector) = (yyvsp[(1) - (1)].selector); ;} break; case 158: -#line 951 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 953 "../css/CSSGrammar.y" { if (!(yyvsp[(2) - (2)].selector)) (yyval.selector) = 0; @@ -3059,14 +3236,18 @@ yyreduce: break; case 159: -#line 964 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 966 "../css/CSSGrammar.y" { (yyval.selector) = 0; ;} break; case 160: -#line 970 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 972 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3078,7 +3259,9 @@ yyreduce: break; case 161: -#line 978 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 980 "../css/CSSGrammar.y" { if ((yyvsp[(1) - (1)].string).characters[0] >= '0' && (yyvsp[(1) - (1)].string).characters[0] <= '9') { (yyval.selector) = 0; @@ -3094,7 +3277,9 @@ yyreduce: break; case 165: -#line 996 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 998 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3106,7 +3291,9 @@ yyreduce: break; case 166: -#line 1007 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1009 "../css/CSSGrammar.y" { CSSParserString& str = (yyvsp[(1) - (2)].string); CSSParser* p = static_cast(parser); @@ -3118,7 +3305,9 @@ yyreduce: break; case 167: -#line 1018 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1020 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->setAttribute(QualifiedName(nullAtom, (yyvsp[(3) - (4)].string), nullAtom)); @@ -3127,7 +3316,9 @@ yyreduce: break; case 168: -#line 1023 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1025 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->setAttribute(QualifiedName(nullAtom, (yyvsp[(3) - (8)].string), nullAtom)); @@ -3137,7 +3328,9 @@ yyreduce: break; case 169: -#line 1029 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1031 "../css/CSSGrammar.y" { AtomicString namespacePrefix = (yyvsp[(3) - (5)].string); CSSParser* p = static_cast(parser); @@ -3149,7 +3342,9 @@ yyreduce: break; case 170: -#line 1037 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1039 "../css/CSSGrammar.y" { AtomicString namespacePrefix = (yyvsp[(3) - (9)].string); CSSParser* p = static_cast(parser); @@ -3162,49 +3357,63 @@ yyreduce: break; case 171: -#line 1049 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1051 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Exact; ;} break; case 172: -#line 1052 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1054 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::List; ;} break; case 173: -#line 1055 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1057 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Hyphen; ;} break; case 174: -#line 1058 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1060 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Begin; ;} break; case 175: -#line 1061 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1063 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::End; ;} break; case 176: -#line 1064 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1066 "../css/CSSGrammar.y" { (yyval.integer) = CSSSelector::Contain; ;} break; case 179: -#line 1075 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1077 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->m_match = CSSSelector::PseudoClass; @@ -3233,7 +3442,9 @@ yyreduce: break; case 180: -#line 1100 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1102 "../css/CSSGrammar.y" { (yyval.selector) = static_cast(parser)->createFloatingSelector(); (yyval.selector)->m_match = CSSSelector::PseudoElement; @@ -3251,7 +3462,9 @@ yyreduce: break; case 181: -#line 1115 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1117 "../css/CSSGrammar.y" { CSSParser *p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3272,7 +3485,9 @@ yyreduce: break; case 182: -#line 1133 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1135 "../css/CSSGrammar.y" { CSSParser *p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3293,7 +3508,9 @@ yyreduce: break; case 183: -#line 1151 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1153 "../css/CSSGrammar.y" { CSSParser *p = static_cast(parser); (yyval.selector) = p->createFloatingSelector(); @@ -3315,7 +3532,9 @@ yyreduce: break; case 184: -#line 1170 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1172 "../css/CSSGrammar.y" { if (!(yyvsp[(4) - (6)].selector)) (yyval.selector) = 0; @@ -3331,14 +3550,18 @@ yyreduce: break; case 185: -#line 1185 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1187 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 186: -#line 1188 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1190 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); if ( (yyvsp[(2) - (2)].boolean) ) @@ -3347,70 +3570,90 @@ yyreduce: break; case 187: -#line 1193 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1195 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (1)].boolean); ;} break; case 188: -#line 1196 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1198 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 189: -#line 1199 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1201 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 190: -#line 1202 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1204 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); ;} break; case 191: -#line 1205 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1207 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (2)].boolean); ;} break; case 192: -#line 1211 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1213 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (3)].boolean); ;} break; case 193: -#line 1214 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1216 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 194: -#line 1217 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1219 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 195: -#line 1220 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1222 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 196: -#line 1223 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1225 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); if ((yyvsp[(2) - (4)].boolean)) @@ -3419,21 +3662,27 @@ yyreduce: break; case 197: -#line 1228 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1230 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (4)].boolean); ;} break; case 198: -#line 1231 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1233 "../css/CSSGrammar.y" { (yyval.boolean) = (yyvsp[(1) - (6)].boolean); ;} break; case 199: -#line 1237 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1239 "../css/CSSGrammar.y" { (yyval.boolean) = false; CSSParser* p = static_cast(parser); @@ -3450,7 +3699,9 @@ yyreduce: break; case 200: -#line 1251 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1253 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); p->m_valueList = new CSSParserValueList; @@ -3465,14 +3716,18 @@ yyreduce: break; case 201: -#line 1263 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1265 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 202: -#line 1267 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1269 "../css/CSSGrammar.y" { /* The default movable type template has letter-spacing: .none; Handle this by looking for error tokens at the start of an expr, recover the expr and then treat as an error, cleaning @@ -3482,7 +3737,9 @@ yyreduce: break; case 203: -#line 1274 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1276 "../css/CSSGrammar.y" { /* When we encounter something like p {color: red !important fail;} we should drop the declaration */ (yyval.boolean) = false; @@ -3490,7 +3747,9 @@ yyreduce: break; case 204: -#line 1279 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1281 "../css/CSSGrammar.y" { /* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */ (yyval.boolean) = false; @@ -3498,7 +3757,9 @@ yyreduce: break; case 205: -#line 1284 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1286 "../css/CSSGrammar.y" { /* div { font-family: } Just reduce away this property with no value. */ (yyval.boolean) = false; @@ -3506,7 +3767,9 @@ yyreduce: break; case 206: -#line 1289 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1291 "../css/CSSGrammar.y" { /* if we come across rules with invalid values like this case: p { weight: *; }, just discard the rule */ (yyval.boolean) = false; @@ -3514,7 +3777,9 @@ yyreduce: break; case 207: -#line 1294 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1296 "../css/CSSGrammar.y" { /* if we come across: div { color{;color:maroon} }, ignore everything within curly brackets */ (yyval.boolean) = false; @@ -3522,24 +3787,32 @@ yyreduce: break; case 208: -#line 1301 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1303 "../css/CSSGrammar.y" { (yyval.integer) = cssPropertyID((yyvsp[(1) - (2)].string)); ;} break; case 209: -#line 1307 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1309 "../css/CSSGrammar.y" { (yyval.boolean) = true; ;} break; case 210: -#line 1308 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1310 "../css/CSSGrammar.y" { (yyval.boolean) = false; ;} break; case 211: -#line 1312 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1314 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = p->createFloatingValueList(); @@ -3548,7 +3821,9 @@ yyreduce: break; case 212: -#line 1317 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1319 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); (yyval.valueList) = (yyvsp[(1) - (3)].valueList); @@ -3566,50 +3841,66 @@ yyreduce: break; case 213: -#line 1331 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1333 "../css/CSSGrammar.y" { (yyval.valueList) = 0; ;} break; case 214: -#line 1337 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1339 "../css/CSSGrammar.y" { (yyval.character) = '/'; ;} break; case 215: -#line 1340 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1342 "../css/CSSGrammar.y" { (yyval.character) = ','; ;} break; case 216: -#line 1343 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1345 "../css/CSSGrammar.y" { (yyval.character) = 0; ;} break; case 217: -#line 1349 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1351 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(1) - (1)].value); ;} break; case 218: -#line 1350 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1352 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(2) - (2)].value); (yyval.value).fValue *= (yyvsp[(1) - (2)].integer); ;} break; case 219: -#line 1351 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1353 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_STRING; ;} break; case 220: -#line 1352 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1354 "../css/CSSGrammar.y" { (yyval.value).id = cssValueKeywordID((yyvsp[(1) - (2)].string)); (yyval.value).unit = CSSPrimitiveValue::CSS_IDENT; @@ -3618,156 +3909,216 @@ yyreduce: break; case 221: -#line 1358 "../css/CSSGrammar.y" - { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION ;} + +/* Line 1455 of yacc.c */ +#line 1360 "../css/CSSGrammar.y" + { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION; ;} break; case 222: -#line 1359 "../css/CSSGrammar.y" - { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(2) - (3)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION ;} + +/* Line 1455 of yacc.c */ +#line 1361 "../css/CSSGrammar.y" + { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(2) - (3)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_DIMENSION; ;} break; case 223: -#line 1360 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1362 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_URI; ;} break; case 224: -#line 1361 "../css/CSSGrammar.y" - { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_UNICODE_RANGE ;} + +/* Line 1455 of yacc.c */ +#line 1363 "../css/CSSGrammar.y" + { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (2)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; ;} break; case 225: -#line 1362 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1364 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (1)].string); (yyval.value).unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; ;} break; case 226: -#line 1363 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1365 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = CSSParserString(); (yyval.value).unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; ;} break; case 227: -#line 1365 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1367 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(1) - (1)].value); ;} break; case 228: -#line 1368 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1370 "../css/CSSGrammar.y" { (yyval.value) = (yyvsp[(1) - (2)].value); ;} break; case 229: -#line 1371 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1373 "../css/CSSGrammar.y" {;} break; case 230: -#line 1375 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1377 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = true; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;} break; case 231: -#line 1376 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1378 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).isInt = false; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_NUMBER; ;} break; case 232: -#line 1377 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1379 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PERCENTAGE; ;} break; case 233: -#line 1378 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1380 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PX; ;} break; case 234: -#line 1379 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1381 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_CM; ;} break; case 235: -#line 1380 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1382 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_MM; ;} break; case 236: -#line 1381 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1383 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_IN; ;} break; case 237: -#line 1382 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1384 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PT; ;} break; case 238: -#line 1383 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1385 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_PC; ;} break; case 239: -#line 1384 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1386 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_DEG; ;} break; case 240: -#line 1385 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1387 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_RAD; ;} break; case 241: -#line 1386 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1388 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_GRAD; ;} break; case 242: -#line 1387 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1389 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_TURN; ;} break; case 243: -#line 1388 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1390 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_MS; ;} break; case 244: -#line 1389 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1391 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_S; ;} break; case 245: -#line 1390 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1392 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_HZ; ;} break; case 246: -#line 1391 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1393 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_KHZ; ;} break; case 247: -#line 1392 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1394 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_EMS; ;} break; case 248: -#line 1393 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1395 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSParserValue::Q_EMS; ;} break; case 249: -#line 1394 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1396 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).fValue = (yyvsp[(1) - (2)].number); (yyval.value).unit = CSSPrimitiveValue::CSS_EXS; ;} break; case 250: -#line 1398 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1400 "../css/CSSGrammar.y" { (yyval.value).id = 0; (yyval.value).string = (yyvsp[(1) - (1)].string); @@ -3776,7 +4127,9 @@ yyreduce: break; case 251: -#line 1406 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1408 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); CSSParserFunction* f = p->createFloatingFunction(); @@ -3789,7 +4142,9 @@ yyreduce: break; case 252: -#line 1415 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1417 "../css/CSSGrammar.y" { CSSParser* p = static_cast(parser); CSSParserFunction* f = p->createFloatingFunction(); @@ -3802,67 +4157,86 @@ yyreduce: break; case 253: -#line 1431 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1433 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 254: -#line 1432 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1434 "../css/CSSGrammar.y" { (yyval.string) = (yyvsp[(1) - (2)].string); ;} break; case 255: -#line 1439 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1441 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 256: -#line 1442 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1444 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 257: -#line 1448 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1450 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 258: -#line 1451 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1453 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 261: -#line 1462 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1464 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 262: -#line 1468 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1470 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; case 263: -#line 1474 "../css/CSSGrammar.y" + +/* Line 1455 of yacc.c */ +#line 1476 "../css/CSSGrammar.y" { (yyval.rule) = 0; ;} break; -/* Line 1267 of yacc.c. */ -#line 3866 "WebCore/tmp/../generated/CSSGrammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 4240 "WebCore/tmp/../generated/CSSGrammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -3873,7 +4247,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -3938,7 +4311,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -3955,7 +4328,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4012,9 +4385,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -4039,7 +4409,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4050,7 +4420,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -4076,6 +4446,8 @@ yyreturn: } -#line 1501 "../css/CSSGrammar.y" + +/* Line 1675 of yacc.c */ +#line 1503 "../css/CSSGrammar.y" diff --git a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h index 1b60c68..84ad511 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h +++ b/src/3rdparty/webkit/WebCore/generated/CSSGrammar.h @@ -1,26 +1,25 @@ #ifndef CSSGRAMMAR_H #define CSSGRAMMAR_H -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -31,10 +30,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -42,140 +42,80 @@ know about them. */ enum yytokentype { TOKEN_EOF = 0, - UNIMPORTANT_TOK = 258, - WHITESPACE = 259, - SGML_CD = 260, - INCLUDES = 261, - DASHMATCH = 262, - BEGINSWITH = 263, - ENDSWITH = 264, - CONTAINS = 265, - STRING = 266, - IDENT = 267, - NTH = 268, - HEX = 269, - IDSEL = 270, - IMPORT_SYM = 271, - PAGE_SYM = 272, - MEDIA_SYM = 273, - FONT_FACE_SYM = 274, - CHARSET_SYM = 275, - NAMESPACE_SYM = 276, - WEBKIT_RULE_SYM = 277, - WEBKIT_DECLS_SYM = 278, - WEBKIT_KEYFRAME_RULE_SYM = 279, - WEBKIT_KEYFRAMES_SYM = 280, - WEBKIT_VALUE_SYM = 281, - WEBKIT_MEDIAQUERY_SYM = 282, - WEBKIT_SELECTOR_SYM = 283, - WEBKIT_VARIABLES_SYM = 284, - WEBKIT_DEFINE_SYM = 285, - VARIABLES_FOR = 286, - WEBKIT_VARIABLES_DECLS_SYM = 287, - ATKEYWORD = 288, - IMPORTANT_SYM = 289, - MEDIA_ONLY = 290, - MEDIA_NOT = 291, - MEDIA_AND = 292, - QEMS = 293, - EMS = 294, - EXS = 295, - PXS = 296, - CMS = 297, - MMS = 298, - INS = 299, - PTS = 300, - PCS = 301, - DEGS = 302, - RADS = 303, - GRADS = 304, - TURNS = 305, - MSECS = 306, - SECS = 307, - HERZ = 308, - KHERZ = 309, - DIMEN = 310, - PERCENTAGE = 311, - FLOATTOKEN = 312, - INTEGER = 313, - URI = 314, - FUNCTION = 315, - NOTFUNCTION = 316, - UNICODERANGE = 317, - VARCALL = 318 + LOWEST_PREC = 258, + UNIMPORTANT_TOK = 259, + WHITESPACE = 260, + SGML_CD = 261, + INCLUDES = 262, + DASHMATCH = 263, + BEGINSWITH = 264, + ENDSWITH = 265, + CONTAINS = 266, + STRING = 267, + IDENT = 268, + NTH = 269, + HEX = 270, + IDSEL = 271, + IMPORT_SYM = 272, + PAGE_SYM = 273, + MEDIA_SYM = 274, + FONT_FACE_SYM = 275, + CHARSET_SYM = 276, + NAMESPACE_SYM = 277, + WEBKIT_RULE_SYM = 278, + WEBKIT_DECLS_SYM = 279, + WEBKIT_KEYFRAME_RULE_SYM = 280, + WEBKIT_KEYFRAMES_SYM = 281, + WEBKIT_VALUE_SYM = 282, + WEBKIT_MEDIAQUERY_SYM = 283, + WEBKIT_SELECTOR_SYM = 284, + WEBKIT_VARIABLES_SYM = 285, + WEBKIT_DEFINE_SYM = 286, + VARIABLES_FOR = 287, + WEBKIT_VARIABLES_DECLS_SYM = 288, + ATKEYWORD = 289, + IMPORTANT_SYM = 290, + MEDIA_ONLY = 291, + MEDIA_NOT = 292, + MEDIA_AND = 293, + QEMS = 294, + EMS = 295, + EXS = 296, + PXS = 297, + CMS = 298, + MMS = 299, + INS = 300, + PTS = 301, + PCS = 302, + DEGS = 303, + RADS = 304, + GRADS = 305, + TURNS = 306, + MSECS = 307, + SECS = 308, + HERZ = 309, + KHERZ = 310, + DIMEN = 311, + PERCENTAGE = 312, + FLOATTOKEN = 313, + INTEGER = 314, + URI = 315, + FUNCTION = 316, + NOTFUNCTION = 317, + UNICODERANGE = 318, + VARCALL = 319 }; #endif -/* Tokens. */ -#define TOKEN_EOF 0 -#define UNIMPORTANT_TOK 258 -#define WHITESPACE 259 -#define SGML_CD 260 -#define INCLUDES 261 -#define DASHMATCH 262 -#define BEGINSWITH 263 -#define ENDSWITH 264 -#define CONTAINS 265 -#define STRING 266 -#define IDENT 267 -#define NTH 268 -#define HEX 269 -#define IDSEL 270 -#define IMPORT_SYM 271 -#define PAGE_SYM 272 -#define MEDIA_SYM 273 -#define FONT_FACE_SYM 274 -#define CHARSET_SYM 275 -#define NAMESPACE_SYM 276 -#define WEBKIT_RULE_SYM 277 -#define WEBKIT_DECLS_SYM 278 -#define WEBKIT_KEYFRAME_RULE_SYM 279 -#define WEBKIT_KEYFRAMES_SYM 280 -#define WEBKIT_VALUE_SYM 281 -#define WEBKIT_MEDIAQUERY_SYM 282 -#define WEBKIT_SELECTOR_SYM 283 -#define WEBKIT_VARIABLES_SYM 284 -#define WEBKIT_DEFINE_SYM 285 -#define VARIABLES_FOR 286 -#define WEBKIT_VARIABLES_DECLS_SYM 287 -#define ATKEYWORD 288 -#define IMPORTANT_SYM 289 -#define MEDIA_ONLY 290 -#define MEDIA_NOT 291 -#define MEDIA_AND 292 -#define QEMS 293 -#define EMS 294 -#define EXS 295 -#define PXS 296 -#define CMS 297 -#define MMS 298 -#define INS 299 -#define PTS 300 -#define PCS 301 -#define DEGS 302 -#define RADS 303 -#define GRADS 304 -#define TURNS 305 -#define MSECS 306 -#define SECS 307 -#define HERZ 308 -#define KHERZ 309 -#define DIMEN 310 -#define PERCENTAGE 311 -#define FLOATTOKEN 312 -#define INTEGER 313 -#define URI 314 -#define FUNCTION 315 -#define NOTFUNCTION 316 -#define UNICODERANGE 317 -#define VARCALL 318 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 57 "../css/CSSGrammar.y" { + +/* Line 1676 of yacc.c */ +#line 57 "../css/CSSGrammar.y" + bool boolean; char character; int integer; @@ -197,15 +137,18 @@ typedef union YYSTYPE WebKitCSSKeyframeRule* keyframeRule; WebKitCSSKeyframesRule* keyframesRule; float val; -} -/* Line 1489 of yacc.c. */ -#line 201 "WebCore/tmp/../generated/CSSGrammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 143 "WebCore/tmp/../generated/CSSGrammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + #endif diff --git a/src/3rdparty/webkit/WebCore/generated/Grammar.cpp b/src/3rdparty/webkit/WebCore/generated/Grammar.cpp index 6f09be8..fd20f69 100644 --- a/src/3rdparty/webkit/WebCore/generated/Grammar.cpp +++ b/src/3rdparty/webkit/WebCore/generated/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,159 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse jscyyparse -#define yylex jscyylex -#define yyerror jscyyerror -#define yylval jscyylval -#define yychar jscyychar -#define yydebug jscyydebug -#define yynerrs jscyynerrs -#define yylloc jscyylloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - NULLTOKEN = 258, - TRUETOKEN = 259, - FALSETOKEN = 260, - BREAK = 261, - CASE = 262, - DEFAULT = 263, - FOR = 264, - NEW = 265, - VAR = 266, - CONSTTOKEN = 267, - CONTINUE = 268, - FUNCTION = 269, - RETURN = 270, - VOIDTOKEN = 271, - DELETETOKEN = 272, - IF = 273, - THISTOKEN = 274, - DO = 275, - WHILE = 276, - INTOKEN = 277, - INSTANCEOF = 278, - TYPEOF = 279, - SWITCH = 280, - WITH = 281, - RESERVED = 282, - THROW = 283, - TRY = 284, - CATCH = 285, - FINALLY = 286, - DEBUGGER = 287, - IF_WITHOUT_ELSE = 288, - ELSE = 289, - EQEQ = 290, - NE = 291, - STREQ = 292, - STRNEQ = 293, - LE = 294, - GE = 295, - OR = 296, - AND = 297, - PLUSPLUS = 298, - MINUSMINUS = 299, - LSHIFT = 300, - RSHIFT = 301, - URSHIFT = 302, - PLUSEQUAL = 303, - MINUSEQUAL = 304, - MULTEQUAL = 305, - DIVEQUAL = 306, - LSHIFTEQUAL = 307, - RSHIFTEQUAL = 308, - URSHIFTEQUAL = 309, - ANDEQUAL = 310, - MODEQUAL = 311, - XOREQUAL = 312, - OREQUAL = 313, - OPENBRACE = 314, - CLOSEBRACE = 315, - NUMBER = 316, - IDENT = 317, - STRING = 318, - AUTOPLUSPLUS = 319, - AUTOMINUSMINUS = 320 - }; -#endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - - - +#define yyparse jscyyparse +#define yylex jscyylex +#define yyerror jscyyerror +#define yylval jscyylval +#define yychar jscyychar +#define yydebug jscyydebug +#define yynerrs jscyynerrs +#define yylloc jscyylloc /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 3 "../../JavaScriptCore/parser/Grammar.y" @@ -363,6 +231,9 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD +/* Line 189 of yacc.c */ +#line 236 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -381,10 +252,88 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedD # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NULLTOKEN = 258, + TRUETOKEN = 259, + FALSETOKEN = 260, + BREAK = 261, + CASE = 262, + DEFAULT = 263, + FOR = 264, + NEW = 265, + VAR = 266, + CONSTTOKEN = 267, + CONTINUE = 268, + FUNCTION = 269, + RETURN = 270, + VOIDTOKEN = 271, + DELETETOKEN = 272, + IF = 273, + THISTOKEN = 274, + DO = 275, + WHILE = 276, + INTOKEN = 277, + INSTANCEOF = 278, + TYPEOF = 279, + SWITCH = 280, + WITH = 281, + RESERVED = 282, + THROW = 283, + TRY = 284, + CATCH = 285, + FINALLY = 286, + DEBUGGER = 287, + IF_WITHOUT_ELSE = 288, + ELSE = 289, + EQEQ = 290, + NE = 291, + STREQ = 292, + STRNEQ = 293, + LE = 294, + GE = 295, + OR = 296, + AND = 297, + PLUSPLUS = 298, + MINUSMINUS = 299, + LSHIFT = 300, + RSHIFT = 301, + URSHIFT = 302, + PLUSEQUAL = 303, + MINUSEQUAL = 304, + MULTEQUAL = 305, + DIVEQUAL = 306, + LSHIFTEQUAL = 307, + RSHIFTEQUAL = 308, + URSHIFTEQUAL = 309, + ANDEQUAL = 310, + MODEQUAL = 311, + XOREQUAL = 312, + OREQUAL = 313, + OPENBRACE = 314, + CLOSEBRACE = 315, + NUMBER = 316, + IDENT = 317, + STRING = 318, + AUTOPLUSPLUS = 319, + AUTOMINUSMINUS = 320 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../../JavaScriptCore/parser/Grammar.y" { + +/* Line 214 of yacc.c */ +#line 157 "../../JavaScriptCore/parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -414,13 +363,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 187 of yacc.c. */ -#line 420 "Grammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 371 "Grammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -440,8 +391,8 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 445 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 396 "Grammar.tab.c" #ifdef short # undef short @@ -516,14 +467,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -605,9 +556,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -642,12 +593,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -2361,17 +2312,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -2406,11 +2360,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -2692,10 +2646,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -2714,10 +2666,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -2741,88 +2692,97 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Number of syntax errors so far. */ + int yynerrs; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -2861,6 +2821,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -2882,9 +2843,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2905,6 +2866,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2913,16 +2877,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2954,20 +2918,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -3008,31 +2968,43 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 290 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NullNode(GLOBAL_DATA), 0, 1); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 291 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, true), 0, 1); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 292 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BooleanNode(GLOBAL_DATA, false), 0, 1); ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 293 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 294 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;} break; case 7: + +/* Line 1455 of yacc.c */ #line 295 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; @@ -3046,6 +3018,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 304 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; @@ -3059,26 +3033,36 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 316 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 10: + +/* Line 1455 of yacc.c */ #line 317 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 11: + +/* Line 1455 of yacc.c */ #line 318 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from((yyvsp[(1) - (3)].doubleValue))), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 12: + +/* Line 1455 of yacc.c */ #line 319 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;} break; case 13: + +/* Line 1455 of yacc.c */ #line 321 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -3091,6 +3075,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 332 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyList).m_node.head = new PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node); (yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head; @@ -3099,6 +3085,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 336 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head; (yyval.propertyList).m_node.tail = new PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail); @@ -3107,51 +3095,71 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 344 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;} break; case 18: + +/* Line 1455 of yacc.c */ #line 345 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;} break; case 19: + +/* Line 1455 of yacc.c */ #line 347 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 351 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ThisNode(GLOBAL_DATA), ThisFeature, 0); ;} break; case 23: + +/* Line 1455 of yacc.c */ #line 354 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 24: + +/* Line 1455 of yacc.c */ #line 355 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;} break; case 25: + +/* Line 1455 of yacc.c */ #line 359 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;} break; case 26: + +/* Line 1455 of yacc.c */ #line 360 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;} break; case 27: + +/* Line 1455 of yacc.c */ #line 361 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;} break; case 28: + +/* Line 1455 of yacc.c */ #line 365 "../../JavaScriptCore/parser/Grammar.y" { (yyval.elementList).m_node.head = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node); (yyval.elementList).m_node.tail = (yyval.elementList).m_node.head; @@ -3160,6 +3168,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 370 "../../JavaScriptCore/parser/Grammar.y" { (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head; (yyval.elementList).m_node.tail = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node); @@ -3168,26 +3178,36 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 377 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = 0; ;} break; case 32: + +/* Line 1455 of yacc.c */ #line 382 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = 1; ;} break; case 33: + +/* Line 1455 of yacc.c */ #line 383 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;} break; case 35: + +/* Line 1455 of yacc.c */ #line 388 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;} break; case 36: + +/* Line 1455 of yacc.c */ #line 389 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3196,6 +3216,8 @@ yyreduce: break; case 37: + +/* Line 1455 of yacc.c */ #line 393 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3204,6 +3226,8 @@ yyreduce: break; case 38: + +/* Line 1455 of yacc.c */ #line 397 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3212,6 +3236,8 @@ yyreduce: break; case 40: + +/* Line 1455 of yacc.c */ #line 405 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3220,6 +3246,8 @@ yyreduce: break; case 41: + +/* Line 1455 of yacc.c */ #line 409 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3228,6 +3256,8 @@ yyreduce: break; case 42: + +/* Line 1455 of yacc.c */ #line 413 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3236,6 +3266,8 @@ yyreduce: break; case 44: + +/* Line 1455 of yacc.c */ #line 421 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3244,6 +3276,8 @@ yyreduce: break; case 46: + +/* Line 1455 of yacc.c */ #line 429 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); @@ -3252,16 +3286,22 @@ yyreduce: break; case 47: + +/* Line 1455 of yacc.c */ #line 436 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 48: + +/* Line 1455 of yacc.c */ #line 437 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 49: + +/* Line 1455 of yacc.c */ #line 438 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3270,6 +3310,8 @@ yyreduce: break; case 50: + +/* Line 1455 of yacc.c */ #line 442 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3277,16 +3319,22 @@ yyreduce: break; case 51: + +/* Line 1455 of yacc.c */ #line 448 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 52: + +/* Line 1455 of yacc.c */ #line 449 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 53: + +/* Line 1455 of yacc.c */ #line 450 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); @@ -3295,6 +3343,8 @@ yyreduce: break; case 54: + +/* Line 1455 of yacc.c */ #line 454 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); @@ -3303,16 +3353,22 @@ yyreduce: break; case 55: + +/* Line 1455 of yacc.c */ #line 461 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA), 0, 0); ;} break; case 56: + +/* Line 1455 of yacc.c */ #line 462 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo(new ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;} break; case 57: + +/* Line 1455 of yacc.c */ #line 466 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentList).m_node.head = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node); (yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head; @@ -3321,6 +3377,8 @@ yyreduce: break; case 58: + +/* Line 1455 of yacc.c */ #line 470 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head; (yyval.argumentList).m_node.tail = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node); @@ -3329,181 +3387,253 @@ yyreduce: break; case 64: + +/* Line 1455 of yacc.c */ #line 488 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 65: + +/* Line 1455 of yacc.c */ #line 489 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 67: + +/* Line 1455 of yacc.c */ #line 494 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 68: + +/* Line 1455 of yacc.c */ #line 495 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 69: + +/* Line 1455 of yacc.c */ #line 499 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 70: + +/* Line 1455 of yacc.c */ #line 500 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;} break; case 71: + +/* Line 1455 of yacc.c */ #line 501 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 72: + +/* Line 1455 of yacc.c */ #line 502 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 73: + +/* Line 1455 of yacc.c */ #line 503 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 74: + +/* Line 1455 of yacc.c */ #line 504 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 75: + +/* Line 1455 of yacc.c */ #line 505 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 76: + +/* Line 1455 of yacc.c */ #line 506 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 77: + +/* Line 1455 of yacc.c */ #line 507 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 78: + +/* Line 1455 of yacc.c */ #line 508 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 79: + +/* Line 1455 of yacc.c */ #line 509 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 85: + +/* Line 1455 of yacc.c */ #line 523 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 86: + +/* Line 1455 of yacc.c */ #line 524 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 87: + +/* Line 1455 of yacc.c */ #line 525 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 89: + +/* Line 1455 of yacc.c */ #line 531 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 90: + +/* Line 1455 of yacc.c */ #line 533 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 91: + +/* Line 1455 of yacc.c */ #line 535 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 93: + +/* Line 1455 of yacc.c */ #line 540 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 94: + +/* Line 1455 of yacc.c */ #line 541 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 96: + +/* Line 1455 of yacc.c */ #line 547 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 97: + +/* Line 1455 of yacc.c */ #line 549 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 99: + +/* Line 1455 of yacc.c */ #line 554 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 100: + +/* Line 1455 of yacc.c */ #line 555 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 101: + +/* Line 1455 of yacc.c */ #line 556 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 103: + +/* Line 1455 of yacc.c */ #line 561 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 104: + +/* Line 1455 of yacc.c */ #line 562 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 105: + +/* Line 1455 of yacc.c */ #line 563 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 107: + +/* Line 1455 of yacc.c */ #line 568 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 108: + +/* Line 1455 of yacc.c */ #line 569 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 109: + +/* Line 1455 of yacc.c */ #line 570 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 110: + +/* Line 1455 of yacc.c */ #line 571 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 111: + +/* Line 1455 of yacc.c */ #line 572 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3511,6 +3641,8 @@ yyreduce: break; case 112: + +/* Line 1455 of yacc.c */ #line 575 "../../JavaScriptCore/parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3518,26 +3650,36 @@ yyreduce: break; case 114: + +/* Line 1455 of yacc.c */ #line 582 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 115: + +/* Line 1455 of yacc.c */ #line 583 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 116: + +/* Line 1455 of yacc.c */ #line 584 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 117: + +/* Line 1455 of yacc.c */ #line 585 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 118: + +/* Line 1455 of yacc.c */ #line 587 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3545,26 +3687,36 @@ yyreduce: break; case 120: + +/* Line 1455 of yacc.c */ #line 594 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 121: + +/* Line 1455 of yacc.c */ #line 595 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 122: + +/* Line 1455 of yacc.c */ #line 596 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 123: + +/* Line 1455 of yacc.c */ #line 597 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 124: + +/* Line 1455 of yacc.c */ #line 599 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3572,6 +3724,8 @@ yyreduce: break; case 125: + +/* Line 1455 of yacc.c */ #line 603 "../../JavaScriptCore/parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); @@ -3579,156 +3733,218 @@ yyreduce: break; case 127: + +/* Line 1455 of yacc.c */ #line 610 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 128: + +/* Line 1455 of yacc.c */ #line 611 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 129: + +/* Line 1455 of yacc.c */ #line 612 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 130: + +/* Line 1455 of yacc.c */ #line 613 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 132: + +/* Line 1455 of yacc.c */ #line 619 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 133: + +/* Line 1455 of yacc.c */ #line 621 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 134: + +/* Line 1455 of yacc.c */ #line 623 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 135: + +/* Line 1455 of yacc.c */ #line 625 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 137: + +/* Line 1455 of yacc.c */ #line 631 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 138: + +/* Line 1455 of yacc.c */ #line 632 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 139: + +/* Line 1455 of yacc.c */ #line 634 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 140: + +/* Line 1455 of yacc.c */ #line 636 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 142: + +/* Line 1455 of yacc.c */ #line 641 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 144: + +/* Line 1455 of yacc.c */ #line 647 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 652 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 657 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 150: + +/* Line 1455 of yacc.c */ #line 663 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 152: + +/* Line 1455 of yacc.c */ #line 669 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 154: + +/* Line 1455 of yacc.c */ #line 674 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 156: + +/* Line 1455 of yacc.c */ #line 680 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 158: + +/* Line 1455 of yacc.c */ #line 686 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 160: + +/* Line 1455 of yacc.c */ #line 691 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 162: + +/* Line 1455 of yacc.c */ #line 697 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 164: + +/* Line 1455 of yacc.c */ #line 703 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 166: + +/* Line 1455 of yacc.c */ #line 708 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 168: + +/* Line 1455 of yacc.c */ #line 714 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 170: + +/* Line 1455 of yacc.c */ #line 719 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 172: + +/* Line 1455 of yacc.c */ #line 725 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 174: + +/* Line 1455 of yacc.c */ #line 731 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 176: + +/* Line 1455 of yacc.c */ #line 737 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 178: + +/* Line 1455 of yacc.c */ #line 743 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3736,6 +3952,8 @@ yyreduce: break; case 180: + +/* Line 1455 of yacc.c */ #line 751 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3743,6 +3961,8 @@ yyreduce: break; case 182: + +/* Line 1455 of yacc.c */ #line 759 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); @@ -3750,99 +3970,137 @@ yyreduce: break; case 183: + +/* Line 1455 of yacc.c */ #line 765 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpEqual; ;} break; case 184: + +/* Line 1455 of yacc.c */ #line 766 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpPlusEq; ;} break; case 185: + +/* Line 1455 of yacc.c */ #line 767 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpMinusEq; ;} break; case 186: + +/* Line 1455 of yacc.c */ #line 768 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpMultEq; ;} break; case 187: + +/* Line 1455 of yacc.c */ #line 769 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpDivEq; ;} break; case 188: + +/* Line 1455 of yacc.c */ #line 770 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpLShift; ;} break; case 189: + +/* Line 1455 of yacc.c */ #line 771 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpRShift; ;} break; case 190: + +/* Line 1455 of yacc.c */ #line 772 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpURShift; ;} break; case 191: + +/* Line 1455 of yacc.c */ #line 773 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpAndEq; ;} break; case 192: + +/* Line 1455 of yacc.c */ #line 774 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpXOrEq; ;} break; case 193: + +/* Line 1455 of yacc.c */ #line 775 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpOrEq; ;} break; case 194: + +/* Line 1455 of yacc.c */ #line 776 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpModEq; ;} break; case 196: + +/* Line 1455 of yacc.c */ #line 781 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 198: + +/* Line 1455 of yacc.c */ #line 786 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 200: + +/* Line 1455 of yacc.c */ #line 791 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 218: + +/* Line 1455 of yacc.c */ #line 815 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 219: + +/* Line 1455 of yacc.c */ #line 817 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 220: + +/* Line 1455 of yacc.c */ #line 822 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 221: + +/* Line 1455 of yacc.c */ #line 824 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); @@ -3850,6 +4108,8 @@ yyreduce: break; case 222: + +/* Line 1455 of yacc.c */ #line 830 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3861,6 +4121,8 @@ yyreduce: break; case 223: + +/* Line 1455 of yacc.c */ #line 837 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3874,6 +4136,8 @@ yyreduce: break; case 224: + +/* Line 1455 of yacc.c */ #line 847 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3885,6 +4149,8 @@ yyreduce: break; case 225: + +/* Line 1455 of yacc.c */ #line 855 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3898,6 +4164,8 @@ yyreduce: break; case 226: + +/* Line 1455 of yacc.c */ #line 867 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData(GLOBAL_DATA); @@ -3909,6 +4177,8 @@ yyreduce: break; case 227: + +/* Line 1455 of yacc.c */ #line 874 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); @@ -3922,6 +4192,8 @@ yyreduce: break; case 228: + +/* Line 1455 of yacc.c */ #line 884 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; @@ -3933,6 +4205,8 @@ yyreduce: break; case 229: + +/* Line 1455 of yacc.c */ #line 892 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); @@ -3946,18 +4220,24 @@ yyreduce: break; case 230: + +/* Line 1455 of yacc.c */ #line 904 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 231: + +/* Line 1455 of yacc.c */ #line 907 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 232: + +/* Line 1455 of yacc.c */ #line 912 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node; (yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head; @@ -3970,6 +4250,8 @@ yyreduce: break; case 233: + +/* Line 1455 of yacc.c */ #line 921 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head; (yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node; @@ -3982,49 +4264,67 @@ yyreduce: break; case 234: + +/* Line 1455 of yacc.c */ #line 932 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 235: + +/* Line 1455 of yacc.c */ #line 933 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 236: + +/* Line 1455 of yacc.c */ #line 937 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 237: + +/* Line 1455 of yacc.c */ #line 941 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 238: + +/* Line 1455 of yacc.c */ #line 945 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;} break; case 239: + +/* Line 1455 of yacc.c */ #line 949 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 240: + +/* Line 1455 of yacc.c */ #line 951 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 241: + +/* Line 1455 of yacc.c */ #line 957 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 242: + +/* Line 1455 of yacc.c */ #line 960 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations), @@ -4034,24 +4334,32 @@ yyreduce: break; case 243: + +/* Line 1455 of yacc.c */ #line 968 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 244: + +/* Line 1455 of yacc.c */ #line 970 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 245: + +/* Line 1455 of yacc.c */ #line 972 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 246: + +/* Line 1455 of yacc.c */ #line 975 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations, (yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features, @@ -4061,6 +4369,8 @@ yyreduce: break; case 247: + +/* Line 1455 of yacc.c */ #line 981 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true), mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations), @@ -4071,6 +4381,8 @@ yyreduce: break; case 248: + +/* Line 1455 of yacc.c */ #line 988 "../../JavaScriptCore/parser/Grammar.y" { ForInNode* node = new ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node); @@ -4083,6 +4395,8 @@ yyreduce: break; case 249: + +/* Line 1455 of yacc.c */ #line 997 "../../JavaScriptCore/parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column); @@ -4092,6 +4406,8 @@ yyreduce: break; case 250: + +/* Line 1455 of yacc.c */ #line 1003 "../../JavaScriptCore/parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column); @@ -4103,16 +4419,22 @@ yyreduce: break; case 251: + +/* Line 1455 of yacc.c */ #line 1013 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 253: + +/* Line 1455 of yacc.c */ #line 1018 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo(0, 0, 0); ;} break; case 255: + +/* Line 1455 of yacc.c */ #line 1023 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4121,6 +4443,8 @@ yyreduce: break; case 256: + +/* Line 1455 of yacc.c */ #line 1027 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4129,6 +4453,8 @@ yyreduce: break; case 257: + +/* Line 1455 of yacc.c */ #line 1031 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4137,6 +4463,8 @@ yyreduce: break; case 258: + +/* Line 1455 of yacc.c */ #line 1035 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4145,6 +4473,8 @@ yyreduce: break; case 259: + +/* Line 1455 of yacc.c */ #line 1042 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4152,6 +4482,8 @@ yyreduce: break; case 260: + +/* Line 1455 of yacc.c */ #line 1045 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4159,6 +4491,8 @@ yyreduce: break; case 261: + +/* Line 1455 of yacc.c */ #line 1048 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4166,6 +4500,8 @@ yyreduce: break; case 262: + +/* Line 1455 of yacc.c */ #line 1051 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4173,6 +4509,8 @@ yyreduce: break; case 263: + +/* Line 1455 of yacc.c */ #line 1057 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4180,6 +4518,8 @@ yyreduce: break; case 264: + +/* Line 1455 of yacc.c */ #line 1060 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); @@ -4187,6 +4527,8 @@ yyreduce: break; case 265: + +/* Line 1455 of yacc.c */ #line 1063 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4194,6 +4536,8 @@ yyreduce: break; case 266: + +/* Line 1455 of yacc.c */ #line 1066 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4201,6 +4545,8 @@ yyreduce: break; case 267: + +/* Line 1455 of yacc.c */ #line 1072 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); @@ -4208,6 +4554,8 @@ yyreduce: break; case 268: + +/* Line 1455 of yacc.c */ #line 1078 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants); @@ -4215,11 +4563,15 @@ yyreduce: break; case 269: + +/* Line 1455 of yacc.c */ #line 1084 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;} break; case 270: + +/* Line 1455 of yacc.c */ #line 1086 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations), @@ -4229,11 +4581,15 @@ yyreduce: break; case 271: + +/* Line 1455 of yacc.c */ #line 1094 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;} break; case 273: + +/* Line 1455 of yacc.c */ #line 1099 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node); (yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head; @@ -4244,6 +4600,8 @@ yyreduce: break; case 274: + +/* Line 1455 of yacc.c */ #line 1105 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head; (yyval.clauseList).m_node.tail = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node); @@ -4255,26 +4613,36 @@ yyreduce: break; case 275: + +/* Line 1455 of yacc.c */ #line 1115 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;} break; case 276: + +/* Line 1455 of yacc.c */ #line 1116 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;} break; case 277: + +/* Line 1455 of yacc.c */ #line 1120 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;} break; case 278: + +/* Line 1455 of yacc.c */ #line 1121 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo(new CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;} break; case 279: + +/* Line 1455 of yacc.c */ #line 1125 "../../JavaScriptCore/parser/Grammar.y" { LabelNode* node = new LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4282,6 +4650,8 @@ yyreduce: break; case 280: + +/* Line 1455 of yacc.c */ #line 1131 "../../JavaScriptCore/parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4290,6 +4660,8 @@ yyreduce: break; case 281: + +/* Line 1455 of yacc.c */ #line 1135 "../../JavaScriptCore/parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); @@ -4298,6 +4670,8 @@ yyreduce: break; case 282: + +/* Line 1455 of yacc.c */ #line 1142 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node), mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations), @@ -4308,6 +4682,8 @@ yyreduce: break; case 283: + +/* Line 1455 of yacc.c */ #line 1148 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0), mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), @@ -4318,6 +4694,8 @@ yyreduce: break; case 284: + +/* Line 1455 of yacc.c */ #line 1155 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations), @@ -4328,23 +4706,31 @@ yyreduce: break; case 285: + +/* Line 1455 of yacc.c */ #line 1164 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 286: + +/* Line 1455 of yacc.c */ #line 1166 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 287: + +/* Line 1455 of yacc.c */ #line 1171 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast((yyval.statementNode).m_node)); ;} break; case 288: + +/* Line 1455 of yacc.c */ #line 1173 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new ParserRefCountedData(GLOBAL_DATA), ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4356,11 +4742,15 @@ yyreduce: break; case 289: + +/* Line 1455 of yacc.c */ #line 1183 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), LEXER->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;} break; case 290: + +/* Line 1455 of yacc.c */ #line 1185 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0); @@ -4371,11 +4761,15 @@ yyreduce: break; case 291: + +/* Line 1455 of yacc.c */ #line 1191 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;} break; case 292: + +/* Line 1455 of yacc.c */ #line 1193 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); @@ -4386,6 +4780,8 @@ yyreduce: break; case 293: + +/* Line 1455 of yacc.c */ #line 1202 "../../JavaScriptCore/parser/Grammar.y" { (yyval.parameterList).m_node.head = new ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)); (yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; @@ -4393,6 +4789,8 @@ yyreduce: break; case 294: + +/* Line 1455 of yacc.c */ #line 1205 "../../JavaScriptCore/parser/Grammar.y" { (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head; (yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); @@ -4400,27 +4798,37 @@ yyreduce: break; case 295: + +/* Line 1455 of yacc.c */ #line 1211 "../../JavaScriptCore/parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 296: + +/* Line 1455 of yacc.c */ #line 1212 "../../JavaScriptCore/parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 297: + +/* Line 1455 of yacc.c */ #line 1216 "../../JavaScriptCore/parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing(new SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;} break; case 298: + +/* Line 1455 of yacc.c */ #line 1217 "../../JavaScriptCore/parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features, (yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;} break; case 299: + +/* Line 1455 of yacc.c */ #line 1222 "../../JavaScriptCore/parser/Grammar.y" { (yyval.sourceElements).m_node = new SourceElements(GLOBAL_DATA); (yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node); @@ -4432,6 +4840,8 @@ yyreduce: break; case 300: + +/* Line 1455 of yacc.c */ #line 1229 "../../JavaScriptCore/parser/Grammar.y" { (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node); (yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations); @@ -4442,188 +4852,261 @@ yyreduce: break; case 304: + +/* Line 1455 of yacc.c */ #line 1243 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 305: + +/* Line 1455 of yacc.c */ #line 1244 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 306: + +/* Line 1455 of yacc.c */ #line 1245 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 307: + +/* Line 1455 of yacc.c */ #line 1246 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 308: + +/* Line 1455 of yacc.c */ #line 1250 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 309: + +/* Line 1455 of yacc.c */ #line 1251 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 310: + +/* Line 1455 of yacc.c */ #line 1252 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 311: + +/* Line 1455 of yacc.c */ #line 1253 "../../JavaScriptCore/parser/Grammar.y" { if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;} break; case 312: + +/* Line 1455 of yacc.c */ #line 1254 "../../JavaScriptCore/parser/Grammar.y" { if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;} break; case 316: + +/* Line 1455 of yacc.c */ #line 1264 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 317: + +/* Line 1455 of yacc.c */ #line 1265 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 318: + +/* Line 1455 of yacc.c */ #line 1267 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 322: + +/* Line 1455 of yacc.c */ #line 1274 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 517: + +/* Line 1455 of yacc.c */ #line 1642 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 518: + +/* Line 1455 of yacc.c */ #line 1643 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 520: + +/* Line 1455 of yacc.c */ #line 1648 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 521: + +/* Line 1455 of yacc.c */ #line 1652 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 522: + +/* Line 1455 of yacc.c */ #line 1653 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 525: + +/* Line 1455 of yacc.c */ #line 1659 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 526: + +/* Line 1455 of yacc.c */ #line 1660 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 530: + +/* Line 1455 of yacc.c */ #line 1667 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 533: + +/* Line 1455 of yacc.c */ #line 1676 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 534: + +/* Line 1455 of yacc.c */ #line 1677 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 539: + +/* Line 1455 of yacc.c */ #line 1694 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 555: + +/* Line 1455 of yacc.c */ #line 1725 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 557: + +/* Line 1455 of yacc.c */ #line 1727 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 559: + +/* Line 1455 of yacc.c */ #line 1732 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 561: + +/* Line 1455 of yacc.c */ #line 1734 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 563: + +/* Line 1455 of yacc.c */ #line 1739 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 565: + +/* Line 1455 of yacc.c */ #line 1741 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 568: + +/* Line 1455 of yacc.c */ #line 1753 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 569: + +/* Line 1455 of yacc.c */ #line 1754 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 578: + +/* Line 1455 of yacc.c */ #line 1778 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 580: + +/* Line 1455 of yacc.c */ #line 1783 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 585: + +/* Line 1455 of yacc.c */ #line 1794 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 592: + +/* Line 1455 of yacc.c */ #line 1810 "../../JavaScriptCore/parser/Grammar.y" { ;} break; -/* Line 1267 of yacc.c. */ -#line 4627 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 5110 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4699,7 +5182,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -4716,7 +5199,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4774,14 +5257,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -4806,7 +5286,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4817,7 +5297,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered @@ -4843,6 +5323,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 1826 "../../JavaScriptCore/parser/Grammar.y" diff --git a/src/3rdparty/webkit/WebCore/generated/Grammar.h b/src/3rdparty/webkit/WebCore/generated/Grammar.h index 4805844..0073f41 100644 --- a/src/3rdparty/webkit/WebCore/generated/Grammar.h +++ b/src/3rdparty/webkit/WebCore/generated/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -104,78 +104,16 @@ AUTOMINUSMINUS = 320 }; #endif -/* Tokens. */ -#define NULLTOKEN 258 -#define TRUETOKEN 259 -#define FALSETOKEN 260 -#define BREAK 261 -#define CASE 262 -#define DEFAULT 263 -#define FOR 264 -#define NEW 265 -#define VAR 266 -#define CONSTTOKEN 267 -#define CONTINUE 268 -#define FUNCTION 269 -#define RETURN 270 -#define VOIDTOKEN 271 -#define DELETETOKEN 272 -#define IF 273 -#define THISTOKEN 274 -#define DO 275 -#define WHILE 276 -#define INTOKEN 277 -#define INSTANCEOF 278 -#define TYPEOF 279 -#define SWITCH 280 -#define WITH 281 -#define RESERVED 282 -#define THROW 283 -#define TRY 284 -#define CATCH 285 -#define FINALLY 286 -#define DEBUGGER 287 -#define IF_WITHOUT_ELSE 288 -#define ELSE 289 -#define EQEQ 290 -#define NE 291 -#define STREQ 292 -#define STRNEQ 293 -#define LE 294 -#define GE 295 -#define OR 296 -#define AND 297 -#define PLUSPLUS 298 -#define MINUSMINUS 299 -#define LSHIFT 300 -#define RSHIFT 301 -#define URSHIFT 302 -#define PLUSEQUAL 303 -#define MINUSEQUAL 304 -#define MULTEQUAL 305 -#define DIVEQUAL 306 -#define LSHIFTEQUAL 307 -#define RSHIFTEQUAL 308 -#define URSHIFTEQUAL 309 -#define ANDEQUAL 310 -#define MODEQUAL 311 -#define XOREQUAL 312 -#define OREQUAL 313 -#define OPENBRACE 314 -#define CLOSEBRACE 315 -#define NUMBER 316 -#define IDENT 317 -#define STRING 318 -#define AUTOPLUSPLUS 319 -#define AUTOMINUSMINUS 320 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 157 "../../JavaScriptCore/parser/Grammar.y" { + +/* Line 1676 of yacc.c */ +#line 157 "../../JavaScriptCore/parser/Grammar.y" + int intValue; double doubleValue; Identifier* ident; @@ -205,13 +143,15 @@ typedef union YYSTYPE ParameterListInfo parameterList; Operator op; -} -/* Line 1489 of yacc.c. */ -#line 211 "Grammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 151 "Grammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -230,3 +170,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp index 1e67ca6..c47664b 100644 --- a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp +++ b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,69 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse xpathyyparse -#define yylex xpathyylex -#define yyerror xpathyyerror -#define yylval xpathyylval -#define yychar xpathyychar -#define yydebug xpathyydebug -#define yynerrs xpathyynerrs - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - MULOP = 258, - RELOP = 259, - EQOP = 260, - MINUS = 261, - PLUS = 262, - AND = 263, - OR = 264, - AXISNAME = 265, - NODETYPE = 266, - PI = 267, - FUNCTIONNAME = 268, - LITERAL = 269, - VARIABLEREFERENCE = 270, - NUMBER = 271, - DOTDOT = 272, - SLASHSLASH = 273, - NAMETEST = 274, - XPATH_ERROR = 275 - }; -#endif -/* Tokens. */ -#define MULOP 258 -#define RELOP 259 -#define EQOP 260 -#define MINUS 261 -#define PLUS 262 -#define AND 263 -#define OR 264 -#define AXISNAME 265 -#define NODETYPE 266 -#define PI 267 -#define FUNCTIONNAME 268 -#define LITERAL 269 -#define VARIABLEREFERENCE 270 -#define NUMBER 271 -#define DOTDOT 272 -#define SLASHSLASH 273 -#define NAMETEST 274 -#define XPATH_ERROR 275 - - +#define yyparse xpathyyparse +#define yylex xpathyylex +#define yyerror xpathyyerror +#define yylval xpathyylval +#define yychar xpathyychar +#define yydebug xpathyydebug +#define yynerrs xpathyynerrs /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 28 "../xml/XPathGrammar.y" @@ -144,6 +102,9 @@ using namespace XPath; +/* Line 189 of yacc.c */ +#line 107 "XPathGrammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -162,10 +123,43 @@ using namespace XPath; # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + MULOP = 258, + RELOP = 259, + EQOP = 260, + MINUS = 261, + PLUS = 262, + AND = 263, + OR = 264, + AXISNAME = 265, + NODETYPE = 266, + PI = 267, + FUNCTIONNAME = 268, + LITERAL = 269, + VARIABLEREFERENCE = 270, + NUMBER = 271, + DOTDOT = 272, + SLASHSLASH = 273, + NAMETEST = 274, + XPATH_ERROR = 275 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 56 "../xml/XPathGrammar.y" { + +/* Line 214 of yacc.c */ +#line 56 "../xml/XPathGrammar.y" + Step::Axis axis; Step::NodeTest* nodeTest; NumericOp::Opcode numop; @@ -176,18 +170,21 @@ typedef union YYSTYPE Vector* argList; Step* step; LocationPath* locationPath; -} -/* Line 187 of yacc.c. */ -#line 182 "XPathGrammar.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 178 "XPathGrammar.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ + +/* Line 264 of yacc.c */ #line 69 "../xml/XPathGrammar.y" @@ -196,8 +193,8 @@ void xpathyyerror(const char*) { } -/* Line 216 of yacc.c. */ -#line 201 "XPathGrammar.tab.c" +/* Line 264 of yacc.c */ +#line 198 "XPathGrammar.tab.c" #ifdef short # undef short @@ -272,14 +269,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -360,9 +357,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -396,12 +393,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -854,17 +851,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -898,11 +898,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1182,10 +1182,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1204,10 +1202,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1231,74 +1228,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1328,7 +1326,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1336,7 +1333,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1359,9 +1355,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1372,7 +1367,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1382,6 +1376,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1390,16 +1387,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1431,20 +1428,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1484,6 +1477,8 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 118 "../xml/XPathGrammar.y" { PARSER->m_topExpr = (yyvsp[(1) - (1)].expr); @@ -1491,6 +1486,8 @@ yyreduce: break; case 3: + +/* Line 1455 of yacc.c */ #line 125 "../xml/XPathGrammar.y" { (yyval.locationPath)->setAbsolute(false); @@ -1498,6 +1495,8 @@ yyreduce: break; case 4: + +/* Line 1455 of yacc.c */ #line 130 "../xml/XPathGrammar.y" { (yyval.locationPath)->setAbsolute(true); @@ -1505,6 +1504,8 @@ yyreduce: break; case 5: + +/* Line 1455 of yacc.c */ #line 137 "../xml/XPathGrammar.y" { (yyval.locationPath) = new LocationPath; @@ -1513,6 +1514,8 @@ yyreduce: break; case 6: + +/* Line 1455 of yacc.c */ #line 143 "../xml/XPathGrammar.y" { (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); @@ -1520,6 +1523,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 148 "../xml/XPathGrammar.y" { (yyval.locationPath) = (yyvsp[(2) - (2)].locationPath); @@ -1529,6 +1534,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 157 "../xml/XPathGrammar.y" { (yyval.locationPath) = new LocationPath; @@ -1539,6 +1546,8 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 165 "../xml/XPathGrammar.y" { (yyval.locationPath)->appendStep((yyvsp[(3) - (3)].step)); @@ -1547,6 +1556,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 171 "../xml/XPathGrammar.y" { (yyval.locationPath)->appendStep((yyvsp[(2) - (3)].step)); @@ -1557,6 +1568,8 @@ yyreduce: break; case 11: + +/* Line 1455 of yacc.c */ #line 181 "../xml/XPathGrammar.y" { if ((yyvsp[(2) - (2)].predList)) { @@ -1570,6 +1583,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 192 "../xml/XPathGrammar.y" { String localName; @@ -1590,6 +1605,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 210 "../xml/XPathGrammar.y" { if ((yyvsp[(3) - (3)].predList)) { @@ -1603,6 +1620,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 221 "../xml/XPathGrammar.y" { String localName; @@ -1623,6 +1642,8 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 245 "../xml/XPathGrammar.y" { (yyval.axis) = Step::AttributeAxis; @@ -1630,6 +1651,8 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 252 "../xml/XPathGrammar.y" { if (*(yyvsp[(1) - (3)].str) == "node") @@ -1645,6 +1668,8 @@ yyreduce: break; case 19: + +/* Line 1455 of yacc.c */ #line 265 "../xml/XPathGrammar.y" { (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest); @@ -1654,6 +1679,8 @@ yyreduce: break; case 20: + +/* Line 1455 of yacc.c */ #line 272 "../xml/XPathGrammar.y" { (yyval.nodeTest) = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, (yyvsp[(3) - (4)].str)->stripWhiteSpace()); @@ -1664,6 +1691,8 @@ yyreduce: break; case 21: + +/* Line 1455 of yacc.c */ #line 282 "../xml/XPathGrammar.y" { (yyval.predList) = 0; @@ -1671,6 +1700,8 @@ yyreduce: break; case 23: + +/* Line 1455 of yacc.c */ #line 291 "../xml/XPathGrammar.y" { (yyval.predList) = new Vector; @@ -1681,6 +1712,8 @@ yyreduce: break; case 24: + +/* Line 1455 of yacc.c */ #line 299 "../xml/XPathGrammar.y" { (yyval.predList)->append(new Predicate((yyvsp[(2) - (2)].expr))); @@ -1689,6 +1722,8 @@ yyreduce: break; case 25: + +/* Line 1455 of yacc.c */ #line 307 "../xml/XPathGrammar.y" { (yyval.expr) = (yyvsp[(2) - (3)].expr); @@ -1696,6 +1731,8 @@ yyreduce: break; case 26: + +/* Line 1455 of yacc.c */ #line 314 "../xml/XPathGrammar.y" { (yyval.step) = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); @@ -1704,6 +1741,8 @@ yyreduce: break; case 27: + +/* Line 1455 of yacc.c */ #line 322 "../xml/XPathGrammar.y" { (yyval.step) = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); @@ -1712,6 +1751,8 @@ yyreduce: break; case 28: + +/* Line 1455 of yacc.c */ #line 328 "../xml/XPathGrammar.y" { (yyval.step) = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest)); @@ -1720,6 +1761,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 336 "../xml/XPathGrammar.y" { (yyval.expr) = new VariableReference(*(yyvsp[(1) - (1)].str)); @@ -1729,6 +1772,8 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 343 "../xml/XPathGrammar.y" { (yyval.expr) = (yyvsp[(2) - (3)].expr); @@ -1736,6 +1781,8 @@ yyreduce: break; case 31: + +/* Line 1455 of yacc.c */ #line 348 "../xml/XPathGrammar.y" { (yyval.expr) = new StringExpression(*(yyvsp[(1) - (1)].str)); @@ -1745,6 +1792,8 @@ yyreduce: break; case 32: + +/* Line 1455 of yacc.c */ #line 355 "../xml/XPathGrammar.y" { (yyval.expr) = new Number((yyvsp[(1) - (1)].str)->toDouble()); @@ -1754,6 +1803,8 @@ yyreduce: break; case 34: + +/* Line 1455 of yacc.c */ #line 366 "../xml/XPathGrammar.y" { (yyval.expr) = createFunction(*(yyvsp[(1) - (3)].str)); @@ -1765,6 +1816,8 @@ yyreduce: break; case 35: + +/* Line 1455 of yacc.c */ #line 375 "../xml/XPathGrammar.y" { (yyval.expr) = createFunction(*(yyvsp[(1) - (4)].str), *(yyvsp[(3) - (4)].argList)); @@ -1777,6 +1830,8 @@ yyreduce: break; case 36: + +/* Line 1455 of yacc.c */ #line 387 "../xml/XPathGrammar.y" { (yyval.argList) = new Vector; @@ -1787,6 +1842,8 @@ yyreduce: break; case 37: + +/* Line 1455 of yacc.c */ #line 395 "../xml/XPathGrammar.y" { (yyval.argList)->append((yyvsp[(3) - (3)].expr)); @@ -1795,6 +1852,8 @@ yyreduce: break; case 40: + +/* Line 1455 of yacc.c */ #line 409 "../xml/XPathGrammar.y" { (yyval.expr) = new Union; @@ -1807,6 +1866,8 @@ yyreduce: break; case 41: + +/* Line 1455 of yacc.c */ #line 421 "../xml/XPathGrammar.y" { (yyval.expr) = (yyvsp[(1) - (1)].locationPath); @@ -1814,6 +1875,8 @@ yyreduce: break; case 43: + +/* Line 1455 of yacc.c */ #line 428 "../xml/XPathGrammar.y" { (yyvsp[(3) - (3)].locationPath)->setAbsolute(true); @@ -1825,6 +1888,8 @@ yyreduce: break; case 44: + +/* Line 1455 of yacc.c */ #line 437 "../xml/XPathGrammar.y" { (yyvsp[(3) - (3)].locationPath)->insertFirstStep((yyvsp[(2) - (3)].step)); @@ -1838,6 +1903,8 @@ yyreduce: break; case 46: + +/* Line 1455 of yacc.c */ #line 452 "../xml/XPathGrammar.y" { (yyval.expr) = new Filter((yyvsp[(1) - (2)].expr), *(yyvsp[(2) - (2)].predList)); @@ -1848,6 +1915,8 @@ yyreduce: break; case 48: + +/* Line 1455 of yacc.c */ #line 464 "../xml/XPathGrammar.y" { (yyval.expr) = new LogicalOp(LogicalOp::OP_Or, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1858,6 +1927,8 @@ yyreduce: break; case 50: + +/* Line 1455 of yacc.c */ #line 476 "../xml/XPathGrammar.y" { (yyval.expr) = new LogicalOp(LogicalOp::OP_And, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1868,6 +1939,8 @@ yyreduce: break; case 52: + +/* Line 1455 of yacc.c */ #line 488 "../xml/XPathGrammar.y" { (yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1878,6 +1951,8 @@ yyreduce: break; case 54: + +/* Line 1455 of yacc.c */ #line 500 "../xml/XPathGrammar.y" { (yyval.expr) = new EqTestOp((yyvsp[(2) - (3)].eqop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1888,6 +1963,8 @@ yyreduce: break; case 56: + +/* Line 1455 of yacc.c */ #line 512 "../xml/XPathGrammar.y" { (yyval.expr) = new NumericOp(NumericOp::OP_Add, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1898,6 +1975,8 @@ yyreduce: break; case 57: + +/* Line 1455 of yacc.c */ #line 520 "../xml/XPathGrammar.y" { (yyval.expr) = new NumericOp(NumericOp::OP_Sub, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1908,6 +1987,8 @@ yyreduce: break; case 59: + +/* Line 1455 of yacc.c */ #line 532 "../xml/XPathGrammar.y" { (yyval.expr) = new NumericOp((yyvsp[(2) - (3)].numop), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); @@ -1918,6 +1999,8 @@ yyreduce: break; case 61: + +/* Line 1455 of yacc.c */ #line 544 "../xml/XPathGrammar.y" { (yyval.expr) = new Negative; @@ -1928,8 +2011,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1933 "XPathGrammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 2017 "XPathGrammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1940,7 +2024,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2005,7 +2088,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -2022,7 +2105,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2079,9 +2162,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -2106,7 +2186,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2117,7 +2197,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -2143,6 +2223,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 552 "../xml/XPathGrammar.y" diff --git a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h index cabe35a..f6c314d 100644 --- a/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h +++ b/src/3rdparty/webkit/WebCore/generated/XPathGrammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -59,33 +59,16 @@ XPATH_ERROR = 275 }; #endif -/* Tokens. */ -#define MULOP 258 -#define RELOP 259 -#define EQOP 260 -#define MINUS 261 -#define PLUS 262 -#define AND 263 -#define OR 264 -#define AXISNAME 265 -#define NODETYPE 266 -#define PI 267 -#define FUNCTIONNAME 268 -#define LITERAL 269 -#define VARIABLEREFERENCE 270 -#define NUMBER 271 -#define DOTDOT 272 -#define SLASHSLASH 273 -#define NAMETEST 274 -#define XPATH_ERROR 275 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 56 "../xml/XPathGrammar.y" { + +/* Line 1676 of yacc.c */ +#line 56 "../xml/XPathGrammar.y" + Step::Axis axis; Step::NodeTest* nodeTest; NumericOp::Opcode numop; @@ -96,14 +79,17 @@ typedef union YYSTYPE Vector* argList; Step* step; LocationPath* locationPath; -} -/* Line 1489 of yacc.c. */ -#line 102 "XPathGrammar.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 87 "XPathGrammar.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + diff --git a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp index ceea77a..d50fef8 100644 --- a/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/CanvasRenderingContext2D.cpp @@ -422,9 +422,7 @@ void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float return; TransformationMatrix transform(m11, m12, m21, m22, dx, dy); - - TransformationMatrix newTransform = state().m_transform; - newTransform.multiply(transform); + TransformationMatrix newTransform = transform * state().m_transform; if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; return; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp index e68be2b..5c39e11 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp @@ -275,7 +275,9 @@ void Path::clear() bool Path::isEmpty() const { - return m_path->isEmpty(); + // Don't use QPainterPath::isEmpty(), as that also returns true if there's only + // one initial MoveTo element in the path. + return m_path->elementCount() == 0; } String Path::debugString() const diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 3e9b239..83f4b1e 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -214,9 +214,11 @@ void QNetworkReplyHandler::finish() resetState(); start(); } else if (m_reply->error() != QNetworkReply::NoError - // a web page that returns 403/404 can still have content + // a web page that returns 401/403/404 can still have content && m_reply->error() != QNetworkReply::ContentOperationNotPermittedError - && m_reply->error() != QNetworkReply::ContentNotFoundError) { + && m_reply->error() != QNetworkReply::ContentNotFoundError + && m_reply->error() != QNetworkReply::AuthenticationRequiredError + && m_reply->error() != QNetworkReply::ProxyAuthenticationRequiredError) { QUrl url = m_reply->url(); ResourceError error(url.host(), m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), url.toString(), m_reply->errorString()); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp index 6dbe464..a369ddc 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/FileSystemQt.cpp @@ -97,7 +97,7 @@ String pathGetFileName(const String& path) String directoryName(const String& path) { - return String(QFileInfo(path).baseName()); + return String(QFileInfo(path).absolutePath()); } Vector listDirectory(const String& path, const String& filter) diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp index 569ed37..b85c748 100644 --- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp @@ -369,10 +369,10 @@ void PluginView::setNPWindowIfNeeded() m_npWindow.height = m_windowRect.height(); // TODO: (also clip against scrollbars, etc.) - m_npWindow.clipRect.left = 0; - m_npWindow.clipRect.top = 0; - m_npWindow.clipRect.right = m_windowRect.width(); - m_npWindow.clipRect.bottom = m_windowRect.height(); + m_npWindow.clipRect.left = max(0, m_windowRect.x()); + m_npWindow.clipRect.top = max(0, m_windowRect.y()); + m_npWindow.clipRect.right = m_windowRect.x() + m_windowRect.width(); + m_npWindow.clipRect.bottom = m_windowRect.y() + m_windowRect.height(); PluginView::setCurrentPluginView(this); JSC::JSLock::DropAllLocks dropAllLocks(false); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index afbc770..a7e176d 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -12,6 +12,25 @@ Reviewed by Simon Hausmann. + Fix crash with plugins when the plugin stream is cancelled. + + Similar to r26667 handle the case where didReceiveResponse on the + plugin view results in failure to set up the stream and + setMainDocumentError being called instead. This will set the + m_pluginView back to 0 and we need check for it before calling + didReceiveData. + + This was triggered by consecutive execution of + LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html + followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::committedLoad): + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + Fix a plugin bug in the WebKit code, similar to the one in WebCore. The problem is when a non visible QtPluginWidget would show it self diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index a2b33c0..680a67a 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -680,6 +680,11 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c if (m_pluginView) { if (!m_hasSentResponseToPlugin) { m_pluginView->didReceiveResponse(loader->response()); + // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in + // setting up this stream can cause the main document load to be cancelled, setting m_pluginView + // to null + if (!m_pluginView) + return; m_hasSentResponseToPlugin = true; } m_pluginView->didReceiveData(data, length); -- cgit v0.12 From 8e0121795a784a1bcedfe3108e2aaf77f26eff6f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 17:08:11 +0200 Subject: Fix initialization of the HTML 5 offline storage. Place the databases into the normal data location. Reviewed-by: Ariya --- demos/browser/browserapplication.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/browser/browserapplication.cpp b/demos/browser/browserapplication.cpp index 5ef3ce6..b27b5c1 100644 --- a/demos/browser/browserapplication.cpp +++ b/demos/browser/browserapplication.cpp @@ -205,6 +205,7 @@ void BrowserApplication::postLaunch() if (directory.isEmpty()) directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); QWebSettings::setIconDatabasePath(directory); + QWebSettings::setOfflineStoragePath(directory); setWindowIcon(QIcon(QLatin1String(":browser.svg"))); -- cgit v0.12 From dab07d0b8ec229bd601d99b6a20326bec3fd33c3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 17:14:23 +0200 Subject: Removed two generated files. They were added by accident. Nevermind :) Reviewed-by: Trust me --- .../webkit/JavaScriptCore/libJavaScriptCore.la | 28 ---------------------- .../JavaScriptCore/pkgconfig/JavaScriptCore.pc | 15 ------------ 2 files changed, 43 deletions(-) delete mode 100644 src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la delete mode 100644 src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc diff --git a/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la b/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la deleted file mode 100644 index 10d3f1e..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/libJavaScriptCore.la +++ /dev/null @@ -1,28 +0,0 @@ -# libJavaScriptCore.la - a libtool library file -# Generated by qmake/libtool (2.01a) (Qt 4.6.0) on: Mon Jun 15 18:55:09 2009 -# The name that we can dlopen(3). -dlname='' - -# Names of this library. -library_names=' ' - -# The name of the static archive. -old_library='libJavaScriptCore.a' - -# Libraries that this one depends upon. -dependency_libs='-L/depot/obuddenh/qt/lib -lQtGui -L/depot/obuddenh/qt/lib -L/usr/X11R6/lib -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread -ldl ' - -# Version information for libJavaScriptCore.la -current=46 -age=0 -revision=0 - -# Is this an already installed library. -installed=yes - -# Files to dlopen/dlpreopen. -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/depot/obuddenh/qt/lib' diff --git a/src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc b/src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc deleted file mode 100644 index fb90b0c..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/pkgconfig/JavaScriptCore.pc +++ /dev/null @@ -1,15 +0,0 @@ -prefix=/depot/obuddenh/qt -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/JavaScriptCore -qt_config=lex yacc debug uic resources qt incremental link_prl exceptions no_mocdepend debug stl qt_no_framework debug largefile stl precompile_header separate_debug_info mmx 3dnow sse sse2 dylib create_prl link_prl depend_includepath QTDIR_build use_libmysqlclient_r building-libs staticlib depend_includepath qt_install_headers qt depend_includepath qmake_cache target_qt hide_symbols create_libtool create_pc explicitlib moc thread static staticlib -moc_location=${prefix}/bin/moc -uic_location=${prefix}/bin/uic - -Name: Javascriptcore -Description: Javascriptcore Library -Version: 4.6.0 -Libs: -L${libdir} -lJavaScriptCore -Libs.private: -L/depot/obuddenh/qt/lib -lQtGui -L/depot/obuddenh/qt/lib -L/usr/X11R6/lib -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread -ldl -Cflags: -DQT_SHARED -I/depot/obuddenh/qt/include -I${includedir} - -- cgit v0.12 From e15d415acbd426e58fb1e967eb331fe41488dfff Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Tue, 12 May 2009 14:47:49 +0200 Subject: Added QTextListFormat::ListUpperRoman and QTextListFormat::ListLowerRoman for roman numbering of lists as supported by HTML/ODF Reviewed-by: Olivier Goffart Merge-request: 681 --- demos/textedit/textedit.cpp | 8 ++++++ src/gui/text/qcssparser.cpp | 10 ++++--- src/gui/text/qcssparser_p.h | 2 ++ src/gui/text/qtextdocument.cpp | 7 ++++- src/gui/text/qtextdocumentlayout.cpp | 6 ++++- src/gui/text/qtextformat.cpp | 2 ++ src/gui/text/qtextformat.h | 2 ++ src/gui/text/qtexthtmlparser.cpp | 6 +++++ src/gui/text/qtextlist.cpp | 49 ++++++++++++++++++++++++++++++++++ src/gui/text/qtextodfwriter.cpp | 8 +++++- tests/auto/qtextlist/tst_qtextlist.cpp | 36 +++++++++++++++++++++++++ 11 files changed, 129 insertions(+), 7 deletions(-) diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index 17516b4..5eee855 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -336,6 +336,8 @@ void TextEdit::setupTextActions() comboStyle->addItem("Ordered List (Decimal)"); comboStyle->addItem("Ordered List (Alpha lower)"); comboStyle->addItem("Ordered List (Alpha upper)"); + comboStyle->addItem("Ordered List (Roman lower)"); + comboStyle->addItem("Ordered List (Roman upper)"); connect(comboStyle, SIGNAL(activated(int)), this, SLOT(textStyle(int))); @@ -573,6 +575,12 @@ void TextEdit::textStyle(int styleIndex) case 6: style = QTextListFormat::ListUpperAlpha; break; + case 7: + style = QTextListFormat::ListLowerRoman; + break; + case 8: + style = QTextListFormat::ListUpperRoman; + break; } cursor.beginEditBlock(); diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index ab69e5c..db5ed7c 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -199,6 +199,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = { { "link", Value_Link }, { "link-visited", Value_LinkVisited }, { "lower-alpha", Value_LowerAlpha }, + { "lower-roman", Value_LowerRoman }, { "lowercase", Value_Lowercase }, { "medium", Value_Medium }, { "mid", Value_Mid }, @@ -230,6 +231,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = { { "transparent", Value_Transparent }, { "underline", Value_Underline }, { "upper-alpha", Value_UpperAlpha }, + { "upper-roman", Value_UpperRoman }, { "uppercase", Value_Uppercase }, { "wave", Value_Wave }, { "window", Value_Window }, @@ -239,10 +241,10 @@ static const QCssKnownValue values[NumKnownValues - 1] = { }; //Map id to strings as they appears in the 'values' array above -static const short indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46, - 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16, - 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0, - 51, 44, 43 }; +static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 54, 35, 26, 70, 71, 25, 43, 5, 63, 47, + 29, 58, 59, 27, 51, 61, 6, 10, 39, 56, 19, 13, 17, 18, 20, 21, 50, 24, 46, 67, 37, 3, 2, 40, 62, 16, + 11, 57, 14, 32, 64, 33, 65, 55, 66, 34, 69, 8, 28, 38, 12, 36, 60, 7, 9, 4, 68, 53, 22, 23, 30, 31, + 1, 15, 0, 52, 45, 44 }; QString Value::toString() const { diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index 8056f4d..b07acd5 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -223,6 +223,8 @@ enum KnownValue { Value_Decimal, Value_LowerAlpha, Value_UpperAlpha, + Value_LowerRoman, + Value_UpperRoman, Value_SmallCaps, Value_Uppercase, Value_Lowercase, diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 3287f31..3531699 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2416,7 +2416,10 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment) static bool isOrderedList(int style) { return style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha - || style == QTextListFormat::ListUpperAlpha; + || style == QTextListFormat::ListUpperAlpha + || style == QTextListFormat::ListUpperRoman + || style == QTextListFormat::ListLowerRoman + ; } void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block) @@ -2513,6 +2516,8 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block) case QTextListFormat::ListSquare: html += QLatin1String("
      (object)->itemText(bl); size.setWidth(fontMetrics.width(itemText)); size.setHeight(fontMetrics.height()); @@ -1426,7 +1428,9 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p switch (style) { case QTextListFormat::ListDecimal: case QTextListFormat::ListLowerAlpha: - case QTextListFormat::ListUpperAlpha: { + case QTextListFormat::ListUpperAlpha: + case QTextListFormat::ListLowerRoman: + case QTextListFormat::ListUpperRoman: { QTextLayout layout(itemText, font, q->paintDevice()); layout.setCacheEnabled(true); QTextOption option(Qt::AlignLeft | Qt::AlignAbsolute); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 9bc62b1..4e43418 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -2078,6 +2078,8 @@ QList QTextBlockFormat::tabPositions() const \value ListDecimal decimal values in ascending order \value ListLowerAlpha lower case Latin characters in alphabetical order \value ListUpperAlpha upper case Latin characters in alphabetical order + \value ListLowerRoman lower case roman numerals (supports up to 4999 items only) + \value ListUpperRoman upper case roman numerals (supports up to 4999 items only) \omitvalue ListStyleUndefined */ diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index d269687..9697105 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -604,6 +604,8 @@ public: ListDecimal = -4, ListLowerAlpha = -5, ListUpperAlpha = -6, + ListLowerRoman = -7, + ListUpperRoman = -8, ListStyleUndefined = 0 }; diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 1bff162..a88cd17 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1206,6 +1206,8 @@ void QTextHtmlParserNode::setListStyle(const QVector &cssValues) case QCss::Value_Decimal: hasOwnListStyle = true; listStyle = QTextListFormat::ListDecimal; break; case QCss::Value_LowerAlpha: hasOwnListStyle = true; listStyle = QTextListFormat::ListLowerAlpha; break; case QCss::Value_UpperAlpha: hasOwnListStyle = true; listStyle = QTextListFormat::ListUpperAlpha; break; + case QCss::Value_LowerRoman: hasOwnListStyle = true; listStyle = QTextListFormat::ListLowerRoman; break; + case QCss::Value_UpperRoman: hasOwnListStyle = true; listStyle = QTextListFormat::ListUpperRoman; break; default: break; } } @@ -1540,6 +1542,10 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) node->listStyle = QTextListFormat::ListLowerAlpha; } else if (value == QLatin1String("A")) { node->listStyle = QTextListFormat::ListUpperAlpha; + } else if (value == QLatin1String("i")) { + node->listStyle = QTextListFormat::ListLowerRoman; + } else if (value == QLatin1String("I")) { + node->listStyle = QTextListFormat::ListUpperRoman; } else { value = value.toLower(); if (value == QLatin1String("square")) diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index addd7a5..02b1c63 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -212,6 +212,55 @@ QString QTextList::itemText(const QTextBlock &blockIt) const } } break; + case QTextListFormat::ListLowerRoman: + case QTextListFormat::ListUpperRoman: + { + if (item < 5000) { + QByteArray romanNumeral; + + // works for up to 4999 items + static const char romanSymbolsLower[] = "iiivixxxlxcccdcmmmm"; + static const char romanSymbolsUpper[] = "IIIVIXXXLXCCCDCMMMM"; + QByteArray romanSymbols; // wrap to have "mid" + if (style == QTextListFormat::ListLowerRoman) + romanSymbols = QByteArray::fromRawData(romanSymbolsLower, sizeof(romanSymbolsLower)); + else + romanSymbols = QByteArray::fromRawData(romanSymbolsUpper, sizeof(romanSymbolsUpper)); + + int c[] = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 }; + int n = item; + for (int i = 12; i >= 0; n %= c[i], i--) { + int q = n / c[i]; + if (q > 0) { + int startDigit = i + (i+3)/4; + int numDigits; + if (i % 4) { + // c[i] == 4|5|9|40|50|90|400|500|900 + if ((i-2) % 4) { + // c[i] == 4|9|40|90|400|900 => with substraction (IV, IX, XL, XC, ...) + numDigits = 2; + } + else { + // c[i] == 5|50|500 (V, L, D) + numDigits = 1; + } + } + else { + // c[i] == 1|10|100|1000 (I, II, III, X, XX, ...) + numDigits = q; + } + + romanNumeral.append(romanSymbols.mid(startDigit, numDigits)); + } + } + result = QString::fromLatin1(romanNumeral); + } + else { + result = QLatin1String("?"); + } + + } + break; default: Q_ASSERT(false); } diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index b0c16ee..883cf80 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -174,6 +174,10 @@ static QString bulletChar(QTextListFormat::Style style) return QString::fromLatin1("a"); case QTextListFormat::ListUpperAlpha: return QString::fromLatin1("A"); + case QTextListFormat::ListLowerRoman: + return QString::fromLatin1("i"); + case QTextListFormat::ListUpperRoman: + return QString::fromLatin1("I"); default: case QTextListFormat::ListStyleUndefined: return QString(); @@ -619,7 +623,9 @@ void QTextOdfWriter::writeListFormat(QXmlStreamWriter &writer, QTextListFormat f QTextListFormat::Style style = format.style(); if (style == QTextListFormat::ListDecimal || style == QTextListFormat::ListLowerAlpha - || style == QTextListFormat::ListUpperAlpha) { + || style == QTextListFormat::ListUpperAlpha + || style == QTextListFormat::ListLowerRoman + || style == QTextListFormat::ListUpperRoman) { writer.writeStartElement(textNS, QString::fromLatin1("list-level-style-number")); writer.writeAttribute(styleNS, QString::fromLatin1("num-format"), bulletChar(style)); writer.writeAttribute(styleNS, QString::fromLatin1("num-suffix"), QString::fromLatin1(".")); diff --git a/tests/auto/qtextlist/tst_qtextlist.cpp b/tests/auto/qtextlist/tst_qtextlist.cpp index 658b8bb..e41d3be 100644 --- a/tests/auto/qtextlist/tst_qtextlist.cpp +++ b/tests/auto/qtextlist/tst_qtextlist.cpp @@ -67,6 +67,8 @@ private slots: void item(); void autoNumbering(); void autoNumberingRTL(); + void romanNumbering(); + void romanNumberingLimit(); void formatChange(); void cursorNavigation(); void partialRemoval(); @@ -142,6 +144,40 @@ void tst_QTextList::autoNumberingRTL() QVERIFY(cursor.currentList()->itemText(cursor.block()) == ".B"); } +void tst_QTextList::romanNumbering() +{ + QTextListFormat fmt; + fmt.setStyle(QTextListFormat::ListUpperRoman); + QTextList *list = cursor.createList(fmt); + QVERIFY(list); + + for (int i = 0; i < 4998; ++i) + cursor.insertBlock(); + + QVERIFY(list->count() == 4999); + + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4998); + QVERIFY(cursor.currentList()->itemText(cursor.block()) == "MMMMCMXCIX."); +} + +void tst_QTextList::romanNumberingLimit() +{ + QTextListFormat fmt; + fmt.setStyle(QTextListFormat::ListLowerRoman); + QTextList *list = cursor.createList(fmt); + QVERIFY(list); + + for (int i = 0; i < 4999; ++i) + cursor.insertBlock(); + + QVERIFY(list->count() == 5000); + + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4999); + QVERIFY(cursor.currentList()->itemText(cursor.block()) == "?."); +} + void tst_QTextList::formatChange() { // testing the formatChanged slot in QTextListManager -- cgit v0.12 From 9db4b800a2c8da5916a6d5da9e37a17d185cdc5e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 13 Jul 2009 17:07:42 +0200 Subject: More tests for list numbering --- .../tst_qtextdocumentfragment.cpp | 10 ++++++ tests/auto/qtextlist/tst_qtextlist.cpp | 40 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 56f5e7a..4559daa 100644 --- a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -2758,6 +2758,16 @@ void tst_QTextDocumentFragment::css_listStyleType() QVERIFY(cursor.currentList()); QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperAlpha); + doc->setHtml("
      • Blah
      "); + cursor.movePosition(QTextCursor::End); + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperRoman); + + doc->setHtml("
      • Blah
      "); + cursor.movePosition(QTextCursor::End); + QVERIFY(cursor.currentList()); + QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListLowerRoman); + // ignore the unsupported list-style-position inside the list-style shorthand property doc->setHtml("
      • Blah
      "); cursor.movePosition(QTextCursor::End); diff --git a/tests/auto/qtextlist/tst_qtextlist.cpp b/tests/auto/qtextlist/tst_qtextlist.cpp index e41d3be..4ab6f5a 100644 --- a/tests/auto/qtextlist/tst_qtextlist.cpp +++ b/tests/auto/qtextlist/tst_qtextlist.cpp @@ -77,6 +77,8 @@ private slots: void add(); void defaultIndent(); void blockUpdate(); + void numbering_data(); + void numbering(); private: QTextDocument *doc; @@ -336,5 +338,43 @@ void tst_QTextList::blockUpdate() QVERIFY(!layout->error); } +void tst_QTextList::numbering_data() +{ + QTest::addColumn("format"); + QTest::addColumn("number"); + QTest::addColumn("result"); + + QTest::newRow("E.") << int(QTextListFormat::ListUpperAlpha) << 5 << "E."; + QTest::newRow("abc.") << int(QTextListFormat::ListLowerAlpha) << (26 + 2) * 26 + 3 << "abc."; + QTest::newRow("12.") << int(QTextListFormat::ListDecimal) << 12 << "12."; + QTest::newRow("XXIV.") << int(QTextListFormat::ListUpperRoman) << 24 << "XXIV."; + QTest::newRow("VIII.") << int(QTextListFormat::ListUpperRoman) << 8 << "VIII."; + QTest::newRow("xxx.") << int(QTextListFormat::ListLowerRoman) << 30 << "xxx."; + QTest::newRow("xxix.") << int(QTextListFormat::ListLowerRoman) << 29 << "xxix."; +// QTest::newRow("xxx. alpha") << int(QTextListFormat::ListLowerAlpha) << (24 * 26 + 24) * 26 + 24 << "xxx."; //Too slow +} + +void tst_QTextList::numbering() +{ + QFETCH(int, format); + QFETCH(int, number); + QFETCH(QString, result); + + + QTextListFormat fmt; + fmt.setStyle(QTextListFormat::Style(format)); + QTextList *list = cursor.createList(fmt); + QVERIFY(list); + + for (int i = 1; i < number; ++i) + cursor.insertBlock(); + + QCOMPARE(list->count(), number); + + QVERIFY(cursor.currentList()); + QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), number - 1); + QCOMPARE(cursor.currentList()->itemText(cursor.block()), result); +} + QTEST_MAIN(tst_QTextList) #include "tst_qtextlist.moc" -- cgit v0.12 From ecffc68ab222309e30d83a55022169cef9acfd81 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 17:24:43 +0200 Subject: Fix WebKit import url Fix the contents of src/3rdparty/webkit/VERSION to point to gitorious.org Reviewed-by: Trust me --- util/webkit/mkdist-webkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index c26fdc1..f63bf22 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -268,7 +268,7 @@ rm -rf $srcdir/WebKitBuild cat >$srcdir/VERSION < Date: Mon, 13 Jul 2009 17:26:02 +0200 Subject: Fix import of WebKit from the trunk Don't try to remove the scons files, as they were removed upstream. Reviewed-by: Trust me --- util/webkit/mkdist-webkit | 2 -- 1 file changed, 2 deletions(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 1837dd5..9e9d656 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -154,10 +154,8 @@ files_to_remove="$files_to_remove WebKit/qt/QtLauncher/main.cpp" files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp" files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl" -files_to_remove="$files_to_remove JavaScriptCore/SConstruct" files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl" -files_to_remove="$files_to_remove WebCore/SConstruct" files_to_remove="$files_to_remove WebCore/WebCoreSources.bkl" files_to_remove="$files_to_remove WebCore/webcore-base.bkl" files_to_remove="$files_to_remove WebCore/webcore-wx.bkl" -- cgit v0.12 From 3e5d7444b883778663d1e31e54afffae65921da3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 17:45:53 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( a3e05ad8acdead3b534d0cef772b85f002e80b8d ) Changes in WebKit since the last update: ++ b/LayoutTests/ChangeLog 2009-06-18 Chris Evans Reviewed by Adam Barth. Added test for bug 26454 (broken 8-digit hex entities). https://bugs.webkit.org/show_bug.cgi?id=26454 * fast/parser/eightdigithexentity-expected.txt: Added. * fast/parser/eightdigithexentity.html: Added. 2009-06-20 Sam Weinig Reviewed by Adam Barth. Test for https://bugs.webkit.org/show_bug.cgi?id=26554 Test writing to parent and top. * http/tests/security/cross-frame-access-put-expected.txt: * http/tests/security/cross-frame-access-put.html: * http/tests/security/resources/cross-frame-iframe-for-put-test.html: ++ b/WebCore/ChangeLog 2009-06-18 Chris Evans Reviewed by Adam Barth. Fix 8-digit long hex entities. Fixes bug 26454 https://bugs.webkit.org/show_bug.cgi?id=26454 Test: fast/parser/eightdigithexentity.html * html/HTMLTokenizer.cpp: fix off-by-ones. 2009-06-20 Sam Weinig Reviewed by Adam Barth. Fix for https://bugs.webkit.org/show_bug.cgi?id=26554 Shadowing of top and parent * page/DOMWindow.idl: --- src/3rdparty/webkit/VERSION | 4 ++-- src/3rdparty/webkit/WebCore/ChangeLog | 20 ++++++++++++++++++++ .../webkit/WebCore/generated/JSDOMWindow.cpp | 4 ++++ src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 8 ++++++-- src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 4 ++-- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 368d2b5..88f32d9 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -1,6 +1,6 @@ This is a snapshot of the Qt port of WebKit from - git://code.staikos.net/webkit + git://gitorious.org/qtwebkit/qtwebkit.git The commit imported was from the @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - eb4957a561d3f85d4cd5602832375c66f378b521 + a3e05ad8acdead3b534d0cef772b85f002e80b8d diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index be6922f..19bb36a 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,23 @@ +2009-06-18 Chris Evans + + Reviewed by Adam Barth. + + Fix 8-digit long hex entities. Fixes bug 26454 + https://bugs.webkit.org/show_bug.cgi?id=26454 + + Test: fast/parser/eightdigithexentity.html + + * html/HTMLTokenizer.cpp: fix off-by-ones. + +2009-06-20 Sam Weinig + + Reviewed by Adam Barth. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=26554 + Shadowing of top and parent + + * page/DOMWindow.idl: + 2008-12-18 Bernhard Rosenkraenzer Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp index c6906b6..d692150 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp @@ -2496,11 +2496,15 @@ void setJSDOMWindowOpener(ExecState* exec, JSObject* thisObject, JSValuePtr valu void setJSDOMWindowParent(ExecState* exec, JSObject* thisObject, JSValuePtr value) { + if (!static_cast(thisObject)->allowsAccessFrom(exec)) + return; static_cast(thisObject)->putDirect(Identifier(exec, "parent"), value); } void setJSDOMWindowTop(ExecState* exec, JSObject* thisObject, JSValuePtr value) { + if (!static_cast(thisObject)->allowsAccessFrom(exec)) + return; static_cast(thisObject)->putDirect(Identifier(exec, "top"), value); } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp index 6de9951..b6a5418 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp @@ -867,7 +867,9 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de } } else { // FIXME: We should eventually colorize entities by sending them as a special token. - checkBuffer(11); + // 12 bytes required: up to 10 bytes in m_cBuffer plus the + // leading '&' and trailing ';' + checkBuffer(12); *dest++ = '&'; for (unsigned i = 0; i < cBufferPos; i++) dest[i] = m_cBuffer[i]; @@ -878,7 +880,9 @@ HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& de } } } else { - checkBuffer(10); + // 11 bytes required: up to 10 bytes in m_cBuffer plus the + // leading '&' + checkBuffer(11); // ignore the sequence, add it to the buffer as plaintext *dest++ = '&'; for (unsigned i = 0; i < cBufferPos; i++) diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl index d0114e6..71c3137 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl @@ -121,8 +121,8 @@ module window { attribute [Replaceable, DoNotCheckDomainSecurityOnGet] DOMWindow frames; attribute [Replaceable, DoNotCheckDomainSecurityOnGet] DOMWindow opener; - attribute [Replaceable, DoNotCheckDomainSecurity] DOMWindow parent; - attribute [Replaceable, DoNotCheckDomainSecurity] DOMWindow top; + attribute [Replaceable, DoNotCheckDomainSecurityOnGet] DOMWindow parent; + attribute [Replaceable, DoNotCheckDomainSecurityOnGet] DOMWindow top; // DOM Level 2 AbstractView Interface readonly attribute Document document; -- cgit v0.12 From 46df9f83cb64541f7d9ecd34645ef1558ce1c0c6 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 13 Jul 2009 17:53:34 +0200 Subject: Fixed a potential memory leak on XP Calling OpenThemeData directly causes a leak when changing the style as we do not call the corresponding CloseThemeData. Task-number:257916 Reviewed-by:prasanth --- src/gui/styles/qwindowsxpstyle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 2abf3bc..1b8ceae 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -1202,7 +1202,8 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option, if (const QStyleOptionButton *btn = qstyleoption_cast(option)) { MARGINS borderSize; if (widget) { - HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button"); + XPThemeData buttontheme(widget, 0, QLatin1String("Button")); + HTHEME theme = buttontheme.handle(); if (theme) { int stateId; if (!(option->state & State_Enabled)) @@ -3611,7 +3612,8 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt case CT_LineEdit: case CT_ComboBox: { - HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button"); + XPThemeData buttontheme(widget, 0, QLatin1String("Button")); + HTHEME theme = buttontheme.handle(); MARGINS borderSize; if (theme) { int result = pGetThemeMargins(theme, -- cgit v0.12 From b7598e32617ea8608d7c82800e1706d9180ddbd9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 13 Jul 2009 17:53:49 +0200 Subject: make examples/activeqt/webbrowser work on Windows CE This example only worked on desktop Windows and Windows mobile. Windows CE uses the same GUID for the Internet Explorer ActiveX control like desktop Windows. Task-number: 255111 Reviewed-by: thartman --- examples/activeqt/webbrowser/main.cpp | 4 +- .../webbrowser/mainwindow_windowsmobile.ui | 299 +++++++++++++++++++++ examples/activeqt/webbrowser/webbrowser.pro | 2 +- examples/activeqt/webbrowser/wincemainwindow.ui | 299 --------------------- 4 files changed, 302 insertions(+), 302 deletions(-) create mode 100644 examples/activeqt/webbrowser/mainwindow_windowsmobile.ui delete mode 100644 examples/activeqt/webbrowser/wincemainwindow.ui diff --git a/examples/activeqt/webbrowser/main.cpp b/examples/activeqt/webbrowser/main.cpp index ab14c0b..e83ef56 100644 --- a/examples/activeqt/webbrowser/main.cpp +++ b/examples/activeqt/webbrowser/main.cpp @@ -46,8 +46,8 @@ #include #include -#if defined(Q_OS_WINCE) -#include "ui_wincemainwindow.h" +#if defined(Q_WS_WINCE_WM) +#include "ui_mainwindow_windowsmobile.h" #include #else #include "ui_mainwindow.h" diff --git a/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui new file mode 100644 index 0000000..98a9ddb --- /dev/null +++ b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui @@ -0,0 +1,299 @@ + + MainWindow + + + MainWindow + + + + 0 + 0 + 812 + 605 + + + + Qt WebBrowser + + + + + unnamed + + + 0 + + + 6 + + + + + Frame3 + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + unnamed + + + 1 + + + 0 + + + + + WebBrowser + + + Qt::StrongFocus + + + {F5AFC7EF-1571-48B6-A69C-F1833F4C3A44} + + + + + + + + + + + tbNavigate + + + Navigation + + + + + + + + + + + + tbAddress + + + Address + + + + lblAddress + + + Address + + + + + addressEdit + + + + + + + menubar + + + + PopupMenu + + + &File + + + + FileNewGroup_2 + + + New + + + + + + + + + + + unnamed + + + &Help + + + + + + + + + + actionGo + + + image0 + + + Go + + + + + actionBack + + + image1 + + + Back + + + Backspace + + + + + actionForward + + + image2 + + + Forward + + + + + actionStop + + + image3 + + + Stop + + + + + actionRefresh + + + image4 + + + Refresh + + + + + actionHome + + + image5 + + + Home + + + + + actionFileClose + + + Close + + + C&lose + + + + + actionSearch + + + image6 + + + Search + + + + + actionAbout + + + About + + + + + actionAboutQt + + + About Qt + + + + + + actionNewWindow + + + Window + + + Ctrl+N + + + + FileNewGroup + + + + + + addressEdit + returnPressed() + actionGo + trigger() + + + + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563 + + + 789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906 + + + 789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853 + + + 789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf + + + 789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635 + + + diff --git a/examples/activeqt/webbrowser/webbrowser.pro b/examples/activeqt/webbrowser/webbrowser.pro index 992d871..32eac71 100644 --- a/examples/activeqt/webbrowser/webbrowser.pro +++ b/examples/activeqt/webbrowser/webbrowser.pro @@ -7,7 +7,7 @@ QTDIR_build:REQUIRES = shared HEADERS = webaxwidget.h SOURCES = main.cpp FORMS = mainwindow.ui -wince*: FORMS = wincemainwindow.ui +wincewm*: FORMS = mainwindow_windowsmobile.ui # install diff --git a/examples/activeqt/webbrowser/wincemainwindow.ui b/examples/activeqt/webbrowser/wincemainwindow.ui deleted file mode 100644 index 98a9ddb..0000000 --- a/examples/activeqt/webbrowser/wincemainwindow.ui +++ /dev/null @@ -1,299 +0,0 @@ - - MainWindow - - - MainWindow - - - - 0 - 0 - 812 - 605 - - - - Qt WebBrowser - - - - - unnamed - - - 0 - - - 6 - - - - - Frame3 - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - unnamed - - - 1 - - - 0 - - - - - WebBrowser - - - Qt::StrongFocus - - - {F5AFC7EF-1571-48B6-A69C-F1833F4C3A44} - - - - - - - - - - - tbNavigate - - - Navigation - - - - - - - - - - - - tbAddress - - - Address - - - - lblAddress - - - Address - - - - - addressEdit - - - - - - - menubar - - - - PopupMenu - - - &File - - - - FileNewGroup_2 - - - New - - - - - - - - - - - unnamed - - - &Help - - - - - - - - - - actionGo - - - image0 - - - Go - - - - - actionBack - - - image1 - - - Back - - - Backspace - - - - - actionForward - - - image2 - - - Forward - - - - - actionStop - - - image3 - - - Stop - - - - - actionRefresh - - - image4 - - - Refresh - - - - - actionHome - - - image5 - - - Home - - - - - actionFileClose - - - Close - - - C&lose - - - - - actionSearch - - - image6 - - - Search - - - - - actionAbout - - - About - - - - - actionAboutQt - - - About Qt - - - - - - actionNewWindow - - - Window - - - Ctrl+N - - - - FileNewGroup - - - - - - addressEdit - returnPressed() - actionGo - trigger() - - - - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563 - - - 789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906 - - - 789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868 - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974 - - - 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853 - - - 789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf - - - 789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635 - - - -- cgit v0.12 From 1cea2ed930377b1bb0d1ce583eacae87d999fc16 Mon Sep 17 00:00:00 2001 From: Thomas Sondergaard Date: Mon, 13 Jul 2009 17:32:02 +0200 Subject: QToolTip: Uses QPalette::ToolTipText default text color for rich text. Task-number: 248429 Merge-request: 786 Reviewed-by: Olivier Goffart --- src/gui/kernel/qwhatsthis.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index f38b0f6..f569c97 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -351,6 +351,7 @@ void QWhatsThat::paintEvent(QPaintEvent*) rect.translate(-r.x(), -r.y()); p.setClipRect(rect); QAbstractTextDocumentLayout::PaintContext context; + context.palette.setColor(QPalette::Text, context.palette.toolTipText()); doc->documentLayout()->draw(&p, context); } else -- cgit v0.12 From 808a6b824fe194d958f5ed1a0fd4f03362ced767 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Mon, 13 Jul 2009 18:27:05 +0200 Subject: Revert "Remove builtin xml schema file until legal issues are clarified" This reverts commit 3ded2e1ea5a74a6fc0d3938fa732f886aa275ca2. --- src/xmlpatterns/schema/builtinschemas.qrc | 1 + src/xmlpatterns/schema/schemas/xml.xsd | 145 ++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 src/xmlpatterns/schema/schemas/xml.xsd diff --git a/src/xmlpatterns/schema/builtinschemas.qrc b/src/xmlpatterns/schema/builtinschemas.qrc index 4ca9cd5..fb43d78 100644 --- a/src/xmlpatterns/schema/builtinschemas.qrc +++ b/src/xmlpatterns/schema/builtinschemas.qrc @@ -1,4 +1,5 @@ + schemas/xml.xsd diff --git a/src/xmlpatterns/schema/schemas/xml.xsd b/src/xmlpatterns/schema/schemas/xml.xsd new file mode 100644 index 0000000..eeb9db5 --- /dev/null +++ b/src/xmlpatterns/schema/schemas/xml.xsd @@ -0,0 +1,145 @@ + + + + + + See http://www.w3.org/XML/1998/namespace.html and + http://www.w3.org/TR/REC-xml for information about this namespace. + + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + + Note that local names in this namespace are intended to be defined + only by the World Wide Web Consortium or its subgroups. The + following names are currently defined in this namespace and should + not be used with conflicting semantics by any Working Group, + specification, or document instance: + + base (as an attribute name): denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification. + + id (as an attribute name): denotes an attribute whose value + should be interpreted as if declared to be of type ID. + This name is reserved by virtue of its definition in the + xml:id specification. + + lang (as an attribute name): denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification. + + space (as an attribute name): denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification. + + Father (in any context at all): denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + + In appreciation for his vision, leadership and dedication + the W3C XML Plenary on this 10th day of February, 2000 + reserves for Jon Bosak in perpetuity the XML name + xml:Father + + + + + This schema defines attributes and an attribute group + suitable for use by + schemas wishing to allow xml:base, xml:lang, xml:space or xml:id + attributes on elements they define. + + To enable this, such a schema must import this schema + for the XML namespace, e.g. as follows: + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + + Subsequently, qualified reference to any of the attributes + or the group defined below will have the desired effect, e.g. + + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + + will define a type which will schema-validate an instance + element with any of those attributes + + + + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + http://www.w3.org/2007/08/xml.xsd. + At the date of issue it can also be found at + http://www.w3.org/2001/xml.xsd. + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML Schema + itself, or with the XML namespace itself. In other words, if the XML + Schema or XML namespaces change, the version of this document at + http://www.w3.org/2001/xml.xsd will change + accordingly; the version at + http://www.w3.org/2007/08/xml.xsd will not change. + + + + + + Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. See + RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry + at http://www.iana.org/assignments/lang-tag-apps.htm for + further information. + + The union allows for the 'un-declaration' of xml:lang with + the empty string. + + + + + + + + + + + + + + + + + + + + + + + + See http://www.w3.org/TR/xmlbase/ for + information about this attribute. + + + + + + See http://www.w3.org/TR/xml-id/ for + information about this attribute. + + + + + + + + + + + -- cgit v0.12 From 2567ec486d5d95dc4ca06874cf75bf03bd7502b9 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Mon, 13 Jul 2009 18:32:31 +0200 Subject: Add W3C license text for xml.xsd --- src/xmlpatterns/schema/xml.xsd-LICENSE | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/xmlpatterns/schema/xml.xsd-LICENSE diff --git a/src/xmlpatterns/schema/xml.xsd-LICENSE b/src/xmlpatterns/schema/xml.xsd-LICENSE new file mode 100644 index 0000000..2c687d8 --- /dev/null +++ b/src/xmlpatterns/schema/xml.xsd-LICENSE @@ -0,0 +1,40 @@ +W3C® SOFTWARE NOTICE AND LICENSE + +This license came from: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + +This work (and included software, documentation such as READMEs, or other +related items) is being provided by the copyright holders under the following +license. By obtaining, using and/or copying this work, you (the licensee) +agree that you have read, understood, and will comply with the following +terms and conditions. + +Permission to copy, modify, and distribute this software and its +documentation, with or without modification, for any purpose and without +fee or royalty is hereby granted, provided that you include the following on +ALL copies of the software and documentation or portions thereof, including +modifications: + + 1. The full text of this NOTICE in a location viewable to users of the + redistributed or derivative work. + 2. Any pre-existing intellectual property disclaimers, notices, or terms + and conditions. If none exist, the W3C Software Short Notice should be + included (hypertext is preferred, text is permitted) + within the body of any redistributed or derivative code. + 3. Notice of any changes or modifications to the files, including the date + changes were made. (We recommend you provide URIs to the location from + which the code is derived.) + +THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS +MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR +PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE +ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + +COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR +DOCUMENTATION. + +The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to the software without specific, written +prior permission. Title to copyright in this software and any associated +documentation will at all times remain with copyright holders. -- cgit v0.12 From c549bda8cd38a099118f3cf4c7e5462010cb7259 Mon Sep 17 00:00:00 2001 From: Noah White-Hamerslough Date: Mon, 13 Jul 2009 18:58:48 +0200 Subject: Fixes: The keyboard navigation of QComboBox don't work with the completion Merge-request: 653 Reviewed-by: Olivier Goffart Task-number: 247560 --- src/gui/util/qcompleter.cpp | 4 ++-- tests/auto/qcompleter/tst_qcompleter.cpp | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index f4adcea..d68e309 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1182,7 +1182,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) case Qt::Key_Up: if (!curIndex.isValid()) { int rowCount = d->proxy->rowCount(); - QModelIndex lastIndex = d->proxy->index(rowCount - 1, 0); + QModelIndex lastIndex = d->proxy->index(rowCount - 1, d->column); d->setCurrentIndex(lastIndex); return true; } else if (curIndex.row() == 0) { @@ -1194,7 +1194,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) case Qt::Key_Down: if (!curIndex.isValid()) { - QModelIndex firstIndex = d->proxy->index(0, 0); + QModelIndex firstIndex = d->proxy->index(0, d->column); d->setCurrentIndex(firstIndex); return true; } else if (curIndex.row() == d->proxy->rowCount() - 1) { diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index baea419..bbc01cc 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -146,6 +146,8 @@ private slots: void task253125_lineEditCompletion_data(); void task253125_lineEditCompletion(); + void task247560_keyboardNavigation(); + private: void filter(); void testRowCount(); @@ -1230,5 +1232,43 @@ void tst_QCompleter::task253125_lineEditCompletion() QCOMPARE(edit.text(), QString("iota")); } +void tst_QCompleter::task247560_keyboardNavigation() +{ + QStandardItemModel model; + + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 5; j++) { + model.setItem(i, j, new QStandardItem(QString("row %1 column %2").arg(i).arg(j))); + } + } + + + QCompleter completer(&model); + completer.setCompletionColumn(1); + + QLineEdit edit; + edit.setCompleter(&completer); + edit.show(); + edit.setFocus(); + + QTest::qWait(100); + + QTest::keyClick(&edit, 'r'); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); + + QCOMPARE(edit.text(), QString("row 1 column 1")); + + edit.clear(); + + QTest::keyClick(&edit, 'r'); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Up); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Up); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); + + QCOMPARE(edit.text(), QString("row 3 column 1")); +} + QTEST_MAIN(tst_QCompleter) #include "tst_qcompleter.moc" -- cgit v0.12 From 0c3068761598e9decd2bdc903be5431d093b8eac Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 13 Jul 2009 19:09:33 +0200 Subject: Make test faster + fix whitespace --- tests/auto/qcompleter/tst_qcompleter.cpp | 41 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index bbc01cc..fb03e1a 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -58,9 +58,9 @@ class CsvCompleter : public QCompleter Q_OBJECT public: CsvCompleter(QObject *parent = 0) : QCompleter(parent), csv(true) { } - - QString pathFromIndex(const QModelIndex& sourceIndex) const; - + + QString pathFromIndex(const QModelIndex& sourceIndex) const; + void setCsvCompletion(bool set) { csv = set; } protected: @@ -178,7 +178,7 @@ tst_QCompleter::~tst_QCompleter() } void tst_QCompleter::setSourceModel(ModelType type) -{ +{ QString text; QTreeWidgetItem *parent, *child; treeWidget->clear(); @@ -284,7 +284,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() for (int i = 0; i < 2; i++) { if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; - + // Plain text filter QTest::newRow("()") << "" << "" << "P0" << "P0"; QTest::newRow("()F") << "" << "F" << "P0" << "P0"; @@ -301,7 +301,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() QTest::newRow("(p)NNNN") << "p" << "NNNN" << "p4" << "p4"; QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + // Tree filter QTest::newRow("(P0,)") << "P0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(P0,c)") << "P0,c" << "" << "c0P0" << "P0,c0P0"; @@ -335,7 +335,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data() QTest::addColumn("completion"); QTest::addColumn("completionText"); - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; @@ -354,7 +354,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data() QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1"; QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + //// Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0"; @@ -406,7 +406,7 @@ void tst_QCompleter::ciMatchingOnCsSortedModel_data() QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1"; QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + // Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0"; @@ -458,7 +458,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data() QTest::newRow("(p)NNN") << "p" << "NNN" << "p3" << "p3"; QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + //// Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0p0" << "p0,c0p0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0p0" << "p0,c0p0"; @@ -471,7 +471,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data() QTest::newRow("(p3,,c)") << "p3,,c" << "" << "" << ""; QTest::newRow("(p3,c0P3,)") << "p3,c0P3," << "" << "" << ""; QTest::newRow("(p,)") << "p," << "" << "" << ""; - + QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; } } @@ -509,13 +509,13 @@ void tst_QCompleter::directoryModel_data() QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; #elif defined (Q_OS_MAC) QTest::newRow("()") << "" << "" << "/" << "/"; - QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; + QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer"; #else QTest::newRow("()") << "" << "" << "/" << "/"; #if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) QTest::newRow("(/h)") << "/h" << "" << "home" << "/home"; -#endif +#endif QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc"; QTest::newRow("(/etc/passw)") << "/etc/passw" << "" << "passwd" << "/etc/passwd"; #endif @@ -661,7 +661,7 @@ void tst_QCompleter::currentRow() completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); setSourceModel(CASE_INSENSITIVELY_SORTED_MODEL); - + // blank text completer->setCompletionPrefix(""); QCOMPARE(completer->currentRow(), 0); @@ -693,7 +693,7 @@ void tst_QCompleter::sortedEngineMapFromSource() QModelIndex si1, si2, pi; QAbstractItemModel *sourceModel = completer->model(); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast(completer->completionModel()); // Fitering ON @@ -764,7 +764,7 @@ void tst_QCompleter::unsortedEngineMapFromSource() QModelIndex si, si2, si3, pi; QAbstractItemModel *sourceModel = completer->model(); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast(completer->completionModel()); si = sourceModel->index(6, completionColumn); // "P3" @@ -846,7 +846,7 @@ void tst_QCompleter::historySearch() completer->setCaseSensitivity(Qt::CaseSensitive); setSourceModel(HISTORY_MODEL); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast(completer->completionModel()); // "p3,c3p3" and "p2,c4p2" are added in the tree root @@ -954,7 +954,7 @@ void tst_QCompleter::multipleWidgets() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&window); #endif - QTest::qWait(5000); + QTest::qWait(50); QTRY_VERIFY(qApp->focusWidget() == comboBox); comboBox->lineEdit()->setText("it"); QCOMPARE(comboBox->currentText(), QString("it")); // should not complete with setText @@ -967,7 +967,8 @@ void tst_QCompleter::multipleWidgets() lineEdit->setCompleter(&completer); lineEdit->show(); lineEdit->setFocus(); - QTest::qWait(5000); + QTest::qWait(50); + QTRY_VERIFY(qApp->focusWidget() == lineEdit); lineEdit->setText("it"); QCOMPARE(lineEdit->text(), QString("it")); // should not completer with setText QCOMPARE(comboBox->currentText(), QString("")); // combo box text must not change! @@ -1029,7 +1030,7 @@ void tst_QCompleter::dynamicSortOrder() QCOMPARE(completer.completionCount(), 12); completer.setCompletionPrefix("13"); QCOMPARE(completer.completionCount(), 2); - + root->sortChildren(0, Qt::DescendingOrder); completer.setCompletionPrefix("13"); QCOMPARE(completer.completionCount(), 2); -- cgit v0.12 From 449f033b88a18204404356664b654b85cc086092 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 13 Jul 2009 20:49:43 +0200 Subject: Compile without qt3support --- src/gui/kernel/qwhatsthis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index f569c97..62b5863 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -351,7 +351,7 @@ void QWhatsThat::paintEvent(QPaintEvent*) rect.translate(-r.x(), -r.y()); p.setClipRect(rect); QAbstractTextDocumentLayout::PaintContext context; - context.palette.setColor(QPalette::Text, context.palette.toolTipText()); + context.palette.setBrush(QPalette::Text, context.palette.toolTipText()); doc->documentLayout()->draw(&p, context); } else -- cgit v0.12 From 8e186f42278c7033a2df08f4a986419087457efc Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 13 Jul 2009 11:42:07 -0700 Subject: Clean up QDirectFBPaintEngine code - Remove unnecessary copy of QTransform - Fold matrixRotShear and scale into transformationFlags. Note that transformationFlags is not a proper bitset of the types of transform but rather set to the most complex operation (from QTransform::type()) and having NegativeScale added if qMin(transform.m11(), transform.m22()) < 0 - Fix a bug whereby setState didn't call setRenderHints - Make everything more readable - Don't initialize state in QDirectFBPaintEngine::begin() QDirectFBPaintEngine::setState will be called from QPainter::begin just before QDirectFBPaintEngine::begin Reviewed-by: Donald --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 137 +++++++++++---------- 1 file changed, 71 insertions(+), 66 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 27df0da..db08240 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -80,7 +80,7 @@ template inline const T *ptr(const T &t) { return &t; } template <> inline const bool* ptr(const bool &) { return 0; } template static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - int scale, bool matrixRotShear, bool simplePen, + uint transformationType, bool simplePen, bool dfbHandledClip, bool unsupportedCompositionMode, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, @@ -95,8 +95,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << dev << "of type" << dev->devType(); } - dbg << "scale" << scale - << "matrixRotShear" << matrixRotShear + dbg << QString("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) << "simplePen" << simplePen << "dfbHandledClip" << dfbHandledClip << "unsupportedCompositionMode" << unsupportedCompositionMode; @@ -123,9 +122,10 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \ rasterFallbackWarn("Disabled raster engine operation", \ __FUNCTION__, state()->painter->device(), \ - d_func()->scale, d_func()->matrixRotShear, \ - d_func()->simplePen, d_func()->dfbCanHandleClip(), \ - d_func()->unsupportedCompositionMode, \ + d_func()->transformationType, \ + d_func()->simplePen, \ + d_func()->dfbCanHandleClip(), \ + d_func()->unsupportedCompositionMode, \ #one, one, #two, two, #three, three); \ if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \ return; @@ -138,9 +138,10 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \ rasterFallbackWarn("Falling back to raster engine for", \ __FUNCTION__, state()->painter->device(), \ - d_func()->scale, d_func()->matrixRotShear, \ - d_func()->simplePen, d_func()->dfbCanHandleClip(), \ - d_func()->unsupportedCompositionMode, \ + d_func()->transformationType, \ + d_func()->simplePen, \ + d_func()->dfbCanHandleClip(), \ + d_func()->unsupportedCompositionMode, \ #one, one, #two, two, #three, three); #else #define RASTERFALLBACK(op, one, two, three) @@ -211,16 +212,19 @@ static QCache imageCache(4*1024*1024); // 4 MB class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate { public: - enum Scale { NoScale, Scaled, NegativeScale }; - + enum TransformationTypeFlags { + NegativeScale = 0x100, + RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject), + BlitUnsupported = (NegativeScale|RectsUnsupported) + }; QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p); ~QDirectFBPaintEnginePrivate(); - void setTransform(const QTransform &m); - void setPen(const QPen &pen); + inline void setTransform(const QTransform &transforma); + inline void setPen(const QPen &pen); inline void setCompositionMode(QPainter::CompositionMode mode); inline void setOpacity(quint8 value); - void setRenderHints(QPainter::RenderHints hints); + inline void setRenderHints(QPainter::RenderHints hints); inline void setDFBColor(const QColor &color); @@ -263,11 +267,9 @@ private: bool simplePen; - bool matrixRotShear; - Scale scale; + uint transformationType; // this is QTransform::type() + NegativeScale if qMin(transform.m11(), transform.m22()) < 0 SurfaceCache *surfaceCache; - QTransform transform; int lastLockedHeight; IDirectFB *fb; @@ -288,6 +290,7 @@ private: friend class QDirectFBPaintEngine; }; + QDirectFBPaintEngine::QDirectFBPaintEngine(QPaintDevice *device) : QRasterPaintEngine(*(new QDirectFBPaintEnginePrivate(this)), device) { @@ -318,21 +321,11 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device) device->devType()); } d->lockedMemory = 0; - d->surface->GetSize(d->surface, &d->fbWidth, &d->fbHeight); - d->setTransform(QTransform()); - d->antialiased = false; - d->setOpacity(255); - d->setCompositionMode(state()->compositionMode()); - d->dirtyClip = true; - d->setPen(state()->pen); - const bool status = QRasterPaintEngine::begin(device); - // XXX: QRasterPaintEngine::begin() resets the capabilities gccaps |= PorterDuff; - return status; } @@ -389,30 +382,27 @@ void QDirectFBPaintEngine::renderHintsChanged() void QDirectFBPaintEngine::transformChanged() { Q_D(QDirectFBPaintEngine); - const QDirectFBPaintEnginePrivate::Scale old = d->scale; - d->setTransform(state()->transform()); - if (d->scale != old) { - d->setPen(state()->pen); - } + d->setTransform(state()->matrix); QRasterPaintEngine::transformChanged(); } -void QDirectFBPaintEngine::setState(QPainterState *s) +void QDirectFBPaintEngine::setState(QPainterState *state) { Q_D(QDirectFBPaintEngine); - QRasterPaintEngine::setState(s); + QRasterPaintEngine::setState(state); d->dirtyClip = true; - d->setPen(state()->pen); - d->setOpacity(quint8(state()->opacity * 255)); - d->setCompositionMode(state()->compositionMode()); - d->setTransform(state()->transform()); + d->setPen(state->pen); + d->setOpacity(quint8(state->opacity * 255)); + d->setCompositionMode(state->compositionMode()); + d->setTransform(state->transform()); + d->setRenderHints(state->renderHints); } void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); d->dirtyClip = true; - const QPoint bottom = d->transform.map(QPoint(0, int(path.controlPointRect().y2))); + const QPoint bottom = state()->matrix.map(QPoint(0, int(path.controlPointRect().y2))); if (bottom.y() > d->lastLockedHeight) d->lock(); QRasterPaintEngine::clip(path, op); @@ -423,7 +413,7 @@ void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) Q_D(QDirectFBPaintEngine); d->dirtyClip = true; if (d->clip() && !d->clip()->hasRectClip && d->clip()->enabled) { - const QPoint bottom = d->transform.map(QPoint(0, rect.bottom())); + const QPoint bottom = state()->matrix.map(QPoint(0, rect.bottom())); if (bottom.y() > d->lastLockedHeight) d->lock(); } @@ -436,8 +426,11 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) Q_D(QDirectFBPaintEngine); d->updateClip(); const QBrush &brush = state()->brush; - if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear - || !d->simplePen || !d->isSimpleBrush(brush)) { + if (d->unsupportedCompositionMode + || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported) + || !d->simplePen + || !d->dfbCanHandleClip() + || !d->isSimpleBrush(brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -461,8 +454,11 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) Q_D(QDirectFBPaintEngine); d->updateClip(); const QBrush &brush = state()->brush; - if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear - || !d->simplePen || !d->isSimpleBrush(brush)) { + if (d->unsupportedCompositionMode + || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported) + || !d->simplePen + || !d->dfbCanHandleClip() + || !d->isSimpleBrush(brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -544,8 +540,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, d->updateClip(); #if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE if (d->unsupportedCompositionMode - || d->matrixRotShear - || d->scale == QDirectFBPaintEnginePrivate::NegativeScale + || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported) || !d->dfbCanHandleClip(r) #ifndef QT_DIRECTFB_IMAGECACHE || QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN @@ -590,8 +585,9 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); d->lock(); QRasterPaintEngine::drawPixmap(r, pixmap, sr); - } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear - || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { + } else if (d->unsupportedCompositionMode + || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported) + || !d->dfbCanHandleClip(r)) { RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); const QImage *img = static_cast(pixmap.pixmapData())->buffer(DSLF_READ); d->lock(); @@ -623,8 +619,9 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset); - } else if (d->unsupportedCompositionMode || !d->dfbCanHandleClip(r) || d->matrixRotShear - || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { + } else if (d->unsupportedCompositionMode + || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported) + || !d->dfbCanHandleClip(r)) { RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); const QImage *img = static_cast(pixmap.pixmapData())->buffer(DSLF_READ); d->lock(); @@ -719,7 +716,9 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->unsupportedCompositionMode && d->dfbCanHandleClip(rect) && !d->matrixRotShear) { + if (!d->unsupportedCompositionMode + && !(d->transformationType & (QDirectFBPaintEnginePrivate::RectsUnsupported)) + && d->dfbCanHandleClip(rect)) { switch (brush.style()) { case Qt::SolidPattern: { const QColor color = brush.color(); @@ -727,12 +726,12 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) return; d->unlock(); d->setDFBColor(color); - const QRect r = d->transform.mapRect(rect).toRect(); + const QRect r = state()->matrix.mapRect(rect).toRect(); d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()); return; } case Qt::TexturePattern: { - if (d->scale == QDirectFBPaintEnginePrivate::NegativeScale) + if (d->transformationType & QDirectFBPaintEnginePrivate::NegativeScale) break; const QPixmap texture = brush.texture(); @@ -757,14 +756,16 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) return; Q_D(QDirectFBPaintEngine); d->updateClip(); - if (d->unsupportedCompositionMode || !d->dfbCanHandleClip() || d->matrixRotShear) { + if (d->unsupportedCompositionMode + || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported) + || !d->dfbCanHandleClip()) { RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, color); } else { d->unlock(); d->setDFBColor(color); - const QRect r = d->transform.mapRect(rect).toRect(); + const QRect r = state()->matrix.mapRect(rect).toRect(); d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()); } @@ -835,7 +836,7 @@ void QDirectFBPaintEngine::initImageCache(int size) QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) : surface(0), antialiased(false), simplePen(false), - matrixRotShear(false), scale(NoScale), lastLockedHeight(-1), + transformationType(0), lastLockedHeight(-1), fbWidth(-1), fbHeight(-1), opacity(255), dirtyClip(true), dfbHandledClip(false), dfbDevice(0), lockedMemory(0), unsupportedCompositionMode(false), q(p) @@ -894,17 +895,13 @@ void QDirectFBPaintEnginePrivate::unlock() lockedMemory = 0; } -void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m) +void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) { - transform = m; - matrixRotShear = (transform.m12() != 0 || transform.m21() != 0); + transformationType = transform.type(); if (qMin(transform.m11(), transform.m22()) < 0) { - scale = NegativeScale; - } else if (transform.m11() != 1 || transform.m22() != 1) { - scale = Scaled; - } else { - scale = NoScale; + transformationType |= QDirectFBPaintEnginePrivate::NegativeScale; } + setPen(q->state()->pen); } void QDirectFBPaintEnginePrivate::setPen(const QPen &p) @@ -916,7 +913,7 @@ void QDirectFBPaintEnginePrivate::setPen(const QPen &p) && !antialiased && pen.brush().style() == Qt::SolidPattern && pen.widthF() <= 1.0 - && (scale == NoScale || pen.isCosmetic())) { + && (transformationType < QTransform::TxScale || pen.isCosmetic())) { simplePen = true; } else { simplePen = false; @@ -965,6 +962,7 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) { + const QTransform &transform = q->state()->matrix; for (int i = 0; i < n; ++i) { const QLine l = transform.map(lines[i]); surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); @@ -973,6 +971,7 @@ void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) { + const QTransform &transform = q->state()->matrix; for (int i = 0; i < n; ++i) { const QLine l = transform.map(lines[i]).toLine(); surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); @@ -990,6 +989,7 @@ void QDirectFBPaintEnginePrivate::fillRegion(const QRegion ®ion) void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) { + const QTransform &transform = q->state()->matrix; for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]); surface->FillRectangle(surface, r.x(), r.y(), @@ -999,6 +999,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) { + const QTransform &transform = q->state()->matrix; for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]).toRect(); surface->FillRectangle(surface, r.x(), r.y(), @@ -1008,6 +1009,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) { + const QTransform &transform = q->state()->matrix; for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]); surface->DrawRectangle(surface, r.x(), r.y(), @@ -1017,6 +1019,7 @@ void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) { + const QTransform &transform = q->state()->matrix; for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]).toRect(); surface->DrawRectangle(surface, r.x(), r.y(), @@ -1062,7 +1065,7 @@ IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, boo void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, const QRectF &src) { const QRect sr = src.toRect(); - const QRect dr = transform.mapRect(dest).toRect(); + const QRect dr = q->state()->matrix.mapRect(dest).toRect(); if (dr.isEmpty()) return; const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; @@ -1091,6 +1094,8 @@ static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset) void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off) { Q_ASSERT(!dirtyClip); + Q_ASSERT(!(transformationType & BlitUnsupported)); + const QTransform &transform = q->state()->matrix; const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); QRect newClip = destinationRect; if (!currentClip.isEmpty()) -- cgit v0.12 From 74c95015686ad5576b53fef5f653442ea2c4053a Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 13 Jul 2009 12:50:34 -0700 Subject: Code cleanup in QDirectFBPaintEngine Take out the QPen member. Reviewed-by: Donald --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index db08240..eda83b2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -261,10 +261,7 @@ public: private: IDirectFBSurface *surface; - QPen pen; - bool antialiased; - bool simplePen; uint transformationType; // this is QTransform::type() + NegativeScale if qMin(transform.m11(), transform.m22()) < 0 @@ -443,8 +440,9 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) d->setDFBColor(brush.color()); d->fillRects(rects, rectCount); } - if (d->pen != Qt::NoPen) { - d->setDFBColor(d->pen.color()); + const QPen &pen = state()->pen; + if (pen != Qt::NoPen) { + d->setDFBColor(pen.color()); d->drawRects(rects, rectCount); } } @@ -471,8 +469,9 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) d->setDFBColor(brush.color()); d->fillRects(rects, rectCount); } - if (d->pen != Qt::NoPen) { - d->setDFBColor(d->pen.color()); + const QPen &pen = state()->pen; + if (pen != Qt::NoPen) { + d->setDFBColor(pen.color()); d->drawRects(rects, rectCount); } } @@ -488,9 +487,10 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) return; } - if (d->pen != Qt::NoPen) { + const QPen &pen = state()->pen; + if (pen != Qt::NoPen) { d->unlock(); - d->setDFBColor(d->pen.color()); + d->setDFBColor(pen.color()); d->drawLines(lines, lineCount); } } @@ -506,9 +506,10 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) return; } - if (d->pen != Qt::NoPen) { + const QPen &pen = state()->pen; + if (pen != Qt::NoPen) { d->unlock(); - d->setDFBColor(d->pen.color()); + d->setDFBColor(pen.color()); d->drawLines(lines, lineCount); } } @@ -904,9 +905,8 @@ void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) setPen(q->state()->pen); } -void QDirectFBPaintEnginePrivate::setPen(const QPen &p) +void QDirectFBPaintEnginePrivate::setPen(const QPen &pen) { - pen = p; if (pen.style() == Qt::NoPen) { simplePen = true; } else if (pen.style() == Qt::SolidLine -- cgit v0.12 From 3f14a6f5bf06ffa2451226928a925f5d23e343c3 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 13 Jul 2009 11:44:24 -0700 Subject: Remove unused variables in QDirectFBPaintEngine fbWidth/fbHeight were never used for anything Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index eda83b2..4ede69a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -270,8 +270,6 @@ private: int lastLockedHeight; IDirectFB *fb; - int fbWidth; - int fbHeight; quint8 opacity; @@ -318,7 +316,6 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device) device->devType()); } d->lockedMemory = 0; - d->surface->GetSize(d->surface, &d->fbWidth, &d->fbHeight); const bool status = QRasterPaintEngine::begin(device); // XXX: QRasterPaintEngine::begin() resets the capabilities @@ -838,7 +835,7 @@ void QDirectFBPaintEngine::initImageCache(int size) QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) : surface(0), antialiased(false), simplePen(false), transformationType(0), lastLockedHeight(-1), - fbWidth(-1), fbHeight(-1), opacity(255), dirtyClip(true), + opacity(255), dirtyClip(true), dfbHandledClip(false), dfbDevice(0), lockedMemory(0), unsupportedCompositionMode(false), q(p) { -- cgit v0.12 From 815eec62128d9b971306d698c9beee52a604d455 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 13 Jul 2009 11:47:09 -0700 Subject: Remove QDirectFBPaintEnginePrivate::setOpacity The function only sets a variable anyway. Replace with: d->opacity = state()->opacity * 255 Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 4ede69a..1ea0325 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -223,7 +223,6 @@ public: inline void setTransform(const QTransform &transforma); inline void setPen(const QPen &pen); inline void setCompositionMode(QPainter::CompositionMode mode); - inline void setOpacity(quint8 value); inline void setRenderHints(QPainter::RenderHints hints); inline void setDFBColor(const QColor &color); @@ -355,7 +354,7 @@ void QDirectFBPaintEngine::penChanged() void QDirectFBPaintEngine::opacityChanged() { Q_D(QDirectFBPaintEngine); - d->setOpacity(quint8(state()->opacity * 255)); + d->opacity = quint8(state()->opacity * 255); QRasterPaintEngine::opacityChanged(); } @@ -386,7 +385,7 @@ void QDirectFBPaintEngine::setState(QPainterState *state) QRasterPaintEngine::setState(state); d->dirtyClip = true; d->setPen(state->pen); - d->setOpacity(quint8(state->opacity * 255)); + d->opacity = quint8(state->opacity * 255); d->setCompositionMode(state->compositionMode()); d->setTransform(state->transform()); d->setRenderHints(state->renderHints); @@ -922,12 +921,6 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m unsupportedCompositionMode = (mode != QPainter::CompositionMode_SourceOver); } - -void QDirectFBPaintEnginePrivate::setOpacity(quint8 op) -{ - opacity = op; -} - void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) { const bool old = antialiased; -- cgit v0.12 From fd302ab05face6c592944187fb594c1f55d62c5d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 21:55:57 +0200 Subject: Update to today's WebKit 4.6 snapshot --- util/webkit/mkdist-webkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 9e9d656..a843c83 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -5,7 +5,7 @@ die() { exit 1 } -default_tag="qtwebkit-4.6-snapshot-29062009" +default_tag="qtwebkit-4.6-snapshot-13072009" if [ $# -eq 0 ]; then tag="$default_tag" -- cgit v0.12 From afb4dfc7b9536b7e7f443a89e94f331f8946de07 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 13 Jul 2009 12:52:49 -0700 Subject: Move ALPHA_PREMULT It's only used once and I want to unclutter the top of qdirectfbpaintengine.cpp Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 1ea0325..605324e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -147,13 +147,6 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * #define RASTERFALLBACK(op, one, two, three) #endif -static inline uint ALPHA_MUL(uint x, uint a) -{ - uint t = x * a; - t = ((t + (t >> 8) + 0x80) >> 8) & 0xff; - return t; -} - class SurfaceCache { public: @@ -940,6 +933,13 @@ void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags)); } +static inline uint ALPHA_MUL(uint x, uint a) +{ + uint t = x * a; + t = ((t + (t >> 8) + 0x80) >> 8) & 0xff; + return t; +} + void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) { Q_ASSERT(surface); -- cgit v0.12 From f23fa541a04abd1ddc36815a285ec824d5b5c5e0 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 13 Jul 2009 22:00:20 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-13072009 ( b2abc0c271880b8135507861056af497f895adf5 ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix qdoc warnings for QWebPage::shouldInterruptJavaScript() and mention how to re-implement it. * Api/qwebpage.cpp: 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Fix crash with plugins when the plugin stream is cancelled. Similar to r26667 handle the case where didReceiveResponse on the plugin view results in failure to set up the stream and setMainDocumentError being called instead. This will set the m_pluginView back to 0 and we need check for it before calling didReceiveData. This was triggered by consecutive execution of LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::committedLoad): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Added QWebDatabase::removeAllDatabases, as a way to delete all databases from the offline storage path. Used by the Qt DRT. * Api/qwebdatabase.cpp: (QWebDatabase::removeAllDatabases): * Api/qwebdatabase.h: 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Added loadStarted() and loadFinished() signals to QWebFrame, to allow load tracking of individual frames, as opposed to QWebPage's loadStarted/loadFinished signals that are emitted whenever _any_ child frame loads/finishes. * Api/qwebframe.cpp: Document new signals. * Api/qwebframe.h: Add new signals. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::setFrame): Connect new signals. 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Add hooks for the GCController JavaScript interface needed by the Qt DRT. Fixed sort order of includes in qwebframe.cpp. * Api/qwebframe.cpp: (qt_drt_javaScriptObjectsCount): (qt_drt_garbageCollector_collect): (qt_drt_garbageCollector_collectOnAlternateThread): 2009-07-13 Simon Hausmann Reviewed by Ariya Hidayat. Add hooks for the GCController JavaScript interface needed by the Qt DRT. Fixed sort order of includes in qwebframe.cpp. * Api/qwebframe.cpp: (qt_drt_javaScriptObjectsCount): (qt_drt_garbageCollector_collect): (qt_drt_garbageCollector_collectOnAlternateThread): 2009-07-12 Brent Fulgham Speculative build fix after http://trac.webkit.org/changeset/45786. * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::addMessageToConsole): * WebCoreSupport/ChromeClientQt.h: 2009-07-10 Yael Aharon Reviewed by Holger Freyther. https://bugs.webkit.org/show_bug.cgi?id=27136 Fix a bug where webkit hangs when executing infinite JavaScript loop. * Api/qwebpage.cpp: (QWebPage::shouldInterruptJavaScript): * Api/qwebpage.h: * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::shouldInterruptJavaScript): * tests/qwebpage/tst_qwebpage.cpp: (JSTestPage::JSTestPage): (JSTestPage::shouldInterruptJavaScript): (tst_QWebPage::infiniteLoopJS): 2009-07-10 Simon Hausmann Reviewed by Holger Freyther. https://bugs.webkit.org/show_bug.cgi?id=27108 Fix crash when in frame tree of a new frame before the new frame has been installed in the frame tree, similar to r35088. After calling Frame::init() the frame it may have been removed from the frame tree again through JavaScript. Detect this by checking the page() afterwards. To make this check safe the Frame::init() code was moved into QWebFrameData's constructor, where a RefPtr holds a reference to the frame. After the check back in FrameLoaderClientQt we would hold the single reference left and after release() the frame, its frame loader, its client as well as the QWebFrame should have disappeared then. * Api/qwebframe.cpp: (QWebFramePrivate::init): Only call Frame::init here, the rest is done in QWebFrameData's constructor. (QWebFrame::QWebFrame): * Api/qwebframe_p.h: Adjust declaration. (QWebFrameData::QWebFrameData): Create the Frame here. * Api/qwebpage.cpp: (QWebPagePrivate::createMainFrame): Adjust and simplify to new QWebFrame constructor. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createFrame): Adjust to new QWebFrame construction using QWebFrameData and add the check like in r35088. 2009-07-09 Beth Dakin Reviewed by Dave Hyatt. Make Widget RefCounted to fix: REGRESSION (TOT): In Mail, a crash occurs at WebCore::Widget::afterMouseDown() after clicking To Do's close box WER #16: Repro Access Violation in WebCore::PluginView::bindingInstance (1310178023) -and- WER #13: Crash in WebKit! WebCore::PluginView::performRequest+203 (1311461169) * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createPlugin): (WebCore::FrameLoaderClientQt::createJavaAppletWidget): * WebCoreSupport/FrameLoaderClientQt.h: 2009-07-08 Pradeepto Bhattacharya Reviewed by Ariya Hidayat. Build fix. * WebCoreSupport/FrameLoaderClientQt.h: Removed the slot slotCallPolicyFunction(). 2009-07-08 Simon Hausmann Reviewed by Tor Arne Vestbø. https://bugs.webkit.org/show_bug.cgi?id=27080 Fix DRT instability issues with fast/loader/submit-form-while-parsing-2.html When the form is submitted we call the policy function in the frame loader delayed with a queued connection. That queued connection sometimes interferes with the javascript timeout set in the testcase. Eliminate the entire delayed policy function mechanism and instead always call back directly, like in the other ports. In most other places we called the slot directly anyway. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): Remove m_policyFunction. (WebCore::FrameLoaderClientQt::callPolicyFunction): Call the policy function directly instead of emitting the queued signal. (WebCore::FrameLoaderClientQt::cancelPolicyCheck): Call callPolicyFunction directly. (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm): Ditto. (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType): Ditto. (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): Ditto. (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): Ditto. * WebCoreSupport/FrameLoaderClientQt.h: Remove m_policyFunction as well as the associated signal. 2009-07-07 Simon Hausmann Reviewed by Holger Freyther. Add Qt DRT hook for clearing the frame name. * Api/qwebframe.cpp: (qt_drt_clearFrameName): 2009-07-05 Simon Hausmann Reviewed by Holger Freyther. Fix two qdoc warnings. Added missing \property for QWebFrame::hasFocus and added \a tag for pos of QWebPage::frameAt. * Api/qwebframe.cpp: * Api/qwebpage.cpp: 2009-07-04 Holger Hans Peter Freyther Reviewed by Simon Hausmann. Use the recently introduced FocusController::setFocused Use the recently introduced FocusController::setFocused in the Qt platform. The SelectionController will be updated from within the FocusController now. * Api/qwebpage.cpp: (QWebPagePrivate::focusInEvent): (QWebPagePrivate::focusOutEvent): 2009-07-02 Simon Hausmann Reviewed by Ariya Hidayat. Improve documentation of QWebFrame::setFocus and hasFocus() Added missing Q_PROPERTY for QWebFrame::hasFocus. * Api/qwebframe.cpp: Clarify the docs. * Api/qwebframe.h: add Q_PROPERTY(focus). 2009-07-02 Joe Ligman Reviewed by Simon Hausmann. Bug 26855: [Qt] New methods for QWebFrame to check and set focus. Added new public methods QWebFrame::hasFocus() and QWebFrame::setFocus() Added auto test. * Api/qwebframe.cpp: (QWebFrame::hasFocus): (QWebFrame::setFocus): * Api/qwebframe.h: * tests/qwebframe/tst_qwebframe.cpp: 2009-07-01 Robert Hogan Reviewed by NOBODY. Fix Qt segfault when javascript disabled. If clients call addToJavaScriptWindowObject even though JavascriptEnabled is false webkit will segfault on the assert: ASSERTION FAILED: _rootObject (../../../WebCore/bridge/runtime.cpp:52 JSC::Bindings::Instance::Instance(WTF::PassRefPtr)) Fix is to ensure JavaScript is enabled when client calls addToJavaScriptWindowObject. https://bugs.webkit.org/show_bug.cgi?id=26906 * Api/qwebframe.cpp: (QWebFrame::addToJavaScriptWindowObject): 2009-07-01 Jakub Wieczorek Reviewed by Simon Hausmann. [Qt] Move some API headers from WebCore.pro to headers.pri so that they get installed when running make install from the build directory. * Api/headers.pri: 2009-07-01 Balazs Kelemen Reviewed by Simon Hausmann. Fixed robotized QtLauncher to work when there is no index.html in the user's home. * QtLauncher/main.cpp: (main): 2009-06-30 Brian Weinstein Reviewed by Adam Roben. Renamed scrollbarUnderPoint to scrollbarAtPoint to follow conventions. * Api/qwebpage.cpp: (QWebPage::swallowContextMenuEvent): 2009-06-30 Joe Ligman Reviewed by Adam Treat. Bug 26422: [Qt] QWebPagePrivate::frameAt calculates wrong frame Added a public method QWebPage::frameAt Removed QWebPagePrivate::frameAt, which calcuated the wrong frame Modified QWebPage::swallowContextMenuEvent to use the new frameAt method New test case for frameAt added to tst_qwebpage.cpp * Api/qwebpage.cpp: (QWebPage::frameAt): (QWebPage::swallowContextMenuEvent): * Api/qwebpage.h: * Api/qwebpage_p.h: * tests/qwebpage/frametest/iframe.html: Added. * tests/qwebpage/frametest/iframe2.html: Added. * tests/qwebpage/frametest/iframe3.html: Added. * tests/qwebpage/tst_qwebpage.cpp: (frameAtHelper): (tst_QWebPage::frameAt): * tests/qwebpage/tst_qwebpage.qrc: 2009-06-30 Jakub Wieczorek Reviewed by Simon Hausmann. Add QWebFrame::baseUrl() function that exposes the base URL of a frame. Autotests included. * Api/qwebframe.cpp: (QWebFrame::baseUrl): * Api/qwebframe.h: * tests/qwebframe/tst_qwebframe.cpp: --- src/3rdparty/webkit/ChangeLog | 69 + src/3rdparty/webkit/JavaScriptCore/ChangeLog | 461 ++ .../webkit/JavaScriptCore/JavaScriptCore.gypi | 452 ++ .../webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 25 +- .../webkit/JavaScriptCore/bytecode/CodeBlock.h | 39 +- .../webkit/JavaScriptCore/bytecode/Opcode.h | 1 - .../bytecompiler/BytecodeGenerator.cpp | 87 +- .../bytecompiler/BytecodeGenerator.h | 14 +- .../webkit/JavaScriptCore/create_hash_table | 2 +- .../webkit/JavaScriptCore/debugger/Debugger.h | 2 +- .../JavaScriptCore/generated/ArrayPrototype.lut.h | 2 +- .../JavaScriptCore/generated/DatePrototype.lut.h | 2 +- .../webkit/JavaScriptCore/generated/Grammar.cpp | 1002 +++- .../webkit/JavaScriptCore/generated/Grammar.h | 109 +- .../JavaScriptCore/generated/JSONObject.lut.h | 2 +- .../webkit/JavaScriptCore/generated/Lexer.lut.h | 2 +- .../JavaScriptCore/generated/MathObject.lut.h | 2 +- .../generated/NumberConstructor.lut.h | 2 +- .../generated/RegExpConstructor.lut.h | 2 +- .../JavaScriptCore/generated/RegExpObject.lut.h | 2 +- .../JavaScriptCore/generated/StringPrototype.lut.h | 2 +- .../webkit/JavaScriptCore/interpreter/CallFrame.h | 19 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 562 +- .../JavaScriptCore/interpreter/Interpreter.h | 1 - src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp | 1 - .../webkit/JavaScriptCore/jit/JITOpcodes.cpp | 13 +- src/3rdparty/webkit/JavaScriptCore/jsc.cpp | 6 +- .../JavaScriptCore/parser/NodeConstructors.h | 5 + .../webkit/JavaScriptCore/parser/Nodes.cpp | 6 +- src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h | 2 + .../webkit/JavaScriptCore/runtime/JSActivation.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSGlobalData.cpp | 16 +- .../JavaScriptCore/runtime/LiteralParser.cpp | 6 +- .../webkit/JavaScriptCore/runtime/Lookup.h | 7 + .../webkit/JavaScriptCore/runtime/RegExp.cpp | 41 +- .../webkit/JavaScriptCore/runtime/RegExp.h | 3 +- .../JavaScriptCore/runtime/RegExpConstructor.cpp | 53 +- .../JavaScriptCore/runtime/StringPrototype.cpp | 3 +- .../webkit/JavaScriptCore/wtf/FastMalloc.cpp | 21 +- .../webkit/JavaScriptCore/wtf/FastMalloc.h | 7 + src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h | 16 +- .../webkit/JavaScriptCore/wtf/OwnPtrCommon.h | 3 + .../webkit/JavaScriptCore/wtf/OwnPtrWin.cpp | 7 + src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 18 +- .../webkit/JavaScriptCore/wtf/PtrAndFlags.h | 15 +- src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp | 216 +- .../webkit/JavaScriptCore/yarr/RegexJIT.cpp | 2 + src/3rdparty/webkit/VERSION | 6 +- src/3rdparty/webkit/WebCore/ChangeLog | 5485 ++++++++++++++++++++ src/3rdparty/webkit/WebCore/DerivedSources.cpp | 1 + src/3rdparty/webkit/WebCore/WebCore.gypi | 3334 ++++++++++++ src/3rdparty/webkit/WebCore/WebCore.order | 1 - src/3rdparty/webkit/WebCore/WebCore.pro | 48 +- .../WebCore/accessibility/AccessibilityObject.h | 5 +- .../accessibility/AccessibilityRenderObject.cpp | 46 +- .../accessibility/AccessibilityRenderObject.h | 1 + .../WebCore/bindings/js/JSAbstractWorkerCustom.cpp | 93 + .../bindings/js/JSCustomXPathNSResolver.cpp | 2 +- .../webkit/WebCore/bindings/js/JSDOMBinding.cpp | 5 + .../webkit/WebCore/bindings/js/JSDOMBinding.h | 12 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.cpp | 2 +- .../WebCore/bindings/js/JSDOMWindowCustom.cpp | 8 + .../bindings/js/JSDataGridColumnListCustom.cpp | 5 + .../WebCore/bindings/js/JSDataGridDataSource.cpp | 35 +- .../WebCore/bindings/js/JSDataGridDataSource.h | 5 +- .../webkit/WebCore/bindings/js/JSEventTarget.cpp | 14 + .../bindings/js/JSHTMLDataGridElementCustom.cpp | 10 + .../bindings/js/JSHTMLFormElementCustom.cpp | 2 +- .../WebCore/bindings/js/JSLazyEventListener.cpp | 8 +- .../WebCore/bindings/js/JSNamedNodesCollection.cpp | 4 +- .../webkit/WebCore/bindings/js/JSRGBColor.cpp | 4 +- .../bindings/js/JSSharedWorkerConstructor.cpp | 83 + .../bindings/js/JSSharedWorkerConstructor.h | 56 + .../WebCore/bindings/js/JSSharedWorkerCustom.cpp | 57 + .../WebCore/bindings/js/JSWorkerContextCustom.cpp | 11 + .../webkit/WebCore/bindings/js/JSWorkerCustom.cpp | 1 + .../WebCore/bindings/js/ScriptController.cpp | 13 +- .../WebCore/bindings/js/ScriptObjectQuarantine.cpp | 2 +- .../WebCore/bindings/scripts/CodeGeneratorJS.pm | 14 +- .../WebCore/bindings/scripts/CodeGeneratorV8.pm | 103 +- .../webkit/WebCore/bridge/qt/qt_instance.cpp | 2 +- .../webkit/WebCore/bridge/qt/qt_runtime.cpp | 2 +- .../webkit/WebCore/bridge/runtime_array.cpp | 8 +- .../webkit/WebCore/bridge/runtime_method.cpp | 7 +- .../webkit/WebCore/bridge/runtime_object.cpp | 4 +- .../webkit/WebCore/bridge/runtime_root.cpp | 1 + src/3rdparty/webkit/WebCore/bridge/runtime_root.h | 2 +- src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 45 +- .../webkit/WebCore/css/CSSPrimitiveValueMappings.h | 10 +- src/3rdparty/webkit/WebCore/css/CSSRule.idl | 1 + src/3rdparty/webkit/WebCore/css/CSSSelector.cpp | 12 + src/3rdparty/webkit/WebCore/css/CSSSelector.h | 3 + .../webkit/WebCore/css/CSSStyleSelector.cpp | 48 +- src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h | 7 + src/3rdparty/webkit/WebCore/css/CSSValue.idl | 1 + .../webkit/WebCore/css/CSSValueKeywords.in | 4 +- src/3rdparty/webkit/WebCore/css/MediaList.cpp | 2 +- src/3rdparty/webkit/WebCore/css/MediaQuery.h | 3 +- .../webkit/WebCore/css/MediaQueryEvaluator.cpp | 2 +- .../webkit/WebCore/css/MediaQueryEvaluator.h | 3 +- src/3rdparty/webkit/WebCore/css/MediaQueryExp.h | 6 +- src/3rdparty/webkit/WebCore/css/StyleSheet.idl | 1 + src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.h | 2 +- src/3rdparty/webkit/WebCore/css/html.css | 613 +++ src/3rdparty/webkit/WebCore/css/html4.css | 617 --- src/3rdparty/webkit/WebCore/css/mediaControls.css | 13 +- .../webkit/WebCore/css/mediaControlsQT.css | 115 +- src/3rdparty/webkit/WebCore/css/themeWin.css | 2 +- src/3rdparty/webkit/WebCore/dom/Comment.h | 3 +- src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp | 2 + src/3rdparty/webkit/WebCore/dom/Document.cpp | 24 +- src/3rdparty/webkit/WebCore/dom/Document.h | 8 +- src/3rdparty/webkit/WebCore/dom/Document.idl | 2 +- .../webkit/WebCore/dom/DocumentFragment.cpp | 2 +- src/3rdparty/webkit/WebCore/dom/DocumentFragment.h | 3 +- .../webkit/WebCore/dom/DynamicNodeList.cpp | 13 +- src/3rdparty/webkit/WebCore/dom/DynamicNodeList.h | 9 +- src/3rdparty/webkit/WebCore/dom/EditingText.h | 3 +- src/3rdparty/webkit/WebCore/dom/Element.cpp | 32 +- src/3rdparty/webkit/WebCore/dom/Element.h | 2 + src/3rdparty/webkit/WebCore/dom/Event.idl | 1 + src/3rdparty/webkit/WebCore/dom/EventTarget.cpp | 7 + src/3rdparty/webkit/WebCore/dom/EventTarget.h | 6 + .../webkit/WebCore/dom/HTMLAllCollection.idl | 40 + src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp | 4 +- .../webkit/WebCore/dom/MessagePortChannel.cpp | 17 - .../webkit/WebCore/dom/MessagePortChannel.h | 2 + src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp | 2 +- src/3rdparty/webkit/WebCore/dom/Node.cpp | 28 +- src/3rdparty/webkit/WebCore/dom/Node.idl | 2 +- src/3rdparty/webkit/WebCore/dom/NodeRareData.h | 21 +- src/3rdparty/webkit/WebCore/dom/Notation.h | 3 +- .../webkit/WebCore/dom/ProcessingInstruction.h | 3 +- src/3rdparty/webkit/WebCore/dom/Range.cpp | 10 +- .../webkit/WebCore/dom/ScriptExecutionContext.h | 2 +- src/3rdparty/webkit/WebCore/dom/SelectElement.cpp | 13 + src/3rdparty/webkit/WebCore/dom/SelectElement.h | 3 +- src/3rdparty/webkit/WebCore/dom/StyledElement.cpp | 5 +- .../webkit/WebCore/dom/XMLTokenizerLibxml2.cpp | 17 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 7 +- .../dom/default/PlatformMessagePortChannel.cpp | 21 + .../webkit/WebCore/editing/ApplyStyleCommand.cpp | 4 +- .../WebCore/editing/CompositeEditCommand.cpp | 2 + .../WebCore/editing/DeleteSelectionCommand.cpp | 2 +- src/3rdparty/webkit/WebCore/editing/Editor.cpp | 12 +- .../webkit/WebCore/editing/EditorCommand.cpp | 3 +- .../WebCore/editing/IndentOutdentCommand.cpp | 10 +- .../webkit/WebCore/editing/IndentOutdentCommand.h | 3 + .../webkit/WebCore/editing/SelectionController.cpp | 3 +- .../webkit/WebCore/editing/SmartReplaceICU.cpp | 3 +- .../webkit/WebCore/editing/TextIterator.cpp | 96 +- .../WebCore/editing/gtk/SelectionControllerGtk.cpp | 4 +- .../webkit/WebCore/generated/ArrayPrototype.lut.h | 2 +- .../webkit/WebCore/generated/CSSGrammar.cpp | 877 +++- src/3rdparty/webkit/WebCore/generated/CSSGrammar.h | 109 +- .../webkit/WebCore/generated/CSSValueKeywords.c | 547 +- .../webkit/WebCore/generated/CSSValueKeywords.h | 426 +- .../webkit/WebCore/generated/DatePrototype.lut.h | 2 +- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 1002 +++- src/3rdparty/webkit/WebCore/generated/Grammar.h | 109 +- .../WebCore/generated/HTMLElementFactory.cpp | 28 + .../webkit/WebCore/generated/HTMLNames.cpp | 20 +- src/3rdparty/webkit/WebCore/generated/HTMLNames.h | 4 + src/3rdparty/webkit/WebCore/generated/JSAttr.cpp | 6 +- .../webkit/WebCore/generated/JSBarInfo.cpp | 4 +- .../webkit/WebCore/generated/JSCDATASection.cpp | 6 +- .../webkit/WebCore/generated/JSCSSCharsetRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSImportRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSMediaRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSPageRule.cpp | 6 +- .../WebCore/generated/JSCSSPrimitiveValue.cpp | 6 +- .../webkit/WebCore/generated/JSCSSRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSRuleList.cpp | 6 +- .../WebCore/generated/JSCSSStyleDeclaration.cpp | 6 +- .../webkit/WebCore/generated/JSCSSStyleRule.cpp | 6 +- .../webkit/WebCore/generated/JSCSSStyleSheet.cpp | 6 +- .../webkit/WebCore/generated/JSCSSValue.cpp | 6 +- .../webkit/WebCore/generated/JSCSSValueList.cpp | 6 +- .../generated/JSCSSVariablesDeclaration.cpp | 6 +- .../WebCore/generated/JSCSSVariablesRule.cpp | 6 +- .../webkit/WebCore/generated/JSCanvasGradient.cpp | 2 +- .../webkit/WebCore/generated/JSCanvasPattern.cpp | 2 +- .../generated/JSCanvasRenderingContext2D.cpp | 6 +- .../webkit/WebCore/generated/JSCharacterData.cpp | 6 +- .../webkit/WebCore/generated/JSClientRect.cpp | 6 +- .../webkit/WebCore/generated/JSClientRectList.cpp | 6 +- .../webkit/WebCore/generated/JSClipboard.cpp | 6 +- .../webkit/WebCore/generated/JSComment.cpp | 6 +- .../webkit/WebCore/generated/JSConsole.cpp | 4 +- .../webkit/WebCore/generated/JSCoordinates.cpp | 4 +- .../webkit/WebCore/generated/JSCounter.cpp | 6 +- .../WebCore/generated/JSDOMApplicationCache.cpp | 4 +- .../WebCore/generated/JSDOMCoreException.cpp | 6 +- .../WebCore/generated/JSDOMImplementation.cpp | 6 +- .../webkit/WebCore/generated/JSDOMParser.cpp | 6 +- .../webkit/WebCore/generated/JSDOMSelection.cpp | 4 +- .../webkit/WebCore/generated/JSDOMWindow.cpp | 71 +- .../webkit/WebCore/generated/JSDOMWindow.h | 7 + .../webkit/WebCore/generated/JSDataGridColumn.cpp | 11 +- .../webkit/WebCore/generated/JSDataGridColumn.h | 4 + .../WebCore/generated/JSDataGridColumnList.cpp | 11 +- .../WebCore/generated/JSDataGridColumnList.h | 4 + .../webkit/WebCore/generated/JSDatabase.cpp | 4 +- .../webkit/WebCore/generated/JSDocument.cpp | 6 +- .../WebCore/generated/JSDocumentFragment.cpp | 6 +- .../webkit/WebCore/generated/JSDocumentType.cpp | 6 +- .../webkit/WebCore/generated/JSElement.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSEntity.cpp | 6 +- .../webkit/WebCore/generated/JSEntityReference.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSEvent.cpp | 6 +- .../webkit/WebCore/generated/JSEventException.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSFile.cpp | 6 +- .../webkit/WebCore/generated/JSFileList.cpp | 6 +- .../webkit/WebCore/generated/JSGeolocation.cpp | 4 +- .../webkit/WebCore/generated/JSGeoposition.cpp | 4 +- .../WebCore/generated/JSHTMLAnchorElement.cpp | 6 +- .../WebCore/generated/JSHTMLAppletElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLAreaElement.cpp | 6 +- .../WebCore/generated/JSHTMLAudioElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLBRElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLBaseElement.cpp | 6 +- .../WebCore/generated/JSHTMLBaseFontElement.cpp | 6 +- .../WebCore/generated/JSHTMLBlockquoteElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLBodyElement.cpp | 6 +- .../WebCore/generated/JSHTMLButtonElement.cpp | 18 +- .../webkit/WebCore/generated/JSHTMLButtonElement.h | 1 + .../WebCore/generated/JSHTMLCanvasElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLCollection.cpp | 6 +- .../WebCore/generated/JSHTMLDListElement.cpp | 6 +- .../generated/JSHTMLDataGridCellElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridCellElement.h | 4 + .../WebCore/generated/JSHTMLDataGridColElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridColElement.h | 4 + .../WebCore/generated/JSHTMLDataGridElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridElement.h | 4 + .../WebCore/generated/JSHTMLDataGridRowElement.cpp | 11 +- .../WebCore/generated/JSHTMLDataGridRowElement.h | 4 + .../WebCore/generated/JSHTMLDirectoryElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLDivElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLDocument.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLElement.cpp | 6 +- .../generated/JSHTMLElementWrapperFactory.cpp | 24 + .../WebCore/generated/JSHTMLEmbedElement.cpp | 6 +- .../WebCore/generated/JSHTMLFieldSetElement.cpp | 18 +- .../WebCore/generated/JSHTMLFieldSetElement.h | 1 + .../webkit/WebCore/generated/JSHTMLFontElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLFormElement.cpp | 6 +- .../WebCore/generated/JSHTMLFrameElement.cpp | 6 +- .../WebCore/generated/JSHTMLFrameSetElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLHRElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLHeadElement.cpp | 6 +- .../WebCore/generated/JSHTMLHeadingElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.cpp | 6 +- .../WebCore/generated/JSHTMLIFrameElement.cpp | 6 +- .../WebCore/generated/JSHTMLImageElement.cpp | 6 +- .../WebCore/generated/JSHTMLInputElement.cpp | 18 +- .../webkit/WebCore/generated/JSHTMLInputElement.h | 1 + .../WebCore/generated/JSHTMLIsIndexElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLLIElement.cpp | 6 +- .../WebCore/generated/JSHTMLLabelElement.cpp | 6 +- .../WebCore/generated/JSHTMLLegendElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLLinkElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLMapElement.cpp | 6 +- .../WebCore/generated/JSHTMLMarqueeElement.cpp | 6 +- .../WebCore/generated/JSHTMLMediaElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLMenuElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLMetaElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLModElement.cpp | 6 +- .../WebCore/generated/JSHTMLOListElement.cpp | 6 +- .../WebCore/generated/JSHTMLObjectElement.cpp | 6 +- .../WebCore/generated/JSHTMLOptGroupElement.cpp | 6 +- .../WebCore/generated/JSHTMLOptionElement.cpp | 6 +- .../WebCore/generated/JSHTMLOptionsCollection.cpp | 4 +- .../WebCore/generated/JSHTMLParagraphElement.cpp | 6 +- .../WebCore/generated/JSHTMLParamElement.cpp | 6 +- .../webkit/WebCore/generated/JSHTMLPreElement.cpp | 6 +- .../WebCore/generated/JSHTMLQuoteElement.cpp | 6 +- .../WebCore/generated/JSHTMLScriptElement.cpp | 6 +- .../WebCore/generated/JSHTMLSelectElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLSelectElement.h | 1 + .../WebCore/generated/JSHTMLSourceElement.cpp | 6 +- .../WebCore/generated/JSHTMLStyleElement.cpp | 6 +- .../generated/JSHTMLTableCaptionElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableCellElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableColElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableElement.cpp | 6 +- .../WebCore/generated/JSHTMLTableRowElement.cpp | 6 +- .../generated/JSHTMLTableSectionElement.cpp | 6 +- .../WebCore/generated/JSHTMLTextAreaElement.cpp | 20 +- .../WebCore/generated/JSHTMLTextAreaElement.h | 1 + .../WebCore/generated/JSHTMLTitleElement.cpp | 6 +- .../WebCore/generated/JSHTMLUListElement.cpp | 6 +- .../WebCore/generated/JSHTMLVideoElement.cpp | 6 +- .../webkit/WebCore/generated/JSHistory.cpp | 4 +- .../webkit/WebCore/generated/JSImageData.cpp | 6 +- .../WebCore/generated/JSInspectorController.cpp | 6 +- .../WebCore/generated/JSJavaScriptCallFrame.cpp | 4 +- .../webkit/WebCore/generated/JSKeyboardEvent.cpp | 6 +- .../webkit/WebCore/generated/JSLocation.cpp | 4 +- .../webkit/WebCore/generated/JSMediaError.cpp | 6 +- .../webkit/WebCore/generated/JSMediaList.cpp | 6 +- .../webkit/WebCore/generated/JSMessageChannel.cpp | 4 +- .../webkit/WebCore/generated/JSMessageEvent.cpp | 6 +- .../webkit/WebCore/generated/JSMessagePort.cpp | 6 +- .../webkit/WebCore/generated/JSMimeType.cpp | 6 +- .../webkit/WebCore/generated/JSMimeTypeArray.cpp | 6 +- .../webkit/WebCore/generated/JSMouseEvent.cpp | 6 +- .../webkit/WebCore/generated/JSMutationEvent.cpp | 6 +- .../webkit/WebCore/generated/JSNamedNodeMap.cpp | 6 +- .../webkit/WebCore/generated/JSNavigator.cpp | 4 +- src/3rdparty/webkit/WebCore/generated/JSNode.cpp | 6 +- .../webkit/WebCore/generated/JSNodeFilter.cpp | 6 +- .../webkit/WebCore/generated/JSNodeIterator.cpp | 6 +- .../webkit/WebCore/generated/JSNodeList.cpp | 6 +- .../webkit/WebCore/generated/JSNotation.cpp | 6 +- .../webkit/WebCore/generated/JSONObject.lut.h | 2 +- .../webkit/WebCore/generated/JSOverflowEvent.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp | 6 +- .../webkit/WebCore/generated/JSPluginArray.cpp | 6 +- .../webkit/WebCore/generated/JSPositionError.cpp | 6 +- .../WebCore/generated/JSProcessingInstruction.cpp | 6 +- .../webkit/WebCore/generated/JSProgressEvent.cpp | 6 +- .../webkit/WebCore/generated/JSRGBColor.lut.h | 2 +- src/3rdparty/webkit/WebCore/generated/JSRange.cpp | 6 +- .../webkit/WebCore/generated/JSRangeException.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSRect.cpp | 6 +- .../webkit/WebCore/generated/JSSQLError.cpp | 4 +- .../webkit/WebCore/generated/JSSQLResultSet.cpp | 4 +- .../WebCore/generated/JSSQLResultSetRowList.cpp | 4 +- .../webkit/WebCore/generated/JSSQLTransaction.cpp | 2 +- .../webkit/WebCore/generated/JSSVGAElement.cpp | 4 +- .../WebCore/generated/JSSVGAltGlyphElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGAngle.cpp | 6 +- .../WebCore/generated/JSSVGAnimateColorElement.cpp | 2 +- .../WebCore/generated/JSSVGAnimateElement.cpp | 2 +- .../generated/JSSVGAnimateTransformElement.cpp | 2 +- .../WebCore/generated/JSSVGAnimatedAngle.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedBoolean.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedEnumeration.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedInteger.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedLength.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedLengthList.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedNumber.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedNumberList.cpp | 4 +- .../generated/JSSVGAnimatedPreserveAspectRatio.cpp | 4 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.cpp | 4 +- .../WebCore/generated/JSSVGAnimatedString.cpp | 4 +- .../generated/JSSVGAnimatedTransformList.cpp | 4 +- .../WebCore/generated/JSSVGAnimationElement.cpp | 4 +- .../WebCore/generated/JSSVGCircleElement.cpp | 4 +- .../WebCore/generated/JSSVGClipPathElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGColor.cpp | 6 +- .../JSSVGComponentTransferFunctionElement.cpp | 6 +- .../WebCore/generated/JSSVGCursorElement.cpp | 4 +- .../generated/JSSVGDefinitionSrcElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGDefsElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGDescElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGDocument.cpp | 4 +- .../webkit/WebCore/generated/JSSVGElement.cpp | 4 +- .../WebCore/generated/JSSVGElementInstance.cpp | 4 +- .../WebCore/generated/JSSVGElementInstanceList.cpp | 4 +- .../WebCore/generated/JSSVGEllipseElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGException.cpp | 6 +- .../WebCore/generated/JSSVGFEBlendElement.cpp | 6 +- .../generated/JSSVGFEColorMatrixElement.cpp | 6 +- .../generated/JSSVGFEComponentTransferElement.cpp | 4 +- .../WebCore/generated/JSSVGFECompositeElement.cpp | 6 +- .../generated/JSSVGFEDiffuseLightingElement.cpp | 4 +- .../generated/JSSVGFEDisplacementMapElement.cpp | 6 +- .../generated/JSSVGFEDistantLightElement.cpp | 4 +- .../WebCore/generated/JSSVGFEFloodElement.cpp | 6 +- .../WebCore/generated/JSSVGFEFuncAElement.cpp | 2 +- .../WebCore/generated/JSSVGFEFuncBElement.cpp | 2 +- .../WebCore/generated/JSSVGFEFuncGElement.cpp | 2 +- .../WebCore/generated/JSSVGFEFuncRElement.cpp | 2 +- .../generated/JSSVGFEGaussianBlurElement.cpp | 4 +- .../WebCore/generated/JSSVGFEImageElement.cpp | 4 +- .../WebCore/generated/JSSVGFEMergeElement.cpp | 4 +- .../WebCore/generated/JSSVGFEMergeNodeElement.cpp | 4 +- .../WebCore/generated/JSSVGFEOffsetElement.cpp | 4 +- .../WebCore/generated/JSSVGFEPointLightElement.cpp | 4 +- .../generated/JSSVGFESpecularLightingElement.cpp | 4 +- .../WebCore/generated/JSSVGFESpotLightElement.cpp | 4 +- .../WebCore/generated/JSSVGFETileElement.cpp | 4 +- .../WebCore/generated/JSSVGFETurbulenceElement.cpp | 6 +- .../WebCore/generated/JSSVGFilterElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGFontElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceElement.cpp | 2 +- .../generated/JSSVGFontFaceFormatElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceNameElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceSrcElement.cpp | 2 +- .../WebCore/generated/JSSVGFontFaceUriElement.cpp | 2 +- .../generated/JSSVGForeignObjectElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGGElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGGlyphElement.cpp | 2 +- .../WebCore/generated/JSSVGGradientElement.cpp | 6 +- .../webkit/WebCore/generated/JSSVGHKernElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGImageElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGLength.cpp | 6 +- .../webkit/WebCore/generated/JSSVGLengthList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGLineElement.cpp | 4 +- .../generated/JSSVGLinearGradientElement.cpp | 4 +- .../WebCore/generated/JSSVGMarkerElement.cpp | 6 +- .../webkit/WebCore/generated/JSSVGMaskElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGMatrix.cpp | 4 +- .../WebCore/generated/JSSVGMetadataElement.cpp | 2 +- .../WebCore/generated/JSSVGMissingGlyphElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGNumber.cpp | 4 +- .../webkit/WebCore/generated/JSSVGNumberList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPaint.cpp | 6 +- .../webkit/WebCore/generated/JSSVGPathElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPathSeg.cpp | 6 +- .../WebCore/generated/JSSVGPathSegArcAbs.cpp | 4 +- .../WebCore/generated/JSSVGPathSegArcRel.cpp | 4 +- .../WebCore/generated/JSSVGPathSegClosePath.cpp | 2 +- .../generated/JSSVGPathSegCurvetoCubicAbs.cpp | 4 +- .../generated/JSSVGPathSegCurvetoCubicRel.cpp | 4 +- .../JSSVGPathSegCurvetoCubicSmoothAbs.cpp | 4 +- .../JSSVGPathSegCurvetoCubicSmoothRel.cpp | 4 +- .../generated/JSSVGPathSegCurvetoQuadraticAbs.cpp | 4 +- .../generated/JSSVGPathSegCurvetoQuadraticRel.cpp | 4 +- .../JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp | 4 +- .../JSSVGPathSegCurvetoQuadraticSmoothRel.cpp | 4 +- .../WebCore/generated/JSSVGPathSegLinetoAbs.cpp | 4 +- .../generated/JSSVGPathSegLinetoHorizontalAbs.cpp | 4 +- .../generated/JSSVGPathSegLinetoHorizontalRel.cpp | 4 +- .../WebCore/generated/JSSVGPathSegLinetoRel.cpp | 4 +- .../generated/JSSVGPathSegLinetoVerticalAbs.cpp | 4 +- .../generated/JSSVGPathSegLinetoVerticalRel.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPathSegList.cpp | 4 +- .../WebCore/generated/JSSVGPathSegMovetoAbs.cpp | 4 +- .../WebCore/generated/JSSVGPathSegMovetoRel.cpp | 4 +- .../WebCore/generated/JSSVGPatternElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPoint.cpp | 4 +- .../webkit/WebCore/generated/JSSVGPointList.cpp | 4 +- .../WebCore/generated/JSSVGPolygonElement.cpp | 4 +- .../WebCore/generated/JSSVGPolylineElement.cpp | 4 +- .../WebCore/generated/JSSVGPreserveAspectRatio.cpp | 6 +- .../generated/JSSVGRadialGradientElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGRect.cpp | 4 +- .../webkit/WebCore/generated/JSSVGRectElement.cpp | 4 +- .../WebCore/generated/JSSVGRenderingIntent.cpp | 6 +- .../webkit/WebCore/generated/JSSVGSVGElement.cpp | 4 +- .../WebCore/generated/JSSVGScriptElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGSetElement.cpp | 2 +- .../webkit/WebCore/generated/JSSVGStopElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGStringList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGStyleElement.cpp | 4 +- .../WebCore/generated/JSSVGSwitchElement.cpp | 4 +- .../WebCore/generated/JSSVGSymbolElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTRefElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTSpanElement.cpp | 2 +- .../WebCore/generated/JSSVGTextContentElement.cpp | 6 +- .../webkit/WebCore/generated/JSSVGTextElement.cpp | 4 +- .../WebCore/generated/JSSVGTextPathElement.cpp | 6 +- .../generated/JSSVGTextPositioningElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTitleElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGTransform.cpp | 6 +- .../WebCore/generated/JSSVGTransformList.cpp | 4 +- .../webkit/WebCore/generated/JSSVGUnitTypes.cpp | 6 +- .../webkit/WebCore/generated/JSSVGUseElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGViewElement.cpp | 4 +- .../webkit/WebCore/generated/JSSVGZoomEvent.cpp | 4 +- src/3rdparty/webkit/WebCore/generated/JSScreen.cpp | 4 +- .../webkit/WebCore/generated/JSStorage.cpp | 6 +- .../webkit/WebCore/generated/JSStorageEvent.cpp | 6 +- .../webkit/WebCore/generated/JSStyleSheet.cpp | 6 +- .../webkit/WebCore/generated/JSStyleSheetList.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSText.cpp | 6 +- .../webkit/WebCore/generated/JSTextEvent.cpp | 6 +- .../webkit/WebCore/generated/JSTextMetrics.cpp | 6 +- .../webkit/WebCore/generated/JSTimeRanges.cpp | 4 +- .../webkit/WebCore/generated/JSTreeWalker.cpp | 6 +- .../webkit/WebCore/generated/JSUIEvent.cpp | 6 +- .../webkit/WebCore/generated/JSValidityState.cpp | 172 + .../webkit/WebCore/generated/JSValidityState.h | 79 + .../webkit/WebCore/generated/JSVoidCallback.cpp | 2 +- .../WebCore/generated/JSWebKitAnimationEvent.cpp | 6 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.cpp | 6 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.cpp | 6 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.cpp | 4 +- .../generated/JSWebKitCSSTransformValue.cpp | 6 +- .../webkit/WebCore/generated/JSWebKitPoint.cpp | 4 +- .../WebCore/generated/JSWebKitTransitionEvent.cpp | 6 +- .../webkit/WebCore/generated/JSWheelEvent.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSWorker.cpp | 20 +- .../webkit/WebCore/generated/JSWorkerContext.cpp | 35 +- .../webkit/WebCore/generated/JSWorkerContext.h | 3 + .../webkit/WebCore/generated/JSWorkerLocation.cpp | 6 +- .../webkit/WebCore/generated/JSWorkerNavigator.cpp | 4 +- .../webkit/WebCore/generated/JSXMLHttpRequest.cpp | 4 +- .../generated/JSXMLHttpRequestException.cpp | 6 +- .../generated/JSXMLHttpRequestProgressEvent.cpp | 6 +- .../WebCore/generated/JSXMLHttpRequestUpload.cpp | 6 +- .../webkit/WebCore/generated/JSXMLSerializer.cpp | 6 +- .../webkit/WebCore/generated/JSXPathEvaluator.cpp | 6 +- .../webkit/WebCore/generated/JSXPathException.cpp | 6 +- .../webkit/WebCore/generated/JSXPathExpression.cpp | 6 +- .../webkit/WebCore/generated/JSXPathNSResolver.cpp | 2 +- .../webkit/WebCore/generated/JSXPathResult.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/Lexer.lut.h | 2 +- .../webkit/WebCore/generated/MathObject.lut.h | 2 +- .../WebCore/generated/NumberConstructor.lut.h | 2 +- .../WebCore/generated/RegExpConstructor.lut.h | 2 +- .../webkit/WebCore/generated/RegExpObject.lut.h | 2 +- .../webkit/WebCore/generated/StringPrototype.lut.h | 2 +- .../WebCore/generated/UserAgentStyleSheets.h | 4 +- .../WebCore/generated/UserAgentStyleSheetsData.cpp | 243 +- .../webkit/WebCore/generated/XPathGrammar.cpp | 418 +- .../webkit/WebCore/generated/XPathGrammar.h | 64 +- .../webkit/WebCore/history/HistoryItem.cpp | 24 +- src/3rdparty/webkit/WebCore/history/HistoryItem.h | 9 +- .../WebCore/html/CanvasRenderingContext2D.cpp | 12 +- src/3rdparty/webkit/WebCore/html/CanvasStyle.cpp | 4 +- .../webkit/WebCore/html/DOMDataGridDataSource.cpp | 44 + .../webkit/WebCore/html/DOMDataGridDataSource.h | 69 + .../webkit/WebCore/html/DataGridColumn.cpp | 11 + src/3rdparty/webkit/WebCore/html/DataGridColumn.h | 47 +- .../webkit/WebCore/html/DataGridColumn.idl | 3 +- .../webkit/WebCore/html/DataGridColumnList.cpp | 40 +- .../webkit/WebCore/html/DataGridColumnList.h | 21 +- .../webkit/WebCore/html/DataGridColumnList.idl | 3 +- .../webkit/WebCore/html/DataGridDataSource.h | 7 +- .../webkit/WebCore/html/HTMLAnchorElement.cpp | 4 +- .../webkit/WebCore/html/HTMLAppletElement.h | 3 +- .../webkit/WebCore/html/HTMLAttributeNames.in | 1 + .../webkit/WebCore/html/HTMLAudioElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLBRElement.h | 3 +- .../webkit/WebCore/html/HTMLBaseElement.cpp | 4 +- src/3rdparty/webkit/WebCore/html/HTMLBaseElement.h | 4 +- .../webkit/WebCore/html/HTMLBaseFontElement.h | 3 +- .../webkit/WebCore/html/HTMLButtonElement.idl | 3 + .../webkit/WebCore/html/HTMLDListElement.h | 3 +- .../WebCore/html/HTMLDataGridCellElement.cpp | 5 + .../webkit/WebCore/html/HTMLDataGridCellElement.h | 4 + .../WebCore/html/HTMLDataGridCellElement.idl | 3 +- .../webkit/WebCore/html/HTMLDataGridColElement.cpp | 75 +- .../webkit/WebCore/html/HTMLDataGridColElement.h | 23 +- .../webkit/WebCore/html/HTMLDataGridColElement.idl | 3 +- .../webkit/WebCore/html/HTMLDataGridElement.cpp | 32 +- .../webkit/WebCore/html/HTMLDataGridElement.h | 10 +- .../webkit/WebCore/html/HTMLDataGridElement.idl | 3 +- .../webkit/WebCore/html/HTMLDataGridRowElement.cpp | 5 + .../webkit/WebCore/html/HTMLDataGridRowElement.h | 4 + .../webkit/WebCore/html/HTMLDataGridRowElement.idl | 3 +- .../webkit/WebCore/html/HTMLDirectoryElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLElement.cpp | 9 +- .../webkit/WebCore/html/HTMLFieldSetElement.cpp | 2 +- .../webkit/WebCore/html/HTMLFieldSetElement.idl | 3 + .../webkit/WebCore/html/HTMLFormControlElement.cpp | 27 + .../webkit/WebCore/html/HTMLFormControlElement.h | 6 + .../webkit/WebCore/html/HTMLFormElement.cpp | 10 +- src/3rdparty/webkit/WebCore/html/HTMLFormElement.h | 2 +- src/3rdparty/webkit/WebCore/html/HTMLHRElement.cpp | 2 +- src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h | 3 +- .../webkit/WebCore/html/HTMLImageElement.h | 2 +- .../webkit/WebCore/html/HTMLInputElement.cpp | 4 +- .../webkit/WebCore/html/HTMLInputElement.idl | 5 +- .../webkit/WebCore/html/HTMLIsIndexElement.h | 3 +- .../webkit/WebCore/html/HTMLLinkElement.cpp | 4 +- .../webkit/WebCore/html/HTMLMarqueeElement.cpp | 2 +- .../webkit/WebCore/html/HTMLMediaElement.cpp | 37 +- .../webkit/WebCore/html/HTMLMediaElement.h | 11 +- src/3rdparty/webkit/WebCore/html/HTMLMenuElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLModElement.h | 3 +- .../webkit/WebCore/html/HTMLOListElement.h | 3 +- .../webkit/WebCore/html/HTMLOptionElement.cpp | 8 +- .../webkit/WebCore/html/HTMLParamElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLParser.cpp | 18 +- src/3rdparty/webkit/WebCore/html/HTMLParser.h | 2 + .../webkit/WebCore/html/HTMLQuoteElement.h | 3 +- .../webkit/WebCore/html/HTMLSelectElement.cpp | 8 +- .../webkit/WebCore/html/HTMLSelectElement.idl | 3 + .../webkit/WebCore/html/HTMLStyleElement.h | 3 +- .../webkit/WebCore/html/HTMLTableCaptionElement.h | 3 +- .../webkit/WebCore/html/HTMLTableCellElement.h | 3 +- .../webkit/WebCore/html/HTMLTableColElement.h | 3 +- .../WebCore/html/HTMLTableSectionElement.cpp | 2 +- src/3rdparty/webkit/WebCore/html/HTMLTagNames.in | 11 +- .../webkit/WebCore/html/HTMLTextAreaElement.idl | 3 + .../webkit/WebCore/html/HTMLTitleElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 57 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h | 4 + .../webkit/WebCore/html/HTMLUListElement.h | 3 +- .../webkit/WebCore/html/HTMLVideoElement.cpp | 16 +- .../webkit/WebCore/html/HTMLVideoElement.h | 6 +- src/3rdparty/webkit/WebCore/html/ImageData.idl | 2 +- src/3rdparty/webkit/WebCore/html/TimeRanges.h | 3 +- src/3rdparty/webkit/WebCore/html/ValidityState.cpp | 43 + src/3rdparty/webkit/WebCore/html/ValidityState.h | 59 + src/3rdparty/webkit/WebCore/html/ValidityState.idl | 36 + .../webkit/WebCore/inspector/ConsoleMessage.cpp | 8 +- .../webkit/WebCore/inspector/ConsoleMessage.h | 5 +- .../WebCore/inspector/InspectorController.cpp | 24 +- .../webkit/WebCore/inspector/InspectorController.h | 4 +- .../webkit/WebCore/inspector/InspectorFrontend.cpp | 3 +- .../WebCore/inspector/JavaScriptCallFrame.cpp | 8 + .../webkit/WebCore/inspector/JavaScriptCallFrame.h | 1 + .../WebCore/inspector/JavaScriptDebugServer.cpp | 21 +- .../WebCore/inspector/JavaScriptDebugServer.h | 3 + .../inspector/front-end/CallStackSidebarPane.js | 57 + .../webkit/WebCore/inspector/front-end/Console.js | 94 +- .../inspector/front-end/KeyboardShortcut.js | 108 + .../webkit/WebCore/inspector/front-end/Resource.js | 4 +- .../WebCore/inspector/front-end/ResourcesPanel.js | 2 +- .../WebCore/inspector/front-end/ScriptsPanel.js | 61 +- .../WebCore/inspector/front-end/TextPrompt.js | 5 +- .../webkit/WebCore/inspector/front-end/WebKit.qrc | 2 + .../WebCore/inspector/front-end/inspector.css | 8 +- .../WebCore/inspector/front-end/inspector.html | 1 + .../WebCore/inspector/front-end/inspector.js | 1 + src/3rdparty/webkit/WebCore/loader/DocLoader.cpp | 2 +- src/3rdparty/webkit/WebCore/loader/EmptyClients.h | 9 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 77 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.h | 8 +- .../webkit/WebCore/loader/FrameLoaderClient.h | 4 +- .../webkit/WebCore/loader/TextDocument.cpp | 2 + .../webkit/WebCore/loader/icon/IconDatabase.cpp | 4 + .../webkit/WebCore/loader/icon/IconDatabase.h | 4 +- .../WebCore/loader/icon/IconDatabaseNone.cpp | 21 + src/3rdparty/webkit/WebCore/loader/loader.cpp | 43 +- src/3rdparty/webkit/WebCore/loader/loader.h | 9 +- src/3rdparty/webkit/WebCore/page/ChromeClient.h | 5 +- src/3rdparty/webkit/WebCore/page/Console.cpp | 39 +- src/3rdparty/webkit/WebCore/page/Console.h | 19 +- src/3rdparty/webkit/WebCore/page/DOMWindow.cpp | 2 +- src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 9 +- src/3rdparty/webkit/WebCore/page/EventHandler.cpp | 62 +- src/3rdparty/webkit/WebCore/page/EventHandler.h | 4 + .../webkit/WebCore/page/FocusController.cpp | 36 +- src/3rdparty/webkit/WebCore/page/FocusController.h | 4 + src/3rdparty/webkit/WebCore/page/Frame.cpp | 4 +- src/3rdparty/webkit/WebCore/page/FrameView.cpp | 223 +- src/3rdparty/webkit/WebCore/page/FrameView.h | 34 +- .../WebCore/page/MouseEventWithHitTestResults.h | 5 +- src/3rdparty/webkit/WebCore/page/Settings.cpp | 12 + src/3rdparty/webkit/WebCore/page/Settings.h | 8 + src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp | 135 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.h | 24 +- .../WebCore/page/android/DragControllerAndroid.cpp | 2 +- .../WebCore/page/android/EventHandlerAndroid.cpp | 4 +- .../WebCore/page/animation/AnimationBase.cpp | 2 +- .../WebCore/page/animation/AnimationController.cpp | 18 +- .../WebCore/page/animation/CompositeAnimation.cpp | 147 +- .../WebCore/page/animation/CompositeAnimation.h | 2 - .../WebCore/page/animation/ImplicitAnimation.cpp | 4 + .../webkit/WebCore/page/qt/DragControllerQt.cpp | 3 +- .../webkit/WebCore/page/win/DragControllerWin.cpp | 3 +- src/3rdparty/webkit/WebCore/page/win/FrameWin.h | 2 +- .../webkit/WebCore/platform/CrossThreadCopier.h | 9 + src/3rdparty/webkit/WebCore/platform/DragImage.h | 4 +- src/3rdparty/webkit/WebCore/platform/FileSystem.h | 38 +- .../webkit/WebCore/platform/LocalizedStrings.h | 3 + .../webkit/WebCore/platform/ScrollView.cpp | 56 +- src/3rdparty/webkit/WebCore/platform/ScrollView.h | 16 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp | 31 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.h | 15 +- .../webkit/WebCore/platform/ScrollbarClient.h | 26 +- src/3rdparty/webkit/WebCore/platform/Theme.h | 2 +- src/3rdparty/webkit/WebCore/platform/ThemeTypes.h | 7 +- src/3rdparty/webkit/WebCore/platform/Widget.cpp | 106 +- src/3rdparty/webkit/WebCore/platform/Widget.h | 26 +- .../WebCore/platform/graphics/BitmapImage.cpp | 4 +- .../webkit/WebCore/platform/graphics/Color.h | 1 - .../WebCore/platform/graphics/GraphicsLayer.cpp | 1 + .../WebCore/platform/graphics/GraphicsLayer.h | 9 + .../webkit/WebCore/platform/graphics/Image.h | 16 +- .../webkit/WebCore/platform/graphics/IntPoint.h | 1 + .../WebCore/platform/graphics/MediaPlayer.cpp | 20 +- .../webkit/WebCore/platform/graphics/MediaPlayer.h | 4 + .../WebCore/platform/graphics/MediaPlayerPrivate.h | 7 +- .../WebCore/platform/mac/LocalizedStringsMac.mm | 16 + .../webkit/WebCore/platform/mac/ThemeMac.mm | 13 + .../WebCore/platform/mac/WebCoreSystemInterface.h | 7 +- .../WebCore/platform/mac/WebCoreSystemInterface.mm | 7 +- .../webkit/WebCore/platform/mac/WidgetMac.mm | 74 +- .../platform/network/ResourceHandleInternal.h | 4 +- .../platform/network/ResourceResponseBase.cpp | 2 +- .../platform/network/ResourceResponseBase.h | 2 - .../webkit/WebCore/platform/qt/Localizations.cpp | 10 + .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 2 +- .../webkit/WebCore/platform/sql/SQLiteDatabase.cpp | 5 +- .../WebCore/platform/sql/SQLiteFileSystem.cpp | 123 + .../webkit/WebCore/platform/sql/SQLiteFileSystem.h | 114 + .../platform/text/TextBreakIteratorInternalICU.h | 4 +- .../text/android/TextBreakIteratorInternalICU.cpp | 7 + .../text/mac/TextBreakIteratorInternalICUMac.mm | 96 +- .../text/win/TextBreakIteratorInternalICUWin.cpp | 6 + src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 22 +- src/3rdparty/webkit/WebCore/plugins/PluginView.h | 2 +- .../plugins/win/PluginMessageThrottlerWin.cpp | 3 + .../WebCore/plugins/win/PluginPackageWin.cpp | 11 +- .../webkit/WebCore/plugins/win/PluginViewWin.cpp | 45 +- .../webkit/WebCore/rendering/AutoTableLayout.cpp | 4 +- .../webkit/WebCore/rendering/InlineBox.cpp | 38 +- src/3rdparty/webkit/WebCore/rendering/InlineBox.h | 39 +- .../webkit/WebCore/rendering/InlineFlowBox.cpp | 53 +- .../webkit/WebCore/rendering/InlineFlowBox.h | 12 +- .../webkit/WebCore/rendering/InlineTextBox.cpp | 4 +- .../WebCore/rendering/MediaControlElements.cpp | 308 +- .../WebCore/rendering/MediaControlElements.h | 97 +- .../webkit/WebCore/rendering/RenderApplet.cpp | 1 + .../webkit/WebCore/rendering/RenderArena.cpp | 2 +- .../webkit/WebCore/rendering/RenderBlock.cpp | 90 +- .../webkit/WebCore/rendering/RenderBlock.h | 21 +- .../WebCore/rendering/RenderBlockLineLayout.cpp | 2264 ++++++++ .../webkit/WebCore/rendering/RenderBox.cpp | 2 +- .../WebCore/rendering/RenderBoxModelObject.cpp | 71 +- .../webkit/WebCore/rendering/RenderDataGrid.cpp | 136 +- .../webkit/WebCore/rendering/RenderDataGrid.h | 22 +- .../webkit/WebCore/rendering/RenderFieldset.cpp | 2 +- .../webkit/WebCore/rendering/RenderFlexibleBox.cpp | 26 +- .../webkit/WebCore/rendering/RenderFrameSet.cpp | 2 +- .../webkit/WebCore/rendering/RenderFrameSet.h | 3 +- .../webkit/WebCore/rendering/RenderImage.cpp | 3 +- .../webkit/WebCore/rendering/RenderInline.cpp | 6 +- .../webkit/WebCore/rendering/RenderInline.h | 5 +- .../webkit/WebCore/rendering/RenderLayer.cpp | 152 +- .../webkit/WebCore/rendering/RenderLayer.h | 28 +- .../WebCore/rendering/RenderLayerBacking.cpp | 19 +- .../webkit/WebCore/rendering/RenderLayerBacking.h | 3 +- .../WebCore/rendering/RenderLayerCompositor.cpp | 180 +- .../WebCore/rendering/RenderLayerCompositor.h | 30 +- .../webkit/WebCore/rendering/RenderListBox.cpp | 70 +- .../webkit/WebCore/rendering/RenderListBox.h | 4 + .../webkit/WebCore/rendering/RenderMarquee.cpp | 3 +- .../webkit/WebCore/rendering/RenderMedia.cpp | 209 +- .../webkit/WebCore/rendering/RenderMedia.h | 25 +- .../webkit/WebCore/rendering/RenderMenuList.cpp | 7 + .../webkit/WebCore/rendering/RenderObject.cpp | 35 +- .../webkit/WebCore/rendering/RenderObject.h | 8 +- .../webkit/WebCore/rendering/RenderPart.cpp | 16 +- src/3rdparty/webkit/WebCore/rendering/RenderPart.h | 4 +- .../webkit/WebCore/rendering/RenderReplaced.cpp | 5 +- .../webkit/WebCore/rendering/RenderSVGImage.cpp | 14 +- .../webkit/WebCore/rendering/RenderSVGInline.cpp | 4 +- .../webkit/WebCore/rendering/RenderSVGInline.h | 2 +- .../WebCore/rendering/RenderSVGInlineText.cpp | 2 +- .../webkit/WebCore/rendering/RenderSVGText.cpp | 4 +- .../webkit/WebCore/rendering/RenderSVGText.h | 2 +- .../webkit/WebCore/rendering/RenderSlider.cpp | 90 +- .../webkit/WebCore/rendering/RenderSlider.h | 3 +- .../webkit/WebCore/rendering/RenderTable.cpp | 3 +- .../webkit/WebCore/rendering/RenderTableCol.h | 3 +- .../webkit/WebCore/rendering/RenderTextControl.cpp | 31 +- .../rendering/RenderTextControlSingleLine.cpp | 4 +- .../webkit/WebCore/rendering/RenderTheme.cpp | 23 +- .../webkit/WebCore/rendering/RenderTheme.h | 10 +- .../WebCore/rendering/RenderThemeChromiumMac.h | 2 +- .../WebCore/rendering/RenderThemeChromiumMac.mm | 30 +- .../WebCore/rendering/RenderThemeChromiumSkia.cpp | 23 +- .../WebCore/rendering/RenderThemeChromiumSkia.h | 2 +- .../WebCore/rendering/RenderThemeChromiumWin.cpp | 10 +- .../webkit/WebCore/rendering/RenderThemeMac.h | 7 +- .../webkit/WebCore/rendering/RenderThemeSafari.cpp | 6 +- .../webkit/WebCore/rendering/RenderThemeSafari.h | 2 +- .../webkit/WebCore/rendering/RenderView.cpp | 4 +- .../webkit/WebCore/rendering/RenderWidget.cpp | 31 +- .../webkit/WebCore/rendering/RenderWidget.h | 7 +- .../webkit/WebCore/rendering/RootInlineBox.cpp | 4 +- .../WebCore/rendering/SVGCharacterLayoutInfo.cpp | 4 +- .../WebCore/rendering/SVGCharacterLayoutInfo.h | 3 +- .../webkit/WebCore/rendering/SVGInlineFlowBox.h | 2 +- .../webkit/WebCore/rendering/SVGInlineTextBox.h | 2 +- .../webkit/WebCore/rendering/SVGRootInlineBox.h | 2 +- .../WebCore/rendering/TextControlInnerElements.cpp | 10 + .../WebCore/rendering/TextControlInnerElements.h | 4 +- src/3rdparty/webkit/WebCore/rendering/bidi.cpp | 2231 -------- src/3rdparty/webkit/WebCore/rendering/bidi.h | 65 - .../webkit/WebCore/rendering/style/RenderStyle.cpp | 7 + .../webkit/WebCore/rendering/style/RenderStyle.h | 9 +- .../WebCore/rendering/style/RenderStyleConstants.h | 5 +- .../WebCore/rendering/style/SVGRenderStyleDefs.h | 4 +- .../WebCore/rendering/style/StyleInheritedData.h | 2 +- src/3rdparty/webkit/WebCore/storage/Database.cpp | 24 +- src/3rdparty/webkit/WebCore/storage/Database.h | 3 + src/3rdparty/webkit/WebCore/storage/DatabaseTask.h | 15 +- .../webkit/WebCore/storage/DatabaseThread.cpp | 27 + .../webkit/WebCore/storage/DatabaseThread.h | 8 + .../webkit/WebCore/storage/DatabaseTracker.cpp | 55 +- .../webkit/WebCore/storage/OriginUsageRecord.cpp | 12 +- .../webkit/WebCore/storage/StorageArea.cpp | 221 +- src/3rdparty/webkit/WebCore/storage/StorageArea.h | 44 +- .../webkit/WebCore/storage/StorageAreaImpl.cpp | 266 + .../webkit/WebCore/storage/StorageAreaImpl.h | 80 + .../webkit/WebCore/storage/StorageAreaSync.h | 3 +- .../webkit/WebCore/storage/StorageNamespace.cpp | 96 +- .../webkit/WebCore/storage/StorageNamespace.h | 26 +- .../WebCore/storage/StorageNamespaceImpl.cpp | 129 + .../webkit/WebCore/storage/StorageNamespaceImpl.h | 66 + .../webkit/WebCore/svg/GradientAttributes.h | 3 +- .../webkit/WebCore/svg/LinearGradientAttributes.h | 3 +- .../webkit/WebCore/svg/PatternAttributes.h | 3 +- .../webkit/WebCore/svg/RadialGradientAttributes.h | 3 +- .../webkit/WebCore/svg/SVGAnimatedPathData.h | 6 +- .../webkit/WebCore/svg/SVGAnimatedPoints.h | 6 +- .../webkit/WebCore/svg/SVGAnimationElement.h | 3 +- .../webkit/WebCore/svg/SVGClipPathElement.h | 3 +- .../webkit/WebCore/svg/SVGDocumentExtensions.cpp | 4 +- .../webkit/WebCore/svg/SVGElementInstance.h | 3 +- .../webkit/WebCore/svg/SVGElementInstance.idl | 2 +- .../webkit/WebCore/svg/SVGFEBlendElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEBlendElement.h | 6 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.cpp | 2 +- .../WebCore/svg/SVGFEComponentTransferElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFECompositeElement.cpp | 2 +- .../WebCore/svg/SVGFEDiffuseLightingElement.cpp | 2 +- .../WebCore/svg/SVGFEDisplacementMapElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEDistantLightElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFloodElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEFloodElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncAElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncBElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncGElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFuncRElement.h | 6 +- .../WebCore/svg/SVGFEGaussianBlurElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEImageElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEMergeElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEOffsetElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFEPointLightElement.h | 6 +- .../WebCore/svg/SVGFESpecularLightingElement.cpp | 2 +- .../webkit/WebCore/svg/SVGFESpotLightElement.h | 6 +- .../webkit/WebCore/svg/SVGFETileElement.cpp | 2 +- src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp | 3 +- src/3rdparty/webkit/WebCore/svg/SVGList.h | 3 +- src/3rdparty/webkit/WebCore/svg/SVGListTraits.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h | 3 +- .../webkit/WebCore/svg/SVGMetadataElement.h | 6 +- .../webkit/WebCore/svg/SVGParserUtilities.cpp | 4 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.h | 3 +- src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl | 2 +- .../webkit/WebCore/svg/SVGPathSegClosePath.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGSetElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h | 6 +- .../webkit/WebCore/svg/SVGTextPathElement.cpp | 2 +- .../webkit/WebCore/svg/SVGTextPathElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h | 6 +- .../webkit/WebCore/svg/SVGTransformDistance.cpp | 2 + .../webkit/WebCore/svg/SVGTransformList.cpp | 18 - src/3rdparty/webkit/WebCore/svg/SVGTransformList.h | 1 - .../webkit/WebCore/svg/SVGTransformable.cpp | 12 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp | 2 +- .../webkit/WebCore/svg/animation/SMILTime.cpp | 9 +- .../webkit/WebCore/svg/animation/SVGSMILElement.h | 3 +- .../webkit/WebCore/svg/graphics/SVGImage.cpp | 4 +- .../webkit/WebCore/svg/graphics/SVGResource.cpp | 3 +- src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp | 4 +- .../webkit/WebCore/wml/WMLErrorHandling.cpp | 2 +- src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp | 2 +- .../webkit/WebCore/wml/WMLPostfieldElement.cpp | 2 +- .../webkit/WebCore/wml/WMLSelectElement.cpp | 336 +- src/3rdparty/webkit/WebCore/wml/WMLSelectElement.h | 23 +- .../webkit/WebCore/wml/WMLSetvarElement.cpp | 2 +- .../webkit/WebCore/workers/AbstractWorker.cpp | 125 + .../webkit/WebCore/workers/AbstractWorker.h | 86 + .../webkit/WebCore/workers/AbstractWorker.idl | 52 + .../webkit/WebCore/workers/GenericWorkerTask.h | 70 + .../webkit/WebCore/workers/SharedWorker.cpp | 52 + src/3rdparty/webkit/WebCore/workers/SharedWorker.h | 61 + .../webkit/WebCore/workers/SharedWorker.idl | 42 + src/3rdparty/webkit/WebCore/workers/Worker.cpp | 17 +- src/3rdparty/webkit/WebCore/workers/Worker.h | 5 +- src/3rdparty/webkit/WebCore/workers/Worker.idl | 3 +- .../webkit/WebCore/workers/WorkerContext.cpp | 32 +- .../webkit/WebCore/workers/WorkerContext.h | 9 +- .../webkit/WebCore/workers/WorkerContext.idl | 8 +- .../webkit/WebCore/workers/WorkerContextProxy.h | 5 +- .../webkit/WebCore/workers/WorkerLoaderProxy.h | 2 +- .../WebCore/workers/WorkerMessagingProxy.cpp | 52 +- .../webkit/WebCore/workers/WorkerMessagingProxy.h | 8 +- .../webkit/WebCore/workers/WorkerObjectProxy.h | 7 +- .../webkit/WebCore/workers/WorkerRunLoop.cpp | 3 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp | 36 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h | 1 + src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp | 8 +- src/3rdparty/webkit/WebCore/xml/XPathPath.h | 3 +- src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp | 2 +- src/3rdparty/webkit/WebKit.pri | 6 +- src/3rdparty/webkit/WebKit/ChangeLog | 39 + .../webkit/WebKit/StringsNotToBeLocalized.txt | 9 +- src/3rdparty/webkit/WebKit/qt/Api/headers.pri | 4 +- src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp | 14 + src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 197 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h | 9 + src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h | 10 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 71 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h | 4 + src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 3 - src/3rdparty/webkit/WebKit/qt/ChangeLog | 338 ++ .../WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 7 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.h | 2 +- .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 70 +- .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 8 +- .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 60 + .../WebKit/qt/tests/qwebpage/frametest/iframe.html | 6 + .../qt/tests/qwebpage/frametest/iframe2.html | 7 + .../qt/tests/qwebpage/frametest/iframe3.html | 5 + .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 50 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.qrc | 3 + 904 files changed, 25388 insertions(+), 8713 deletions(-) create mode 100644 src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi create mode 100644 src/3rdparty/webkit/WebCore/WebCore.gypi create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSharedWorkerCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/css/html.css delete mode 100644 src/3rdparty/webkit/WebCore/css/html4.css create mode 100644 src/3rdparty/webkit/WebCore/dom/HTMLAllCollection.idl create mode 100644 src/3rdparty/webkit/WebCore/generated/JSValidityState.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSValidityState.h create mode 100644 src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/DOMDataGridDataSource.h create mode 100644 src/3rdparty/webkit/WebCore/html/ValidityState.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/ValidityState.h create mode 100644 src/3rdparty/webkit/WebCore/html/ValidityState.idl create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/KeyboardShortcut.js create mode 100644 src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/sql/SQLiteFileSystem.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderBlockLineLayout.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/bidi.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/bidi.h create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.cpp create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageAreaImpl.h create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.cpp create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageNamespaceImpl.h create mode 100644 src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp create mode 100644 src/3rdparty/webkit/WebCore/workers/AbstractWorker.h create mode 100644 src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl create mode 100644 src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp create mode 100644 src/3rdparty/webkit/WebCore/workers/SharedWorker.h create mode 100644 src/3rdparty/webkit/WebCore/workers/SharedWorker.idl create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index f2cc9a2..fa8e3ff 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,72 @@ +2009-07-13 Laszlo Gombos + + Reviewed by Tor Arne Vestbø. + + [Qt] Build fix for QtWebKit on Win + https://bugs.webkit.org/show_bug.cgi?id=27205 + + * WebKit.pri: Include the major version number in the QtWebKit + library file for Win. + +2009-07-13 Simon Hausmann + + Reviewed by Ariya Hidayat. + + Add the test netscape plugin for the Qt DRT to the build. + + * WebKit.pro: + +2009-07-13 Drew Wilson + + Reviewed by David Levin. + + Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs + https://bugs.webkit.org/show_bug.cgi?id=26932 + + Added ENABLE(SHARED_WORKERS) flag. + + * configure.ac: + +2009-07-12 Xan Lopez + + Reviewed by Gustavo Noronha. + + Bump version in preparation for 1.1.11 release. + + * configure.ac: + +2009-07-07 Norbert Leser + + Reviewed by Simon Hausmann. + + Exclude DumpRenderTree.pro from symbian build + + * WebKit.pro: + +2009-07-09 Drew Wilson + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=26903 + + Turned on CHANNEL_MESSAGING by default because the MessageChannel API + can now be implemented for Web Workers and is reasonably stable. + + * configure.ac: enable CHANNEL_MESSAGING. + +2009-07-03 Jan Michael Alonzo + + Reviewed by Xan Lopez and Gustavo Noronha. + + Set user-agent from application + https://bugs.webkit.org/show_bug.cgi?id=17375 + + Define UA version macros to be used by the UA string. + Add new WebSettings unit test for the User-Agent string API. + + * GNUmakefile.am: + * configure.ac: + 2009-06-20 Gustavo Noronha Silva Reviewed by Jan Alonzo. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index c8bba0f..cd46bf5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,464 @@ +2009-07-13 Gustavo Noronha Silva + + Unreviewed make dist build fix. + + * GNUmakefile.am: + +2009-07-13 Drew Wilson + + Reviewed by David Levin. + + Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs + https://bugs.webkit.org/show_bug.cgi?id=26932 + + Added ENABLE(SHARED_WORKERS) flag (off by default). + + * Configurations/FeatureDefines.xcconfig: + +2009-07-07 Norbert Leser + + Reviewed by Maciej Stachoviak. + + https://bugs.webkit.org/show_bug.cgi?id=27058 + + Removed superfluous parenthesis around single expression. + Compilers on Symbian platform fail to properly parse and compile. + + * JavaScriptCore/wtf/Platform.h: + +2009-07-13 Norbert Leser + + Reviewed by Maciej Stachoviak. + + https://bugs.webkit.org/show_bug.cgi?id=27054 + + Renamed Translator to HashTranslator + + Codewarrior compiler (WINSCW) latest b482 cannot resolve typename + mismatch between template declaration and definition + (HashTranslator / Translator) + + * wtf/HashSet.h: + +2009-07-13 Norbert Leser + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=27053 + + Ambiguity in LabelScope initialization + + Codewarrior compiler (WINSCW) latest b482 on Symbian cannot resolve + type of "0" unambiguously. Set expression explicitly to + PassRefPtr